/* Runewall — shell. The wall is drawn on canvas; this file is the room around it. */
:root {
  --ink: #e9f2ff;
  --dim: #8ea3c0;
  --ice: #7fd8ff;
  --ice-2: #c9eeff;
  --gold: #e8c765;
  --deep: #070b16;
  --panel: rgba(10, 16, 28, 0.88);
  --edge: rgba(140, 200, 240, 0.16);
  --edge-2: rgba(140, 200, 240, 0.42);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: #05080f;
  color: var(--ink);
  font: 15px/1.5 "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#app::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(78% 62% at 50% 46%, rgba(4, 8, 16, 0) 40%, rgba(3, 6, 12, .55) 100%);
}
#app {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
}

/* ------------------------------------------------------------------ HUD */
.hud {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px 7px;
  background: linear-gradient(180deg, rgba(6, 10, 19, 0.94), rgba(6, 10, 19, 0.35));
  border-bottom: 1px solid rgba(140, 200, 240, 0.10);
  backdrop-filter: blur(6px);
}
.hud-l { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.hud-chap { display: flex; flex-direction: column; min-width: 0; }
.hud-act {
  font-size: 9px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--ice); opacity: .82;
}
.hud-name {
  font: 14.5px/1.15 Georgia, "Times New Roman", serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 34vw;
}
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.courses {
  display: flex; align-items: baseline; gap: 4px;
  font: 12px/1 Georgia, serif; letter-spacing: .06em;
}
.courses-label { font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin-right: 3px; }
.courses b { font-size: 17px; color: var(--gold); }
.courses-sep { color: rgba(232, 199, 101, .45); }
.courses-track {
  width: 132px; height: 3px; border-radius: 2px;
  background: rgba(232, 199, 101, .14); overflow: hidden;
}
.courses-track i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #b8892f, var(--gold), #fff1bb);
  box-shadow: 0 0 8px rgba(232, 199, 101, .6);
  transition: width .28s cubic-bezier(.2,.8,.3,1);
}
.courses-track i.endless { background: linear-gradient(90deg, #4d9fd0, var(--ice)); }
.hud-r { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; justify-content: flex-end; }
.hud-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.hud-stat b { font: 600 14.5px/1 Georgia, serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-stat span { font-size: 8px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-top: 3px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--edge);
  background: rgba(140, 200, 240, 0.05);
  color: var(--ink); font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.icon-btn:hover { border-color: var(--edge-2); background: rgba(140, 200, 240, .12); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.95); }

/* ---------------------------------------------------------------- stage */
.stage {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 128px;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  width: 100%; max-width: 690px;
  margin: 0 auto;
  padding: 10px 10px 6px;
}
.rail { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; justify-content: space-between; padding: 2px 0; }
.panel {
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(16, 25, 42, .78), rgba(9, 14, 25, .78));
  padding: 7px 7px 6px;
  min-width: 0; overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .04) inset;
}
.panel h3 {
  font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ice); opacity: .75; font-weight: 500; margin-bottom: 5px; text-align: center;
}
.mini { display: block; width: 100%; max-width: 100%; height: 54px; }
.mini.tall { height: 168px; }
.stat-panel { display: flex; flex-direction: column; gap: 7px; padding: 9px 8px; }
.stat { display: flex; align-items: baseline; justify-content: space-between; }
.stat b { font: 600 15px/1 Georgia, serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 8px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.frost-panel { padding: 8px 8px 9px; }
.frost-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 8.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim);
  margin-bottom: 6px;
}
.frost-head b { font: 600 12px/1 Georgia, serif; color: var(--ice-2); letter-spacing: 0; }
.frost-bar {
  height: 7px; border-radius: 4px; overflow: hidden;
  background: rgba(127, 216, 255, .10);
  border: 1px solid rgba(127, 216, 255, .18);
}
.frost-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #2c6b8f, #59b6dd, #c9eeff);
  box-shadow: 0 0 10px rgba(127, 216, 255, .55);
  transition: width .2s linear;
}
.frost-bar i.warn { background: linear-gradient(90deg, #7a8fbf, #b7c9ff); }
.frost-bar i.danger {
  background: linear-gradient(90deg, #ff7a5c, #ffd08a);
  box-shadow: 0 0 12px rgba(255, 122, 92, .7);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .62; } }

.bifrost {
  position: relative;
  width: 100%; padding: 8px 6px 7px;
  border-radius: 11px; cursor: pointer;
  border: 1px solid rgba(140, 200, 240, .22);
  background: linear-gradient(180deg, rgba(30, 45, 74, .8), rgba(14, 21, 36, .85));
  color: #bfd9f2;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform .12s, box-shadow .25s, border-color .2s, color .2s;
}
.bifrost-name { font: 13px/1 Georgia, serif; letter-spacing: .12em; }
.bifrost-charge { font-size: 9px; letter-spacing: .14em; color: var(--dim); }
.bifrost:disabled { opacity: .55; cursor: default; }
.bifrost.ready {
  color: #101a2c;
  border-color: rgba(255, 240, 190, .8);
  background: linear-gradient(100deg, #ff8f70, #ffd479, #9be8c0, #7fd8ff, #b89bff);
  background-size: 220% 100%;
  box-shadow: 0 0 20px rgba(160, 220, 255, .45), 0 1px 0 rgba(255,255,255,.6) inset;
  animation: rainbow 3.2s linear infinite;
}
.bifrost.ready .bifrost-charge { color: rgba(16, 26, 44, .72); }
@keyframes rainbow { to { background-position: 220% 0; } }

.board-wrap {
  position: relative; min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
#cv { display: block; touch-action: none; cursor: pointer; }

/* ----------------------------------------------------------------- dock */
.dock {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 14px 8px;
  background: linear-gradient(0deg, rgba(6, 10, 19, .95), rgba(6, 10, 19, .3));
  border-top: 1px solid rgba(140, 200, 240, .09);
}
.dock-quip {
  font: italic 12.5px/1.35 Georgia, serif; color: #b9cbe2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; opacity: .9;
  transition: transform .2s;
}
.dock-quip.pop { animation: quipPop .7s ease both; }
@keyframes quipPop {
  0% { transform: translateY(0); }
  25% { transform: translateY(-3px); color: #fff3cf; }
  100% { transform: translateY(0); }
}
.keys { display: flex; gap: 10px; flex: 0 0 auto; flex-wrap: nowrap; }
.keys span { display: flex; align-items: center; gap: 3px; font-size: 9.5px; letter-spacing: .04em; color: #7186a3; }
kbd {
  font: 10px/1 ui-monospace, Menlo, monospace;
  border: 1px solid rgba(140, 200, 240, .24); border-radius: 4px;
  padding: 2px 4px; color: #c7d8ee; background: rgba(140, 200, 240, .06);
}
.touch { display: none; gap: 6px; flex: 0 0 auto; }
.tbtn {
  height: 38px; min-width: 40px; padding: 0 10px;
  border-radius: 9px; border: 1px solid var(--edge);
  background: rgba(20, 31, 50, .8);
  color: #d8e8fa; font-size: 14px; cursor: pointer;
  transition: transform .1s, background .12s;
}
.tbtn:active { transform: scale(.94); background: rgba(127, 216, 255, .2); }
.tbtn.wide { font-size: 10px; letter-spacing: .14em; }

/* -------------------------------------------------------------- overlays */
.ov {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: radial-gradient(120% 90% at 50% 42%, rgba(6, 10, 19, .62), rgba(3, 6, 12, .95));
  backdrop-filter: blur(4px);
  animation: fade .26s ease both;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.card {
  position: relative;
  width: 100%; max-width: 540px; max-height: 93vh; overflow-y: auto;
  padding: 28px 30px 24px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(127, 216, 255, .10), transparent 62%),
    radial-gradient(90% 60% at 50% 110%, rgba(232, 199, 101, .05), transparent 60%),
    rgba(9, 14, 25, .95);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .75), 0 0 0 1px rgba(0, 0, 0, .55) inset;
  text-align: center;
  animation: rise .38s cubic-bezier(.2, .9, .3, 1.15) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.975) } to { opacity: 1; transform: none } }
.card.wide { max-width: 700px; }
.card::before {
  content: ""; position: absolute; left: 20px; right: 20px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 216, 255, .7), rgba(232, 199, 101, .4), transparent);
}
.kicker {
  font-size: 10px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--ice); margin-bottom: 9px; opacity: .9;
}
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h2 { font-size: clamp(23px, 4.6vw, 31px); line-height: 1.14; }
.wordmark {
  font-size: clamp(46px, 11vw, 72px);
  letter-spacing: .18em; text-indent: .18em;
  background: linear-gradient(180deg, #ffffff, #cfeaff 42%, #7fb6d8 68%, #e8c765);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 26px rgba(127, 216, 255, .35));
  margin: 0;
}
.wordmark-sub {
  font: italic 14px/1.3 Georgia, serif; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold); opacity: .9;
  margin: 6px 0 16px;
}
.lore {
  font: 14.5px/1.62 Georgia, "Times New Roman", serif;
  color: #c9d8ea; margin: 0 auto 16px; max-width: 46ch;
}
.lore.small { font-size: 13px; margin-bottom: 15px; opacity: .92; }
.hint { font-size: 12px; color: var(--dim); line-height: 1.55; margin: 9px 0 13px; }
.tiny { font-size: 10.5px; letter-spacing: .05em; color: #6d809b; margin-top: 13px; }
.big {
  display: block; width: 100%; height: 46px; margin: 0 0 9px;
  border: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(180deg, #bfe9ff, #6fb6d9 60%, #4e8fb3);
  color: #06202e; font-size: 13px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase;
  box-shadow: 0 10px 26px rgba(80, 160, 200, .26), 0 1px 0 rgba(255, 255, 255, .6) inset;
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.big:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 14px 32px rgba(80, 160, 200, .34), 0 1px 0 rgba(255,255,255,.65) inset; }
.big:active { transform: translateY(1px) scale(.996); }
.ghost {
  height: 39px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--edge); background: rgba(140, 200, 240, .04);
  color: #d3e3f4; font-size: 12px; letter-spacing: .05em;
  transition: border-color .15s, background .15s;
}
.ghost:hover { border-color: var(--edge-2); background: rgba(140, 200, 240, .1); }
.ghost.gold { color: var(--gold); }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1 1 0; }
.sound { margin-top: 9px; width: 100%; }

.stars { font-size: 28px; letter-spacing: .18em; color: var(--gold); margin: 8px 0 2px; text-shadow: 0 0 22px rgba(232, 199, 101, .6); }
.stars .off { color: #2b3446; text-shadow: none; }
.brief-meta {
  display: flex; justify-content: center; gap: 20px; margin: 2px 0 16px;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim);
}
.brief-meta b { display: block; font: 18px/1.2 Georgia, serif; color: var(--gold); letter-spacing: .02em; margin-bottom: 4px; }

.steps { text-align: left; margin: 4px 0 12px; padding-left: 0; list-style: none; counter-reset: s; }
.steps li {
  position: relative; padding-left: 29px; margin: 0 0 10px;
  font-size: 12.5px; line-height: 1.55; color: #bccfe4;
  counter-increment: s;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid rgba(127, 216, 255, .4); color: var(--ice);
  font: 11px/19px Georgia, serif; text-align: center;
}
.steps b { color: #eaf6ff; font-weight: 600; }

/* chapter grid */
.grid-acts { text-align: left; margin: 2px 0 8px; }
.act-block { margin-bottom: 13px; }
.act-head {
  display: flex; align-items: baseline; gap: 9px; margin-bottom: 7px;
  border-bottom: 1px solid rgba(140, 200, 240, .12); padding-bottom: 5px;
}
.act-head .n { font: 10px/1 Georgia, serif; letter-spacing: .2em; color: var(--ice); text-transform: uppercase; }
.act-head .t { font: 12.5px/1 Georgia, serif; color: #9fb3cb; font-style: italic; }
.cells { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.cbtn {
  position: relative; aspect-ratio: 1/1; border-radius: 7px; cursor: pointer;
  border: 1px solid rgba(140, 200, 240, .16);
  background: linear-gradient(180deg, rgba(140, 200, 240, .08), rgba(140, 200, 240, .02));
  color: #d9e8f8; font: 11.5px/1 Georgia, serif;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, border-color .15s, background .15s;
}
.cbtn:hover { border-color: var(--edge-2); background: rgba(127, 216, 255, .16); transform: translateY(-1px); }
.cbtn.locked { opacity: .26; cursor: not-allowed; filter: grayscale(.7); }
.cbtn.cur { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(232, 199, 101, .45), 0 0 16px rgba(232, 199, 101, .22); }
.cbtn .st { position: absolute; bottom: 1px; left: 0; right: 0; font-size: 6.5px; letter-spacing: -.5px; color: var(--gold); }

.card::-webkit-scrollbar { width: 6px; }
.card::-webkit-scrollbar-thumb { background: rgba(127, 216, 255, .22); border-radius: 3px; }

/* ------------------------------------------------------------- responsive */
@media (min-width: 1100px) {
  .stage { grid-template-columns: 150px minmax(0, 1fr) 150px; max-width: 840px; gap: 16px; }
  .mini.tall { height: 210px; }
  .panel { padding: 9px 9px 8px; }
}
@media (max-width: 720px) {
  .stage {
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    gap: 7px; padding: 5px 6px 2px;
  }
  .panel { padding: 5px 5px 4px; border-radius: 9px; }
  .panel h3 { font-size: 7px; letter-spacing: .16em; margin-bottom: 3px; }
  .mini { height: 40px; }
  .mini.tall { height: 118px; }
  .stat-panel { padding: 6px; gap: 4px; }
  .stat b { font-size: 12px; }
  .stat span { font-size: 6.5px; }
  .frost-head { font-size: 7px; margin-bottom: 4px; }
  .frost-head b { font-size: 10px; }
  .bifrost-name { font-size: 10.5px; letter-spacing: .06em; }
  .bifrost-charge { font-size: 8px; }
  .hud-name { max-width: 30vw; font-size: 12.5px; }
  .hud-stat b { font-size: 12.5px; }
  .hud-r { gap: 8px; }
  .courses-track { width: 88px; }
  .keys { display: none; }
  .touch { display: flex; justify-content: space-between; }
  .dock { flex-direction: column; align-items: stretch; padding: 4px 8px 6px; gap: 4px; }
  .dock-quip {
    font-size: 10.5px; line-height: 1.32; white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; max-height: 28px;
  }
  .cbtn { font-size: 10px; }
  .cells { gap: 4px; grid-template-columns: repeat(4, 1fr); }
}
@media (max-height: 560px) {
  .hud { padding: 5px 10px 4px; }
  .dock { padding: 4px 10px 5px; }
  .mini.tall { height: 130px; }
  .card { padding: 18px 20px 16px; max-height: 95vh; }
  .wordmark { font-size: 42px; }
  .wordmark-sub { margin-bottom: 8px; }
  .lore { font-size: 12.5px; line-height: 1.5; margin-bottom: 10px; }
  .big { height: 40px; }
  .steps li { margin-bottom: 7px; font-size: 11.5px; }
}
@media (max-width: 380px) {
  .cells { grid-template-columns: repeat(4, 1fr); }
  .stage { grid-template-columns: 66px minmax(0, 1fr) 66px; }
  .row2 { flex-direction: column; }
}
