:root {
  --ink: #19201d;
  --muted: #69706b;
  --paper: #f1efe8;
  --panel: #fbfaf6;
  --line: #d8d6cd;
  --lime: #d8ff63;
  --lime-deep: #b6df35;
  --blue: #576dff;
  --orange: #ff8f50;
  --red: #e84e3f;
  --shadow: 0 22px 70px rgba(25, 32, 29, .12);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 14%, rgba(216, 255, 99, .18), transparent 27rem),
    linear-gradient(rgba(25, 32, 29, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 32, 29, .035) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 90%);
}

.topbar {
  width: min(1440px, calc(100% - 48px));
  min-height: 98px;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid rgba(25, 32, 29, .16);
}

.brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.04em;
  text-transform: uppercase;
}

.brand-mark { width: 36px; height: 36px; display: flex; flex-direction: column-reverse; gap: 2px; padding: 6px; background: var(--ink); }
.brand-mark i { display: block; height: 6px; background: var(--lime); }
.brand-mark i:nth-child(2) { width: 74%; }
.brand-mark i:nth-child(3) { width: 45%; }

.hud { display: flex; align-items: center; }
.hud-item { min-width: 122px; padding: 0 25px; border-right: 1px solid rgba(25, 32, 29, .16); }
.hud-item:first-child { border-left: 1px solid rgba(25, 32, 29, .16); }
.hud-item span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hud-item strong { font-size: 20px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hud-item strong b { font-weight: inherit; }
.hud-item strong.tick { display: inline-block; animation: tick .3s ease; }
.stability-hud strong { color: #526516; }

.quiet-button {
  justify-self: end;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 4px 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.quiet-button:hover { color: var(--ink); }

main { width: min(1440px, calc(100% - 48px)); margin: auto; }

.start-screen {
  min-height: calc(100vh - 166px);
  min-height: calc(100dvh - 166px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, .82fr);
  align-items: center;
  gap: clamp(48px, 8vw, 130px);
  padding: 54px 4vw 66px;
}

.start-copy { max-width: 760px; animation: rise-in .65s cubic-bezier(.2,.8,.2,1) both; }
.kicker, .section-label, .situation-number { margin: 0 0 19px; color: #4c5f15; font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.start-copy h1 { max-width: 11ch; margin: 0; font-size: clamp(58px, 7.4vw, 114px); line-height: .87; letter-spacing: -.075em; text-transform: uppercase; }
.start-copy h1 em { display: block; color: var(--blue); font-style: normal; }
.lead { max-width: 58ch; margin: 32px 0 29px; color: #535b56; font-size: clamp(17px, 1.45vw, 21px); line-height: 1.55; }

.primary-button {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border: 0;
  padding: 15px 18px 15px 23px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 7px 7px 0 var(--lime-deep);
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary-button span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--ink); font-size: 18px; }
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 var(--lime-deep); }
.primary-button:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--lime-deep); }
.start-button { min-width: 286px; }
.duration { margin: 18px 0 0; color: var(--muted); font-size: 12px; }

.start-visual {
  position: relative;
  aspect-ratio: .79;
  max-height: 690px;
  overflow: hidden;
  background: var(--blue);
  box-shadow: 22px 22px 0 var(--ink);
  animation: poster-in .7s .08s cubic-bezier(.2,.8,.2,1) both;
}
.blueprint-grid { position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(white 1px, transparent 1px), linear-gradient(90deg, white 1px, transparent 1px); background-size: 37px 37px; }
.poster-label { position: absolute; z-index: 2; top: 28px; left: 30px; color: rgba(255,255,255,.68); font-size: 11px; line-height: 1.2; letter-spacing: .12em; text-transform: uppercase; }
.poster-label strong { color: white; font-size: 16px; }
.poster-score { position: absolute; z-index: 2; right: 26px; bottom: 25px; color: white; text-align: right; text-transform: uppercase; }
.poster-score span { display: block; margin-bottom: 3px; color: var(--lime); font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.poster-score strong { font-size: 16px; line-height: 1; }
.poster-stamp { position: absolute; top: 32%; left: 8%; color: rgba(255,255,255,.42); font-size: 10px; font-weight: 900; letter-spacing: .15em; transform: rotate(-90deg); }
.preview-tower { position: absolute; left: 50%; bottom: 74px; width: 62%; height: 70%; display: flex; flex-direction: column; justify-content: end; align-items: center; transform: translateX(-50%); }
.preview-block { position: relative; display: block; height: 16%; background: var(--lime); border: 4px solid var(--ink); box-shadow: inset -12px -10px 0 rgba(25,32,29,.12); }
.preview-block::after { content: ""; position: absolute; left: 15%; right: 15%; top: 35%; height: 16%; background: repeating-linear-gradient(90deg, var(--ink) 0 12px, transparent 12px 25px); opacity: .78; }
.preview-block span { position: absolute; top: 7px; left: 9px; font-size: 9px; font-style: normal; font-weight: 900; }
.preview-block.p1 { width: 100%; }
.preview-block.p2 { width: 87%; margin-left: -7%; background: white; }
.preview-block.p3 { width: 74%; margin-left: 9%; }
.preview-block.p4 { width: 60%; margin-left: -2%; background: var(--orange); transform: rotate(-2deg); }
.preview-base { width: 118%; height: 14px; background: var(--ink); }

.game-screen {
  min-height: calc(100vh - 166px);
  min-height: calc(100dvh - 166px);
  grid-template-columns: minmax(420px, 1.12fr) minmax(410px, .88fr);
  gap: 32px;
  padding: 30px 0 42px;
  opacity: 0;
  transform: translateY(12px);
}
.game-screen.is-visible { display: grid; opacity: 1; transform: translateY(0); transition: opacity .35s ease, transform .35s ease; }

.tower-panel, .decision-panel, .result-panel { min-width: 0; border: 1px solid var(--line); background: rgba(251,250,246,.82); }
.tower-panel { padding: 25px 25px 17px; }
.tower-heading { min-height: 48px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.tower-heading .section-label { margin-bottom: 5px; font-size: 9px; }
.tower-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.035em; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime-deep); box-shadow: 0 0 0 5px rgba(182,223,53,.15); animation: pulse 1.8s infinite; }

.tower-stage {
  position: relative;
  height: clamp(440px, calc(100vh - 280px), 650px);
  min-height: 440px;
  overflow: hidden;
  border: 1px solid rgba(25,32,29,.18);
  background: #dfe4f4;
  isolation: isolate;
}
.tower-stage::before { content: ""; position: absolute; inset: 0; z-index: -2; background: linear-gradient(rgba(25,32,29,.065) 1px, transparent 1px), linear-gradient(90deg, rgba(25,32,29,.065) 1px, transparent 1px); background-size: 42px 42px; }
.tower-stage::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(216,255,99,.18), transparent 38%); }
.sky-orb { position: absolute; top: 10%; right: 10%; width: 68px; height: 68px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 15px rgba(216,255,99,.18); }
.height-lines { position: absolute; inset: 10% 18px 14%; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.height-lines span { display: flex; align-items: center; gap: 10px; color: rgba(25,32,29,.4); font-size: 9px; font-weight: 900; }
.height-lines span::after { content: ""; flex: 1; height: 1px; background: rgba(25,32,29,.13); }
.tower-wrap { position: absolute; inset: 6% 12% 9%; display: flex; flex-direction: column; justify-content: end; align-items: center; }
.tower { width: min(78%, 390px); display: flex; flex-direction: column-reverse; align-items: center; filter: drop-shadow(12px 16px 0 rgba(25,32,29,.1)); transform-origin: bottom; }
.tower-block {
  position: relative;
  width: calc(100% - var(--floor, 0px));
  height: clamp(39px, 6.2vh, 58px);
  min-height: 39px;
  flex: none;
  margin-top: -1px;
  overflow: hidden;
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--lime);
  transform: translateX(var(--offset)) rotate(var(--tilt));
  transform-origin: center bottom;
  animation: block-drop .58s cubic-bezier(.17,.78,.25,1.13) both;
}
.tower-block:nth-child(n+5) { width: 86%; }
.tower-block.good { background: var(--lime); }
.tower-block.medium { background: #fff4d5; box-shadow: inset 0 -9px 0 rgba(255,143,80,.28); }
.tower-block.bad { background: var(--orange); box-shadow: inset 0 -9px 0 rgba(232,78,63,.24); }
.floor-number { position: absolute; top: 7px; left: 9px; font-size: 9px; font-weight: 900; }
.block-status { position: absolute; top: 50%; right: 12px; width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; font-size: 12px; font-weight: 900; transform: translateY(-50%); }
.block-windows { position: absolute; top: 35%; left: 21%; right: 22%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8%; }
.block-windows i { height: 9px; background: var(--ink); opacity: .75; }
.crack { position: absolute; left: 56%; top: -4px; width: 2px; height: 44px; background: var(--ink); transform: rotate(16deg); }
.crack::before, .crack::after { content: ""; position: absolute; width: 10px; height: 2px; background: var(--ink); }
.crack::before { top: 13px; right: -1px; transform: rotate(-35deg); }
.crack::after { top: 26px; left: -1px; transform: rotate(40deg); }
.foundation { width: min(92%, 455px); height: 30px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 7px 16px; background: var(--ink); }
.foundation span { background: var(--lime); opacity: .8; }
.ground-line { position: absolute; left: 0; right: 0; bottom: 7%; height: 2px; background: var(--ink); }
.build-hint { position: absolute; right: 18px; bottom: 12px; margin: 0; color: rgba(25,32,29,.58); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.tower-stage.react-bad .tower { animation: tower-shake .38s ease; }
.tower-stage.react-medium .tower { animation: tower-settle .4s ease; }
.tower-stage.react-good .sky-orb { animation: orb-glow .7s ease; }
.tower-stage.is-complete .tower { animation: tower-finish .85s cubic-bezier(.2,.8,.2,1) both; }
.tower-stage.is-complete .sky-orb { box-shadow: 0 0 0 18px rgba(216,255,99,.22), 0 0 70px rgba(216,255,99,.9); }
.legend { display: flex; gap: 20px; padding-top: 14px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border: 1px solid var(--ink); }
.good-dot { background: var(--lime); } .medium-dot { background: #fff4d5; } .bad-dot { background: var(--orange); }

.decision-panel, .result-panel { min-height: 620px; padding: clamp(27px, 4vw, 58px); align-self: stretch; box-shadow: var(--shadow); }
.progress-row { display: flex; gap: 18px; align-items: center; margin-bottom: clamp(48px, 8vh, 82px); color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.progress-row > span { white-space: nowrap; }
.progress-track { flex: 1; height: 5px; background: #e1e0d9; overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--blue); transition: width .4s ease; }
.situation-number { margin-bottom: 17px; }
.question-view h2, .feedback-view h2, .result-panel h2 { margin: 0; font-size: clamp(28px, 3vw, 45px); line-height: 1.04; letter-spacing: -.055em; }
.answer-prompt { margin: 36px 0 13px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.answers { display: grid; gap: 10px; }
.answer-button {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 32px 1fr 23px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  padding: 13px 15px;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: border-color .16s, transform .16s, background .16s;
}
.answer-button > span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-size: 11px; font-weight: 900; }
.answer-button b { font-size: 14px; line-height: 1.4; font-weight: 700; }
.answer-button > i { font-style: normal; font-size: 18px; opacity: 0; transform: translateX(-5px); transition: opacity .16s, transform .16s; }
.answer-button:hover:not(:disabled) { border-color: var(--ink); transform: translateX(4px); background: #f8f9f2; }
.answer-button:hover:not(:disabled) > i { opacity: 1; transform: translateX(0); }
.answer-button.is-selected { border-color: var(--blue); background: #eef0ff; }
.answer-button:disabled { cursor: default; opacity: .48; }
.answer-button.is-selected:disabled { opacity: 1; }

.feedback-view { animation: feedback-in .35s ease both; }
.feedback-sign { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 26px; border: 2px solid var(--ink); border-radius: 50%; background: var(--lime); font-size: 29px; font-weight: 900; box-shadow: 7px 7px 0 var(--ink); }
.feedback-view[data-quality="medium"] .feedback-sign { background: #fff4d5; }
.feedback-view[data-quality="bad"] .feedback-sign { background: var(--orange); }
.feedback-quality { margin: 0 0 12px; color: #526516; font-size: 11px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.feedback-view[data-quality="bad"] .feedback-quality { color: var(--red); }
.feedback-view > p:not(.feedback-quality) { max-width: 49ch; margin: 20px 0 0; color: #59615c; font-size: 16px; line-height: 1.58; }
.feedback-score { margin: 34px 0 30px; display: flex; align-items: end; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; }
.feedback-score span { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.feedback-score strong { color: var(--blue); font-size: 30px; letter-spacing: -.05em; }

.result-panel { display: flex; flex-direction: column; justify-content: center; animation: feedback-in .42s ease both; }
.result-copy .kicker { margin-bottom: 14px; }
.result-lead { margin: 14px 0 0; color: var(--blue); font-size: 20px; font-weight: 800; }
.result-stats { display: grid; grid-template-columns: 1.25fr 1fr 1fr; margin: 32px 0 23px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.result-stat { min-height: 88px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-stat span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.result-stat strong { font-size: 24px; letter-spacing: -.05em; }
.result-stat small { font-size: 11px; letter-spacing: 0; }
.result-stat.featured { grid-row: span 2; background: var(--lime); }
.result-stat.featured strong { font-size: clamp(42px, 5vw, 66px); }
.result-note { margin-bottom: 28px; padding-left: 17px; border-left: 4px solid var(--blue); color: #555d58; font-size: 14px; line-height: 1.55; }
.result-panel .primary-button { width: 100%; }

footer {
  width: min(1440px, calc(100% - 48px));
  min-height: 68px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(25,32,29,.16);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

@keyframes rise-in { from { opacity: 0; transform: translateY(22px); } }
@keyframes poster-in { from { opacity: 0; transform: translate(22px, 18px) rotate(1deg); } }
@keyframes tick { 50% { color: var(--blue); transform: translateY(-3px) scale(1.07); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(182,223,53,0); } }
@keyframes block-drop { from { opacity: 0; transform: translate(var(--offset), -100px) rotate(calc(var(--tilt) * -1)); } 70% { opacity: 1; transform: translate(var(--offset), 5px) rotate(var(--tilt)); } to { transform: translateX(var(--offset)) rotate(var(--tilt)); } }
@keyframes tower-shake { 25% { transform: translateX(-5px) rotate(-.6deg); } 50% { transform: translateX(5px) rotate(.7deg); } 75% { transform: translateX(-2px) rotate(-.3deg); } }
@keyframes tower-settle { 40% { transform: rotate(.5deg); } 75% { transform: rotate(-.25deg); } }
@keyframes orb-glow { 50% { transform: scale(1.1); box-shadow: 0 0 0 26px rgba(216,255,99,0), 0 0 50px var(--lime); } }
@keyframes feedback-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes tower-finish { 0% { transform: scale(.97); } 45% { transform: scale(1.025); filter: drop-shadow(12px 16px 0 rgba(25,32,29,.1)) brightness(1.08); } }

@media (max-width: 1020px) {
  .topbar { grid-template-columns: 1fr auto; }
  .hud { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: stretch; padding-bottom: 14px; }
  .hud-item { flex: 1; min-width: 0; padding: 0 16px; }
  .quiet-button { grid-column: 2; grid-row: 1; }
  .start-screen { grid-template-columns: 1fr minmax(340px, .72fr); gap: 50px; padding-inline: 0; }
  .game-screen { grid-template-columns: minmax(350px, .92fr) minmax(390px, 1.08fr); }
  .decision-panel, .result-panel { padding: 31px; }
}

@media (max-width: 780px) {
  .topbar, main, footer { width: min(100% - 28px, 680px); }
  .topbar { min-height: 76px; }
  .brand { font-size: 12px; }
  .brand-mark { width: 31px; height: 31px; }
  .quiet-button { font-size: 11px; }
  .hud { margin-top: 7px; }
  .hud-item { padding: 0 10px; }
  .hud-item span { font-size: 8px; }
  .hud-item strong { font-size: 17px; }
  .start-screen { min-height: auto; grid-template-columns: 1fr; padding: 55px 0 76px; }
  .start-copy h1 { font-size: clamp(50px, 15vw, 84px); }
  .start-visual { width: min(calc(100% - 14px), 470px); justify-self: start; box-shadow: 14px 14px 0 var(--ink); }
  .game-screen.is-visible { display: flex; flex-direction: column; padding: 20px 0 40px; }
  .tower-panel { padding: 14px; }
  .tower-heading { min-height: 45px; }
  .tower-stage { height: min(52vh, 480px); min-height: 385px; }
  .tower-block { height: clamp(35px, 5vh, 46px); min-height: 35px; }
  .decision-panel, .result-panel { min-height: auto; padding: 28px 21px 34px; }
  .progress-row { margin-bottom: 40px; }
  .question-view h2, .feedback-view h2, .result-panel h2 { font-size: clamp(28px, 8vw, 40px); }
  .result-stats { grid-template-columns: 1.2fr 1fr; }
  .result-stat.featured { grid-row: span 2; }
  footer { min-height: 58px; gap: 10px; font-size: 8px; }
}

@media (max-width: 430px) {
  .start-screen { gap: 54px; }
  .start-copy h1 { font-size: clamp(48px, 16vw, 68px); }
  .lead { font-size: 16px; }
  .start-button { width: calc(100% - 7px); min-width: 0; }
  .tower-stage { height: 390px; min-height: 390px; }
  .legend { gap: 10px; justify-content: space-between; font-size: 8px; }
  .live-badge { font-size: 8px; }
  .answer-button { min-height: 81px; grid-template-columns: 30px 1fr; }
  .answer-button > i { display: none; }
  .answer-button b { font-size: 13px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stat.featured { grid-column: 1 / -1; grid-row: auto; min-height: 115px; }
  .result-stat.featured strong { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
