/* ============ SOMOU GAME — expo challenge (teal envelope, brass, cream) ============ */
:root {
  --smg-teal: #1A6B6A; --smg-teal2: #14514F; --smg-deep: #0E3B3A;
  --smg-cream: #FAF8F5; --smg-gold: #E8C99B; --smg-brass: #C9A15E; --smg-ink: #16140F;
  --smg-f: 'Archivo', 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --smg-a: 'IBM Plex Sans Arabic', 'Geeza Pro', Tahoma, sans-serif;
  --smg-m: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
.smg { position: fixed; inset: 0; z-index: 900; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(232,201,155,.16), transparent 60%),
    radial-gradient(90% 60% at 50% 120%, rgba(0,0,0,.35), transparent 70%),
    linear-gradient(180deg, var(--smg-teal) 0%, var(--smg-teal2) 62%, var(--smg-deep) 100%);
  color: var(--smg-cream); font-family: var(--smg-f); -webkit-font-smoothing: antialiased; }
.smg.hidden { display: none; }
.smg::before { /* a quiet minute track, like the booth's brass ring */
  content: ''; position: fixed; inset: auto; left: 50%; top: 50%; width: 140vmax; height: 140vmax; translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(232,201,155,.07) 0 .25deg, transparent .25deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 33%, #000 33.2%, #000 34.2%, transparent 34.4%);
  mask: radial-gradient(circle, transparent 33%, #000 33.2%, #000 34.2%, transparent 34.4%);
  pointer-events: none; opacity: .9; }
.smg-wrap { position: relative; max-width: 520px; margin: 0 auto; min-height: 100%; padding: max(14px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px; opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .35s ease; }
.smg-wrap.in { opacity: 1; transform: none; }
.smg-wrap[dir=rtl] { font-family: var(--smg-a); }
.smg-top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.smg-brand img { height: 22px; width: auto; display: block; }
.smg-brand b { font-family: var(--smg-f); letter-spacing: .32em; font-weight: 600; font-size: 14px; color: var(--smg-gold); }
.smg-lang { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(232,201,155,.45); color: var(--smg-gold);
  background: transparent; font: 600 14px var(--smg-a); }
.smg-wrap[dir=rtl] .smg-lang { font-family: var(--smg-f); }

.smg-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; }
.smg-seal { width: min(46vw, 190px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.35)); animation: smgFloat 6s ease-in-out infinite; }
.smg-seal img { width: 100%; height: 100%; object-fit: contain; }
.smg-seal.noimg { background: radial-gradient(circle at 35% 30%, #f3dcae, #b98a45 55%, #7c5726); }
.smg-seal.noimg img { display: none; }
@keyframes smgFloat { 50% { transform: translateY(-6px) rotate(-2deg); } }
.smg-kicker { font: 500 12px var(--smg-m); letter-spacing: .14em; text-transform: uppercase; color: var(--smg-gold); margin: 6px 0 0; }
.smg-wrap[dir=rtl] .smg-kicker { font: 600 14px var(--smg-a); letter-spacing: 0; }
.smg-title { margin: 0; font-weight: 600; font-stretch: 118%; font-size: clamp(30px, 8.6vw, 44px); line-height: 1.02; text-transform: uppercase; letter-spacing: -.01em; text-wrap: balance; }
.smg-wrap[dir=rtl] .smg-title { font-family: var(--smg-a); font-weight: 700; text-transform: none; letter-spacing: 0; line-height: 1.3; font-size: clamp(30px, 8.4vw, 42px); }
.smg-sub { margin: 0; font-size: 17px; line-height: 1.55; color: rgba(250,248,245,.86); max-width: 34ch; text-wrap: pretty; }
.smg-wrap[dir=rtl] .smg-sub { line-height: 1.8; }

.smg-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.smg-rules li { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border-radius: 10px;
  background: rgba(250,248,245,.06); border: 1px solid rgba(232,201,155,.22); font-size: 14.5px; line-height: 1.3; font-weight: 500; }
.smg-rules i { font-style: normal; flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: var(--smg-gold); color: var(--smg-teal2); font-weight: 700; }

.smg-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.smg-btn { display: flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 22px; border-radius: 10px;
  font: 600 17px inherit; font-family: inherit; text-decoration: none; cursor: pointer; border: 0; transition: transform .12s ease, filter .2s; -webkit-tap-highlight-color: transparent; }
.smg-btn:active { transform: scale(.98); }
.smg-btn[disabled] { opacity: .7; }
.smg-btn--gold { background: linear-gradient(180deg, #f1d7aa, var(--smg-gold) 45%, #d3ad74); color: var(--smg-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 24px -10px rgba(0,0,0,.55); }
.smg-btn--line { background: transparent; color: var(--smg-cream); border: 1.5px solid rgba(250,248,245,.55); }
.smg-btn--ghost { background: transparent; color: var(--smg-gold); min-height: 48px; }

.smg-form { display: flex; flex-direction: column; gap: 14px; }
.smg-h2 { margin: 6px 0 0; font-size: 26px; font-weight: 700; line-height: 1.2; }
.smg-h3 { margin: 8px 0 -6px; font-size: 18px; font-weight: 700; }
.smg-field { display: flex; flex-direction: column; gap: 6px; }
.smg-lab { font-size: 15px; font-weight: 600; color: var(--smg-gold); }
.smg-help { font-size: 13.5px; color: rgba(250,248,245,.7); line-height: 1.5; }
.smg-field input, .smg-field select { width: 100%; min-height: 56px; padding: 0 14px; border-radius: 10px; border: 1.5px solid rgba(232,201,155,.4);
  background: rgba(8,36,35,.55); color: var(--smg-cream); font-size: 18px; font-family: inherit; outline: none; -webkit-appearance: none; appearance: none; }
.smg-field input:focus, .smg-field select:focus { border-color: var(--smg-gold); box-shadow: 0 0 0 3px rgba(232,201,155,.22); }
.smg-phone { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: 8px; }
.smg-phone select { font-size: 15px; padding-inline-end: 6px; }
.smg-phone input { letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.smg-warn { margin: 0; padding: 12px 14px; border-inline-start: 3px solid var(--smg-gold); background: rgba(250,248,245,.06); font-size: 14.5px; line-height: 1.6; border-radius: 4px; }
.smg-err { margin: 0; min-height: 1.2em; color: #ffd0c4; font-weight: 600; font-size: 15px; }

.smg-muted { margin: 0; color: rgba(250,248,245,.74); font-size: 14.5px; line-height: 1.6; }
.smg-empty { margin: 8px 0; padding: 18px; text-align: center; border: 1px dashed rgba(232,201,155,.35); border-radius: 10px; color: rgba(250,248,245,.8); }
.smg-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.smg-board li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px;
  border-radius: 10px; background: rgba(250,248,245,.05); border: 1px solid rgba(250,248,245,.08); }
.smg-board li.is-podium { background: linear-gradient(90deg, rgba(232,201,155,.22), rgba(232,201,155,.06)); border-color: rgba(232,201,155,.45); }
.smg-wrap[dir=rtl] .smg-board li.is-podium { background: linear-gradient(270deg, rgba(232,201,155,.22), rgba(232,201,155,.06)); }
.smg-pos { font-size: 20px; color: var(--smg-gold); text-align: center; font-weight: 700; }
.smg-who { display: flex; flex-direction: column; min-width: 0; }
.smg-who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.smg-who small { font-family: var(--smg-m); font-size: 12px; color: rgba(250,248,245,.6); text-align: start; }
.smg-ms { font-family: var(--smg-m); font-weight: 500; font-size: 16px; font-variant-numeric: tabular-nums; }
.smg-wrap[dir=rtl] .smg-ms { font-family: var(--smg-a); font-weight: 600; }

.smg-res { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 10px; }
.smg-time { margin: 0; font-family: var(--smg-m); font-weight: 500; font-size: clamp(56px, 18vw, 84px); line-height: 1; color: var(--smg-gold);
  font-variant-numeric: tabular-nums; text-shadow: 0 8px 30px rgba(0,0,0,.35); }
.smg-wrap[dir=rtl] .smg-time { font-family: var(--smg-a); font-weight: 700; }
.smg-break { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; margin: 6px 0 0; }
.smg-break div { padding: 10px 6px; border-radius: 8px; background: rgba(250,248,245,.06); }
.smg-break dt { font-size: 12.5px; color: rgba(250,248,245,.7); }
.smg-break dd { margin: 4px 0 0; font-weight: 700; font-size: 17px; }
.smg-rank { margin: 4px 0 0; padding: 8px 16px; border-radius: 999px; background: var(--smg-gold); color: var(--smg-ink); font-weight: 700; font-size: 16px; }
.smg-saving { animation: smgPulse 1.2s ease-in-out infinite; }
@keyframes smgPulse { 50% { opacity: .45; } }

.smg-admin { overflow-x: auto; border-radius: 8px; background: rgba(0,0,0,.25); }
.smg-admin table { border-collapse: collapse; width: 100%; font-size: 13px; }
.smg-admin th, .smg-admin td { padding: 8px; border-bottom: 1px solid rgba(250,248,245,.1); text-align: start; white-space: nowrap; }
.smg-admin a { color: var(--smg-gold); }
.smg-admin tr.flag td { color: #ffcbbd; }
.smg-wrap.is-admin { max-width: 980px; }

/* countdown */
.smg-count { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; background: rgba(10,40,39,.78);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--smg-gold); font-family: var(--smg-a); transition: opacity .35s; }
.smg-count.out { opacity: 0; }
.smg-count span { font-size: clamp(64px, 26vw, 140px); font-weight: 700; animation: smgPop .8s ease both; }
.smg-count span.go { color: var(--smg-cream); }
@keyframes smgPop { 0% { transform: scale(.6); opacity: 0; } 30% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* on the bench during a Somou run: no menus, no mode switching, a teal clock */
body.smg-running #btn-back, body.smg-running #mode-bar, body.smg-running #smith-mascot,
body.smg-running .mascot, body.smg-running #part-card { display: none !important; }
body.smg-running .hud-timer { color: var(--smg-gold); font-size: 19px; font-weight: 700; }
.smg-hudtag { position: absolute; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%); z-index: 30;
  padding: 4px 12px; border-radius: 999px; background: rgba(20,81,79,.88); color: var(--smg-gold); border: 1px solid rgba(232,201,155,.45);
  font: 600 12px var(--smg-a); pointer-events: none; white-space: nowrap; }
.smg-hudtag.hidden { display: none; }
body.smg-mode #shell { visibility: hidden; }
body.smg-mode.smg-running #shell { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .smg-seal, .smg-saving { animation: none; } .smg-wrap { transition: none; } }
