html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #24363B;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
canvas {
  touch-action: none;
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

:root { color-scheme: dark; }
* { box-sizing: border-box; }
button, select { font: inherit; }
button, select { min-height: 44px; border: 1px solid #889b94; border-radius: 5px; background: #243b3b; color: #fff0d1; padding: .65rem .85rem; }
button { cursor: pointer; font-weight: 650; }
button:hover { background: #3c5550; }
:focus-visible { outline: 3px solid #fff0d1; outline-offset: 3px; }
[hidden] { display: none !important; }
#menus { position: absolute; inset: 0; display: grid; place-items: center; background: #14292bc9; overflow: auto; padding: 16px; }
.panel { width: min(860px,100%); max-height: 100%; overflow: auto; background: #1c3032; color: #fff0d1; border: 1px solid #72877e; border-top: 4px solid #e77d51; padding: clamp(16px,2.5vw,26px); border-radius: 8px; }
.eyebrow { color: #e9bb97; font-size: .73rem; letter-spacing: .14em; margin: 0 0 8px; }
h1 { font-size: clamp(1.4rem,4vw,2rem); margin: 0 0 12px; }
p { line-height: 1.5; margin: .6rem 0; }
label { display: block; font-size: .85rem; margin: 12px 0 6px; }
select { width: 100%; }
#track-brief { color: #d1dbcf; font-size: .88rem; margin: .3rem 0; }
#track-sections { padding-left: 1.3rem; font-size: .8rem; line-height: 1.55; color: #d1dbcf; margin: .4rem 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.primary { background: #eab18c; color: #192d30; border-color: #eab18c; }
.primary:hover { background: #ffd1af; }
.hint { font-size: .78rem; color: #d1dbcf; }
#ride-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
#ride-actions button { font-size: .75rem; padding: .55rem .65rem; background: #1c3032ed; }
#touch-controls { position: absolute; bottom: max(12px,env(safe-area-inset-bottom)); left: 12px; right: 12px; display: flex; justify-content: space-between; gap: 12px; }
.control-pair { display: flex; gap: 8px; }
#touch-controls button { width: clamp(56px,13vw,86px); height: 64px; padding: 4px; font-size: .72rem; touch-action: none; background: #1c3032ed; }
#touch-controls button[aria-pressed=true] { background: #eab18c; color: #192d30; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Clean Modern Entry / Mission Dossier Styling */
.mission-control-panel {
  width: min(1040px, 98%);
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(22, 38, 40, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(136, 170, 160, 0.35);
  border-top: 4px solid #e77d51;
  padding: clamp(14px, 2.2vw, 22px);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Top Hero Header Bar */
.entry-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(136, 170, 160, 0.25);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand-tag {
  color: #e9bb97;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  font-weight: 750;
  text-transform: uppercase;
}
.brand-title {
  font-size: clamp(1.3rem, 2.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff0d1;
  margin: 0;
  line-height: 1.15;
}
.hero-actions-dock {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-track-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(16, 28, 30, 0.75);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(100, 130, 120, 0.3);
}
.indicator-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: #8da39b;
  font-weight: 750;
}
.indicator-value {
  font-size: 0.88rem;
  font-weight: 750;
  color: #fff0d1;
}
.hero-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #eab18c 0%, #e77d51 100%);
  color: #172a2c;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 8px 18px;
  border-radius: 6px;
  border: 1px solid #ffd1af;
  box-shadow: 0 4px 16px rgba(231, 125, 81, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  cursor: pointer;
}
.hero-launch-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(231, 125, 81, 0.6);
  background: linear-gradient(135deg, #ffd1af 0%, #eab18c 100%);
}
.hero-launch-btn .key-shortcut {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: rgba(23, 42, 44, 0.35);
  border-radius: 4px;
  color: #172a2c;
  font-weight: 800;
  margin-left: 4px;
}

/* Two-Column Dossier Workspace */
.dossier-workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: stretch;
  margin: 0;
}
@media (max-width: 768px) {
  .dossier-workspace {
    grid-template-columns: 1fr;
  }
}
.dossier-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(16, 28, 30, 0.65);
  border: 1px solid rgba(80, 110, 100, 0.35);
  border-radius: 8px;
  padding: 12px;
}
.sidebar-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: #8da39b;
  padding: 0 2px 6px;
  border-bottom: 1px solid rgba(80, 110, 100, 0.25);
}
.sidebar-total-badge {
  font-size: 0.65rem;
  background: rgba(234, 177, 140, 0.15);
  color: #eab18c;
  padding: 2px 6px;
  border-radius: 4px;
}
.collection-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (max-width: 768px) {
  .collection-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}
.collection-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #182a2c;
  border: 1px solid rgba(90, 120, 110, 0.4);
  color: #d1dbcf;
  font-size: 0.82rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}
.collection-tab:hover {
  background: #243c3e;
  border-color: #8da39b;
  color: #fff0d1;
}
.collection-tab[aria-selected="true"] {
  background: #eab18c;
  color: #172a2c;
  border-color: #ffd1af;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(234, 177, 140, 0.35);
}
.collection-tab .tab-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.collection-tab .tab-count {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}
.collection-tab[aria-selected="true"] .tab-count {
  background: rgba(23, 42, 44, 0.25);
  color: #172a2c;
}
.sidebar-select-group {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(80, 110, 100, 0.25);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #8da39b;
  margin: 4px 0 2px;
  text-transform: uppercase;
}
.sidebar-select-group select {
  font-size: 0.8rem;
  padding: 6px 10px;
  background: #142426;
  border: 1px solid #4a635b;
  border-radius: 5px;
  color: #fff0d1;
  width: 100%;
}

/* Right Column: Cards & Inspector */
.dossier-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dossier-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  font-weight: 750;
  color: #8da39b;
}

/* Visual Track Card Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  max-height: 42vh;
  overflow-y: auto;
  padding: 2px 2px 6px;
}
.track-card {
  background: #162628;
  border: 1px solid #485c55;
  border-radius: 7px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  user-select: none;
}
.track-card:hover {
  border-color: #8da39b;
  background: #1c3032;
  transform: translateY(-1px);
}
.track-card.selected {
  border: 2px solid #eab18c;
  background: #233a3c;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35), 0 0 0 1px #eab18c;
}
.track-card:focus-visible {
  outline: 3px solid #fff0d1;
  outline-offset: 2px;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.card-name {
  font-size: .92rem;
  font-weight: 700;
  color: #fff0d1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diff-badge {
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .08em;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.card-silhouette {
  width: 100%;
  height: 38px;
  margin: 2px 0;
  border-radius: 4px;
  background: rgba(0,0,0,0.2);
  overflow: hidden;
}
.card-silhouette svg {
  width: 100%;
  height: 100%;
  display: block;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: .74rem;
  color: #a6b8b0;
}
.card-record {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Track Inspector */
.track-inspector {
  background: rgba(16, 28, 30, 0.75);
  border: 1px solid rgba(80, 110, 100, 0.4);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}
@media (max-width: 680px) {
  .track-inspector {
    grid-template-columns: 1fr;
  }
}
.inspector-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.inspector-title-row h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #fff0d1;
  font-weight: 750;
}
.meta-chip {
  font-size: .72rem;
  color: #b8c7c1;
  background: #1c3032;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #3d514a;
}
.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (max-width: 680px) {
  .inspector-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
.launch-primary-btn {
  font-size: 0.92rem;
  font-weight: 750;
  padding: 10px 20px;
  background: #eab18c;
  color: #172a2c;
  border: 1px solid #ffd1af;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(234, 177, 140, 0.3);
  white-space: nowrap;
}
.launch-primary-btn:hover {
  background: #ffd1af;
}
.back-btn {
  font-size: 0.8rem;
  padding: 8px 14px;
  background: #1c3032;
  border: 1px solid #5a7069;
  border-radius: 6px;
  color: #d1dbcf;
  white-space: nowrap;
}
.back-btn:hover {
  background: #2a4446;
  border-color: #8da39b;
}

/* Footer Key Hints */
.entry-footer-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(80, 110, 100, 0.2);
}
.hint-pill {
  font-size: 0.72rem;
  color: #8da39b;
  background: rgba(16, 28, 30, 0.5);
  border: 1px solid rgba(60, 90, 80, 0.35);
  padding: 3px 8px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

@media (max-height: 540px) {
  #menus { padding: 4px; }
  .panel { padding: 8px 12px; max-height: 98vh; }
  .entry-hero-header { padding-bottom: 6px; margin-bottom: 6px; }
  .brand-title { font-size: 1.15rem; }
  .cards-grid { max-height: 26vh; }
  #track-sections { display: none; }
  #track-brief { font-size: .76rem; margin: 2px 0; }
  .entry-footer-hints { display: none; }
  .track-inspector { padding: 8px 10px; gap: 8px; }
  .hero-actions-dock { gap: 6px; }
  .hero-launch-btn { padding: 6px 12px; font-size: .8rem; }
}
