/* The Iron Maze: tokens, type, title, room map and journal. The play screen and
   the cards live in iron-maze-play.css. No inline styles anywhere: this site's
   pages run under a strict style policy. */

@font-face { font-family: Cinzel; font-weight: 400; font-display: swap; src: url('./assets/fonts/cinzel-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Cinzel; font-weight: 600; font-display: swap; src: url('./assets/fonts/cinzel-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: Cinzel; font-weight: 700; font-display: swap; src: url('./assets/fonts/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: Nunito; font-weight: 400; font-display: swap; src: url('./assets/fonts/nunito-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url('./assets/fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url('./assets/fonts/nunito-latin-700-normal.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --ink: #05090c;
  --bg: #071014;
  --bg-2: #0b1a20;
  --panel: rgba(9, 18, 23, 0.9);
  --panel-solid: #0b161b;
  --line: rgba(214, 169, 74, 0.36);
  --line-soft: rgba(214, 169, 74, 0.16);
  --brass: #d6a94a;
  --brass-hi: #f3d98b;
  --brass-lo: #8a6325;
  --teal: #7fdad4;
  --text: #ece6d3;
  --muted: #a9b4b0;
  --danger: #e2554f;
  --ok: #5edcaa;
  --display: Cinzel, 'Palatino Linotype', Georgia, serif;
  --body: Nunito, 'Segoe UI', system-ui, sans-serif;
  --radius: 12px;
  --gutter: clamp(12px, 2.2vw, 28px);
  --tap: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* The studio credits roll takes its colours and type from the game. */
  --fd-bg: #05090c;
  --fd-accent: #f3d98b;
  --fd-accent-2: #7fdad4;
  --fd-text: #ece6d3;
  --fd-font: Nunito, 'Segoe UI', system-ui, sans-serif;
  --fd-title-font: Cinzel, 'Palatino Linotype', Georgia, serif;
  --fd-focus: #ffd166;
  --fd-glow-hue: 20deg;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
body[data-screen='rooms'], body[data-screen='journal'] { overflow-y: auto; }

h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #ffd166; outline-offset: 2px; }
[hidden] { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 8px; top: -60px; z-index: 50; padding: 8px 12px; background: var(--brass); color: var(--ink); border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 8px; }

.eyebrow { font: 700 0.75rem/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass-hi); }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.icon-slot { display: inline-flex; align-items: center; justify-content: center; }

.screen { position: fixed; inset: 0; }
.screen[hidden] { display: none; }

/* ---------- buttons ---------- */
.icon-button, .menu-item, .card button, .toggle, .pad, .room-tile, .wing-head, .freeze-list button {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(27, 42, 48, 0.92), rgba(12, 22, 27, 0.92));
  border-radius: 10px;
  transition: border-color 0.14s, background 0.14s, transform 0.08s, box-shadow 0.14s;
}
.icon-button:hover, .menu-item:hover, .card button:hover, .toggle:hover, .pad:hover, .freeze-list button:not(:disabled):hover, .room-tile:not(:disabled):hover {
  border-color: var(--brass-hi);
  box-shadow: 0 0 0 1px rgba(243, 217, 139, 0.25), 0 6px 18px rgba(0, 0, 0, 0.35);
}
.icon-button:active, .menu-item:active, .card button:active, .toggle:active, .pad:active { transform: translateY(1px) scale(0.985); }
.icon-button:disabled, .card button:disabled { opacity: 0.4; cursor: default; box-shadow: none; transform: none; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; color: var(--brass-hi); }
.icon-button.small { width: 34px; height: 34px; }
.icon-button .icon { width: 22px; height: 22px; }
.icon-button[aria-pressed='true'] { background: linear-gradient(180deg, rgba(60, 50, 24, 0.95), rgba(31, 26, 12, 0.95)); border-color: var(--brass); }

button.primary, .card button.primary, .menu-item.primary {
  background: linear-gradient(180deg, #f1dc9c 0%, #cfa244 52%, #8e6420 100%);
  border-color: #f6e5ad;
  color: #1d1305;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
button.primary:hover, .card button.primary:hover, .menu-item.primary:hover { filter: brightness(1.08); }
.card button.danger { border-color: rgba(226, 85, 79, 0.6); color: #ffb7b2; }

/* ---------- title ---------- */
.title-screen { overflow: hidden; background: #03070a; }
.title-art {
  position: absolute; inset: 0;
  background: #03070a url('../../../assets/games/the-iron-maze.webp') 28% center / cover no-repeat;
  animation: title-drift 40s ease-in-out infinite alternate;
}
.title-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 7, 10, 0) 38%, rgba(3, 7, 10, 0.78) 74%, rgba(3, 7, 10, 0.94) 100%),
    linear-gradient(0deg, rgba(3, 7, 10, 0.8) 0%, rgba(3, 7, 10, 0) 26%);
}
@keyframes title-drift { from { transform: scale(1.02) translate3d(0, 0, 0); } to { transform: scale(1.08) translate3d(-1.2%, -0.8%, 0); } }
.title-menu {
  position: absolute; right: max(var(--gutter), var(--safe-right)); top: 50%; transform: translateY(-50%);
  width: min(340px, 42vw); display: grid; gap: 10px;
}
.menu-item {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; text-align: left; text-decoration: none; color: var(--text);
  font: 700 1rem/1.2 var(--display); letter-spacing: 0.05em;
}
.menu-item .icon { color: var(--brass-hi); }
.menu-item.primary .icon { color: #1d1305; }
.menu-item.primary { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 66px; font-size: 1.15rem; }
.menu-sub { font: 600 0.8rem/1.2 var(--body); letter-spacing: 0; opacity: 0.8; }
.menu-item.link { min-height: 40px; font: 600 0.85rem/1.3 var(--body); letter-spacing: 0; color: var(--muted); background: none; border-color: transparent; }
.menu-item.link:hover { color: var(--brass-hi); }
.title-notice { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); max-width: min(640px, 90vw); padding: 10px 16px; border-radius: 10px; background: rgba(40, 18, 14, 0.92); border: 1px solid rgba(226, 85, 79, 0.6); color: #ffd9d4; text-align: center; }
.title-copy { position: absolute; left: max(var(--gutter), var(--safe-left)); bottom: max(14px, var(--safe-bottom)); font-size: 0.75rem; color: rgba(236, 230, 211, 0.6); text-shadow: 0 1px 2px #000; }

/* ---------- shared screen chrome ---------- */
.rooms-screen, .journal-screen {
  overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(1200px 700px at 78% -10%, rgba(214, 169, 74, 0.09), transparent 60%), linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
  padding-bottom: calc(40px + var(--safe-bottom));
}
.screen-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: max(12px, var(--safe-top)) max(var(--gutter), var(--safe-right)) 12px max(var(--gutter), var(--safe-left));
  background: linear-gradient(180deg, rgba(5, 9, 12, 0.96), rgba(5, 9, 12, 0.84)); border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
}
.screen-heading { flex: 1; min-width: 0; }
.screen-heading h2 { font: 700 clamp(1.3rem, 3vw, 1.9rem)/1.1 var(--display); letter-spacing: 0.04em; }
.totals { display: flex; gap: 8px 18px; flex-wrap: wrap; justify-content: flex-end; }
.totals div { text-align: right; }
.totals dt { font: 700 0.75rem/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.totals dd { font: 700 1.15rem/1.2 var(--display); color: var(--brass-hi); }

/* ---------- room map ---------- */
.room-map { display: grid; gap: clamp(18px, 3vw, 30px); padding: clamp(14px, 2.4vw, 26px) max(var(--gutter), var(--safe-right)) 0 max(var(--gutter), var(--safe-left)); max-width: 1180px; margin: 0 auto; }
.wing { border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; background: rgba(8, 16, 20, 0.7); }
.wing[data-state='locked'] { opacity: 0.55; }
.wing-head {
  position: relative; display: block; width: 100%; padding: 0; text-align: left; border: 0; border-radius: 0; border-bottom: 1px solid var(--line-soft);
  background: var(--wing-bg, linear-gradient(135deg, #17262c, #0a1317)) center / cover; min-height: 112px; isolation: isolate;
}
.wing-head::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(4, 9, 12, 0.92) 8%, rgba(4, 9, 12, 0.45) 62%, rgba(4, 9, 12, 0.7)); }
.wing-head-inner { display: flex; align-items: center; gap: 16px; padding: 16px clamp(14px, 2.4vw, 24px); }
.wing-emblem { width: 56px; height: 56px; flex: none; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
.wing-title { flex: 1; min-width: 0; }
.wing-title h3 { font: 700 clamp(1.1rem, 2.4vw, 1.5rem)/1.15 var(--display); letter-spacing: 0.04em; }
.wing-title p { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.wing-meter { text-align: right; font: 700 0.8rem/1.3 var(--display); letter-spacing: 0.08em; color: var(--brass-hi); white-space: nowrap; }
.wing-meter small { display: block; font: 600 0.72rem/1.3 var(--body); letter-spacing: 0; color: var(--muted); }
.wing-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px clamp(12px, 2vw, 20px) 18px; }
.room-tile { position: relative; display: grid; gap: 4px; padding: 10px 12px 10px 12px; text-align: left; min-height: 74px; }
.room-tile .tile-no { font: 700 0.75rem/1 var(--display); letter-spacing: 0.12em; color: var(--brass); }
.room-tile .tile-title { font: 700 0.95rem/1.2 var(--display); color: var(--text); }
.room-tile .medals { display: flex; gap: 6px; margin-top: 2px; color: rgba(169, 180, 176, 0.35); }
.room-tile .medals .icon { width: 16px; height: 16px; }
.room-tile .medals .on { color: var(--brass-hi); }
.room-tile .medals .seal.on { color: #ffe9a8; filter: drop-shadow(0 0 4px rgba(255, 217, 120, 0.55)); }
.room-tile.current { border-color: var(--teal); box-shadow: 0 0 0 1px rgba(127, 218, 212, 0.35); }
.room-tile:disabled { opacity: 0.45; cursor: default; }
.room-tile.teaser { background: rgba(10, 16, 20, 0.7); border-style: dashed; }
.room-tile .lock { position: absolute; right: 10px; top: 10px; width: 18px; height: 18px; color: var(--muted); }

/* ---------- journal ---------- */
.journal-list { display: grid; gap: 14px; padding: clamp(14px, 2.4vw, 26px) max(var(--gutter), var(--safe-right)) 0 max(var(--gutter), var(--safe-left)); max-width: 860px; margin: 0 auto; }
.journal-wing h3 { font: 700 1.1rem/1.2 var(--display); letter-spacing: 0.06em; color: var(--brass-hi); margin: 18px 0 8px; }
.journal-entry { margin: 0 0 10px; padding: 14px 18px; border-left: 3px solid var(--brass); background: linear-gradient(90deg, rgba(60, 46, 20, 0.35), rgba(12, 18, 22, 0.6)); border-radius: 0 10px 10px 0; font-style: italic; color: #f2ead2; }
.journal-entry cite { display: block; margin-top: 6px; font: 700 0.72rem/1.2 var(--display); font-style: normal; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.journal-entry.empty { font-style: normal; border-left-color: var(--line-soft); background: rgba(10, 16, 20, 0.5); color: var(--muted); }

@media (max-width: 760px) {
  .title-art { background-position: 22% center; }
  /* Upright phone: the whole key art with its logo across the top, melting into the dark under the menu. */
  @media (orientation: portrait) {
    .title-art { inset: 0 0 auto 0; height: 50dvh; background-size: auto 100%; background-position: 5% top; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
  }
  .title-scrim { background: linear-gradient(0deg, rgba(3, 7, 10, 0.96) 0%, rgba(3, 7, 10, 0.78) 42%, rgba(3, 7, 10, 0) 70%); }
  .title-menu { right: 50%; top: auto; bottom: max(40px, var(--safe-bottom)); transform: translateX(50%); width: min(420px, calc(100vw - 28px)); gap: 8px; }
  .menu-item { min-height: 46px; padding: 8px 14px; }
  .menu-item.primary { min-height: 58px; }
  .totals { display: none; }
  .wing-meter { display: none; }
  .wing-rooms { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .title-menu { width: min(300px, 40vw); gap: 6px; }
  .menu-item { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; }
  .menu-item.primary { min-height: 50px; }
  .menu-item.link { display: none; }
}
@media (prefers-reduced-motion: reduce) { .title-art { animation: none; } * { transition-duration: 0.01ms !important; } }
