/* Yogle. The house base (colours, font, page, masthead) comes from the jacob.gg kit, loaded first:
   https://biccyanzac-pixel.github.io/jacob.gg/kit/jgg.css. This file maps Yogle's names onto the house tokens
   and adds Yogle's own pieces (left/right limb colours, the camera screen). */
:root {
  --ink: var(--text);
  --accent-ink: #ffffff;
  --left: #ff8a4c;
  --right: #6ea8ff;
  --ok: #f2c14e;
  --focus: var(--accent);
}
@media (prefers-color-scheme: light) {
  :root {
    --left: #d9480f;
    --right: #1d5fd1;
    --ok: #b58105;
  }
}

[hidden] { display: none !important; }
body { -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.masthead { padding: 3rem 16px 0; }
.top { text-align: center; padding: 1rem 16px 0; }
.brand { margin: 0; font-size: clamp(1.8rem, 6vw, 2.3rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.tagline { margin: 0.25rem 0 0; color: var(--muted); }

main { max-width: 42rem; margin: 0 auto; padding: 1.25rem 16px 24px; }
.screen { display: flex; flex-direction: column; gap: 14px; }
.daynum { margin: 8px 0 0; text-align: center; color: var(--accent); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.level { margin: 0; text-align: center; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.pose-name { margin: 0; text-align: center; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; }
.meta { margin: 0; text-align: center; color: var(--muted); }
.advanced-warning {
  margin: 0; padding: 12px 14px; border-radius: 10px;
  border: 2px solid var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface));
}

.figure-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.figure { width: 100%; height: 300px; display: block; touch-action: pan-y; cursor: grab; }
.hint { margin: 4px 0 0; text-align: center; font-size: 0.85rem; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn {
  min-height: 48px; padding: 0.7rem 1.2rem; border-radius: 10px; font: inherit; font-weight: 650;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 40px; padding: 0.45rem 0.9rem; font-size: 0.92rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.done-today { margin: 0; width: 100%; text-align: center; font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; }
.panel summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.panel ol { padding-left: 1.2em; }
.label { display: block; margin: 10px 0 6px; }
.select { width: 100%; min-height: 48px; font-size: 1rem; margin-bottom: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); padding: 8px; font: inherit; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.stats b { display: block; font-size: 1.5rem; }
.stats span { font-size: 0.8rem; color: var(--muted); }

.setup-svg { width: 100%; max-width: 420px; display: block; margin: 8px auto; }
.svg-floor { stroke: var(--muted); stroke-width: 2; }
.svg-phone { fill: var(--ink); }
.svg-prop { fill: var(--border); }
.svg-view { stroke: var(--right); stroke-width: 2; stroke-dasharray: 6 5; fill: none; }
.svg-person { fill: var(--left); }
.svg-person-line { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; fill: none; }
.svg-text { fill: var(--muted); font-size: 14px; }

/* play: full screen */
#screen-play:not([hidden]) { position: fixed; inset: 0; z-index: 5; background: #000; display: block; }
.stage { position: absolute; inset: 0; overflow: hidden; }
#video, .overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; transform: scaleX(-1); /* mirror, like a mirror */
}
.hud-top { position: absolute; top: 0; left: 0; right: 0; padding: max(12px, env(safe-area-inset-top)) 12px 12px; background: linear-gradient(rgba(0,0,0,0.75), rgba(0,0,0,0)); }
.status { margin: 0; color: #fff; font-size: 1.45rem; font-weight: 800; text-align: center; text-shadow: 0 2px 6px #000; }
.hud-target { position: absolute; right: 10px; top: 92px; width: 120px; background: rgba(255,255,255,0.9); border-radius: 12px; padding: 4px; }
.mini-figure { width: 112px; height: 130px; display: block; }
.mini-name { margin: 0; font-size: 0.75rem; text-align: center; color: #14213d; font-weight: 700; }
.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 16px 12px max(14px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.8));
}
.meter { flex: 1; color: #fff; }
.meter-label { display: flex; justify-content: space-between; font-weight: 700; }
.meter-bar { position: relative; height: 18px; border-radius: 9px; background: rgba(255,255,255,0.25); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: #4cc26b; transition: width 120ms linear; }
.meter-threshold { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; }
.hold { position: relative; width: 64px; height: 64px; }
.ring { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 5; }
.ring-fg { fill: none; stroke: #4cc26b; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; }
.hold-val { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.3rem; }
.perf { position: absolute; left: 8px; bottom: 96px; margin: 0; color: #fff; font-size: 0.75rem; opacity: 0.8; }

.result-title { margin: 8px 0 0; text-align: center; }
.big-score { margin: 0; text-align: center; font-size: 4.5rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--accent); }
.grid { margin: 0 auto; font-size: 1.6rem; line-height: 1.25; text-align: left; font-family: inherit; white-space: pre; }
.share-msg { text-align: center; min-height: 1.5em; margin: 0; }
.snapshot { margin: 0; text-align: center; }
.snapshot img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.snapshot figcaption { color: var(--muted); font-size: 0.9rem; }

.foot { max-width: 42rem; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 0.9rem; }
.safety { color: var(--ink); border-left: 4px solid var(--bad); padding-left: 10px; }

.dialog { max-width: 520px; border: none; border-radius: 16px; padding: 20px; background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog li { margin-bottom: 6px; }

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .pose-name { font-size: 1.7rem; }
  .hud-target { width: 96px; top: 84px; }
  .mini-figure { width: 88px; height: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  .meter-fill { transition: none; }
}

/* leaderboard + archive */
.panel-title { margin: 4px 0 8px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.section-title { margin: 8px 0; }
.muted { color: var(--muted); margin: 4px 0; }
.btn.wide { width: 100%; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 2px 10px; align-items: baseline; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.board li:last-child { border-bottom: none; }
.board li.me { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 8px; }
.board .rank { font-weight: 800; color: var(--muted); }
.board .name { font-weight: 700; overflow-wrap: anywhere; }
.board .score { font-weight: 900; font-size: 1.3rem; }
.board .detail { grid-column: 2 / 4; font-size: 0.85rem; color: var(--muted); }
.board .gap { display: block; text-align: center; color: var(--muted); border: none; }
.archive-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.archive-list button { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 1rem; cursor: pointer; min-height: 52px; }
.archive-list .a-day { font-weight: 700; }
.archive-list .a-sub { grid-column: 1 / 3; font-size: 0.85rem; color: var(--muted); }
.archive-list .a-you { font-weight: 800; }
.small-figure { height: 220px; }
.submit-row { display: flex; gap: 8px; flex-wrap: wrap; }
.input { flex: 1; min-width: 160px; min-height: 52px; font-size: 1.05rem; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font: inherit; }
.countdown { margin: 0; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
#rate .jgg-rate { margin-top: 0; }
