/* What's Your Depth Gauge? v1.0 — palette and type follow Lila Price's rules sheet */
:root {
  --bg: #14252D;
  --panel: #1E3A45;
  --panel-2: #24434F;
  --gold: #F2B654;
  --gold-2: #F7C977;
  --mint: #7DD8BE;
  --cream: #F3F1EC;
  --red: #A93A30;
  --red-2: #C2483D;
  --text: #E8EEF0;
  --muted: #A9BBC2;
  --ink: #14252D;
  --radius: 14px;
  --ruler: 22px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: 'Nunito', system-ui, sans-serif; line-height: 1.5; min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
a { color: var(--gold); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; border-radius: 8px; }

/* The ruler: the depth gauge motif from the rules sheet */
.ruler {
  position: fixed; inset: 0 auto 0 0; width: var(--ruler); background-color: var(--gold); z-index: 0;
  background-image:
    repeating-linear-gradient(to bottom, var(--ink) 0 2px, transparent 2px 60px),
    repeating-linear-gradient(to bottom, var(--ink) 0 2px, transparent 2px 12px);
  background-size: 22px 100%, 12px 100%;
  background-position: right top, right top;
  background-repeat: repeat-y;
}
.wrap { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 28px 18px 40px calc(var(--ruler) + 18px); }
.screen { display: flex; flex-direction: column; gap: 18px; animation: in .25s ease-out; }
.center { align-items: center; text-align: center; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow { font-weight: 800; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--mint); }
.title { font-family: 'Bungee', 'Arial Black', sans-serif; font-weight: 400; color: var(--gold); font-size: clamp(2.3rem, 11vw, 4.2rem); line-height: 1.02; }
.title.small { font-size: clamp(1.8rem, 8vw, 3rem); }
.h2 { font-family: 'Bungee', sans-serif; font-weight: 400; font-size: clamp(1.5rem, 6vw, 2rem); color: var(--text); }
.h3 { font-family: 'Bungee', sans-serif; font-weight: 400; font-size: 1.1rem; color: var(--gold); margin-top: 6px; }
.lead { font-size: 1.08rem; color: var(--text); opacity: .92; }
.hint { font-size: .9rem; color: var(--muted); }
.credit { font-size: .82rem; color: var(--muted); margin-top: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn { border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 800; font-size: 1rem; transition: transform .1s, background .15s; width: 100%; }
.btn:active { transform: scale(.98); }
.btn-big { padding: 18px 24px; font-size: 1.12rem; }
.btn-small { padding: 10px 16px; font-size: .9rem; width: auto; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--gold-2); }
.btn-mint { background: var(--mint); color: var(--ink); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-2); }
.btn-ghost { background: transparent; color: var(--text); border: 2px solid rgba(232, 238, 240, .3); }
.btn-ghost:hover { border-color: var(--mint); }
.back, .link { background: none; border: 0; color: var(--muted); font-weight: 700; align-self: flex-start; padding: 4px 0; }
.link { align-self: center; font-size: .88rem; text-decoration: underline; }

/* Rules */
.roles, .boxes { display: grid; gap: 12px; }
.role { background: var(--panel); border: 2px solid; border-radius: var(--radius); padding: 16px 18px; }
.role h3, .box h3 { font-family: 'Bungee', sans-serif; font-weight: 400; font-size: 1.1rem; margin-bottom: 6px; }
.role.mint { border-color: var(--mint); } .role.mint h3 { color: var(--mint); }
.role.gold { border-color: var(--gold); } .role.gold h3 { color: var(--gold); }
.steps { list-style: none; counter-reset: s; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-left: 52px; color: var(--muted); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--ink); font-family: 'Bungee', sans-serif; display: grid; place-items: center; }
.steps strong { display: block; color: var(--text); font-size: 1.05rem; }
.box { border-radius: var(--radius); padding: 16px 18px; }
.box.cream { background: var(--cream); color: var(--ink); }
.box.red { background: var(--red); color: #fff; }

/* Setup form */
.form { display: flex; flex-direction: column; gap: 18px; }
fieldset { border: 0; background: var(--panel); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
legend { font-family: 'Bungee', sans-serif; color: var(--gold); padding: 0; float: left; width: 100%; margin-bottom: 4px; }
.team-inputs { display: grid; gap: 10px; }
input[type=text], input[type=number] {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 2px solid transparent; background: var(--bg); color: var(--text); font: inherit; font-weight: 700;
}
input:focus { outline: none; border-color: var(--mint); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field input { max-width: 110px; text-align: center; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 22px; height: 22px; accent-color: var(--mint); }
.levels { display: grid; gap: 10px; }
.level { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.level input[type=number] { width: 72px; text-align: center; }
.level .count { font-size: .8rem; color: var(--muted); }

/* Chips */
.chip { display: inline-block; font-weight: 800; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.chip.Easy { background: #DDF3EC; color: #1F6B4F; }
.chip.Med { background: #FCEFD6; color: #7A5410; }
.chip.Hard { background: #F7DEDA; color: #8C2E25; }
.chip.Advanced { background: var(--ink); color: var(--gold); border: 1px solid var(--gold); }

/* Handoff */
.team-name { font-family: 'Bungee', sans-serif; font-weight: 400; color: var(--gold); font-size: clamp(2rem, 9vw, 3.2rem); line-height: 1.05; }
.callout { background: var(--panel); border-radius: var(--radius); padding: 18px; display: grid; gap: 8px; width: 100%; }

/* Card */
.card { background: var(--cream); color: var(--ink); border-radius: 18px; padding: 18px; display: grid; gap: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.card .art { background: #fff; border-radius: 12px; height: 210px; display: grid; place-items: center; padding: 12px; }
.card .art img { max-width: 100%; max-height: 186px; object-fit: contain; }
.card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card .name { font-family: 'Bungee', sans-serif; font-weight: 400; font-size: 1.35rem; line-height: 1.15; }
.card .pts { font-weight: 800; white-space: nowrap; text-align: right; }
.card .pts .chip { margin-bottom: 4px; }
.card .taboo-title { font-weight: 800; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.card .taboo { display: flex; flex-wrap: wrap; gap: 6px; }
.card .taboo span { background: var(--red); color: #fff; font-weight: 800; padding: 5px 11px; border-radius: 8px; font-size: .92rem; }
.card .aka { font-size: .9rem; color: #4A5A60; }
.card .rule { font-size: .85rem; background: #E7F5F0; color: #1F5A48; border-radius: 8px; padding: 8px 10px; }
.card .desc { font-size: .95rem; color: #33444B; }
.card .spec { font-size: .8rem; font-weight: 700; color: #5E6E74; text-transform: uppercase; letter-spacing: .08em; }

/* Turn */
.clock { font-family: 'Bungee', sans-serif; font-size: clamp(5rem, 30vw, 9rem); color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.clock.warn { color: var(--gold); }
.clock.done { color: var(--red-2); }
.gauge { width: 100%; height: 26px; border-radius: 6px; background: var(--panel); overflow: hidden; position: relative;
  background-image: repeating-linear-gradient(to right, rgba(232,238,240,.35) 0 2px, transparent 2px 10%); }
.gauge-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--gold); transition: width .2s linear; opacity: .9; }
.turn-meta { font-weight: 800; }
.reminder { color: var(--muted); font-weight: 700; }
.reminder span { font-weight: 600; font-size: .9rem; }
.turn-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.peek { user-select: none; -webkit-user-select: none; touch-action: none; }
.peek-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 37, 45, .96); display: grid; place-items: center; padding: 18px; }
.peek-overlay .card { max-width: 520px; width: 100%; }

/* Result */
.outcome { border-radius: var(--radius); padding: 18px; text-align: center; }
.outcome .big { font-family: 'Bungee', sans-serif; font-size: clamp(1.8rem, 8vw, 2.6rem); line-height: 1.1; }
.outcome.got { background: var(--mint); color: var(--ink); }
.outcome.foul { background: var(--red); color: #fff; }
.outcome.time { background: var(--panel-2); color: var(--text); }

/* Scores */
.scores { list-style: none; display: grid; gap: 8px; }
.scores li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 12px 14px; }
.scores li.lead-team { outline: 2px solid var(--gold); }
.scores .n { font-weight: 800; }
.scores .s { font-family: 'Bungee', sans-serif; color: var(--gold); font-size: 1.3rem; min-width: 2ch; text-align: right; }
.scores .adj { display: flex; align-items: center; gap: 8px; }
.scores .adj button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(232,238,240,.3); background: none; color: var(--text); font-weight: 800; }
.scores.final { width: 100%; text-align: left; }

@media (min-width: 640px) {
  .roles, .boxes { grid-template-columns: 1fr 1fr; }
  .card .art { height: 260px; }
  .card .art img { max-height: 236px; }
}

/* Headings get focus on screen change (for screen readers); no ring for that */
[tabindex="-1"]:focus { outline: none; }

/* ===================== App v1.0: host-picked levels, labeled card art, facts, iPad ===================== */
button, .btn { touch-action: manipulation; }
select { width: 100%; max-width: 330px; padding: 12px 14px; border-radius: 10px; border: 2px solid transparent; background: var(--bg); color: var(--text); font: inherit; font-weight: 700; }
select:focus { outline: none; border-color: var(--mint); }
.field { flex-wrap: wrap; }
.btn-huge { padding: 26px 20px; font-size: 1.3rem; border-radius: 22px; }
.center-row { justify-content: center; }
.worth { font-weight: 800; color: var(--gold); text-align: center; font-size: 1.05rem; }
.rule-box { background: var(--panel); border-radius: 12px; padding: 12px 14px; font-size: .92rem; color: var(--muted); }
.rule-box strong { color: var(--text); }
.card-side { display: flex; flex-direction: column; gap: 14px; }

/* Level picker */
.level-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.lvl { border: 0; border-radius: 18px; padding: 20px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; color: var(--ink); min-height: 120px; justify-content: center; }
.lvl .l { font-family: 'Bungee', sans-serif; font-weight: 400; font-size: 1.35rem; }
.lvl .p { font-size: .9rem; }
.lvl .c { font-size: .78rem; opacity: .75; font-weight: 700; }
.lvl.Easy { background: #DDF3EC; } .lvl.Med { background: #FCEFD6; } .lvl.Hard { background: #F7DEDA; }
.lvl.Advanced { background: var(--ink); color: var(--gold); border: 2px solid var(--gold); }
.lvl:disabled { opacity: .35; cursor: not-allowed; }
.lvl:not(:disabled):active { transform: scale(.98); }

/* Card art with the name and taboo words on the image itself */
.card .art { position: relative; height: auto; min-height: 300px; padding: 0; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.card .art .nm { background: var(--ink); color: var(--gold); font-family: 'Bungee', sans-serif; font-size: 1.25rem; line-height: 1.15; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .art .nm .chip { flex-shrink: 0; }
.card .art .im { flex: 1; display: grid; place-items: center; padding: 14px; min-height: 200px; }
.card .art .im img { max-width: 100%; max-height: 230px; object-fit: contain; }
.card .art .tb { background: var(--red); color: #fff; padding: 10px 12px; }
.card .art .tb .t { font-weight: 800; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; opacity: .9; margin-bottom: 6px; }
.card .art .tb .w { display: flex; flex-wrap: wrap; gap: 6px; }
.card .art .tb .w span { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); padding: 4px 10px; border-radius: 8px; font-weight: 800; font-size: .95rem; }
.card .aka { font-size: .92rem; color: #4A5A60; }

/* Result */
.outcome .math { font-weight: 800; font-size: 1.05rem; margin-top: 4px; }
.result-layout, .card-layout, .fact-layout { display: grid; gap: 18px; }

/* Fact */
.fact-art { background: #fff; border-radius: 18px; display: grid; place-items: center; padding: 18px; min-height: 220px; }
.fact-art img { max-width: 100%; max-height: 260px; object-fit: contain; }
.fact-type { display: inline-block; background: var(--mint); color: var(--ink); font-weight: 800; font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; margin-bottom: 10px; }
.fact-name { color: var(--gold); margin-bottom: 10px; }
.fact-text { font-size: 1.25rem; line-height: 1.55; color: var(--text); }
.fact-desc { margin-top: 14px; color: var(--muted); font-size: .98rem; }

/* iPad / tablet */
@media (min-width: 820px) {
  .wrap { max-width: 1100px; padding: 36px 36px 48px calc(var(--ruler) + 36px); }
  .level-pick { grid-template-columns: repeat(4, 1fr); max-width: 980px; }
  .lvl { min-height: 170px; }
  .lvl .l { font-size: 1.6rem; }
  .card-layout { grid-template-columns: 1.25fr 1fr; align-items: start; }
  .card-side { position: sticky; top: 24px; }
  .result-layout { grid-template-columns: 1.2fr 1fr; align-items: start; }
  .fact-layout { grid-template-columns: 1fr 1.2fr; align-items: center; gap: 36px; }
  .fact-text { font-size: 1.5rem; }
  .card .art .im img { max-height: 320px; }
  .card .art { min-height: 380px; }
  .clock { font-size: 11rem; }
  .turn-actions { max-width: 820px; }
  [data-screen="turn"] .btn-huge { padding: 40px 20px; font-size: 1.6rem; }
  .form { max-width: 760px; }
  .screen[data-screen="home"], .screen[data-screen="rules"], .screen[data-screen="scores"] { max-width: 820px; }
}
.card .art { align-items: stretch; place-items: stretch; }
.card.reveal .art .im img { max-height: 200px; }
.result-side { display: flex; flex-direction: column; gap: 14px; }
