:root {
  --ink: #101214;
  --paper: #f7f7f2;
  --brass: #c38a22;
  --green: #85d23b;
  --safe: #05b7a2;
  --caution: #f5c518;
  --danger: #e0060f;
  --ring5: #05b7a2;
  --ring4: #2f71cf;
  --ring3: #8d43cf;
  --ring2: #e13a84;
  --ring1: #e34a22;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(5,183,162,.22), transparent 30rem),
    radial-gradient(circle at 88% 16%, rgba(227,74,34,.18), transparent 26rem),
    #090b0d;
  font-family: Arial, Helvetica, sans-serif;
}

button, input { font: inherit; }
[hidden] { display: none !important; }

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 24px auto;
  padding: 28px;
  background: var(--paper);
  border: 3px solid var(--brass);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  color: white;
  background: var(--ink);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--green);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 1; }
/* A compact tool header: the app is used at the table, so the controls and
   grid should get the space, not the title. */
h1 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1rem, 1.8vw, 1.2rem); }

.round-readout {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 10px;
}
.round-readout span { color: var(--green); font-weight: 900; text-transform: uppercase; }
.round-readout strong { grid-row: 1 / 3; grid-column: 2; font-size: 2rem; line-height: .9; }
.round-readout small { color: #cbd0d2; }

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  color: white;
  background: var(--ink);
  flex-wrap: wrap;
}
.controls > div:first-child { margin-right: auto; }
.controls h2 { font-size: 1.35rem; }
.controls label { color: var(--green); font-weight: 900; text-transform: uppercase; }
.controls select, .controls input {
  width: 82px;
  min-height: 44px;
  padding: 7px 10px;
  border: 2px solid var(--brass);
  border-radius: 0;
  background: white;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}
.controls .control-field {
  display: grid;
  gap: 5px;
  margin-right: 0;
}
.round-stepper { display: flex; }
.round-stepper input { border-left: 0; border-right: 0; }
.round-stepper button {
  width: 42px;
  min-height: 44px;
  border: 2px solid var(--brass);
  border-radius: 0;
  color: var(--ink);
  background: white;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
}
.round-stepper button:hover, .round-stepper button:focus-visible {
  color: white;
  background: var(--ring4);
}

.view-switch {
  display: inline-flex;
  border: 2px solid var(--ink);
}
.view-switch button {
  min-height: 42px;
  padding: 8px 18px;
  border: 0;
  color: var(--ink);
  background: white;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
.view-switch button + button { border-left: 2px solid var(--ink); }
.view-switch button.active { color: white; background: var(--ink); }

.safe { background: var(--safe); }
.caution { background: var(--caution); }
.danger { background: var(--danger); }

.grid-panel {
  margin-top: 18px;
  overflow-x: auto;
  background: #050607;
  border: 3px solid var(--ink);
}

.tracker-panel {
  display: grid;
  place-items: center;
  margin-top: 18px;
  padding: clamp(8px, 2vw, 22px);
  background: #050607;
  border: 3px solid var(--ink);
}
.circular-tracker {
  display: block;
  width: min(100%, 900px);
  height: auto;
  filter: drop-shadow(0 14px 24px rgba(0,0,0,.42));
}
.tracker-ring { fill: none; stroke-width: 66; opacity: .3; }
.tracker-ring-edge { fill: none; stroke-width: 2; opacity: .9; }
.tracker-spoke { stroke: rgba(255,255,255,.16); stroke-width: 1.5; }
.tracker-number { fill: white; font-size: 19px; font-weight: 900; text-anchor: middle; dominant-baseline: central; }
.tracker-number.caution { fill: var(--ink); }
.tracker-medallion { stroke: #090b0d; stroke-width: 3; }
.tracker-medallion.safe { fill: var(--safe); }
.tracker-medallion.caution { fill: var(--caution); }
.tracker-medallion.danger { fill: var(--danger); }
.tracker-label { font-size: 14px; font-weight: 900; letter-spacing: .06em; text-anchor: middle; dominant-baseline: central; }
.tracker-center { fill: #090b0d; stroke: var(--brass); stroke-width: 4; }
.tracker-center-title { fill: white; font-size: 22px; font-weight: 900; text-anchor: middle; }
.tracker-center-round { fill: var(--green); font-size: 15px; font-weight: 900; text-anchor: middle; }
.tracker-reference { fill: none; stroke: white; stroke-width: 6; }
.tracker-reference-label { fill: var(--ink); font-size: 13px; font-weight: 900; text-anchor: middle; }
.tracker-reference-plate { fill: white; }

.orbital-grid {
  display: grid;
  grid-template-columns: 150px repeat(12, minmax(70px, 1fr));
  min-width: 1050px;
}

.corner, .station, .ring-label, .zone {
  min-height: 76px;
  border-right: 1px solid rgba(255,255,255,.26);
  border-bottom: 1px solid rgba(255,255,255,.26);
}
.corner, .ring-label {
  display: flex;
  align-items: center;
  padding: 12px;
  color: white;
  font-weight: 900;
  text-transform: uppercase;
}
.corner { color: var(--green); }
/* Ring labels stay pinned while the grid scrolls sideways, so a player
   scrolled to their zone can still see which row is which ring. */
.corner, .ring-label {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #050607;
}
.station {
  display: grid;
  place-items: center;
  color: white;
  font-size: 1.25rem;
  font-weight: 900;
}
.station::before { content: "Sector"; display: block; font-size: .57rem; color: #aeb7ba; text-transform: uppercase; }

.ring-label { border-left: 9px solid var(--ring-color); }
.ring-label small { display: block; margin-left: auto; color: #aeb7ba; }

.zone {
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--ring-color) 23%, #080a0c), #080a0c 62%);
}
.zone::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid color-mix(in srgb, var(--ring-color) 70%, white);
  opacity: .45;
}
.sector-medallion {
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: 0 0 0 2px rgba(255,255,255,.2);
}
.sector-medallion.caution { color: var(--ink); }
.zone[data-reference="true"] {
  z-index: 2;
  box-shadow:
    inset 0 0 0 5px white,
    inset 0 0 0 9px var(--ring-color),
    inset 0 0 28px rgba(255,255,255,.38);
}
.zone[data-reference="true"]::before {
  content: "YOUR ZONE";
  position: absolute;
  z-index: 3;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 5px;
  color: var(--ink);
  background: white;
  font-size: .5rem;
  font-weight: 900;
  letter-spacing: .05em;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .app-shell { width: 100%; margin: 0; padding: 12px; border-width: 0; }
  .masthead { align-items: flex-start; }
  .round-readout strong { font-size: 1.7rem; }
  .view-switch { display: flex; }
  .view-switch button { flex: 1; }
  .zone[data-reference="true"]::before { font-size: .44rem; }

  /* Controls: drop the redundant heading and fit Round, Ring, and Sector on one line. */
  .controls { gap: 8px; padding: 10px 12px; }
  .controls > div:first-child { display: none; }
  .controls select, .controls input { width: 58px; padding: 6px 4px; }
  .round-stepper button { width: 36px; }

  /* Grid: narrow columns and smaller medallions so more sectors fit on screen. */
  .grid-panel { margin-top: 12px; }
  /* max-content: the grid box must span every column, or the pinned labels
     stop following once the scroll passes the box's own width. */
  .orbital-grid { grid-template-columns: 78px repeat(12, 56px); min-width: 0; width: max-content; }
  .corner, .station, .ring-label, .zone { min-height: 58px; }
  .corner, .ring-label { padding: 6px 8px; font-size: .74rem; flex-wrap: wrap; align-content: center; }
  .ring-label small { margin-left: 0; width: 100%; }
  .station { font-size: 1rem; }
  .zone::after { inset: 5px; }
  .sector-medallion { width: 38px; height: 38px; font-size: 1rem; }
}
