/* Diskobolos — style.css
   Marble, bronze and late sun. Light theme, serif display, restrained motion. */

:root {
  --ink: #2b2118;
  --ink-soft: #574433;
  --ink-mute: #8a7358;
  --paper: #f7efdf;
  --paper-2: #efe2c9;
  --marble: #fbf5e8;
  --terra: #b0563a;
  --terra-deep: #8c3f2a;
  --gold: #c9a227;
  --gold-lt: #eccd75;
  --bronze: #8a6134;
  --olive: #3f4a33;
  --shadow: 0 18px 44px rgba(58, 34, 18, .28);
  --ring: 0 0 0 3px rgba(201, 162, 39, .38);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: #8c4f3a;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.game {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(120% 80% at 50% 0%, #f7d9a3 0%, #e8a86e 46%, #a75e40 100%);
  overflow: hidden;
  isolation: isolate;
}

#stage {
  grid-row: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 1;
}

.grain {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  opacity: .16; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
.vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(120% 100% at 50% 45%, rgba(0,0,0,0) 52%, rgba(62, 30, 16, .34) 100%);
}

/* ------------------------------------------------------------------ HUD */
.hud {
  position: relative; z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(12px, 3vw, 30px) 10px;
  background: linear-gradient(180deg, rgba(35, 22, 14, .34), rgba(35, 22, 14, 0));
  color: #fff6e4;
}
.hud-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hud-kicker {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(255, 238, 205, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-chapter {
  font-family: var(--serif); font-size: clamp(13px, 1.5vw, 17px); letter-spacing: .01em;
  color: #fff8ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 10px rgba(40, 18, 6, .45);
}
.hud-goal { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.goal-label {
  font-size: 9px; letter-spacing: .2em; color: rgba(255, 238, 205, .7);
}
.goal-num { font-family: var(--serif); font-size: 15px; color: #fff8ea; letter-spacing: .06em; }
.goal-bar {
  width: clamp(90px, 16vw, 170px); height: 3px; border-radius: 3px;
  background: rgba(255, 240, 214, .22); overflow: hidden;
}
.goal-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  transition: width .45s cubic-bezier(.22, .8, .3, 1);
  box-shadow: 0 0 10px rgba(236, 205, 117, .8);
}
.hud-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.hud-throws { display: flex; gap: 3px; align-items: center; }
.hud-throws i {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffe3a8, #c08c3f 62%, #7a5220);
  box-shadow: 0 1px 3px rgba(20, 10, 4, .4);
  transition: transform .25s, opacity .25s;
}
.hud-throws i.spent { opacity: .22; transform: scale(.7); }
.hud-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.hud-stat span { font-family: var(--serif); font-size: 16px; color: #fff8ea; }
.hud-stat small { font-size: 8px; letter-spacing: .16em; color: rgba(255, 238, 205, .6); margin-top: 3px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255, 240, 214, .3);
  background: rgba(40, 24, 14, .28);
  color: #ffeecd; font-size: 13px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  transition: background .2s, transform .2s;
}
.icon-btn:hover { background: rgba(40, 24, 14, .5); transform: translateY(-1px); }
.icon-btn.off { opacity: .45; }

/* ----------------------------------------------------------------- dock */
.dock {
  position: relative; z-index: 4;
  display: flex; align-items: center; gap: 12px;
  padding: 8px clamp(10px, 3vw, 26px) 12px;
  background: linear-gradient(0deg, rgba(35, 22, 14, .42), rgba(35, 22, 14, 0));
}
.dock-boosters { display: flex; gap: 7px; }
.booster {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 11px 7px 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 240, 214, .26);
  background: rgba(46, 28, 16, .3);
  color: #ffeed3; font-family: var(--sans); font-size: 11.5px; letter-spacing: .04em;
  cursor: pointer;
  transition: background .18s, transform .18s, border-color .18s;
}
.booster:hover { background: rgba(46, 28, 16, .52); transform: translateY(-1px); border-color: rgba(236, 205, 117, .55); }
.booster:disabled { opacity: .35; cursor: default; transform: none; }
.booster-ico { font-size: 13px; color: var(--gold-lt); }
.booster-pips { display: inline-flex; gap: 2px; margin-left: 2px; }
.booster-pips i { width: 4px; height: 4px; border-radius: 50%; background: var(--gold-lt); opacity: .85; }
.booster-pips i.spent { opacity: .18; }
.dock-hint {
  flex: 1; text-align: center;
  font-size: 11px; letter-spacing: .08em; color: rgba(255, 238, 205, .72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock-keys { font-size: 10.5px; color: rgba(255, 238, 205, .55); white-space: nowrap; }
kbd {
  display: inline-block; min-width: 17px; padding: 1px 4px; margin: 0 1px;
  border-radius: 4px; border: 1px solid rgba(255, 240, 214, .32);
  background: rgba(30, 18, 10, .3);
  font: 10px/1.5 var(--sans); color: #ffeecd; text-align: center;
}

/* --------------------------------------------------------------- screens */
.screen {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 3vw, 34px);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(58, 34, 18, .34), rgba(38, 22, 12, .72) 70%),
    linear-gradient(180deg, rgba(30, 18, 10, .3), rgba(30, 18, 10, .55));
  backdrop-filter: blur(7px) saturate(.92);
  -webkit-backdrop-filter: blur(7px) saturate(.92);
  opacity: 0; visibility: hidden;
  transition: opacity .32s ease, visibility .32s;
  overflow-y: auto;
}
.screen.on { opacity: 1; visibility: visible; }
.screen > div {
  width: min(760px, 100%);
  animation: rise .42s cubic-bezier(.2, .8, .3, 1) both;
}
.screen.on > div { animation-play-state: running; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 10px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold-lt);
}
.title-screen { background: radial-gradient(120% 100% at 50% 10%, rgba(48, 28, 15, .2), rgba(30, 18, 10, .76)); }
.title-wrap { text-align: center; max-width: 720px !important; }
.laurel { color: var(--gold-lt); width: 132px; margin: 0 auto 6px; opacity: .9; }
.laurel svg { width: 100%; height: auto; display: block; }
.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(40px, 9vw, 86px);
  letter-spacing: .14em;
  line-height: .98;
  color: #fff6e4;
  text-shadow: 0 2px 0 rgba(120, 74, 30, .5), 0 18px 46px rgba(20, 10, 4, .5);
}
.wordmark em {
  display: block;
  margin-top: 12px;
  font-size: clamp(12px, 2.1vw, 18px);
  letter-spacing: .42em;
  font-style: normal;
  color: var(--gold-lt);
  text-transform: uppercase;
}
.tagline {
  margin: 18px auto 24px;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(13px, 1.7vw, 17px);
  line-height: 1.65;
  color: rgba(255, 244, 224, .84);
}
.title-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.title-note {
  margin: 18px 0 0;
  font-size: 11px; letter-spacing: .12em; color: rgba(255, 238, 205, .6);
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 240, 214, .34);
  border-radius: 999px;
  padding: 12px 22px;
  font-family: var(--sans); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase;
  color: #fff6e4;
  background: rgba(46, 28, 16, .38);
  cursor: pointer;
  transition: transform .16s, background .2s, border-color .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); background: rgba(46, 28, 16, .56); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary {
  border-color: rgba(255, 235, 180, .7);
  background: linear-gradient(180deg, #e8c872, #b98f2c 62%, #9a7420);
  color: #2e1f0c;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(120, 80, 20, .38), inset 0 1px 0 rgba(255, 250, 226, .7);
}
.btn.primary:hover { background: linear-gradient(180deg, #f2d587, #c69b32 62%, #a87d22); }
.btn.ghost { background: rgba(255, 246, 228, .07); }
.btn.tiny { padding: 7px 13px; font-size: 10.5px; letter-spacing: .1em; }
.btn.endless {
  margin-top: 16px; padding: 8px 16px; font-size: 10.5px;
  border-color: rgba(236, 205, 117, .45); color: var(--gold-lt);
  background: rgba(30, 18, 10, .35);
}

/* ------------------------------------------------------------------ map */
.map-wrap {
  background: linear-gradient(180deg, rgba(251, 245, 232, .97), rgba(238, 225, 200, .97));
  border: 1px solid rgba(255, 250, 236, .8);
  border-radius: 18px;
  padding: clamp(14px, 2.4vw, 26px);
  color: var(--ink);
  box-shadow: var(--shadow);
  max-height: 100%;
  overflow-y: auto;
}
.map-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.map-head .eyebrow { color: var(--terra); }
.map-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 3.4vw, 30px); }
.map-side { display: flex; align-items: center; gap: 10px; }
.map-stars { font-family: var(--serif); font-size: 13px; color: var(--terra-deep); white-space: nowrap; }
.map-head .btn.tiny.ghost { color: var(--ink-soft); border-color: rgba(90, 66, 44, .3); background: rgba(255, 255, 255, .4); }

.acts { display: flex; flex-direction: column; gap: 12px; }
.act { border-top: 1px solid rgba(120, 90, 60, .18); padding-top: 10px; }
.act-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.act-name { font-family: var(--serif); font-size: 15px; color: var(--ink); }
.act-name span { color: var(--terra); font-size: 10px; letter-spacing: .18em; margin-right: 8px; text-transform: uppercase; }
.act-prog { font-size: 10.5px; letter-spacing: .08em; color: var(--ink-mute); }
.ch-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.ch {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  border: 1px solid rgba(120, 90, 60, .22);
  background: rgba(255, 255, 255, .55);
  color: var(--ink-soft);
  font-family: var(--serif); font-size: 14px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .2s, background .2s;
  overflow: hidden;
}
.ch:hover:not(.locked) { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(80, 46, 20, .18); background: #fff; }
.ch.locked { cursor: not-allowed; color: rgba(90, 70, 50, .32); background: rgba(210, 195, 172, .35); }
.ch.locked::after { content: '·'; position: absolute; bottom: 3px; font-size: 10px; color: rgba(90, 70, 50, .3); }
.ch.done { background: linear-gradient(180deg, #fff9ea, #f1e2c2); border-color: rgba(176, 86, 58, .35); }
.ch.now { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 162, 39, .3), 0 8px 18px rgba(120, 80, 20, .18); }
.ch b { font-weight: 400; line-height: 1; }
.ch .cs { display: flex; gap: 1px; margin-top: 3px; font-size: 7px; color: var(--gold); letter-spacing: 0; }
.ch .cs i { font-style: normal; opacity: .25; }
.ch .cs i.on { opacity: 1; }
.map-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(120, 90, 60, .18);
  font-size: 11px; color: var(--ink-mute);
}
.map-foot .btn.tiny { color: var(--ink); border-color: rgba(120, 90, 60, .32); background: rgba(255, 255, 255, .5); }

/* ---------------------------------------------------------------- brief */
.brief-wrap, .result-wrap, .pause-wrap, .how-wrap {
  background: linear-gradient(180deg, rgba(251, 245, 232, .98), rgba(240, 228, 205, .98));
  border: 1px solid rgba(255, 250, 236, .85);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 34px);
  color: var(--ink);
  max-height: 100%;
  overflow-y: auto;
}
.brief-wrap .eyebrow, .result-wrap .eyebrow, .pause-wrap .eyebrow, .how-wrap .eyebrow { color: var(--terra); }
.brief-title {
  margin: 0 0 14px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(24px, 4vw, 36px); line-height: 1.15;
}
.brief-story p {
  margin: 0 0 9px;
  font-family: var(--serif); font-size: clamp(13.5px, 1.6vw, 15.5px); line-height: 1.62;
  color: var(--ink-soft);
}
.brief-story p:first-child::first-letter {
  float: left; font-size: 2.9em; line-height: .82; padding: 4px 8px 0 0; color: var(--terra);
}
.brief-tip {
  display: flex; gap: 10px; align-items: baseline;
  margin: 14px 0 16px; padding: 10px 13px;
  border-left: 2px solid var(--gold);
  background: rgba(255, 250, 235, .7);
  font-size: 12.5px; line-height: 1.55; color: var(--ink-soft);
}
.brief-tip span { font-size: 9.5px; letter-spacing: .2em; color: var(--gold); flex: none; }
.brief-tip em { font-style: normal; }
.brief-stats, .result-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 0 0 18px;
}
.result-stats { grid-template-columns: repeat(3, 1fr); }
.brief-stats > div, .result-stats > div {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px;
  border: 1px solid rgba(120, 90, 60, .16);
  border-radius: 10px;
  background: rgba(255, 255, 255, .45);
}
.brief-stats b, .result-stats b {
  font-family: var(--serif); font-weight: 400; font-size: clamp(18px, 2.6vw, 24px); color: var(--ink);
}
.brief-stats small, .result-stats small { font-size: 8.5px; letter-spacing: .18em; color: var(--ink-mute); }
.brief-stars b { color: var(--gold); letter-spacing: .08em; }
.brief-actions, .result-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.brief-actions .btn, .result-actions .btn { color: var(--ink); border-color: rgba(90, 66, 44, .3); background: rgba(255, 255, 255, .5); }
.brief-actions .btn.primary, .result-actions .btn.primary {
  color: #2e1f0c; border-color: rgba(180, 140, 60, .6);
  background: linear-gradient(180deg, #ecd07c, #bd9330 62%, #9d7722);
}
.brief-actions .btn.ghost:hover, .result-actions .btn.ghost:hover { background: rgba(255, 255, 255, .85); }

/* --------------------------------------------------------------- result */
.result-wrap { text-align: center; }
.result-title {
  margin: 0 0 10px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(24px, 4vw, 36px); line-height: 1.15;
}
.stars { display: flex; justify-content: center; gap: 10px; margin: 6px 0 14px; }
.stars i {
  font-style: normal; font-size: clamp(30px, 5vw, 44px); line-height: 1;
  color: rgba(140, 110, 70, .22);
  transform: scale(.8); transition: color .3s, transform .3s, text-shadow .3s;
}
.stars i.on { color: var(--gold); transform: scale(1); text-shadow: 0 2px 14px rgba(201, 162, 39, .5); }
.result-line { margin: 0 0 16px; font-size: 12.5px; letter-spacing: .06em; color: var(--ink-mute); }
.result-story {
  margin: 16px 0 18px;
  font-family: var(--serif); font-style: italic; font-size: 13.5px; line-height: 1.6;
  color: var(--ink-soft);
}
.result-actions { justify-content: center; }
.fail .result-title { color: var(--terra-deep); }
.pause-wrap, .how-wrap { text-align: left; }
.keys { list-style: none; margin: 14px 0 20px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.keys li { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); }
.keys li span { margin-left: 6px; }
.pause-wrap kbd, .how-wrap kbd { border-color: rgba(90, 66, 44, .3); background: rgba(255, 255, 255, .6); color: var(--ink-soft); }
.how-list { margin: 12px 0 14px; padding-left: 20px; }
.how-list li { font-size: 13px; line-height: 1.6; color: var(--ink-soft); margin-bottom: 8px; }
.how-list b { color: var(--ink); }
.how-note { font-size: 12px; line-height: 1.6; color: var(--ink-mute); font-style: italic; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: absolute; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  z-index: 8; pointer-events: none;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(32, 19, 11, .82);
  border: 1px solid rgba(236, 205, 117, .38);
  color: #ffeed3; font-size: 11.5px; letter-spacing: .1em;
  opacity: 0; transition: opacity .25s, transform .25s;
  white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ----------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .hud { grid-template-columns: 1fr auto; gap: 8px; padding: 9px 12px 8px; }
  .hud-goal { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; gap: 10px; }
  .goal-bar { flex: 1; width: auto; }
  .goal-label { font-size: 8.5px; }
  .dock { flex-wrap: wrap; gap: 6px; padding: 6px 10px 10px; }
  .dock-hint { order: 3; flex-basis: 100%; text-align: left; font-size: 10px; }
  .dock-keys { display: none; }
  .booster { padding: 6px 9px; font-size: 10.5px; }
  .booster-label { display: none; }
  .booster-ico { font-size: 15px; }
  .ch-grid { gap: 4px; }
  .ch { font-size: 12px; border-radius: 7px; }
}
@media (max-width: 520px) {
  .hud-stat small { display: none; }
  .hud-stat span { font-size: 14px; }
  .icon-btn { width: 28px; height: 28px; }
  .wordmark { letter-spacing: .1em; }
  .brief-stats { grid-template-columns: repeat(2, 1fr); }
  .ch-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .screen { padding: 8px; }
  .map-wrap, .brief-wrap, .result-wrap, .pause-wrap, .how-wrap { border-radius: 14px; }
  .title-actions .btn, .brief-actions .btn, .result-actions .btn { flex: 1 1 auto; padding: 11px 14px; }
  .title-note { display: none; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .hud { padding: 6px 12px 4px; }
  .hud-kicker { display: none; }
  .dock { padding: 4px 10px 6px; }
  .dock-hint { display: none; }
  .brief-story p { margin-bottom: 5px; }
  .brief-stats { margin-bottom: 10px; }
  .screen { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
