.escape-app {
  min-height: 100vh;
  color: #e8edf5;
  background:
    radial-gradient(circle at 50% 0, rgba(170, 119, 36, .16), transparent 32rem),
    linear-gradient(180deg, #070b13, #0b1320 48%, #070b13);
}

.escape-app::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .16;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.035) 4px);
}

.escape-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 920px);
  margin: 0 auto;
  padding: 1rem 0 4rem;
}

.preview-ribbon {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: .5rem 1rem;
  color: #151006;
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
  background: #e4b554;
}

.escape-header {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid rgba(223,174,74,.52);
  border-radius: 1.25rem;
  background: #080c13;
  box-shadow: 0 30px 80px rgba(0,0,0,.42);
}

.escape-header__image {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: saturate(.82) contrast(1.08);
}

.escape-header__copy {
  position: absolute;
  right: 1.4rem;
  bottom: 1.4rem;
  left: 1.4rem;
  text-shadow: 0 2px 14px #000;
}

.escape-header h1 {
  max-width: 720px;
  margin: .25rem 0;
  color: #f7df9d;
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  line-height: 1.2;
  word-break: keep-all;
}

.escape-header__copy > p:last-child { color: #d8dee8; font-size: .88rem; }
.escape-kicker { color: #e3b556; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.escape-status {
  position: absolute;
  top: .85rem;
  right: .85rem;
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.escape-status span,
.escape-status select {
  padding: .38rem .65rem;
  border: 1px solid rgba(226,181,89,.42);
  border-radius: 999px;
  color: #f7df9d;
  font-size: .72rem;
  background: rgba(6,10,17,.84);
}

.escape-panel {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid rgba(148,163,184,.23);
  border-radius: 1.1rem;
  background: linear-gradient(145deg, rgba(22,32,48,.94), rgba(11,18,29,.97));
  box-shadow: 0 18px 45px rgba(0,0,0,.24);
}

.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-heading h2, .puzzle-panel h2, .branch-panel h2 { margin-top: .2rem; font-size: 1.25rem; }
.panel-heading strong { min-width: 4.5rem; color: #f5d27e; font-size: 1.2rem; text-align: right; }
.mission-brief { margin-top: .75rem; color: #c5cfdd; line-height: 1.7; word-break: keep-all; }

.mission-glossary { margin-top: .9rem; overflow: hidden; border: 1px solid rgba(125,211,252,.28); border-radius: .85rem; background: rgba(8,47,73,.2); }
.mission-glossary summary { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .75rem .85rem; color: #c9f2ff; font-weight: 800; cursor: pointer; list-style-position: inside; }
.mission-glossary summary small { color: #8fb5c4; font-size: .68rem; font-weight: 600; }
.glossary-guide { padding: 0 .85rem .7rem; color: #b5c6d2; font-size: .76rem; line-height: 1.55; }
.glossary-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; padding: 0 .75rem .75rem; }
.glossary-entry { padding: .7rem; border: 1px solid rgba(125,211,252,.17); border-radius: .65rem; background: rgba(3,13,23,.62); }
.glossary-entry dt { color: #f5d681; font-size: .85rem; font-weight: 900; }
.glossary-entry dd { margin-top: .3rem; color: #d4dde6; font-size: .74rem; line-height: 1.55; }
.glossary-entry dd strong { color: #8cddf3; }
.glossary-entry dd span { display: block; margin-top: .26rem; color: #94a6b5; }

.clue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}

.clue-card {
  min-height: 160px;
  padding: 1rem;
  border: 1px dashed rgba(184,151,78,.46);
  border-radius: .9rem;
  background: rgba(5,10,18,.6);
}

.clue-card.is-open { border-style: solid; border-color: rgba(226,181,89,.62); background: linear-gradient(145deg, rgba(73,55,25,.35), rgba(7,14,24,.84)); }
.clue-card__top { display: flex; justify-content: space-between; gap: .5rem; color: #9ba9bb; font-size: .66rem; font-weight: 700; letter-spacing: .07em; }
.clue-card h3 { margin-top: .6rem; color: #f0d99e; font-size: 1rem; }
.clue-card p { margin-top: .45rem; color: #c9d2df; font-size: .82rem; line-height: 1.6; word-break: keep-all; }
.clue-help { margin-top: .7rem; padding: .7rem; border-left: 3px solid #67e8f9; border-radius: .45rem; color: #d8e7ef; background: rgba(8,47,73,.32); }
.clue-help > strong { color: #a5f3fc; font-size: .73rem; }
.clue-help ul { display: grid; gap: .48rem; margin-top: .48rem; }
.clue-help li { list-style: none; }
.clue-help li > span { color: #f5d681; font-size: .76rem; font-weight: 900; }
.clue-help li > em { display: inline-block; margin-left: .4rem; padding: .08rem .34rem; border-radius: .3rem; color: #082f49; font-size: .64rem; font-style: normal; font-weight: 800; background: #a5f3fc; }
.clue-help li > p { margin-top: .16rem; color: #cbd9e2; font-size: .72rem; line-height: 1.5; }
.investigate-btn { margin-top: 1rem; padding: .55rem .8rem; border-radius: .65rem; color: #13100a; font-weight: 800; background: #ddb052; }
.source-link, .decoy-label { display: inline-block; margin-top: .65rem; font-size: .7rem; }
.source-link { color: #7dd3fc; text-decoration: underline; }
.decoy-label { color: #aeb9c8; }
.locked-note { margin-top: .85rem; color: #aeb9c8; font-size: .78rem; text-align: center; }

.wk-table { width: 100%; margin-top: .65rem; overflow: hidden; border-collapse: collapse; border: 1px solid rgba(226,181,89,.3); border-radius: .5rem; font-size: .72rem; }
.wk-table th, .wk-table td { padding: .3rem .45rem; border-bottom: 1px solid rgba(148,163,184,.18); text-align: left; }
.wk-table th { color: #161007; background: #dcae50; }

.puzzle-panel h2, .branch-panel h2 { margin: .3rem 0 1rem; color: #f7df9d; line-height: 1.45; word-break: keep-all; }
.option-grid, .branch-grid { display: grid; gap: .65rem; }
.option-btn, .branch-grid button {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: .8rem;
  color: #dfe6ef;
  text-align: left;
  background: rgba(7,13,23,.72);
}
.option-btn:hover, .branch-grid button:hover { border-color: rgba(226,181,89,.72); }
.option-btn.is-selected, .branch-grid button.is-selected { border-color: #e4b554; color: #fff1bd; background: rgba(128,87,22,.34); box-shadow: inset 0 0 0 1px rgba(228,181,84,.2); }
.option-number { display: grid; width: 1.6rem; height: 1.6rem; place-items: center; flex: 0 0 auto; border: 1px solid currentColor; border-radius: 50%; font-size: .72rem; font-weight: 800; }
.sequence-readout { margin-bottom: .75rem; padding: .8rem; border-left: 3px solid #e4b554; color: #d9e0ea; font-size: .82rem; line-height: 1.6; background: rgba(4,9,16,.62); }
.code-input { display: grid; gap: .5rem; color: #b8c3d1; font-size: .78rem; }
.code-input input, .reflection-box textarea { width: 100%; padding: .85rem; border: 1px solid rgba(226,181,89,.45); border-radius: .75rem; color: #fff3c4; font-size: 1.05rem; background: #060b13; outline: none; }
.code-input input:focus, .reflection-box textarea:focus { border-color: #f1c765; box-shadow: 0 0 0 3px rgba(226,181,89,.13); }
.basis-board { margin-top: 1rem; padding: .9rem; border: 1px solid rgba(103,232,249,.25); border-radius: .85rem; background: rgba(8,47,73,.18); }
.basis-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; color: #b8f3fb; }
.basis-heading span { color: #8fa8b6; font-size: .72rem; }
.basis-board > p { margin-top: .35rem; color: #9fb0bf; font-size: .75rem; line-height: 1.55; }
.basis-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; margin-top: .7rem; }
.basis-grid button { display: flex; flex-direction: column; gap: .22rem; padding: .65rem; border: 1px solid rgba(148,163,184,.25); border-radius: .65rem; color: #cbd5e1; text-align: left; background: rgba(3,11,20,.7); }
.basis-grid button span { color: #7f93a5; font-size: .65rem; }
.basis-grid button strong { font-size: .78rem; }
.basis-grid button.is-selected { border-color: #67e8f9; color: #cffafe; background: rgba(8,145,178,.2); box-shadow: inset 0 0 0 1px rgba(103,232,249,.14); }
.basis-grid button:disabled { opacity: .7; }
.wrong-box { margin-top: .75rem; padding: .85rem; border: 1px solid rgba(248,113,113,.38); border-radius: .75rem; color: #fecaca; background: rgba(127,29,29,.23); }
.wrong-box p { margin-top: .3rem; color: #e6caca; font-size: .8rem; }
.wrong-box button { margin-top: .55rem; text-decoration: underline; }

.primary-action {
  width: 100%;
  margin-top: 1rem;
  padding: .85rem 1rem;
  border-radius: .8rem;
  color: #151006;
  font-weight: 900;
  background: linear-gradient(135deg, #f0c86b, #d59b32);
  box-shadow: 0 10px 25px rgba(177,117,28,.2);
}
.primary-action:disabled { cursor: not-allowed; opacity: .45; }

.branch-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.branch-grid button { min-height: 125px; flex-direction: column; }
.branch-grid strong { color: #f3d990; }
.branch-grid span { color: #b9c4d2; font-size: .78rem; line-height: 1.55; }
.result-panel { text-align: center; }
.result-panel .seal { display: grid; width: 3.4rem; height: 3.4rem; margin: 0 auto .7rem; place-items: center; border: 2px solid #86efac; border-radius: 50%; color: #86efac; font-size: 1.7rem; }
.result-panel h2 { color: #bbf7d0; font-size: 1.25rem; }
.result-panel > p:not(.escape-kicker) { margin-top: .55rem; color: #b9c4d2; font-size: .82rem; }
.escape-error { position: sticky; bottom: .75rem; margin-top: 1rem; padding: .8rem 1rem; border: 1px solid #ef4444; border-radius: .75rem; color: #fee2e2; background: rgba(127,29,29,.94); }
.escape-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; color: #728094; font-size: .68rem; }

.escape-loading, .escape-final { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; color: #f4dda1; background: #070b13; }
.ending-card { width: min(100%, 660px); padding: clamp(1.2rem, 4vw, 2rem); border: 1px solid rgba(226,181,89,.55); border-radius: 1.2rem; text-align: center; background: linear-gradient(145deg, #172234, #080d16); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.ending-icon { display: block; font-size: 3rem; }
.ending-card h1 { margin-top: .3rem; color: #f6dc96; font-size: clamp(1.8rem, 5vw, 2.8rem); }
.ending-card > p:not(.escape-kicker) { margin-top: .7rem; color: #cbd5e1; line-height: 1.7; }
.score-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }
.score-row div { padding: .8rem; border: 1px solid rgba(148,163,184,.24); border-radius: .8rem; background: rgba(2,7,14,.55); }
.score-row span, .score-row strong { display: block; }
.score-row span { color: #8e9bad; font-size: .7rem; }
.score-row strong { margin-top: .2rem; color: #f5d681; font-size: 1.35rem; }
.history-note { margin-top: 1rem; padding: .9rem; border-left: 3px solid #67e8f9; color: #c9d7e2; text-align: left; background: rgba(8,47,73,.24); }
.history-note strong { color: #a5f3fc; }
.history-note p { margin-top: .35rem; font-size: .8rem; line-height: 1.6; }
.reflection-box { display: grid; gap: .45rem; margin-top: 1rem; color: #e9d496; font-size: .8rem; text-align: left; }
.reflection-box textarea { color: #e7edf6; font-size: .9rem; resize: vertical; }
.final-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .7rem; }
.final-actions button { padding: .7rem; border: 1px solid rgba(148,163,184,.35); border-radius: .7rem; color: #d9e1eb; background: rgba(5,10,18,.7); }

@media (max-width: 640px) {
  .escape-shell { width: min(100% - 1rem, 920px); padding-top: .5rem; }
  .escape-header { min-height: 330px; }
  .escape-header__copy { right: 1rem; bottom: 1rem; left: 1rem; }
  .escape-status { right: .55rem; left: .55rem; }
  .clue-grid, .branch-grid, .basis-grid, .glossary-list { grid-template-columns: 1fr; }
  .clue-card { min-height: 140px; }
  .branch-grid button { min-height: auto; }
  .escape-footer { flex-direction: column; }
}
