
:root {
  --bg: #050a0f;
  --panel: rgba(8, 23, 33, .78);
  --panel2: rgba(12, 35, 50, .72);
  --panel3: rgba(8, 17, 25, .84);
  --line: rgba(93, 209, 255, .38);
  --line-strong: rgba(93, 209, 255, .66);
  --gold: #e0a957;
  --gold2: #ffc76f;
  --cyan: #60d8ff;
  --blue: #8fc9e9;
  --red: #ff6b38;
  --green: #76f6a2;
  --text: #eaf6ff;
  --muted: #89a6b8;
  --dark: #071018;
  --radius: 12px;
  --shadow: 0 20px 80px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -5%, rgba(68,180,255,.16), transparent 36%),
    radial-gradient(circle at 80% 20%, rgba(224,169,87,.08), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  display: grid;
  place-items: center;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: .65;
}

button { font: inherit; color: inherit; }

.ac-shell {
  width: min(1920px, 100vw);
  height: min(100vh, 980px);
  min-height: 760px;
  padding: 14px 16px 12px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 86px minmax(0, 1fr) 184px 58px;
  gap: 10px;
  position: relative;
}

.ac-topbar,
.ac-panel,
.ac-hero-card,
.ac-tabs {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8,23,33,.78), rgba(3,12,18,.82));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(18px);
}

.ac-topbar {
  border-radius: 18px 18px 12px 12px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 560px;
  align-items: center;
  padding: 10px 18px;
  position: relative;
  overflow: hidden;
}

.ac-topbar::before,
.ac-panel::before,
.ac-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 30%, rgba(96,216,255,.07), transparent 70%),
    radial-gradient(circle at 50% 0%, rgba(224,169,87,.09), transparent 45%);
}

.ac-ident {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 12px;
  position: relative;
  z-index: 1;
}

.ac-crest {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(224,169,87,.7);
  background:
    radial-gradient(circle, var(--cyan) 0 5%, transparent 6%),
    conic-gradient(from 60deg, rgba(224,169,87,.1), rgba(224,169,87,.9), rgba(96,216,255,.45), rgba(224,169,87,.15));
  box-shadow: 0 0 22px rgba(96,216,255,.23);
}

.ac-titleblock {
  text-align: center;
  position: relative;
  z-index: 1;
}

.ac-titleblock h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  color: #fff7e8;
  font-size: clamp(42px, 4.5vw, 72px);
  line-height: .82;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 0 28px rgba(224,169,87,.14);
}

.ac-yearline {
  margin-top: 14px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .44em;
  font-size: 13px;
}

.ac-yearline strong {
  letter-spacing: .18em;
}

.ac-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.ac-icon-btn,
.ac-menu-btn,
.tiny-btn {
  border: 1px solid rgba(93,209,255,.28);
  background: rgba(8, 23, 33, .58);
  color: var(--muted);
  border-radius: 8px;
  height: 34px;
  min-width: 38px;
  padding: 0 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}

.ac-icon-btn:hover,
.ac-menu-btn:hover,
.tiny-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(20,65,92,.5);
}

.tiny-btn.active,
.ac-menu-btn.active {
  color: var(--gold2);
  border-color: rgba(224,169,87,.72);
  background: rgba(71,45,10,.52);
}

.ac-main-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(620px, 1fr) 500px;
  gap: 10px;
}

.ac-panel {
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.ac-panel-title {
  color: #fff7e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  letter-spacing: .14em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.ac-stats-panel {
  padding: 18px 18px 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
}

.ac-stats {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  gap: 8px;
  position: relative;
  z-index: 1;
}

.stat {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(93,209,255,.35);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: rgba(17,55,77,.36);
  font-size: 15px;
}

.stat-name {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 11px;
  margin-bottom: 6px;
}

.bar {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, rgba(96,216,255,.45), var(--cyan));
  box-shadow: 0 0 18px rgba(96,216,255,.35);
  transition: width .25s ease;
}

.fill.gold { background: linear-gradient(90deg, #805917, var(--gold)); }
.fill.green { background: linear-gradient(90deg, #247c43, var(--green)); }
.fill.red { background: linear-gradient(90deg, #a8301e, var(--red)); }

.stat strong {
  text-align: right;
  font-size: 16px;
  color: var(--text);
}

.ac-wide-btn {
  position: relative;
  z-index: 1;
  height: 48px;
  border: 1px solid rgba(93,209,255,.28);
  border-radius: 8px;
  background: rgba(17,55,77,.32);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
}

.ac-wide-btn.small { height: 36px; }

.ac-wide-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.ac-hero-card {
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.ac-hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5,10,15,.02) 0%, rgba(5,10,15,.22) 52%, rgba(5,10,15,.92) 100%),
    url("assets/axiom-colony/main_colony.webp") center / cover no-repeat;
  filter: saturate(.92) contrast(1.02);
}

.ac-hero-overlay {
  position: absolute;
  inset: auto 28px 26px 28px;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  align-items: end;
  gap: 18px;
}

.ac-kicker {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 12px;
}

.ac-hero-overlay h2,
.ac-event-info h2 {
  margin: 4px 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  color: #fff7e8;
  font-size: 34px;
  line-height: 1;
}

.ac-hero-overlay p,
.ac-event-info p {
  margin: 0;
  color: #d8e9f5;
  line-height: 1.45;
  font-size: 15px;
}

.ac-ai-card {
  border: 1px solid rgba(224,169,87,.55);
  border-radius: 13px;
  background: rgba(3,10,15,.76);
  padding: 14px;
  box-shadow: 0 0 40px rgba(0,0,0,.36);
}

.ac-ai-card strong {
  display: block;
  color: var(--gold2);
  font-size: 42px;
  line-height: 1;
  margin: 8px 0;
}

.ac-ai-card span {
  color: #d8e9f5;
  font-size: 15px;
}

.ac-event-panel {
  padding: 14px;
  display: grid;
  grid-template-rows: auto 152px auto 20px minmax(184px, 1fr) 28px;
  gap: 8px;
}

.ac-event-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.ac-event-head span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10px;
  float: right;
}

.ac-event-image {
  width: 100%;
  height: 152px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(224,169,87,.42);
  position: relative;
  z-index: 1;
}

.ac-event-info {
  min-height: 84px;
  max-height: 96px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.ac-event-info h2 {
  font-size: 32px;
  letter-spacing: .04em;
}

.ac-event-info p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ac-choose-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .2em;
  text-align: center;
  font-size: 11px;
  position: relative;
  z-index: 1;
}

.ac-choices {
  min-height: 0;
  max-height: 236px;
  display: grid;
  grid-template-rows: repeat(4, minmax(42px, 1fr));
  gap: 7px;
  position: relative;
  z-index: 1;
}

.btn,
.ac-choices .btn {
  min-height: 42px;
  border: 1px solid rgba(93,209,255,.38) !important;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(21,68,95,.68), rgba(7,26,38,.86)) !important;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 4px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text) !important;
}

.btn:hover,
.ac-choices .btn:hover {
  border-color: var(--line-strong) !important;
  background: linear-gradient(180deg, rgba(34,93,126,.72), rgba(8,35,51,.92)) !important;
}

.btn.primary {
  border-color: rgba(224,169,87,.72) !important;
  background: linear-gradient(180deg, rgba(88,58,13,.82), rgba(21,16,7,.9)) !important;
  color: #fff2d2 !important;
}

.choice-label {
  font-size: 14px;
  line-height: 1.12;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.choice-effect {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.choice-effect .pos { color: var(--green); }
.choice-effect .neg { color: var(--red); }
.choice-effect .neu { color: var(--muted); }

.ac-council-meter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 11px;
  position: relative;
  z-index: 1;
}

.ac-meter {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--gold2), var(--cyan));
  position: relative;
}

.ac-meter i {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 3px;
  height: 15px;
  background: #fff7e8;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(255,255,255,.8);
}

.ac-council-meter b {
  color: var(--gold);
}

.ac-bottom-grid {
  display: grid;
  grid-template-columns: 560px minmax(560px, 1fr) 500px;
  gap: 10px;
  min-height: 0;
}

.ac-log-panel,
.ac-forecast-panel,
.ac-protocol-panel {
  padding: 14px 16px;
}

.ac-log-list {
  margin-top: 12px;
  height: 88px;
  display: grid;
  gap: 7px;
  overflow: hidden;
}

.log-item,
.ac-log-list .log-item {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  padding-left: 12px;
  border-left: 2px solid rgba(224,169,87,.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-forecast-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
}

.ac-forecast-panel .ac-panel-title {
  grid-column: 1 / -1;
}

.ac-chart-wrap {
  min-height: 0;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 10px;
}

.ac-chart-legend {
  display: grid;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: 10px;
}

.ac-chart-legend i {
  display: inline-block;
  width: 18px;
  height: 2px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--cyan);
}

.ac-chart-legend i.cyan { background: #48e4d5; }
.ac-chart-legend i.orange { background: var(--red); }

.ac-forecast-svg {
  width: 100%;
  height: 100%;
  min-height: 118px;
}

.ac-forecast-svg .grid line {
  stroke: rgba(255,255,255,.065);
  stroke-width: 1;
}

.ac-forecast-svg .path {
  fill: none;
  stroke-width: 2.2;
}

.ac-forecast-svg .current { stroke: var(--cyan); }
.ac-forecast-svg .optimal { stroke: #48e4d5; stroke-dasharray: 5 6; opacity: .75; }
.ac-forecast-svg .risk { stroke: var(--red); stroke-dasharray: 4 7; opacity: .8; }
.ac-forecast-svg .year-marker { stroke: var(--gold2); stroke-width: 1.4; opacity: .8; }

.ac-forecast-side {
  border-left: 1px solid rgba(93,209,255,.25);
  padding-left: 16px;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
}

.ac-risk-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(8,23,33,.95) 0 58%, transparent 59%),
    conic-gradient(var(--cyan) calc(var(--risk) * .55%), var(--gold) calc(var(--risk) * .82%), rgba(255,255,255,.08) 0);
  border: 1px solid rgba(93,209,255,.25);
  box-shadow: inset 0 0 28px rgba(0,0,0,.6), 0 0 22px rgba(96,216,255,.14);
}

.ac-risk-ring span {
  font-size: 23px;
  font-weight: 800;
  color: #fff7e8;
}

.ac-forecast-side strong {
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  line-height: 1.35;
}

.ac-forecast-side p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ac-protocol-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 14px;
  align-items: center;
}

.ac-protocol-panel .ac-panel-title {
  grid-column: 1 / -1;
}

.ac-protocol-panel blockquote {
  margin: 0;
  color: #c9dde9;
  line-height: 1.48;
  font-size: 14px;
}

.ac-protocol-orbit {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 1px solid rgba(224,169,87,.3);
  background:
    radial-gradient(circle, rgba(224,169,87,.7) 0 3%, transparent 4%),
    repeating-conic-gradient(rgba(224,169,87,.42) 0 2deg, transparent 2deg 35deg);
  opacity: .85;
}

.ac-tabs {
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(6, 1fr) 250px;
  gap: 0;
  overflow: hidden;
}

.ac-tabs button {
  border: 0;
  border-right: 1px solid rgba(93,209,255,.16);
  background: rgba(8,23,33,.25);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  cursor: pointer;
  font-size: 13px;
}

.ac-tabs button:hover,
.ac-tabs button.active {
  color: var(--text);
  background: rgba(20,65,92,.42);
}

.ac-tabs .ac-end-turn {
  color: #fff3d8;
  background: linear-gradient(180deg, rgba(77,50,12,.72), rgba(15,11,5,.82));
  border-left: 1px solid rgba(224,169,87,.45);
  border-right: 0;
}

.start-screen,
.ending {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(3,7,11,.42), rgba(3,7,11,.96)),
    url("assets/axiom-colony/main_colony.webp") center / cover no-repeat;
}

.start-screen.hidden,
.ending { display: none; }

.ending.show { display: grid; }

.start-card,
.ending-card {
  width: min(920px, 100%);
  border: 1px solid rgba(224,169,87,.55);
  border-radius: 22px;
  background: rgba(4,12,18,.88);
  box-shadow: 0 24px 120px rgba(0,0,0,.74);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.start-card { padding: 34px; }

.start-title {
  margin: 0;
  color: #fff7e7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 86px);
  line-height: .94;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.start-subtitle {
  margin: 10px 0 24px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .34em;
  font-size: 12px;
}

.start-grid {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
}

.start-copy {
  color: #d5e7f4;
  line-height: 1.55;
  margin: 0;
}

.start-stats,
.score-panel {
  border: 1px solid rgba(119, 202, 255, .26);
  border-radius: 16px;
  padding: 16px;
  background: rgba(9, 25, 36, .55);
  display: grid;
  gap: 10px;
}

.start-stat-line,
.score-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: 8px;
}

.start-stat-line:last-child,
.score-line:last-child { border-bottom: 0; padding-bottom: 0; }

.start-stat-line strong,
.score-line strong { color: var(--gold); }

.difficulty-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.difficulty-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-right: 6px;
}

.start-actions,
.ending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.ending-card img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.ending-body {
  padding: 24px;
  display: grid;
  gap: 12px;
}

.ending-body h2 {
  margin: 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ending-body p {
  margin: 0;
  color: #d5e7f4;
  line-height: 1.55;
}

.ending-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.summary-chip {
  border: 1px solid rgba(119,202,255,.26);
  border-radius: 14px;
  padding: 10px;
  background: rgba(9,25,36,.55);
}

.summary-chip span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 4px;
}

.summary-chip strong {
  color: #fff7e7;
  font-size: 18px;
}

.admin-panel {
  position: fixed;
  right: 14px;
  top: 110px;
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100vh - 130px);
  z-index: 40;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(4, 12, 18, .94);
  box-shadow: 0 24px 100px rgba(0,0,0,.78);
  backdrop-filter: blur(18px);
  padding: 14px;
  overflow: auto;
}

.admin-panel.hidden { display: none; }

.admin-head {
  display: flex;
  justify-content: space-between;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  margin-bottom: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.admin-grid input,
#debugOutput {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9,25,36,.7);
  color: var(--text);
  padding: 8px;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

#debugOutput {
  height: 180px;
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  resize: vertical;
}

body.scale-compact .ac-shell {
  transform: scale(.92);
  transform-origin: center center;
}

body.scale-large .ac-shell {
  transform: scale(1.04);
  transform-origin: center center;
}

@media (max-width: 1400px) {
  .ac-shell {
    grid-template-rows: 74px minmax(0, 1fr) 160px 54px;
    gap: 8px;
    padding: 8px;
  }

  .ac-topbar {
    grid-template-columns: 220px minmax(0,1fr) 430px;
    padding: 8px 12px;
  }

  .ac-ident { font-size: 9px; }
  .ac-crest { width: 34px; height: 34px; }
  .ac-titleblock h1 { font-size: 42px; }
  .ac-yearline { margin-top: 8px; font-size: 10px; }
  .ac-icon-btn, .ac-menu-btn, .tiny-btn { height: 30px; min-width: 32px; padding: 0 8px; font-size: 9px; }

  .ac-main-grid { grid-template-columns: 260px minmax(480px, 1fr) 390px; gap: 8px; }
  .ac-bottom-grid { grid-template-columns: 390px minmax(430px, 1fr) 390px; gap: 8px; }

  .ac-panel-title { font-size: 11px; }
  .ac-stats-panel { padding: 12px; gap: 10px; }
  .stat { grid-template-columns: 30px minmax(0,1fr) 46px; gap: 7px; }
  .stat-icon { width: 28px; height: 28px; font-size: 12px; }
  .stat-name { font-size: 8px; margin-bottom: 4px; }
  .stat strong { font-size: 12px; }
  .bar { height: 5px; }

  .ac-hero-overlay { inset: auto 18px 18px; grid-template-columns: minmax(0,1fr) 190px; }
  .ac-hero-overlay h2 { font-size: 25px; }
  .ac-hero-overlay p { font-size: 12px; }
  .ac-ai-card strong { font-size: 32px; }

  .ac-event-panel { padding: 10px; grid-template-rows: auto 118px auto auto minmax(0,1fr) 24px; gap: 7px; }
  .ac-event-image { height: 118px; }
  .ac-event-info { min-height: 70px; max-height: 80px; }
  .ac-event-info h2 { font-size: 22px; }
  .ac-event-info p { font-size: 11px; }
  .ac-choose-label { font-size: 9px; }
  .ac-choices { gap: 6px; }
  .btn, .ac-choices .btn { padding: 6px 8px; }
  .choice-label { font-size: 11px; }
  .choice-effect { font-size: 7px; }

  .ac-log-panel, .ac-forecast-panel, .ac-protocol-panel { padding: 10px; }
  .ac-log-list { height: 70px; }
  .log-item { font-size: 10px; }
  .ac-chart-wrap { grid-template-columns: 118px minmax(0,1fr); }
  .ac-chart-legend { font-size: 8px; gap: 6px; }
  .ac-forecast-side { grid-template-columns: 70px 1fr; padding-left: 10px; }
  .ac-risk-ring { width: 66px; height: 66px; }
  .ac-risk-ring span { font-size: 18px; }
  .ac-forecast-side strong, .ac-forecast-side p { font-size: 10px; }
  .ac-protocol-panel blockquote { font-size: 11px; }
  .ac-protocol-orbit { width: 74px; height: 74px; }
  .ac-tabs button { font-size: 10px; }
}

@media (max-width: 980px) {
  html, body { overflow: auto; height: auto; }
  .ac-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    transform: none !important;
    grid-template-rows: auto;
    padding: 10px;
  }
  .ac-topbar,
  .ac-main-grid,
  .ac-bottom-grid,
  .ac-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }
  .ac-topbar { gap: 14px; }
  .ac-actions { justify-content: center; }
  .ac-hero-card { min-height: 420px; }
  .ac-event-panel { grid-template-rows: auto auto auto auto auto auto; }
  .ac-event-image { height: auto; aspect-ratio: 16 / 9; }
  .ac-choices { grid-template-rows: none; }
  .ac-bottom-grid { grid-template-columns: 1fr; }
  .ac-forecast-panel { grid-template-columns: 1fr; }
  .ac-forecast-side { border-left: 0; border-top: 1px solid rgba(93,209,255,.25); padding: 12px 0 0; }
  .start-grid { grid-template-columns: 1fr; }
  .ending-summary { grid-template-columns: 1fr 1fr; }
}


/* V2 runtime fix: cleaner start screen buttons */
.start-main-btn,
.start-secondary-btn {
  min-width: 160px;
  height: 54px;
  border-radius: 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  font-size: 13px;
  transition: transform .12s ease, border-color .12s ease, filter .12s ease;
}

.start-main-btn {
  border: 1px solid rgba(224,169,87,.82);
  background: linear-gradient(180deg, rgba(88,58,13,.9), rgba(21,16,7,.94));
  color: #fff4d8;
  box-shadow: 0 0 24px rgba(224,169,87,.12);
}

.start-secondary-btn {
  border: 1px solid rgba(93,209,255,.46);
  background: linear-gradient(180deg, rgba(20,65,92,.72), rgba(7,26,38,.92));
  color: #dcefff;
}

.start-main-btn:hover,
.start-secondary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.14);
}

.start-main-btn:active,
.start-secondary-btn:active {
  transform: translateY(1px);
}


/* V2 zoom fix: browser zoom-safe desktop cap */
@media (min-width: 1600px) and (min-height: 1000px) {
  .ac-shell {
    height: 980px;
  }

  .ac-event-panel {
    grid-template-rows: auto 152px auto 20px 236px 28px;
  }

  .ac-choices {
    max-height: 236px;
  }

  .ac-choices .btn {
    max-height: 54px;
  }
}

/* Keep title/header from eating too much vertical space on moderate screens. */
@media (max-height: 860px) {
  .ac-shell {
    height: 100vh;
    min-height: 720px;
    grid-template-rows: 74px minmax(0, 1fr) 158px 52px;
    gap: 8px;
  }

  .ac-event-panel {
    grid-template-rows: auto 118px auto 18px minmax(164px, 1fr) 24px;
  }

  .ac-event-image {
    height: 118px;
  }

  .ac-event-info {
    min-height: 70px;
    max-height: 82px;
  }

  .ac-choices {
    max-height: 210px;
    gap: 6px;
  }

  .ac-choices .btn {
    min-height: 38px;
    padding: 6px 8px;
  }

  .choice-label {
    font-size: 11px;
  }

  .choice-effect {
    font-size: 7px;
  }
}


/* UI V2 polish: controls, readable choices, disabled tabs */
.ac-close-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 107, 56, .5);
  border-radius: 8px;
  background: rgba(55, 12, 8, .55);
  color: #ffd8cc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ac-close-btn:hover {
  border-color: rgba(255, 107, 56, .9);
  background: rgba(95, 22, 12, .75);
}

.ac-menu-btn {
  min-width: 78px;
}

.ac-choices .btn {
  padding: 9px 12px;
}

.choice-label {
  letter-spacing: .02em;
  text-transform: none;
  font-size: 14px;
}

.choice-effect {
  letter-spacing: .045em;
  font-size: 9px;
}

.ac-tabs button.is-disabled,
.ac-tabs button:disabled {
  opacity: .42;
  cursor: not-allowed;
  background: rgba(8,23,33,.18);
}

.ac-tabs button.is-disabled:hover,
.ac-tabs button:disabled:hover {
  color: var(--muted);
  background: rgba(8,23,33,.18);
}

@media (max-width: 1400px) {
  .ac-menu-btn {
    min-width: 58px;
  }

  .ac-close-btn {
    width: 30px;
    height: 30px;
    font-size: 19px;
  }

  .choice-label {
    font-size: 11px;
  }

  .choice-effect {
    font-size: 7px;
  }
}


/* Safe render fix */
.start-screen.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ac-shell.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  width: 100vw;
  height: 100dvh;
  max-height: none;
  min-height: 0;
  background: var(--bg);
  overflow: auto;
}

.ac-choices .btn {
  min-height: 54px;
  max-height: none;
}

.choice-label,
.choice-effect {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.choice-label {
  line-height: 1.18;
}

.choice-effect {
  line-height: 1.16;
  margin-top: 2px;
}

@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    display: block;
  }

  .ac-shell {
    width: 100%;
    min-height: 100dvh;
    height: auto;
    max-height: none;
    transform: none !important;
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .ac-topbar,
  .ac-main-grid,
  .ac-bottom-grid {
    grid-template-columns: 1fr;
  }

  .ac-topbar {
    gap: 8px;
  }

  .ac-titleblock h1 {
    font-size: clamp(34px, 11vw, 54px);
  }

  .ac-actions {
    justify-content: center;
  }

  .ac-menu-btn,
  .ac-close-btn {
    min-height: 38px;
  }

  .ac-event-panel {
    grid-template-rows: auto auto auto auto auto auto;
  }

  .ac-event-image {
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 220px;
  }

  .ac-event-info {
    min-height: 0;
    max-height: none;
  }

  .ac-choices {
    max-height: none;
    grid-template-rows: none;
  }

  .ac-choices .btn {
    min-height: 58px;
  }

  .choice-label {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }

  .ac-forecast-panel {
    grid-template-columns: 1fr;
  }

  .ac-chart-wrap {
    grid-template-columns: 1fr;
  }

  .ac-tabs {
    position: sticky;
    bottom: 0;
    z-index: 10;
    grid-template-columns: 1fr 1fr;
  }

  .ac-tabs button:not(.active):not(.ac-end-turn) {
    display: none;
  }

  .start-screen,
  .ending {
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
