/*
  Sanahuijari – styles.css
  Refactored for readability + modern cross-browser defaults.
  Goal: keep the exact UI/behavior while making the CSS easier to maintain.
*/

/* =========================
   Design tokens
   ========================= */

:root{
  --bg: #0e101c;
  --text: #e0ddd0;
  --muted: rgba(224,221,208,.68);
  --muted2: rgba(224,221,208,.52);
  --danger: #ba3c2d;
  --accent: #efbd45;
  --accent2: #326ba0;
  --surface: rgba(45,53,74,.45);
  --surface2: rgba(45,53,74,.25);
  --border: rgba(224,221,208,.12);
  --border2: rgba(224,221,208,.18);
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --radius: 22px;
  --pad: clamp(14px, 3.8vw, 20px);
  --maxw: 680px;
}

/* =========================
   Reset (compat-focused)
   ========================= */

:where(*, *::before, *::after){ box-sizing: border-box; }

html{
  block-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark light;
}

body{
  min-block-size: 100%;
  margin: 0;
}

:where(img, svg, video, canvas){
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

:where(button, input, textarea, select){
  font: inherit;
  color: inherit;
}

:where(button){
  -webkit-tap-highlight-color: transparent;
}

/* =========================
   Base
   ========================= */

body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(100,149,237,.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(147,197,253,.10) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 80%, rgba(56,189,248,.08) 0%, transparent 50%),
    radial-gradient(1200px 800px at 20% 0%, #1e2a4a 0%, var(--bg) 55%);
  background-attachment: fixed;
}

/* Focus styling (keyboard-friendly) */
button:focus-visible,
input:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 4px rgba(239,189,69,.22),
    0 12px 28px rgba(0,0,0,.24);
}

/* Utility */
.hidden{ display: none !important; }

/* =========================
   Boot splash
   ========================= */

/* No scrollbars during boot splash */
body.booting{ overflow: hidden !important; }

body.booting #bootSplash{ display: flex; }
body.booting #appRoot{ visibility: hidden; }

.boot-splash{
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: var(--pad);
  background: transparent;
}

/* Cross-browser translucent boot overlay without needing color-mix(). */
.boot-splash::before{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.68;
}

/* Let snow pop more during boot. */
body.booting .boot-splash::before{ opacity: 0.52; }
body.booting .snow-canvas{ opacity: 1; }

.boot-splash > *{ position: relative; }

.boot-logo{
  width: min(78vw, 420px);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.boot-progress{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.boot-ring{
  width: 72px;
  height: 72px;
}

.boot-ring-track{
  fill: none;
  stroke: var(--border2);
  stroke-width: 6;
  opacity: 0.9;
}

.boot-ring-fill{
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 32px 32px;
}

.boot-percent{
  font-weight: 900;
  letter-spacing: .08em;
  color: rgba(224,221,208,.88);
  font-size: 13px;
}

.boot-version{
  font-weight: 850;
  letter-spacing: .10em;
  color: rgba(224,221,208,.62);
  font-size: 12px;
}

.boot-spinner{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  opacity: 0.95;
  animation: boot-spin 0.9s linear infinite;
}

@keyframes boot-spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce){
  .boot-spinner{ animation: none; }
}

/* =========================
   Background effects
   ========================= */

/* Frost edges vignette (above snow, below UI) */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 120% 80% at 50% 50%, transparent 40%, rgba(147,197,253,.08) 70%, rgba(200,220,255,.15) 100%),
    linear-gradient(180deg, rgba(200,220,255,.12) 0%, transparent 15%, transparent 85%, rgba(200,220,255,.08) 100%),
    linear-gradient(90deg, rgba(200,220,255,.10) 0%, transparent 10%, transparent 90%, rgba(200,220,255,.10) 100%);
}

/* Snowfall (canvas particle system) */
.snow-canvas{
  position: fixed;
  inset: 0;
  z-index: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
  opacity: 0.95;
  contain: strict;
}

@media (prefers-reduced-motion: reduce){
  .snow-canvas{ display: none; }
}
body.force-motion .snow-canvas{ display: block !important; }

/* Background logo watermark */
.bg-logo{
  position: fixed;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  width: min(70vw, 400px);
  height: auto;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

/* =========================
   Layout
   ========================= */

.wrap{
  min-block-size: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  z-index: 2; /* above frost vignette + snow */
  padding:
    calc(var(--pad) + env(safe-area-inset-top))
    var(--pad)
    calc(var(--pad) + env(safe-area-inset-bottom));
}

.app{
  width: min(100%, var(--maxw));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================
   Header
   ========================= */

.head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1{
  margin: 0;
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.3;
  overflow: visible;
  background: linear-gradient(135deg, var(--accent) 0%, var(--text) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 20px rgba(239,189,69,.25);
}

.brand{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tagline{
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(224,221,208,.58);
  line-height: 1.15;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.lang{
  display: flex;
  gap: 8px;
  align-items: center;
}

.langbtn{
  flex: 0 0 auto;
  width: 44px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(224,221,208,.16);
  color: var(--text);
  overflow: hidden;
  box-shadow: none;
}

.langbtn.active{
  border-color: rgba(239,189,69,.75);
  box-shadow: 0 0 0 3px rgba(239,189,69,.22);
}

/* =========================
   Surfaces
   ========================= */

.panel,
.card{
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-inner{ padding: var(--pad); }

/* =========================
   Forms
   ========================= */

.row{
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.col{
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 220px;
}

label{
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .2px;
  color: rgba(224,221,208,.92);
}

input[type="number"]{
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border2);
  background: rgba(0,0,0,.18);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  outline: none;
}

input[type="number"]:focus{
  border-color: rgba(239,189,69,.65);
  box-shadow: 0 0 0 4px rgba(239,189,69,.18);
}

/* =========================
   Buttons
   ========================= */

.btns{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button{
  appearance: none;
  border: none;
  border-radius: 18px;
  padding: 16px;
  min-height: 56px;
  font-size: clamp(16px, 4.4vw, 18px);
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  flex: 1 1 180px;
  white-space: normal;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0,0,0,.24);
  transition:
    transform .08s ease,
    filter .08s ease,
    background .15s ease,
    box-shadow .15s ease;
}

button:active{
  transform: translateY(1px) scale(.99);
  filter: brightness(1.03);
}

button:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.primary:disabled{
  background: rgba(255,255,255,.10);
  border-color: rgba(224,221,208,.18);
  color: rgba(224,221,208,.70);
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
}

.primary{
  background: linear-gradient(180deg, rgba(239,189,69,.98) 0%, rgba(210,155,40,.94) 100%);
  border-color: rgba(239,189,69,.55);
  color: var(--bg);
  box-shadow: 0 18px 45px rgba(0,0,0,.34);
}

/* Secondary in-content rules button */
.rulesbtn{
  flex: 1 1 180px;
  min-height: 50px;
  padding: 12px 14px;
  font-size: clamp(14px, 4.0vw, 16px);
  background: linear-gradient(180deg, rgba(45,53,74,.68) 0%, rgba(30,36,52,.72) 100%);
  border-color: rgba(239,189,69,.22);
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
}

#rulesBtn::before{
  content: "📜";
  margin-right: 10px;
}

.rulesbtn:active{
  background: linear-gradient(180deg, rgba(55,63,84,.78) 0%, rgba(40,46,62,.84) 100%);
}

/* Quick player buttons */
.quick{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quickbtn{
  flex: 1 1 64px;
  padding: 14px 0;
  min-height: 52px;
  font-size: 18px;
  font-weight: 950;
  border-radius: 18px;
  box-shadow: none;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}

.quickbtn.active{
  background: linear-gradient(180deg, rgba(239,189,69,.98) 0%, rgba(210,155,40,.94) 100%);
  border-color: rgba(239,189,69,.55);
  color: var(--bg);
}

/* Segmented control (difficulty) */
.seg{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.segbtn{
  flex: 1 1 120px;
  min-height: 52px;
  padding: 14px 10px;
  border-radius: 18px;
  box-shadow: none;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  font-weight: 950;
}

.segbtn.active{
  background: linear-gradient(180deg, rgba(239,189,69,.98) 0%, rgba(210,155,40,.94) 100%);
  border-color: rgba(239,189,69,.55);
  color: var(--bg);
}

/* Category chips */
.chips{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip{
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 950;
  box-shadow: none;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}

.chip.active{
  background: linear-gradient(180deg, rgba(239,189,69,.98) 0%, rgba(210,155,40,.94) 100%);
  border-color: rgba(239,189,69,.55);
  color: var(--bg);
}

.chip.banned{
  /* Reddish 'banned' state */
  background:
    linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(0,0,0,.18) 100%),
    var(--danger);
  border-color: rgba(255,255,255,.16);
  color: rgba(255,255,255,.94);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* If both classes ever exist, banned wins visually. */
.chip.active.banned{
  background:
    linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(0,0,0,.18) 100%),
    var(--danger);
  border-color: rgba(255,255,255,.16);
  color: rgba(255,255,255,.94);
}

/* Special logo chip (Kinojuha) */
.chip.logo{
  padding: 8px 12px;
  min-height: 44px;
}

.chip.logo img{
  display: block;
  height: 22px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.28));
}

.chip.logo.active img{ filter: none; }

.chip.logo.banned img{
  filter: grayscale(1) opacity(.75) drop-shadow(0 6px 12px rgba(0,0,0,.28));
}

/* =========================
   Toggle rows (settings)
   ========================= */

.toggle{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  cursor: pointer;
  user-select: none;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.toggle:last-of-type{ border-bottom: none; }

.toggle input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.toggle-name{
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: rgba(224,221,208,.88);
  flex: 1 1 auto;
  min-width: 0;
}

/* iOS-style switch */
.toggle-switch{
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
  transition: background .2s ease, border-color .2s ease;
}

.toggle-switch::after{
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(224,221,208,.9);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s ease, background .2s ease;
}

.toggle:active .toggle-switch::after{ transform: scale(.92); }

.toggle input:focus-visible ~ .toggle-switch{
  outline: none;
  box-shadow: 0 0 0 3px rgba(239,189,69,.3);
  border-color: rgba(239,189,69,.5);
}

.toggle input:checked ~ .toggle-switch{
  background: linear-gradient(180deg, #efbd45 0%, #d49b28 100%);
  border-color: rgba(239,189,69,.6);
}

.toggle input:checked ~ .toggle-switch::after{
  transform: translateX(18px);
  background: #fff;
}

.toggle:active input:checked ~ .toggle-switch::after{
  transform: translateX(18px) scale(.92);
}

.toggle input:checked ~ .toggle-name{ color: rgba(224,221,208,.98); }

/* Hide old pill element (kept for backward compatibility with older markup) */
.toggle-pill{ display: none; }
.toggle-ui{ display: contents; }

/* =========================
   Dealing UI
   ========================= */

.topline{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.player{
  font-size: clamp(20px, 5.0vw, 26px);
  font-weight: 950;
  letter-spacing: .2px;
}

.progress{
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.card-face{
  padding: 28px var(--pad);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: clamp(300px, 48vh, 480px);
  justify-content: center;
  text-align: center;
}

.card-title{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(224,221,208,.7);
  background: rgba(239,189,69,.08);
  border: 1px solid rgba(239,189,69,.2);
}

.card-main{
  font-size: clamp(32px, 8vw, 52px);
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1.1;
  word-break: break-word;
  color: var(--text);
}

.card-main.imposter{
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hintbox{
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(239,189,69,.18);
  background: rgba(239,189,69,.06);
  text-align: center;
}

.hintbox .label{
  font-size: 10px;
  color: rgba(224,221,208,.6);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 700;
}

.hintbox .value{
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .2px;
  color: rgba(239,189,69,.95);
  word-break: break-word;
}

/* Big tap CTA for Reveal / Close */
.tap{
  width: 100%;
  padding: 22px 18px;
  border-radius: 16px;
  border: 1px solid rgba(239,189,69,.5);
  background: linear-gradient(180deg, #efbd45 0%, #d49b28 100%);
  color: var(--bg);
  font-weight: 800;
  font-size: clamp(18px, 4.8vw, 24px);
  letter-spacing: .2px;
  box-shadow: 0 12px 32px rgba(0,0,0,.3), 0 0 0 1px rgba(239,189,69,.1) inset;
  position: relative;
  overflow: hidden;
  min-height: 64px;
  transition: transform .1s ease, box-shadow .1s ease;
}

.tap:active{
  transform: scale(.98);
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}

.tap::before{
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.2) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  border-radius: 16px 16px 0 0;
}

.tap::after{ content: ""; display: none; }

.passbtn{
  background: linear-gradient(180deg, rgba(45,53,74,.9) 0%, rgba(30,36,52,.95) 100%);
  border-color: rgba(239,189,69,.35);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.passbtn::before{
  background: linear-gradient(180deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 100%);
}

.passbtn:active{
  background: linear-gradient(180deg, rgba(55,63,84,.95) 0%, rgba(40,46,62,.98) 100%);
}

/* =========================
   Done screen
   ========================= */

.done-face{
  min-height: clamp(260px, 42vh, 440px);
  gap: 12px;
}

.done-title{
  font-size: clamp(26px, 6.4vw, 36px);
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--text) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.done-sub{
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 600;
  color: rgba(224,221,208,.6);
  line-height: 1.3;
}

.results-box{
  margin-top: 14px;
  padding: 16px 14px;
  border-radius: 16px;
  border: 1px solid rgba(239,189,69,.15);
  background: rgba(239,189,69,.04);
  text-align: center;
}

.result-item{ margin-bottom: 12px; }
.result-item:last-child{ margin-bottom: 0; }

.result-label{
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(224,221,208,.5);
  margin-bottom: 4px;
}

.result-value{
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  word-break: break-word;
}

.result-impostor{ color: #ff6b6b; }

/* =========================
   Footer
   ========================= */

.footer{
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 850;
  color: var(--muted2);
  padding: 10px;
  margin-top: 6px;
  user-select: none;
}

.footertext{
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.2;
  padding: 0 10px;
  /* Reserve equal space on both sides so text stays centered with right-side buttons */
  padding-left: 92px;
  padding-right: 92px;
  pointer-events: none;
  max-width: 100%;
}

.footerline{
  pointer-events: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.footerline.top{
  color: rgba(238,243,255,.66);
  font-weight: 950;
  letter-spacing: .04em;
}

.footactions{
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: flex;
  gap: 8px;
  align-items: center;
}

.footbtn{
  appearance: none;
  border: none;
  width: 36px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: none;
  opacity: .70;
  cursor: pointer;
  user-select: none;
  transition:
    transform .08s ease,
    filter .08s ease,
    opacity .15s ease,
    background .15s ease,
    box-shadow .15s ease;
}

.footbtn:active{
  transform: translateY(1px) scale(.99);
  filter: brightness(1.03);
}

.footbtn.active{
  opacity: 1;
  border-color: rgba(122,167,255,.75);
  box-shadow: 0 0 0 3px rgba(122,167,255,.18);
  background: rgba(255,255,255,.06);
}

@media (max-width: 380px){
  .footertext{ padding-left: 82px; padding-right: 82px; }
  .footbtn{ width: 34px; }
}

/* =========================
   Toast
   ========================= */

.toast{
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 999;
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(238,243,255,.92);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .2px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  user-select: none;
  text-align: center;
}

/* =========================
   Rules modal
   ========================= */

body.modal-open{ overflow: hidden; }

.modal{
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--pad) + env(safe-area-inset-top))
    var(--pad)
    calc(var(--pad) + env(safe-area-inset-bottom));
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-sheet{
  position: relative;
  width: min(100%, var(--maxw));
  max-height: min(84dvh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px var(--pad);
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, rgba(45,53,74,.55) 0%, rgba(45,53,74,.25) 100%);
}

.modal-title{
  font-size: 16px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(238,243,255,.86);
  overflow-wrap: anywhere;
}

.modal-close{
  flex: 0 0 auto;
  width: 38px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 12px;
  box-shadow: none;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(238,243,255,.92);
}

.modal-body{
  padding: var(--pad);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.rules{
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: rgba(224,221,208,.90);
  line-height: 1.35;
  font-size: 15px;
}

.rules h3{
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(239,189,69,.92);
}

.rules p{ margin: 0; color: rgba(224,221,208,.86); }

.rules ul,
.rules ol{
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rules li{ color: rgba(224,221,208,.86); }

.rules .note{
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(239,189,69,.18);
  background: rgba(239,189,69,.06);
  color: rgba(224,221,208,.88);
  font-weight: 650;
}

/* =========================
   Motion preferences
   ========================= */

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}

/*
  Force motion (override prefers-reduced-motion).
  Useful on systems that report reduced motion but you still want the app's
  background/boot animations.
*/
body.force-motion .boot-spinner{
  animation: boot-spin 0.9s linear infinite !important;
}

/* Restore key UI transitions even when reduced-motion disables transitions globally */
body.force-motion button{
  transition: transform .08s ease, filter .08s ease, background .15s ease, box-shadow .15s ease !important;
}

body.force-motion .toggle-switch{
  transition: background .2s ease, border-color .2s ease !important;
}

body.force-motion .toggle-switch::after{
  transition: transform .2s ease, background .2s ease !important;
}

body.force-motion .tap{
  transition: transform .1s ease, box-shadow .1s ease !important;
}

body.force-motion .footbtn{
  transition: transform .08s ease, filter .08s ease, opacity .15s ease, background .15s ease, box-shadow .15s ease !important;
}
