:root {
  --ink: #18251f;
  --muted: #67736c;
  --paper: #f6f3eb;
  --surface: #ffffff;
  --surface-soft: #eeeee5;
  --line: #dfe2d9;
  --green: #123f32;
  --green-2: #1d5b47;
  --green-3: #dcebe3;
  --orange: #f47b3f;
  --orange-dark: #d85c25;
  --yellow: #f4c95d;
  --red: #bb413f;
  --blue: #356e81;
  --shadow-sm: 0 8px 28px rgba(25, 46, 37, .08);
  --shadow-lg: 0 28px 80px rgba(14, 42, 32, .18);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 32px;
  --max: 1180px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(244, 123, 63, .35); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.035em; }
h1 { font-size: clamp(2.35rem, 7vw, 5rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2.25rem); }
h3 { font-size: 1.08rem; }
p { color: var(--muted); }

.app-shell, .spectator-shell { min-height: 100vh; }
.app-shell { padding-bottom: calc(76px + var(--safe-bottom)); }
.app-shell.has-action-dock { padding-bottom: calc(154px + var(--safe-bottom)); }
.page { width: min(100% - 28px, var(--max)); margin: 0 auto; padding: 28px 0 56px; }
.page--spectator { width: min(100% - 24px, 920px); padding-top: 20px; }

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 68px;
  padding: 10px max(18px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid rgba(24, 37, 31, .08);
  background: rgba(246, 243, 235, .92);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; padding: 4px; border: 0; background: none; font-weight: 850; font-size: 1.03rem; letter-spacing: -.025em; cursor: pointer; }
.brand--static { cursor: default; }
.logo-mark { position: relative; display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 11px; background: var(--green); transform: rotate(-4deg); box-shadow: 0 5px 15px rgba(18, 63, 50, .2); }
.logo-mark::before { content: "A"; color: #fff; font-family: Georgia, serif; font-weight: 900; font-size: 1.12rem; transform: rotate(4deg); }
.logo-mark i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--orange); }
.logo-mark i:nth-child(1) { top: 5px; left: 6px; }
.logo-mark i:nth-child(2) { right: 6px; bottom: 6px; }
.logo-mark i:nth-child(3) { right: 5px; top: 8px; background: var(--yellow); }
.desktop-nav { display: none; }
.profile-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 148px; padding: 6px 10px 6px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 750; font-size: .82rem; cursor: pointer; box-shadow: var(--shadow-sm); }
.profile-chip > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-exit { color: var(--muted); }
.avatar-mini { display: inline-grid; width: 29px; height: 29px; place-items: center; flex: none; border-radius: 50%; background: var(--surface-soft); font-size: 1.05rem; }

.mobile-nav {
  position: fixed;
  z-index: 45;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 10px calc(7px + var(--safe-bottom));
  border-top: 1px solid rgba(24, 37, 31, .1);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
}
.nav-item { display: grid; min-height: 55px; place-items: center; gap: 0; border: 0; border-radius: 14px; background: none; color: var(--muted); cursor: pointer; }
.nav-item > span { font-size: 1.2rem; line-height: 1; }
.nav-item small { font-size: .7rem; font-weight: 750; }
.nav-item.is-active { color: var(--green); background: var(--green-3); }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid transparent; border-radius: 999px; font-weight: 820; line-height: 1.1; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button--primary { color: #fff; background: var(--green); box-shadow: 0 10px 24px rgba(18, 63, 50, .2); }
.button--primary:hover:not(:disabled) { background: var(--green-2); }
.button--accent { color: #26170f; background: var(--orange); box-shadow: 0 10px 25px rgba(244, 123, 63, .26); }
.button--accent:hover:not(:disabled) { background: #ff8c51; }
.button--secondary { border-color: var(--line); background: var(--surface); }
.button--secondary:hover:not(:disabled) { border-color: #bac3ba; box-shadow: var(--shadow-sm); }
.button--ghost { border-color: rgba(24, 37, 31, .14); background: transparent; }
.button--glass { color: #fff; border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.1); backdrop-filter: blur(12px); }
.button--danger { color: #fff; background: var(--red); }
.button--danger-quiet { color: var(--red); border-color: transparent; background: transparent; }
.button--large { min-height: 52px; padding-inline: 23px; }
.button--compact { min-height: 36px; padding: 8px 14px; font-size: .83rem; }
.button--full { width: 100%; }
.text-button { padding: 6px; border: 0; background: none; color: var(--green-2); font-weight: 820; cursor: pointer; }

.eyebrow { display: inline-block; margin-bottom: 8px; color: var(--green-2); font-size: .73rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow--light { color: #c9e7d8; }
.muted { color: var(--muted); }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.compact-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.compact-panel h3, .compact-panel p { margin-bottom: 0; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2, .panel-heading h3, .panel-heading p { margin-bottom: 0; }
.panel-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; background: var(--green-3); color: var(--green); font-size: 1.25rem; }
.panel-empty { margin: 16px 0 0; padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius-sm); text-align: center; }
.panel-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: .88rem; }
.count-badge { padding: 5px 10px; border-radius: 999px; background: var(--surface-soft); font-size: .76rem; font-weight: 850; }

.hero { position: relative; display: grid; min-height: 500px; align-items: center; overflow: hidden; margin-bottom: 50px; padding: 42px 28px; border-radius: var(--radius-lg); color: #fff; background: radial-gradient(circle at 86% 10%, rgba(244,201,93,.24), transparent 30%), linear-gradient(135deg, #0e3a2d, #195945 64%, #0d372b); box-shadow: var(--shadow-lg); }
.hero::after { content: ""; position: absolute; right: -16%; bottom: -45%; width: 530px; height: 530px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.hero-copy { position: relative; z-index: 2; max-width: 690px; }
.hero h1 { max-width: 720px; margin-bottom: 22px; }
.hero p { max-width: 610px; margin-bottom: 28px; color: rgba(255,255,255,.74); font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-visual { display: none; }
.section { margin-bottom: 48px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; }
.game-grid { display: grid; gap: 14px; }
.game-card { display: grid; gap: 18px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.game-card__head, .game-card__body, .game-card__foot { display: flex; align-items: center; gap: 12px; }
.game-card__head { align-items: flex-start; justify-content: space-between; }
.game-card h3 { margin-bottom: 5px; }
.game-card p { margin-bottom: 0; font-size: .85rem; }
.game-card__body { color: var(--muted); font-size: .82rem; }
.game-card__foot { flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.game-card__foot .button, .game-card__foot > .muted { margin-left: auto; }
.game-time { color: var(--muted); font-size: .78rem; }
.avatar-stack { display: flex; align-items: center; padding-left: 6px; }
.avatar-stack > span { display: grid; width: 31px; height: 31px; margin-left: -6px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--surface-soft); font-size: 1rem; }
.status-badge, .role-pill, .dealer-chip, .winner-chip, .live-dot { display: inline-flex; width: max-content; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: .69rem; font-weight: 900; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.status-badge--lobby { color: #8b4c0a; background: #fff0cf; }
.status-badge--in_progress { color: #176144; background: #dff2e7; }
.status-badge--finished { color: #56615a; background: #e9ece9; }
.role-pill--host { color: #fff; background: var(--green); }
.role-pill--host_recovery { color: #7b3b19; background: #ffe2d2; }
.role-pill--player { color: #195b70; background: #dceef3; }
.role-pill--spectator { color: #644b0c; background: #f9e9af; }
.role-pill--visitor { color: #59615d; background: var(--surface-soft); }
.feature-strip { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.feature-strip article { padding: 24px; }
.feature-strip article + article { border-top: 1px solid var(--line); }
.feature-strip article > span { color: var(--orange-dark); font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.feature-strip h3 { margin: 10px 0 8px; }
.feature-strip p { margin: 0; font-size: .9rem; }

.page-intro { display: flex; flex-direction: column; gap: 16px; margin: 20px 0 30px; }
.page-intro h1 { margin-bottom: 12px; }
.page-intro p { max-width: 680px; }
.standard-layout { display: grid; gap: 20px; }
.loading-card { display: flex; min-height: 130px; align-items: center; justify-content: center; gap: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.loading-ring { width: 22px; height: 22px; border: 3px solid var(--green-3); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.empty-card { display: grid; min-height: 230px; place-items: center; align-content: center; padding: 28px; border: 1px dashed #cbd1c9; border-radius: var(--radius); background: rgba(255,255,255,.58); text-align: center; }
.empty-card h2 { margin: 10px 0 7px; }
.empty-card p { max-width: 430px; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 16px; background: var(--green-3); color: var(--green); font-size: 1.4rem; }

.auth-layout, .create-layout { display: grid; gap: 24px; align-items: center; min-height: calc(100vh - 150px); }
.auth-art, .create-intro { padding: 20px 4px; }
.auth-art h1, .create-intro h1 { margin-bottom: 18px; }
.auth-art p, .create-intro p { max-width: 570px; font-size: 1.03rem; }
.auth-panel, .create-form { width: 100%; max-width: 540px; margin: 0 auto; padding: 18px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 20px; padding: 4px; border-radius: 999px; background: var(--surface-soft); }
.auth-tabs button { min-height: 42px; border: 0; border-radius: 999px; background: transparent; font-weight: 800; cursor: pointer; }
.auth-tabs button.is-active { background: var(--surface); box-shadow: 0 4px 12px rgba(24,37,31,.08); }
.auth-form, .create-form { display: grid; gap: 17px; }
.field { display: grid; gap: 7px; color: var(--ink); font-size: .86rem; font-weight: 760; }
.field small { color: var(--muted); font-weight: 500; }
.field--inline { grid-template-columns: 1fr; margin-top: 18px; }
.input { width: 100%; min-height: 49px; padding: 11px 13px; border: 1px solid #cfd5ce; border-radius: var(--radius-sm); background: #fff; color: var(--ink); outline: 0; transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(29,91,71,.1); }
.form-note { margin: 0; font-size: .82rem; text-align: center; }
.avatar-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.avatar-choice { display: grid; aspect-ratio: 1; min-width: 0; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); font-size: 1.35rem; cursor: pointer; }
.avatar-choice.is-selected { border-color: var(--orange); background: #fff1e9; box-shadow: 0 0 0 2px rgba(244,123,63,.2); transform: scale(1.05); }
.floating-cards { display: flex; gap: 12px; margin-top: 30px; }
.floating-cards span { display: grid; width: 60px; height: 78px; place-items: center; border-radius: 11px; background: #fff; color: var(--red); font-family: Georgia, serif; font-size: 1.6rem; box-shadow: var(--shadow-sm); transform: rotate(-6deg); }
.floating-cards span:nth-child(2) { color: var(--green); transform: translateY(8px) rotate(3deg); }
.floating-cards span:nth-child(3) { transform: rotate(9deg); }
.check-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.check-card input, .phase-check input { position: absolute; opacity: 0; pointer-events: none; }
.check-ui { display: grid; width: 24px; height: 24px; place-items: center; flex: none; border: 2px solid #aeb7ae; border-radius: 8px; background: #fff; }
.check-card input:checked + .check-ui, .phase-check input:checked + .check-ui { border-color: var(--green); background: var(--green); }
.check-card input:checked + .check-ui::after, .phase-check input:checked + .check-ui::after { content: "✓"; color: #fff; font-size: .8rem; font-weight: 900; }
.check-card strong, .check-card small { display: block; }
.check-card small { color: var(--muted); font-size: .78rem; }
.check-list { display: grid; gap: 10px; margin: 25px 0 0; padding: 0; list-style: none; color: var(--green); font-weight: 760; }
.check-list li::before { content: "✓"; margin-right: 10px; color: var(--orange-dark); }

.lobby-layout, .game-layout, .rules-layout, .results-layout { display: grid; gap: 18px; }
.lobby-hero, .player-hero, .winner-hero, .rules-hero, .spectator-hero { position: relative; overflow: hidden; padding: 30px 24px; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(135deg, var(--green), var(--green-2)); box-shadow: var(--shadow-lg); }
.lobby-hero { display: grid; gap: 24px; align-items: center; }
.lobby-hero h1, .player-hero h1, .winner-hero h1, .rules-hero h1, .spectator-hero h1 { margin-bottom: 12px; font-size: clamp(2.1rem, 6vw, 4rem); }
.lobby-hero p, .player-hero p, .winner-hero p, .rules-hero p, .spectator-hero p { max-width: 650px; margin-bottom: 0; color: rgba(255,255,255,.72); }
.lobby-count { display: grid; min-width: 145px; padding: 18px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); background: rgba(255,255,255,.1); backdrop-filter: blur(10px); }
.lobby-count strong { font-size: 2.5rem; line-height: 1; }
.lobby-count span { font-weight: 800; }
.lobby-count small { margin-top: 6px; color: #c9e7d8; }
.lobby-columns, .game-columns { display: grid; gap: 18px; }
.lobby-side { display: grid; gap: 18px; align-content: start; }
.roster { display: grid; gap: 8px; }
.roster-person { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fafbf8; }
.roster-person.is-you { border-color: #a8cbbb; background: #f1f8f4; }
.person-avatar { display: grid; width: 40px; height: 40px; place-items: center; flex: none; border-radius: 13px; background: var(--surface-soft); font-size: 1.3rem; }
.seat-number { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: .7rem; font-weight: 900; }
.person-name { min-width: 0; }
.person-name strong, .person-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name small { color: var(--muted); font-size: .74rem; }
.dealer-chip { color: #6b4900; background: #fff0bc; }
.roster-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 5px; padding-top: 7px; border-top: 1px solid var(--line); }
.icon-control { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 1.05rem; font-weight: 850; cursor: pointer; }
.icon-control:disabled { opacity: .35; cursor: not-allowed; }
.icon-control--danger { color: var(--red); }
.invite-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.invite-card:first-of-type { border-top: 0; }
.invite-card .button { grid-column: 2; justify-self: start; }
.invite-card h3 { margin: 0 0 4px; }
.invite-card p { margin: 0; font-size: .82rem; }
.invite-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: #ffe5d8; color: var(--orange-dark); font-size: 1.15rem; }
.invite-card--watch .invite-icon { color: #725611; background: #fbecba; }
.waiting-panel { display: grid; place-items: center; padding: 32px; text-align: center; }
.waiting-pulse { width: 18px; height: 18px; margin-bottom: 18px; border: 5px solid #cde1d7; border-radius: 50%; box-shadow: 0 0 0 0 rgba(29,91,71,.3); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 15px rgba(29,91,71,0); } }
.watching-list { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: .8rem; }
.watcher-chip { padding: 6px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--ink); font-weight: 740; }
.lobby-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 0; }
.lobby-actions p { flex-basis: 100%; margin: 0; font-size: .82rem; }

.join-layout, .recovery-layout, .invite-layout { display: grid; min-height: calc(100vh - 180px); place-items: center; }
.join-card, .invite-accept { width: min(100%, 560px); padding: 30px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; }
.join-card h1, .invite-accept h1 { margin: 18px 0 10px; font-size: clamp(2rem, 7vw, 3.5rem); }
.join-card .avatar-stack { justify-content: center; margin: 24px 0 10px; }
.join-card > strong { display: block; margin-bottom: 18px; }
.join-card > small { display: block; margin-top: 12px; color: var(--muted); }
.join-roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-bottom: 24px; }
.join-roster span { padding: 6px 10px; border-radius: 999px; background: var(--surface-soft); font-size: .82rem; }
.recovery-panel { width: min(100%, 500px); padding: 28px; text-align: center; }
.recovery-icon, .invite-accept__icon { display: grid; width: 64px; height: 64px; margin: 0 auto 18px; place-items: center; border-radius: 20px; background: var(--green-3); font-size: 1.8rem; }
.identity-preview { display: flex; align-items: center; gap: 12px; margin: 22px 0; padding: 14px; border-radius: 15px; background: var(--surface-soft); text-align: left; }
.identity-preview > span { font-size: 2rem; }
.identity-preview strong, .identity-preview small { display: block; }
.identity-preview small { color: var(--muted); }
.invite-accept--watch .invite-accept__icon { background: #fbecba; color: #71550d; }

.dealer-banner { display: flex; align-items: center; gap: 13px; padding: 15px 17px; border-radius: var(--radius); color: #fff; background: var(--green); box-shadow: var(--shadow-sm); }
.dealer-banner > div { display: grid; min-width: 0; flex: 1; }
.dealer-banner span { color: #c9e7d8; font-size: .76rem; }
.dealer-banner strong { overflow: hidden; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.dealer-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; background: rgba(255,255,255,.12); color: #fff !important; font-size: 1.35rem !important; }
.live-dot { color: #164f3b !important; background: #dff2e7; }
.live-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #2f9b69; }
.player-hero { display: grid; gap: 25px; background: radial-gradient(circle at 90% 20%, rgba(244,201,93,.24), transparent 35%), linear-gradient(135deg, #123f32, #1d5b47); }
.player-hero .progress-track { max-width: 560px; margin-top: 15px; background: rgba(255,255,255,.18); }
.big-score { display: grid; align-content: center; justify-items: start; min-width: 150px; }
.big-score strong { font-size: 3.5rem; line-height: 1; }
.big-score span { color: #c9e7d8; }
.standings { display: grid; gap: 8px; }
.standing-row { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; gap: 10px; align-items: center; min-height: 70px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: #fafbf8; }
.standing-row.is-highlighted { border-color: #94c4ad; background: #edf7f2; box-shadow: inset 4px 0 0 var(--green-2); }
.standing-place { width: 20px; color: var(--muted); font-weight: 900; text-align: center; }
.standing-person { min-width: 0; }
.standing-person strong, .standing-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standing-person small { margin: 2px 0 7px; color: var(--muted); font-size: .73rem; }
.standing-score { display: grid; justify-items: end; }
.standing-score strong { font-size: 1.15rem; }
.standing-score small { color: var(--muted); font-size: .68rem; }
.progress-track { height: 5px; overflow: hidden; border-radius: 999px; background: #e2e6e1; }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.progress-fill--0 { width: 0; }
.progress-fill--1 { width: 9.091%; }
.progress-fill--2 { width: 18.182%; }
.progress-fill--3 { width: 27.273%; }
.progress-fill--4 { width: 36.364%; }
.progress-fill--5 { width: 45.455%; }
.progress-fill--6 { width: 54.545%; }
.progress-fill--7 { width: 63.636%; }
.progress-fill--8 { width: 72.727%; }
.progress-fill--9 { width: 81.818%; }
.progress-fill--10 { width: 90.909%; }
.progress-fill--11 { width: 100%; }
.round-history { display: grid; gap: 8px; }
.round-history details { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fafbf8; }
.round-history summary { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 13px; cursor: pointer; list-style: none; }
.round-history summary::-webkit-details-marker { display: none; }
.round-history summary span { color: var(--green-2); font-size: .78rem; font-weight: 900; }
.round-history summary strong { font-size: .88rem; }
.round-history summary small { color: var(--muted); font-size: .72rem; }
.round-detail { display: grid; padding: 0 13px 12px; }
.round-detail > div { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .76rem; }
.round-detail > div span:nth-child(2) { color: var(--muted); }
.action-dock { position: fixed; z-index: 44; right: 10px; bottom: calc(72px + var(--safe-bottom)); left: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 17px; border: 1px solid rgba(255,255,255,.13); border-radius: 22px; color: #fff; background: rgba(18,63,50,.96); box-shadow: 0 18px 50px rgba(18,63,50,.34); backdrop-filter: blur(18px); }
.action-dock > div { display: grid; min-width: 0; }
.action-dock span { color: #c9e7d8; font-size: .7rem; }
.action-dock strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spectator-shell { padding-bottom: 0; background: #0e352b; }
.spectator-bar { display: flex; min-height: 64px; align-items: center; gap: 12px; padding: 10px max(14px, calc((100vw - 920px) / 2)); color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.spectator-bar .role-pill { margin-left: auto; }
.spectator-layout { display: grid; gap: 16px; }
.spectator-hero { box-shadow: none; background: radial-gradient(circle at 90% 10%, rgba(244,201,93,.25), transparent 30%), #174c3c; }
.spectator-board { overflow: hidden; padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.spectator-board__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 7px 5px 16px; }
.spectator-board__head h2 { margin: 7px 0 0; }
.spectator-board__head > span { color: var(--muted); font-size: .72rem; }
.spectator-shell .watching-list { color: rgba(255,255,255,.65); }
.spectator-shell .watcher-chip { background: rgba(255,255,255,.1); color: #fff; }
.spectator-footer { display: flex; justify-content: space-between; gap: 12px; width: min(100% - 24px, 920px); margin: 0 auto; padding: 22px 0 calc(22px + var(--safe-bottom)); color: rgba(255,255,255,.55); font-size: .72rem; }

.dialog-overlay { position: fixed; z-index: 100; inset: 0; display: grid; align-items: end; justify-items: center; padding: 10px; background: rgba(9,26,20,.68); backdrop-filter: blur(8px); }
.dialog { width: min(100%, 520px); max-height: min(90vh, 900px); overflow: auto; border-radius: 26px 26px 18px 18px; background: var(--surface); box-shadow: 0 30px 100px rgba(0,0,0,.32); }
.dialog--wide { width: min(100%, 760px); }
.dialog--full { width: min(100%, 820px); height: min(95vh, 940px); max-height: none; }
.modal-open { overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dialog-head h2 { margin: 0; }
.sticky-head { position: sticky; z-index: 4; top: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.confirm-dialog, .dealer-confirm { padding: 30px 24px; text-align: center; }
.confirm-icon, .dealer-confirm__icon { display: grid; width: 62px; height: 62px; margin: 0 auto 18px; place-items: center; border-radius: 20px; color: var(--green); background: var(--green-3); font-size: 1.7rem; font-weight: 900; }
.confirm-icon.is-danger { color: var(--red); background: #fbe4e3; }
.confirm-dialog p, .dealer-confirm p { max-width: 430px; margin-inline: auto; }
.confirm-dialog .dialog-actions { justify-content: center; }
.rules-editor { padding-bottom: 18px; }
.rules-editor > p { padding: 0 20px; }
.rules-editor > .dialog-actions { padding: 0 20px; }
.phase-editor { display: grid; gap: 7px; margin: 18px 0; padding: 0 20px; list-style: none; }
.phase-editor li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 13px; }
.phase-editor li > div { display: flex; gap: 4px; }
.phase-number { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: #fff; background: var(--green); font-size: .74rem; font-weight: 900; }
.round-sheet { min-height: 100%; padding-bottom: 24px; }
.sheet-step { padding: 21px; border-bottom: 1px solid var(--line); }
.step-heading { display: flex; gap: 12px; margin-bottom: 16px; }
.step-heading > span { display: grid; width: 30px; height: 30px; place-items: center; flex: none; border-radius: 10px; color: #fff; background: var(--green); font-size: .8rem; font-weight: 900; }
.step-heading h3, .step-heading p { margin-bottom: 2px; }
.step-heading p { font-size: .82rem; }
.went-out-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.went-out-button { display: grid; min-height: 82px; place-items: center; gap: 4px; padding: 9px; border: 1px solid var(--line); border-radius: 15px; background: #fafbf8; cursor: pointer; }
.went-out-button span { font-size: 1.6rem; }
.went-out-button strong { max-width: 100%; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.went-out-button.is-selected { color: #fff; border-color: var(--green); background: var(--green); box-shadow: 0 8px 20px rgba(18,63,50,.2); }
.score-people { display: grid; gap: 10px; }
.score-person { display: grid; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: #fafbf8; }
.score-person.is-out { grid-template-columns: auto 1fr auto; align-items: center; background: #edf7f2; }
.score-person.is-out small, .score-person.is-out strong { display: block; }
.score-person.is-out small { color: var(--muted); }
.score-person__head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.score-person__head strong, .score-person__head small { display: block; }
.score-person__head small { color: var(--muted); font-size: .72rem; }
.points-label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .74rem; }
.score-input { width: 70px; height: 45px; padding: 5px; border: 1px solid #bdc6bd; border-radius: 11px; background: #fff; color: var(--ink); font-size: 1.1rem; font-weight: 850; text-align: center; }
.score-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.score-chip { min-height: 38px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--green-2); font-size: .78rem; font-weight: 900; cursor: pointer; }
.phase-check { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: .82rem; font-weight: 760; cursor: pointer; }
.sheet-save { position: sticky; bottom: 0; padding: 14px 20px max(14px, var(--safe-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); }

.winner-hero { text-align: center; background: radial-gradient(circle at 50% 0, rgba(244,201,93,.24), transparent 40%), var(--green); }
.winner-symbol { display: grid; width: 64px; height: 64px; margin: 0 auto 18px; place-items: center; border-radius: 21px; color: var(--green); background: var(--yellow); font-size: 1.6rem; }
.winner-hero p { margin-inline: auto; }
.final-standings { display: grid; gap: 9px; }
.final-standings article { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: #fafbf8; }
.final-standings article.is-winner { border-color: #e4c361; background: #fff9e7; box-shadow: inset 4px 0 0 var(--yellow); }
.final-place { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 9px; background: var(--surface-soft); font-size: .75rem; font-weight: 900; }
.final-standings strong, .final-standings small { display: block; }
.final-standings small { color: var(--muted); font-size: .72rem; }
.final-standings article > b { font-size: .86rem; }
.winner-chip { grid-column: 3 / -1; justify-self: start; color: #6f4d00; background: #ffe79f; }
.history-grid { display: grid; gap: 10px; }
.history-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.history-card h3, .history-card p { margin-bottom: 3px; }
.history-card p, .history-card small { color: var(--muted); font-size: .78rem; }
.history-symbol { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #6c4b00; background: #fff0bc; }

.rules-hero { background: radial-gradient(circle at 85% 5%, rgba(244,123,63,.2), transparent 32%), var(--green); }
.rule-cards, .rules-columns { display: grid; gap: 14px; }
.rule-cards article { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rule-cards article > span { color: var(--orange-dark); font-size: .72rem; font-weight: 900; }
.rule-cards h2 { margin: 12px 0 8px; font-size: 1.25rem; }
.rule-cards p { margin: 0; font-size: .88rem; }
.score-key { display: grid; gap: 8px; }
.score-key > div { display: flex; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-soft); }
.phase-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.phase-list li { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.phase-list li:last-child { border-bottom: 0; }
.phase-list span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: #fff; background: var(--green); font-size: .72rem; font-weight: 900; }

.toast-host { position: fixed; z-index: 200; right: 12px; bottom: calc(88px + var(--safe-bottom)); left: 12px; display: grid; justify-items: center; pointer-events: none; }
.toast { max-width: 540px; padding: 12px 16px; border-radius: 999px; color: #fff; background: #263a31; box-shadow: 0 15px 40px rgba(0,0,0,.25); font-weight: 760; font-size: .86rem; opacity: 0; transform: translateY(12px); transition: opacity .18s, transform .18s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--error { background: var(--red); }
.toast--success { background: var(--green-2); }
.boot-screen { display: grid; min-height: 100vh; place-items: center; align-content: center; gap: 12px; background: var(--paper); }
.boot-screen .logo-mark { width: 54px; height: 54px; border-radius: 17px; }
.boot-screen .logo-mark::before { font-size: 1.7rem; }
.boot-screen .loading-card { min-height: 50px; border: 0; background: transparent; }

@media (min-width: 620px) {
  .page { width: min(100% - 48px, var(--max)); padding-top: 38px; }
  .hero { padding: 55px 48px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-strip { grid-template-columns: repeat(3, 1fr); }
  .feature-strip article + article { border-top: 0; border-left: 1px solid var(--line); }
  .page-intro { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .page-intro .button { flex: none; }
  .auth-panel, .create-form { padding: 28px; }
  .avatar-picker { grid-template-columns: repeat(10, 1fr); }
  .lobby-hero, .player-hero { grid-template-columns: 1fr auto; padding: 38px; }
  .roster-person { grid-template-columns: auto auto minmax(0,1fr) auto auto; }
  .roster-actions { grid-column: auto; padding-top: 0; border-top: 0; }
  .field--inline { grid-template-columns: 130px 1fr; align-items: center; }
  .went-out-grid { grid-template-columns: repeat(4, 1fr); }
  .dialog-overlay { align-items: center; padding: 24px; }
  .dialog { border-radius: 26px; }
  .rule-cards { grid-template-columns: repeat(3, 1fr); }
  .winner-chip { grid-column: auto; }
  .final-standings article { grid-template-columns: auto auto minmax(0,1fr) auto auto; }
}

@media (min-width: 900px) {
  .app-shell { padding-bottom: 0; }
  .app-shell.has-action-dock { padding-bottom: 100px; }
  .topbar { grid-template-columns: 1fr auto 1fr; min-height: 76px; }
  .topbar > :last-child { justify-self: end; }
  .desktop-nav { display: flex; align-items: center; gap: 3px; padding: 4px; border-radius: 999px; background: rgba(24,37,31,.055); }
  .desktop-nav button { min-height: 38px; padding: 7px 15px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: .82rem; font-weight: 780; cursor: pointer; }
  .desktop-nav button.is-active { color: var(--green); background: #fff; box-shadow: 0 5px 15px rgba(24,37,31,.08); }
  .mobile-nav { display: none; }
  .hero { grid-template-columns: 1.35fr .65fr; min-height: 560px; padding: 70px 65px; }
  .hero-visual { position: relative; z-index: 2; display: grid; min-height: 360px; place-items: center; }
  .score-peek { width: 290px; padding: 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 25px; background: rgba(255,255,255,.11); box-shadow: 0 30px 60px rgba(0,0,0,.2); backdrop-filter: blur(18px); transform: rotate(4deg); }
  .score-peek > span { color: #c9e7d8; font-size: .68rem; font-weight: 900; letter-spacing: .12em; }
  .score-peek > strong { display: block; margin: 5px 0 18px; font-size: 1.25rem; }
  .score-peek > div { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; margin-top: 8px; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.1); }
  .score-peek i { font-style: normal; font-size: 1.4rem; }
  .score-peek b { font-size: .82rem; }
  .score-peek em { color: #c9e7d8; font-size: .72rem; font-style: normal; }
  .orbit { position: absolute; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
  .orbit--one { width: 360px; height: 360px; }
  .orbit--two { width: 450px; height: 450px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-layout, .create-layout { grid-template-columns: 1fr minmax(430px, .75fr); gap: 70px; }
  .lobby-columns { grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); }
  .game-columns { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); }
  .action-dock { right: max(24px, calc((100vw - 780px) / 2)); bottom: 22px; left: max(24px, calc((100vw - 780px) / 2)); }
  .spectator-bar { padding-block: 14px; }
  .spectator-hero { padding: 42px; }
  .spectator-board { padding: 22px; }
  .rules-columns { grid-template-columns: .8fr 1.2fr; }
}

@media (min-width: 1180px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-layout .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  .topbar { padding-inline: 13px; }
  .brand > span:last-child { display: none; }
  .profile-chip { max-width: 132px; }
  .page { width: min(100% - 20px, var(--max)); }
  .hero { min-height: 460px; padding: 33px 22px; border-radius: 25px; }
  .hero h1 { font-size: 2.8rem; }
  .hero-actions .button { width: 100%; }
  .panel { padding: 16px; }
  .compact-panel { align-items: flex-start; flex-direction: column; }
  .lobby-hero, .player-hero, .winner-hero, .rules-hero, .spectator-hero { border-radius: 24px; }
  .game-card__foot .button { width: 100%; margin-left: 0; }
  .game-card__foot > .muted { margin-left: 0; }
  .roster-person { grid-template-columns: auto auto minmax(0,1fr); }
  .roster-person .dealer-chip { grid-column: 3; }
  .history-card { grid-template-columns: auto minmax(0,1fr); }
  .history-card .button { grid-column: 1 / -1; }
  .standing-row { grid-template-columns: auto auto minmax(0,1fr); }
  .dealer-banner--host { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .dealer-banner--host strong { white-space: normal; line-height: 1.15; }
  .dealer-banner--host > .button { grid-column: 1 / -1; width: 100%; }
  .standing-score { grid-column: 3; justify-items: start; padding-left: 2px; }
  .round-history summary { grid-template-columns: auto 1fr; }
  .round-history summary small { grid-column: 2; }
  .round-detail > div { grid-template-columns: 1fr auto; }
  .round-detail > div span:nth-child(2) { grid-column: 1; }
  .final-standings article { grid-template-columns: auto auto minmax(0,1fr); }
  .final-standings article > b { grid-column: 3; }
  .winner-chip { grid-column: 3; }
  .action-dock .button { padding-inline: 16px; }
  .action-dock > div { max-width: 45%; }
  .spectator-footer { flex-direction: column; }
  .phase-editor { padding-inline: 12px; }
  .phase-editor li { grid-template-columns: auto 1fr; }
  .phase-editor li > div { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
