/* Digital Netizenship, chat-style story game.
   Same indigo band, type and point network as the front page. */
:root {
  --indigo-1: #232058;
  --indigo-2: #312e81;
  --indigo-3: #1e1b4b;

  --panel:    rgba(23,22,58,.72);   /* the chat column, lets the network through */
  --panel-2:  rgba(255,255,255,.06);
  --line:     rgba(148,171,214,.18);

  --ink:      #eef3fc;
  --muted:    #9aa6c8;
  --npc:      rgba(255,255,255,.09);
  --you:      #4f46e5;
  --you-ink:  #ffffff;
  --cyan:     #22d3ee;
  --good:     #35d6c2;
  --bad:      #ff7a85;

  --radius: 14px;
  --max: 640px;

  --display: "Sora", system-ui, sans-serif;
  --body:    "Plus Jakarta Sans", system-ui, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  font-family: var(--body);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: var(--indigo-3);
  background-image: linear-gradient(165deg, var(--indigo-1) 0%, var(--indigo-2) 55%, var(--indigo-3) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* the drifting point network, same script as the front page */
#netbg {
  position: fixed; left: 0; top: -40px; width: 100%; height: calc(100% + 320px);
  z-index: 0; pointer-events: none; will-change: transform;
}

.app {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  backdrop-filter: blur(3px);
}

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px; min-height: 58px; border-bottom: 1px solid var(--line);
  background: rgba(15,14,40,.86); backdrop-filter: saturate(160%) blur(12px);
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.02rem;
  letter-spacing: -.02em; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--cyan); }
.bar-right { display: flex; align-items: center; gap: 12px; }
.game-title { color: var(--muted); font-size: 13px; }
.score {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  background: rgba(34,211,238,.14); color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(34,211,238,.3);
  padding: 5px 10px; border-radius: 6px;
}

/* game picker */
.menu { flex: 1; padding: 30px 20px 34px; }
.menu-title { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; margin: 8px 0 6px; font-size: clamp(22px, 5vw, 30px); color: #fff; }
.menu-sub { margin: 0 0 24px; color: var(--muted); font-size: 15px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.menu-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: rgba(24,23,62,.72); box-shadow: 0 14px 32px rgba(0,0,0,.34);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
@media (hover: hover) {
  .menu-card:hover { border-color: rgba(34,211,238,.55); box-shadow: 0 24px 50px rgba(0,0,0,.5); transform: translateY(-4px); }
  .menu-card:hover .menu-thumb img { transform: scale(1.05); }
}
.menu-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #000; border-bottom: 1px solid var(--line); }
.menu-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.menu-text { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px 17px; }
.menu-card b { font-family: var(--display); font-weight: 600; font-size: 15px; color: #fff; letter-spacing: -.01em; }
.menu-card .menu-text span {
  font-family: var(--mono); color: var(--cyan); font-size: 11px;
  letter-spacing: .09em; text-transform: uppercase;
}
@media (max-width: 480px){ .menu-grid { grid-template-columns: 1fr; } }

.thread { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }

.scene-image img { width: 100%; border-radius: var(--radius); display: block; border: 1px solid var(--line); }
.scene-banner {
  text-align: center; font-family: var(--mono); font-size: 11.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 13px; align-self: center;
}
.narration { text-align: center; font-style: italic; color: var(--muted); font-size: 14px; padding: 4px 8px; }

.msg-row { display: flex; align-items: flex-end; gap: 8px; max-width: 90%; }
.msg-row.npc { align-self: flex-start; }
.msg-row.you { align-self: flex-end; flex-direction: row; }
.bubble-wrap { display: flex; flex-direction: column; gap: 3px; }
.name { font-size: 11px; color: var(--muted); margin-left: 6px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.avatar-fallback { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }

.bubble { padding: 11px 15px; border-radius: 18px; line-height: 1.45; font-size: 15px; }
.bubble-npc { background: var(--npc); color: var(--ink); border-bottom-left-radius: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.bubble-you { background: var(--you); color: var(--you-ink); border-bottom-right-radius: 6px; }

.choices { display: flex; flex-direction: column; gap: 9px; align-self: flex-end; max-width: 90%; margin-top: 5px; }
.choice {
  border: 1.5px solid rgba(34,211,238,.5); color: var(--cyan); background: rgba(34,211,238,.06);
  font-family: var(--body); padding: 11px 15px; border-radius: 18px; font-size: 15px; text-align: right;
  cursor: pointer; transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.choice:hover:not(:disabled) { background: rgba(34,211,238,.16); border-color: var(--cyan); }
.choice.locked { cursor: default; }
.choice.locked:not(.selected) { opacity: .32; }
.choice.selected { background: var(--you); color: #fff; border-color: var(--you); }

.feedback {
  align-self: center; font-size: 13.5px; color: var(--muted);
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 10px; padding: 9px 13px; max-width: 92%;
}
.feedback.good { color: var(--good); background: rgba(53,214,194,.10); box-shadow: inset 0 0 0 1px rgba(53,214,194,.28); }
.feedback.bad  { color: var(--bad);  background: rgba(255,122,133,.10); box-shadow: inset 0 0 0 1px rgba(255,122,133,.3); }

.ending { align-self: center; text-align: center; padding: 24px 20px; margin-top: 10px; border-radius: var(--radius); width: 100%; }
.ending.win  { background: rgba(53,214,194,.10); border: 1px solid rgba(53,214,194,.34); }
.ending.lose { background: rgba(255,122,133,.10); border: 1px solid rgba(255,122,133,.34); }
.ending-title { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; font-size: 23px; color: #fff; }
.ending-msg { color: var(--ink); margin: 9px 0 4px; font-size: 14.5px; }
.ending-score { font-family: var(--mono); color: var(--muted); margin: 6px 0 18px; font-size: 13px; letter-spacing: .04em; }
.ending-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn {
  border: none; font-family: var(--display); padding: 12px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px;
  transition: transform .16s ease, filter .16s ease, border-color .16s ease, color .16s ease;
}
.btn-primary { background: var(--you); color: #fff; box-shadow: 0 14px 28px rgba(79,70,229,.34); }
.btn-secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary:hover { border-color: rgba(34,211,238,.7); color: var(--cyan); }
@media (hover: hover) { .btn:hover { transform: translateY(-2px); } }

.foot {
  text-align: center; color: var(--muted); font-family: var(--mono);
  font-size: 11.5px; letter-spacing: .04em; padding: 15px 12px; border-top: 1px solid var(--line);
}

/* progress bar */
.progress { height: 4px; background: rgba(255,255,255,.10); position: sticky; top: 58px; z-index: 4; }
.progress-fill { height: 100%; width: 0; background: var(--cyan); transition: width .4s ease; border-radius: 0 2px 2px 0; }

/* start-over button in the bar */
.startover {
  background: none; border: 1px solid var(--line); color: var(--muted);
  font-family: var(--body); font-size: 12px;
  padding: 6px 13px; border-radius: 999px; cursor: pointer; min-height: 32px;
}
.startover:hover { border-color: rgba(34,211,238,.6); color: var(--cyan); }

/* resume + error notices */
.resume-banner {
  align-self: center; font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em;
  color: var(--cyan); background: rgba(34,211,238,.10);
  box-shadow: inset 0 0 0 1px rgba(34,211,238,.26); border-radius: 999px; padding: 6px 13px;
}
.load-error {
  align-self: center; text-align: center;
  background: rgba(255,122,133,.10); border: 1px solid rgba(255,122,133,.34);
  border-radius: var(--radius); padding: 20px; max-width: 92%;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.load-error-title { font-family: var(--display); font-weight: 700; color: var(--bad); }

/* accessible focus */
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.choice:focus-visible { outline-offset: 2px; }

/* comfortable tap targets */
.choice { min-height: 44px; }

/* reduced motion: kill transitions/animations/typewriter cursor motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .progress-fill { transition: none !important; }
}
