/* ==========================================================================
   Milk & Cookies — main stylesheet
   ========================================================================== */
:root {
  --ink: #1d1712;
  --paper: #efe6d1;
  --paper-2: #e3d7bc;
  --beige: #d8ccb0;
  --beige-hi: #f6efdd;
  --beige-lo: #9d8f72;
  --frame: #2a2119;
  --night: #0c0e17;
  --night-2: #151827;
  --red: #b3261e;
  --red-hi: #e0443a;
  --gold: #e3b450;
  --teal: #2f8f8a;
  --muted: #6d604c;
  --ui: 'Silkscreen', 'Courier New', monospace;
  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --mono: 'VT323', 'Courier New', monospace;
  --vw: 780px;  /* set by JS */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--paper); overflow: hidden; }
body {
  font-family: var(--serif);
  background:
    radial-gradient(ellipse at 50% 0%, #1d2238 0%, transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 6px),
    var(--night);
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- title ---------- */
#title { background: #05060b; cursor: default; }
.title-bg {
  position: absolute; inset: 0;
  background: url(../assets/endings/title.webp) center/cover no-repeat;
  filter: saturate(.9) brightness(.82);
  animation: slowzoom 40s ease-in-out infinite alternate;
}
@keyframes slowzoom { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1%, 1%); } }
#title::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,6,11,.55) 0%, rgba(5,6,11,0) 35%, rgba(5,6,11,.15) 60%, rgba(5,6,11,.92) 100%); pointer-events: none; }
.title-inner { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; padding-top: 6vh; text-align: center; }
.title-kicker { font-family: var(--ui); font-size: 13px; letter-spacing: .25em; color: #d7c9a6; opacity: .85; text-transform: uppercase; }
.title-logo {
  margin: .15em 0 0; font-family: var(--serif); font-weight: 600; font-style: italic;
  font-size: clamp(54px, 9vw, 128px); line-height: 1; color: #f6ecd2;
  text-shadow: 0 0 30px rgba(120,160,255,.35), 0 4px 0 #000, 0 0 2px #000;
}
.title-logo span { color: var(--red-hi); font-style: normal; }
.title-sub { font-family: var(--ui); font-size: 15px; letter-spacing: .3em; color: #9fb7e8; margin-top: .6em; text-transform: uppercase; }
.title-menu { margin-top: auto; margin-bottom: 7vh; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.tbtn {
  min-width: 240px; padding: 10px 24px; cursor: pointer;
  font-family: var(--ui); font-size: 15px; letter-spacing: .12em; text-transform: uppercase;
  color: #f2e7cc; background: rgba(12,14,23,.72); border: 1px solid rgba(242,231,204,.35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6); transition: background .15s, color .15s, border-color .15s;
}
.tbtn:hover, .tbtn:focus-visible { background: var(--red); border-color: #ffb3a8; color: #fff; outline: none; }
.tbtn:disabled { opacity: .35; cursor: default; background: rgba(12,14,23,.72); }
.title-foot { position: absolute; bottom: 14px; left: 0; right: 0; font-family: var(--ui); font-size: 11px; color: #8d8470; letter-spacing: .1em; }

/* ---------- intro ---------- */
#intro { background: #000; }
.intro-bg { position: absolute; inset: 0; background: url(../assets/scenes/desk.webp) center/cover; opacity: .0; transition: opacity 3s; filter: blur(2px) brightness(.5); }
#intro.lit .intro-bg { opacity: 1; }
.intro-text {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(760px, 88vw); font-family: var(--serif); font-size: clamp(18px, 2.2vw, 25px); line-height: 1.6; color: #efe6d1;
  text-shadow: 0 2px 8px #000;
}
.intro-text p { margin: 0 0 1em; opacity: 0; transform: translateY(6px); transition: opacity 1.4s, transform 1.4s; }
.intro-text p.on { opacity: 1; transform: none; }
.intro-text .k { font-family: var(--ui); font-size: .62em; letter-spacing: .2em; color: #e3b450; text-transform: uppercase; }
.intro-skip { position: absolute; right: 18px; bottom: 16px; background: none; border: 1px solid #444; color: #aaa; font-family: var(--ui); font-size: 12px; padding: 6px 12px; cursor: pointer; }
.intro-skip:hover { color: #fff; border-color: #aaa; }

/* ---------- game layout ---------- */
#game { display: none; flex-direction: column; }
#game.active { display: flex; }
#topbar {
  height: 38px; flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: linear-gradient(#262033, #191526); border-bottom: 1px solid #000; box-shadow: 0 1px 0 rgba(255,255,255,.06);
  font-family: var(--ui); font-size: 12px; letter-spacing: .06em;
}
.tb-logo { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 19px; color: #f3e8cc; letter-spacing: 0; }
.tb-logo span { color: var(--red-hi); font-style: normal; }
.tb-date { color: #e9dcb9; }
.tb-phase { color: #0c0e17; background: var(--gold); padding: 2px 8px; border-radius: 2px; }
.tb-phase.night { background: #6f86c9; color: #0c0e17; }
.tb-phase.school { background: #7fbf87; }
.tb-spacer { flex: 1; }
.tb-btn { background: none; border: 1px solid transparent; color: #cfc3a6; cursor: pointer; padding: 4px 8px; font-family: var(--ui); font-size: 11px; }
.tb-btn:hover { border-color: #6b5f4a; color: #fff; }
.tb-btn.on { color: var(--gold); }

#main { flex: 1; display: flex; gap: 10px; padding: 10px; min-height: 0; justify-content: center; }
#left { display: flex; flex-direction: column; gap: 8px; min-width: 0; width: var(--vw); }
#right { width: 300px; display: flex; flex-direction: column; gap: 10px; flex: 0 0 300px; min-height: 0; }

/* Mac-ish window chrome */
.win { background: var(--paper); border: 2px solid var(--frame); box-shadow: 3px 3px 0 rgba(0,0,0,.55); color: var(--ink); position: relative; }
.win-title {
  height: 22px; display: flex; align-items: center; gap: 8px; padding: 0 6px;
  font-family: var(--ui); font-size: 12px; letter-spacing: .08em; color: var(--ink); background: var(--paper);
  border-bottom: 2px solid var(--frame); white-space: nowrap;
}
.wt-stripes { flex: 1; height: 11px; background: repeating-linear-gradient(180deg, var(--frame) 0 1px, transparent 1px 3px); opacity: .85; }

#viewwin { flex: 0 0 auto; }
#viewport { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; background: #000; cursor: default; }
#scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#scene-layers, #hotspots { position: absolute; inset: 0; }
#scene-layers img { position: absolute; pointer-events: none; }
#scene-layers .drop-item { position: absolute; width: 7.5%; aspect-ratio: 1; pointer-events: none; filter: drop-shadow(0 6px 5px rgba(0,0,0,.6)); }
#scene-layers .drop-item img { width: 100%; height: 100%; position: static; }
.hs { position: absolute; border-radius: 6px; cursor: pointer; transition: box-shadow .15s, background .15s; }
.hs.exit { cursor: pointer; }
.hs[data-id="turnback"]::after { content: '\25BC'; position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); font-size: 13px; color: rgba(255,255,255,.55); text-shadow: 0 1px 3px #000; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, 3px); } }
#viewport.show-hs .hs { box-shadow: inset 0 0 0 2px rgba(227,180,80,.85), 0 0 12px rgba(227,180,80,.35); background: rgba(227,180,80,.08); }
#viewport.show-hs .hs.exit { box-shadow: inset 0 0 0 2px rgba(111,170,255,.9), 0 0 12px rgba(111,170,255,.35); background: rgba(111,170,255,.08); }
#viewport.show-hs .hs.npc { box-shadow: inset 0 0 0 2px rgba(240,110,100,.95), 0 0 12px rgba(240,110,100,.35); background: rgba(240,110,100,.08); }
.hs:hover { background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
#hover-label {
  position: absolute; pointer-events: none; z-index: 30; display: none;
  font-family: var(--ui); font-size: 12px; color: #fff; background: rgba(12,14,23,.86); padding: 3px 7px; border: 1px solid rgba(255,255,255,.25); white-space: nowrap;
}
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 40; }
#fade.on { opacity: 1; }

/* cursor modes */
#viewport.verb-pending, #viewport.verb-pending .hs, #inventory.verb-pending .inv-slot { cursor: crosshair; }

/* ---------- verbs ---------- */
#verbbar { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
#verbs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; flex: 1; }
.verb {
  font-family: var(--ui); font-size: 11px; letter-spacing: .04em; padding: 7px 2px; cursor: pointer; text-transform: uppercase;
  background: linear-gradient(var(--beige-hi), var(--beige)); color: var(--ink);
  border: 1px solid var(--frame); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--beige-lo), 2px 2px 0 rgba(0,0,0,.5);
}
.verb:hover { background: linear-gradient(#fff8e6, #e6dbc0); }
.verb.sel { background: var(--red); color: #fff; box-shadow: inset 1px 1px 0 #ff8a80, inset -1px -1px 0 #6d140f, 2px 2px 0 rgba(0,0,0,.5); }
.verb kbd { font-family: var(--ui); opacity: .45; font-size: 9px; margin-left: 2px; }
#command {
  font-family: var(--ui); font-size: 11px; color: #e8dcbc; padding: 3px 2px 0; height: 16px; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- text log ---------- */
#textwin { flex: 1 1 auto; min-height: 90px; overflow: hidden; display: flex; flex-direction: column; }
#log {
  flex: 1; overflow-y: auto; padding: 10px 14px 14px; font-family: var(--serif); font-size: 16.5px; line-height: 1.5; color: var(--ink);
  background: linear-gradient(var(--paper), var(--paper-2)); user-select: text; -webkit-user-select: text;
  scrollbar-width: thin; scrollbar-color: var(--beige-lo) transparent;
}
#log p { margin: 0 0 .55em; }
#log p.old { color: #6b604f; }
#log p.cmd { font-family: var(--ui); font-size: 11px; color: var(--muted); margin: .7em 0 .25em; letter-spacing: .06em; }
#log p.sys { font-family: var(--ui); font-size: 11px; color: var(--red); letter-spacing: .05em; }
#log p.event { border-left: 3px solid var(--red); padding-left: 10px; font-style: italic; }
#log p.day { text-align: center; font-family: var(--ui); font-size: 12px; color: var(--paper); background: var(--frame); padding: 4px; letter-spacing: .15em; margin: 1em 0 .6em; }
#log em { color: #7a2a1f; }
#log b { color: #2b1d10; }
#log .say { color: #20406a; }
#log .act { font-style: italic; color: #6d604c; }

/* ---------- map ---------- */
#mapwin { flex: 0 0 auto; }
#map { padding: 6px; background: var(--paper); }
#map svg { display: block; width: 100%; height: auto; }
#map .room { fill: #f8f1df; stroke: var(--frame); stroke-width: 1.4; transition: fill .15s; }
#map .room.adj { fill: #e9d8a8; cursor: pointer; }
#map .room.adj:hover { fill: var(--gold); }
#map .room.cur { fill: var(--red); }
#map .room.dim { fill: #e6dece; stroke: #b6a98c; }
#map text { font-family: var(--ui); font-size: 8.5px; fill: var(--ink); pointer-events: none; letter-spacing: .02em; }
#map .room.cur + text, #map text.cur { fill: #fff; }
#map .lbl { font-size: 8px; fill: var(--muted); letter-spacing: .12em; }
#map .void { fill: #cfc4ab; stroke: var(--frame); stroke-dasharray: 2 2; stroke-width: 1; }
#map .exit-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.exit-btn { font-family: var(--ui); font-size: 10px; padding: 4px 6px; cursor: pointer; background: #f8f1df; border: 1px solid var(--frame); }
.exit-btn:hover { background: var(--gold); }

/* ---------- inventory ---------- */
#invwin { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
#inventory { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: max-content; gap: 6px; padding: 8px; align-content: start; background: repeating-linear-gradient(0deg, transparent 0 23px, rgba(0,0,0,.035) 23px 24px), var(--paper); }
.inv-slot {
  position: relative; aspect-ratio: 1; background: #fbf6ea; border: 1px solid #b9ab8c; border-radius: 3px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform .1s, border-color .1s;
}
.inv-slot img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(1px 2px 1px rgba(0,0,0,.35)); pointer-events: none; }
.inv-slot:hover { border-color: var(--frame); transform: translateY(-1px); }
.inv-slot.sel { border: 2px solid var(--red); background: #fff1ea; }
.inv-slot.new { animation: pop .6s ease-out; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.inv-empty { grid-column: 1 / -1; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 14px; padding: 8px 2px; }
#selfbtn-wrap { display: flex; gap: 6px; padding: 6px 8px 8px; border-top: 1px solid #c8b995; }
#selfbtn-wrap button { flex: 1; font-family: var(--ui); font-size: 11px; padding: 6px; cursor: pointer; background: linear-gradient(var(--beige-hi), var(--beige)); border: 1px solid var(--frame); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--beige-lo); }
#selfbtn-wrap button:hover { background: #fff7e2; }

/* ---------- dialog ---------- */
#dialog { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: linear-gradient(90deg, rgba(5,6,11,.82) 0%, rgba(5,6,11,.5) 45%, rgba(5,6,11,.65) 100%); animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.dlg-portrait { position: absolute; left: 0; bottom: 0; height: 100%; aspect-ratio: 3/4; max-width: 38%; }
.dlg-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; mask-image: linear-gradient(90deg, #000 70%, transparent 100%); -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent 100%); animation: slidein .35s ease-out; }
.dlg-portrait.none { display: none; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-box { position: relative; margin-left: 33%; margin-right: 3%; margin-bottom: 3%; width: 64%; max-height: 92%; display: flex; flex-direction: column; background: rgba(239,230,209,.97); color: var(--ink); border: 2px solid var(--frame); box-shadow: 4px 4px 0 rgba(0,0,0,.6); }
#dialog.noportrait .dlg-box { margin-left: 8%; width: 84%; }
.dlg-name { font-family: var(--ui); font-size: 12px; letter-spacing: .12em; background: var(--frame); color: var(--gold); padding: 4px 10px; text-transform: uppercase; }
.dlg-text { padding: 12px 16px 6px; font-size: clamp(14px, 1.45vw, 18px); line-height: 1.5; overflow-y: auto; min-height: 3em; }
.dlg-text .act { font-style: italic; color: var(--muted); }
.dlg-choices { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.dlg-choice { text-align: left; cursor: pointer; padding: 6px 10px; font-family: var(--serif); font-size: clamp(13px, 1.3vw, 16.5px); line-height: 1.35; background: none; border: 1px solid transparent; color: #233f6b; }
.dlg-choice::before { content: '\25B8  '; color: var(--red); }
.dlg-choice:hover, .dlg-choice:focus-visible { background: #fff9ea; border-color: #b9ab8c; outline: none; }
.dlg-choice.seen { color: #6f6a76; }
.dlg-choice .tag { font-family: var(--ui); font-size: 9.5px; letter-spacing: .06em; color: #fff; background: var(--muted); padding: 1px 4px; margin-right: 6px; vertical-align: 1px; }
.dlg-choice .tag.t-kind { background: #3b7a57; }
.dlg-choice .tag.t-mean { background: var(--red); }
.dlg-choice .tag.t-honest { background: #2f5d8f; }
.dlg-cont { align-self: flex-end; margin: 0 10px 10px; font-family: var(--ui); font-size: 11px; cursor: pointer; background: var(--frame); color: var(--gold); border: none; padding: 5px 12px; }
.dlg-cont:hover { background: var(--red); color: #fff; }

/* ---------- closeup ---------- */
#closeup { position: absolute; inset: 0; z-index: 25; background: rgba(5,6,11,.88); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; animation: fadein .25s; }
#closeup img { max-width: 80%; max-height: 78%; box-shadow: 0 10px 40px #000; border: 6px solid #f4ecd9; transform: rotate(-1.5deg); }
#closeup-cap { margin-top: 14px; font-family: var(--serif); font-style: italic; color: #e9dfc6; font-size: 16px; max-width: 80%; text-align: center; }
#closeup .paper { background: #fbfaf5; color: #1a1a1a; width: min(560px, 80%); max-height: 82%; overflow: auto; padding: 26px 30px; font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.55; box-shadow: 0 10px 40px #000; transform: rotate(-.8deg); white-space: pre-wrap; user-select: text; }
#closeup .paper.hand { font-family: var(--serif); font-style: italic; font-size: 18px; color: #1f3a7a; background: #fffbe8 repeating-linear-gradient(180deg, transparent 0 27px, #b9d0ea 27px 28px); }

/* ---------- ending ---------- */
#ending { background: #000; overflow-y: auto; }
#ending.active { display: flex; flex-direction: column; align-items: center; }
.end-img-wrap { width: min(1100px, 100%); position: relative; flex: 0 0 auto; }
#end-img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; animation: endzoom 18s ease-out both; mask-image: linear-gradient(180deg, #000 75%, transparent); -webkit-mask-image: linear-gradient(180deg, #000 75%, transparent); }
@keyframes endzoom { from { transform: scale(1.06); filter: brightness(.3); } 15% { filter: brightness(1); } to { transform: scale(1); } }
.end-panel { width: min(820px, 92%); margin: -40px auto 40px; position: relative; z-index: 2; text-align: center; }
.end-kicker { font-family: var(--ui); font-size: 12px; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; }
.end-title { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: clamp(32px, 5vw, 60px); margin: .1em 0 .4em; color: #f6ecd2; text-shadow: 0 3px 12px #000; }
.end-text { font-family: var(--serif); font-size: clamp(16px, 1.6vw, 19px); line-height: 1.65; color: #e6dcc4; text-align: left; }
.end-text p { margin: 0 0 1em; opacity: 0; animation: fadeup 1.2s forwards; }
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.end-text .sad { text-align: center; font-family: var(--ui); color: var(--red-hi); letter-spacing: .1em; font-size: .85em; }
.end-tally { margin: 1.4em 0 1em; font-family: var(--ui); font-size: 11px; color: #a69a80; letter-spacing: .06em; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.end-tally span { border: 1px solid #4a4235; padding: 3px 6px; }
.end-tally span.got { color: #0c0e17; background: var(--gold); border-color: var(--gold); }
.end-tally span.cur { background: var(--red); color: #fff; border-color: var(--red); }
.end-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.end-buttons .tbtn { min-width: 170px; }

/* newspaper clipping */
#end-news { position: absolute; right: 4%; top: 6%; width: min(360px, 42%); background: #ebe3cf; color: #1a1a1a; padding: 14px 16px 16px; transform: rotate(2.5deg); box-shadow: 0 12px 30px rgba(0,0,0,.8); font-family: Georgia, 'Times New Roman', serif; animation: fadein 2s 1.5s both; }
#end-news .np-mast { font-family: 'Times New Roman', serif; font-weight: bold; font-size: 22px; text-align: center; border-bottom: 3px double #222; padding-bottom: 4px; letter-spacing: .02em; }
#end-news .np-date { font-size: 10px; text-align: center; border-bottom: 1px solid #222; padding: 2px 0; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .1em; }
#end-news .np-head { font-weight: bold; font-size: 20px; line-height: 1.1; margin-bottom: 6px; }
#end-news .np-body { font-size: 11.5px; line-height: 1.4; column-count: 2; column-gap: 12px; text-align: justify; }

/* ---------- BSOD ---------- */
#bsod { background: #0000aa; color: #fff; font-family: 'Lucida Console', 'Courier New', monospace; cursor: pointer; }
#bsod.active { display: flex; align-items: center; justify-content: center; }
.bsod-inner { width: min(720px, 92vw); font-size: clamp(14px, 1.8vw, 20px); line-height: 1.45; }
.bsod-head { display: table; margin: 0 auto 1.4em; background: #aaa; color: #0000aa; padding: 0 .3em; font-weight: bold; }
.bsod-c { text-align: center; margin-top: 2em; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal-box { width: min(560px, 92vw); max-height: 88vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 2px solid var(--frame); box-shadow: 6px 6px 0 rgba(0,0,0,.7); }
.modal-title { font-family: var(--ui); font-size: 13px; letter-spacing: .12em; padding: 6px 10px; background: var(--frame); color: var(--gold); text-transform: uppercase; }
.modal-body { padding: 14px 16px; overflow-y: auto; font-size: 16px; line-height: 1.5; }
.modal-body h4 { font-family: var(--ui); font-size: 12px; letter-spacing: .1em; margin: 1em 0 .3em; color: var(--red); }
.modal-body ul { margin: .3em 0; padding-left: 1.2em; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px 14px; flex-wrap: wrap; }
.mbtn { font-family: var(--ui); font-size: 12px; padding: 7px 14px; cursor: pointer; background: linear-gradient(var(--beige-hi), var(--beige)); border: 1px solid var(--frame); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--beige-lo); }
.mbtn:hover { background: var(--gold); }
.mbtn.primary { background: var(--red); color: #fff; }
.slot-row { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid #c8b995; margin-bottom: 6px; background: #fbf6ea; }
.slot-row .slot-info { flex: 1; font-size: 14px; }
.slot-row .slot-info b { font-family: var(--ui); font-size: 11px; letter-spacing: .06em; }
.slot-row .slot-info small { color: var(--muted); display: block; }
.endings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.end-card { border: 1px solid var(--frame); background: #222; color: #ccc; font-family: var(--ui); font-size: 10px; letter-spacing: .05em; text-align: center; }
.end-card .ec-img { aspect-ratio: 16/9; background: #111 center/cover; filter: grayscale(1) brightness(.25) blur(3px); }
.end-card.got .ec-img { filter: none; }
.end-card div.ec-name { padding: 5px 4px; }
.end-card.got { background: var(--frame); color: var(--gold); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--frame); color: var(--gold); font-family: var(--ui); font-size: 12px; padding: 8px 14px; letter-spacing: .08em; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; z-index: 200; border: 1px solid var(--gold); }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  html, body { overflow: auto; }
  #game.active { display: block; }
  #main { flex-direction: column; padding: 8px 16px; height: auto; }
  #left { width: 100% !important; }
  #right { width: 100%; flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; }
  #mapwin { flex: 1 1 260px; }
  #invwin { flex: 1 1 260px; min-height: 200px; }
  #verbs { grid-template-columns: repeat(5, 1fr); }
  #textwin { min-height: 160px; max-height: 240px; }
  #topbar { flex-wrap: wrap; height: auto; padding: 6px 12px; }
  .tb-logo { display: none; }
  .dlg-box { margin-left: 4%; width: 92%; }
  .dlg-portrait { max-width: 30%; height: 55%; top: 0; bottom: auto; }
}
