body {
  font-family: Arial, sans-serif;
  padding: 20px;
  max-width: 1180px;
  margin: 0 auto;
  background: #eef1f4;
  color: #111;

  padding-bottom: 90px;
  padding-left: 70px;
  padding-right: 70px;
}

h1,
h2 {
  text-align: center;
}

h1 {
  margin-bottom: 18px;
}

h2,
h3,
p {
  margin-top: 0;
}

/* BOXES */
#baseline-setup,
#updated-setup,
#live-impact,
#engineer-feedback {
  text-align: center;
  margin: 10px 0;
  min-height: 20px;

  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 10px;
}

#engineer-feedback {
  text-align: left;
}

.engineer-block.is-processing {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.engineer-processing {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 8px;
  background: rgba(229, 231, 235, 0.78);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.engineer-processing.is-visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.engineer-processing-copy {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: min(260px, 100%);
  padding: 18px 22px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
  text-align: center;
}

.engineer-processing b {
  color: #111827;
}

.engineer-processing small {
  display: block;
  color: #475569;
  font-size: 12px;
}

.engineer-processing-wheel {
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: engineer-processing-spin 0.75s linear infinite;
}

@keyframes engineer-processing-spin {
  to {
    transform: rotate(360deg);
  }
}

/* LIVE IMPACT */
#live-impact {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setup-tendency {
  display: grid;
  gap: 10px;
}

.setup-tendency-summary {
  display: grid;
  gap: 3px;
}

.setup-tendency-summary b {
  color: #111827;
  font-size: 15px;
}

.setup-tendency-summary span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.setup-tendency-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.setup-tendency-pill {
  padding: 5px 7px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.setup-tendency-pill.tendency-speed {
  background: #eff6ff;
  color: #1d4ed8;
}

.setup-tendency-pill.tendency-grip {
  background: #f0fdf4;
  color: #15803d;
}

.setup-tendency-pill.tendency-stable {
  background: #f8fafc;
  color: #475569;
}

.setup-tendency-pill.tendency-sharp {
  background: #fff7ed;
  color: #c2410c;
}

.setup-tendency-notes {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 16px;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

/* CONTROLS */
select,
button,
input[type="text"],
textarea,
#driver-feedback {
  display: block;
  margin: 10px auto;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.2);
  background: white;
  cursor: pointer;
}

#driver-feedback {
  box-sizing: border-box;
  width: 100%;
  cursor: text;
  min-height: 92px;
  resize: vertical;
  line-height: 1.4;
  font: inherit;
}

.feedback-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.feedback-hint {
  margin: 8px 0 10px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}

.feedback-entry #driver-feedback,
.feedback-entry button {
  margin: 0;
}

.guided-feedback {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.selected-track-part {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: #f8fafc;
}

.selected-track-part span {
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.selected-track-part b {
  text-align: right;
}

.guided-feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.guided-feedback-grid .phase-field {
  display: none;
}

.guided-feedback-grid label {
  display: grid;
  gap: 4px;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.guided-feedback-grid select {
  width: 100%;
}

.guided-feedback select:disabled,
.guided-feedback button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.guided-feedback button {
  width: 100%;
  min-height: 38px;
  margin: 0;
  font-weight: 700;
}

.advanced-feedback {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.advanced-feedback summary {
  cursor: pointer;
  color: #53606b;
  font-size: 12px;
  font-weight: 700;
}

button:hover {
  background: #f0f0f0;
}

/* SLIDERS */
.slider-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

input[type="range"] {
  width: 100%;
}

/* SETUP BUTTONS */
.setup-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* PAGES */
.page {
  display: none;
  padding-top: 20px;
}

/* SETUP WORKSPACE */
.setup-workspace {
  width: 100%;
}

.workspace-header {
  margin: 8px 0 18px;
  text-align: center;
}

.workspace-header h2 {
  margin-bottom: 4px;
}

#workspace-circuit {
  color: #53606b;
  font-size: 14px;
}

.workspace-grid {
  display: block;
}

.workspace-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(17, 24, 39, 0.11);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.setup-panel {
  overflow: hidden;
}

.track-map-panel {
  display: none;
  grid-area: trackmap;
  padding: 12px;
}

.track-map-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.track-map-header h3 {
  margin: 0;
  font-size: 14px;
}

#track-map-label {
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

#track-map-svg {
  position: relative;
  display: block;
  width: 100%;
  min-height: 360px;
  aspect-ratio: 1000 / 620;
  max-height: 560px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  user-select: none;
  -webkit-user-select: none;
}

#track-map-svg svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}

#track-map-svg .corner-label {
  user-select: none;
  -webkit-user-select: none;
}

#track-map-svg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.track-map-fallback-note {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.88);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.track-map-error {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: #6b7280;
  font-size: 13px;
}

#setup-tabs {
  display: flex;
  flex-wrap: wrap;
  background: #e5e9ee;
  border-bottom: 1px solid rgba(17, 24, 39, 0.12);
}

#setup-tabs button {
  flex: 1 1 120px;
  min-width: 112px;
  min-height: 42px;
  margin: 0;
  border: 0;
  border-right: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 0;
  background: transparent;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

#setup-tabs button:last-child {
  border-right: 0;
}

#setup-tabs button:hover,
#setup-tabs button.active-tab {
  background: #ffffff;
  color: #111827;
}

#setup-pages {
  padding: 18px;
}

.setup-group {
  display: grid;
  gap: 12px;
}

.setup-item {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(160px, 1fr) 74px;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 6px;
}

.setup-item label {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}

.setup-item label small {
  display: block;
  margin-top: 3px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 500;
}

.setup-value-input {
  width: 74px;
  box-sizing: border-box;
  margin: 0;
  padding: 5px 6px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 6px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  text-align: right;
  cursor: text;
}

.setup-value-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.support-panel {
  margin-top: 16px;
  padding: 16px;
}

.support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.85fr);
  grid-template-areas:
    "engineer engineer"
    "tendency saved";
  gap: 16px;
  align-items: start;
}

.support-panel.has-track-map .support-grid {
  grid-template-areas:
    "trackmap trackmap"
    "engineer engineer"
    "tendency saved";
}

.support-grid .panel-block {
  min-width: 0;
}

.tendency-block {
  grid-area: tendency;
}

.engineer-block {
  grid-area: engineer;
  position: relative;
  overflow: hidden;
}

.saved-block {
  grid-area: saved;
}

.panel-block h3 {
  margin-bottom: 10px;
  font-size: 14px;
  text-align: left;
}

.engineer-issue + .engineer-issue {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(17, 24, 39, 0.1);
}

.engineer-issue.applied {
  padding: 10px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.engineer-meta {
  margin-top: 3px;
  color: #53606b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.feedback-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.feedback-context span {
  padding: 4px 6px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
}

.feedback-context .corner-confidence {
  border: 1px solid transparent;
}

.feedback-context .confidence-low {
  background: #fffbeb;
  border-color: rgba(217, 119, 6, 0.28);
  color: #92400e;
}

.feedback-context .confidence-medium {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.22);
  color: #1e40af;
}

.feedback-context .confidence-high {
  background: #f0fdf4;
  border-color: rgba(22, 163, 74, 0.24);
  color: #166534;
}

.engineer-issue p {
  margin: 8px 0;
  line-height: 1.35;
}

.track-notes {
  margin: 8px 0;
  padding: 8px;
  border-left: 3px solid #2563eb;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.35;
}

.engineer-issue ul {
  margin: 0;
  padding-left: 18px;
}

.engineer-issue li {
  margin: 8px 0;
  line-height: 1.35;
}

.engineer-issue small {
  display: block;
  color: #53606b;
}

#apply-engineer-suggestions {
  margin-top: 14px;
}

/* SETUP DEVELOPMENT */
.development-workspace {
  width: 100%;
}

.development-panel {
  padding: 16px;
}

.development-panel + .development-panel {
  margin-top: 16px;
}

.session-workspace {
  width: 100%;
}

#circuit-profile {
  margin-bottom: 16px;
}

.track-demand-card {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

.track-demand-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.track-demand-header b {
  display: block;
  color: #111827;
}

.track-demand-header span {
  display: block;
  margin-top: 3px;
  color: #6b7280;
  font-size: 13px;
}

.track-demand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.track-demand-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-left-width: 4px;
  border-radius: 8px;
  background: #f8fafc;
}

.track-demand-item span {
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.track-demand-item b {
  color: #111827;
  font-size: 12px;
  text-align: right;
  text-transform: capitalize;
}

.track-demand-item.demand-very-low,
.track-demand-item.demand-low {
  border-left-color: #2563eb;
}

.track-demand-item.demand-low-medium,
.track-demand-item.demand-medium {
  border-left-color: #16a34a;
}

.track-demand-item.demand-medium-high,
.track-demand-item.demand-high {
  border-left-color: #d97706;
}

.track-demand-item.demand-very-high {
  border-left-color: #dc2626;
}

.track-demand-item.demand-balanced {
  border-left-color: #64748b;
}

.track-demand-item.demand-low-drag {
  border-left-color: #0891b2;
}

.track-demand-item.demand-downforce {
  border-left-color: #7c3aed;
}

.validation-status-card {
  padding: 16px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

.validation-status-header {
  margin-bottom: 14px;
}

.validation-status-header b {
  display: block;
  color: #111827;
}

.validation-status-header span {
  display: block;
  margin-top: 3px;
  color: #6b7280;
  font-size: 13px;
}

.validation-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.validation-status-block {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 8px;
  background: #f8fafc;
}

.validation-status-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.validation-status-title b {
  color: #111827;
  font-size: 13px;
}

.validation-status-title span {
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.validation-progress {
  display: flex;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.validation-progress span {
  display: block;
  min-width: 0;
  height: 100%;
}

.validation-progress-verified {
  background: #16a34a;
}

.validation-progress-review {
  background: #2563eb;
}

.validation-progress-draft {
  background: #d97706;
}

.validation-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.validation-count {
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.validation-count.verified {
  background: #f0fdf4;
  color: #166534;
}

.validation-count.review {
  background: #eff6ff;
  color: #1e40af;
}

.validation-count.draft {
  background: #fffbeb;
  color: #92400e;
}

.comparison-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.comparison-selectors label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

.comparison-selectors select {
  width: 100%;
  margin: 0;
}

.baseline-status,
.empty-state {
  margin: 10px 0;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid rgba(17, 24, 39, 0.08);
}

.baseline-status.ready {
  border-color: rgba(22, 163, 74, 0.32);
  background: #f0fdf4;
}

.baseline-status.missing {
  border-color: rgba(234, 179, 8, 0.35);
  background: #fffbeb;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13px;
}

.comparison-table th,
.comparison-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  text-align: center;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
  text-align: left;
}

.comparison-table th:last-child,
.comparison-table td:last-child {
  max-width: 280px;
  text-align: left;
  color: #4b5563;
}

.comparison-table th {
  background: #f8fafc;
  color: #374151;
}

.comparison-table .positive {
  color: #15803d;
  font-weight: 700;
}

.comparison-table .negative {
  color: #b91c1c;
  font-weight: 700;
}

.setup-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.setup-snapshot-group {
  padding: 10px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 8px;
  background: #f8fafc;
}

.setup-snapshot-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #111827;
}

.setup-snapshot-items {
  display: grid;
  gap: 6px;
}

.setup-snapshot-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #4b5563;
}

.setup-snapshot-item b {
  color: #111827;
  white-space: nowrap;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.notes-header h3 {
  margin: 0;
}

.notes-header button {
  margin: 0;
}

#development-notes {
  box-sizing: border-box;
  width: 100%;
  min-height: 130px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  font: inherit;
}

/* NAV */
.nav {
  display: none;
}

body.has-circuit .nav {
  display: block;
}

/* PREV */
#prev {
  position: fixed;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;

  width: 45px;
  height: 45px;

  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.15);

  background: rgba(255,255,255,0.95);
  color: #111;

  font-size: 18px;
  cursor: pointer;
}

/* NEXT */
#next {
  position: fixed;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;

  width: 45px;
  height: 45px;

  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.15);

  background: rgba(255,255,255,0.95);
  color: #111;

  font-size: 18px;
  cursor: pointer;
}

/* PAGE LABEL */
#page-label {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;

  font-size: 12px;
  font-weight: 600;

  color: #333;
  background: rgba(255,255,255,0.9);

  padding: 4px 10px;
  border-radius: 6px;

  border: 1px solid rgba(0,0,0,0.1);
}

/* PERFORMANCE */
.metric {
  margin: 10px 0;
  font-size: 14px;
}

.bar {
  width: 100%;
  height: 12px;
  background: #ddd;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}

.bar div {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  transition: width 0.2s ease;
  background: linear-gradient(90deg, #00ff88, #00c3ff);
}

/* SAFE SPACE */
.bottom-safe-space {
  display: none;
  height: 80px;
  width: 100%;
  flex-shrink: 0;
}

body.has-circuit .bottom-safe-space {
  display: block;
}

#circuit {
  text-align: center;
  text-align-last: center;
}

@media (max-width: 780px) {
  body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .support-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "engineer"
      "tendency"
      "saved";
  }

  .support-panel.has-track-map .support-grid {
    grid-template-areas:
      "engineer"
      "trackmap"
      "tendency"
      "saved";
  }

  #track-map-svg {
    min-height: 280px;
    max-height: 380px;
  }

  .guided-feedback-grid {
    grid-template-columns: 1fr;
  }

  .comparison-selectors {
    grid-template-columns: 1fr;
  }

  .validation-status-grid {
    grid-template-columns: 1fr;
  }

  #setup-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #setup-tabs button {
    min-width: 0;
    white-space: normal;
  }

  .setup-item {
    grid-template-columns: 1fr 74px;
  }

  .setup-item input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
