/* Konsep: meja kartu dilihat dari atas. Felt hijau, tulisan cetak melengkung, juara dibagikan sebagai kartu. */
:root {
  color-scheme: dark;
  --felt: #0d3b2e;
  --felt-deep: #072119;
  --felt-lift: #15523f;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --line: rgba(240, 232, 210, 0.14);
  --text: #eff1e7;
  --muted: #a9c2b3;
  --brass: #e6b957;
  --brass-deep: #b98a2b;
  --win: #84e3aa;
  --loss: #ffa097;
  --bone: #f6f1e4;
  --ink: #1b211e;
  --ink-soft: #5b6660;
  --red: #c8282f;
  --sheet: #0f3226;

  --display: 'Gloock', 'Times New Roman', serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --card-w: clamp(116px, 34vw, 176px);
  --fan: 0%;
  --dock-h: 80px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--felt-deep); -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body:has(dialog[open]) .dock { visibility: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font: 400 16px/1.5 var(--body);
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 65% 0%, var(--felt-lift), var(--felt) 45%, var(--felt-deep) 100%);
}

h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
h1, h2 { font-family: var(--display); font-weight: 400; text-wrap: balance; }
h2 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: transform 120ms var(--ease), filter 120ms var(--ease), opacity 120ms;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary {
  color: #2a1e05;
  background: linear-gradient(180deg, #f0c86c, var(--brass) 45%, var(--brass-deep));
  box-shadow: 0 8px 24px -8px rgba(230, 185, 87, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn--ghost { background: var(--surface); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-strong); }
.btn--wide { width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding-block: 8px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: rgba(7, 33, 25, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-size: 1.375rem; color: var(--brass); }
.brand--dark { color: var(--brass-deep); }
.topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-cta { display: none; min-height: 40px; }
.topbar-me { display: block; max-width: 45vw; min-height: 40px; padding: 0 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page {
  display: grid;
  gap: 64px;
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-top: 32px;
  padding-bottom: calc(var(--dock-h) + 48px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page > section { min-width: 0; }

.dock {
  position: fixed;
  inset: auto 0 0;
  z-index: 5;
  padding-top: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(180deg, transparent, var(--felt-deep) 40%);
}

/* Hero */
.hero { display: grid; gap: 32px; align-items: center; }
.eyebrow { color: var(--brass); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.hero h1 { margin-top: 8px; font-size: clamp(2.5rem, 8vw, 4.25rem); line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.hero-name { color: var(--brass); }
.hero-sub { margin-top: 16px; max-width: 42ch; color: var(--muted); font-size: 1.125rem; }
.hero .tabs { margin-top: 24px; }
.hero-amount { margin-top: 12px; font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 700; letter-spacing: -0.01em; color: var(--win); font-variant-numeric: tabular-nums; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 16px 32px; margin-top: 24px; }
.hero-stats dt { color: var(--muted); font-size: 0.8125rem; }
.hero-stats dd { font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.hand-wrap { position: relative; min-height: calc(var(--card-w) * 2.2); max-width: 560px; width: 100%; margin-inline: auto; overflow: hidden; }
.felt-arc { position: absolute; top: 0; left: 0; width: 100%; }
.felt-arc text { fill: var(--brass); opacity: 0.6; font: 400 19px var(--display); letter-spacing: 0.1em; }
.felt-rule { stroke: var(--brass); stroke-opacity: 0.32; stroke-width: 1.5; }
.hand { position: absolute; inset: auto 0 24px; height: calc(var(--card-w) * 1.4 + 24px); }

.card {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(160deg, #fffaf0, var(--bone) 60%, #e9e2cf);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 240ms var(--ease);
}
.hand .card { position: absolute; left: 50%; bottom: 0; }
.card--first { z-index: 2; transform: translateX(-50%) translateY(-24px); }
.card--second { z-index: 1; transform: translateX(calc(-100% - var(--fan))) rotate(-10deg); transform-origin: bottom center; }
.card--third { z-index: 1; transform: translateX(var(--fan)) rotate(10deg); transform-origin: bottom center; }
@media (hover: hover) {
  .card--first:hover { transform: translateX(-50%) translateY(-36px); }
  .card--second:hover { transform: translateX(calc(-104% - var(--fan))) translateY(-12px) rotate(-12deg); }
  .card--third:hover { transform: translateX(calc(4% + var(--fan))) translateY(-12px) rotate(12deg); }
}
.hand--deal .card { animation: deal 700ms var(--ease) backwards; }
.hand--deal .card--second { animation-delay: 120ms; }
.hand--deal .card--third { animation-delay: 240ms; }
.hand--deal .card--first { animation-delay: 380ms; }
@keyframes deal { from { transform: translate(-50%, 120px) rotate(0deg) scale(0.9); } }

.card--red { color: var(--red); }
.corner { position: absolute; top: 8px; left: 10px; display: grid; justify-items: center; line-height: 1; font-family: var(--display); }
.corner--flip { top: auto; left: auto; bottom: 8px; right: 10px; transform: rotate(180deg); }
.corner-rank { font-size: 1.375rem; }
.corner-suit { font-size: 1rem; }
.card-pip { position: absolute; inset: 14% 0 auto; text-align: center; font-size: calc(var(--card-w) * 0.46); line-height: 1.1; }
.card-text { position: absolute; inset: auto 12px 48px; color: var(--ink); text-align: center; }
.card-name { font-family: var(--display); font-size: 1.0625rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-amount { font-size: 0.75rem; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.card--second .card-text { padding-right: calc(var(--card-w) * 0.28); text-align: left; }
.card--third .card-text { padding-left: calc(var(--card-w) * 0.28); text-align: right; }

.card--back {
  background:
    repeating-linear-gradient(45deg, rgba(246, 241, 228, 0.16) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(-45deg, rgba(246, 241, 228, 0.16) 0 2px, transparent 2px 10px),
    #7a1d24;
  border: 6px solid var(--bone);
}

.loading { display: flex; justify-content: center; align-items: center; gap: 16px; min-height: 100dvh; padding-inline: 16px; color: var(--muted); }
.loading .card { --card-w: 96px; animation: pulse 1.2s ease-in-out infinite alternate; }
.loading .card:nth-child(2) { animation-delay: 150ms; }
.loading .card:nth-child(3) { animation-delay: 300ms; }
@keyframes pulse { from { opacity: 0.5; } to { opacity: 1; } }

/* Streak */
#streaks { display: grid; gap: 24px; }
.panels { display: grid; gap: 16px; }
.panel { display: grid; gap: 16px; align-content: start; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.streak-list { display: grid; gap: 12px; }
.streak-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; }
.streak-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streak-count { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.streak-count--win { color: var(--win); }
.streak-count--loss { color: var(--loss); }
.chips-stack { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; padding-left: 2px; }
.chip {
  width: 24px;
  height: 24px;
  margin-right: -10px;
  border-radius: 50%;
  border: 3px dashed var(--bone);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}
.chip--win { background: var(--brass-deep); }
.chip--loss { background: #a3262c; }
.chip-more { margin-left: 18px; color: var(--muted); font-size: 0.8125rem; font-weight: 600; }

/* Klasemen */
#board { display: grid; gap: 24px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tab { min-height: 40px; padding: 0 16px; background: none; border: 0; border-radius: 4px; color: var(--muted); font-weight: 600; font-size: 0.875rem; }
.tab[aria-pressed='true'] { color: var(--text); background: var(--surface-strong); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th { padding: 12px 16px; color: var(--muted); font-size: 0.8125rem; font-weight: 600; text-align: left; white-space: nowrap; }
tbody td, tbody th { padding: 12px 16px; border-top: 1px solid var(--line); text-align: left; font-weight: 400; vertical-align: middle; }
tbody tr:first-child td, tbody tr:first-child th { background: rgba(230, 185, 87, 0.08); }
.col-rank { width: 40px; color: var(--muted); padding-right: 0; }
th.col-name { width: 100%; max-width: 0; }
.who { display: flex; align-items: center; gap: 12px; }
.streak-inline { margin-top: 4px; }
.col-streak { display: none; }
.suit { flex: none; width: 20px; color: var(--text); font-size: 1.25rem; line-height: 1; text-align: center; }
.suit--red { color: var(--loss); }
.name-stack { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; font-weight: 600; }
.name-stack > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-stack small { color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
thead .col-total, td.col-total { text-align: right; }
td.col-total { font-weight: 700; white-space: nowrap; }
.col-form, .col-trend { display: none; }
.amount--win { color: var(--win); }
.amount--loss { color: var(--loss); }
.amount--even { color: var(--muted); }

.dots { display: inline-flex; gap: 4px; }
.dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.dot--win { color: #082417; background: var(--win); }
.dot--loss { color: #3a0d0b; background: var(--loss); }
.dot--draw { color: var(--muted); background: var(--surface-strong); }

.spark { display: block; width: 100px; height: 28px; overflow: visible; }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: currentColor; }
.spark-zero { stroke: var(--line); stroke-dasharray: 3 3; }
.spark--win { color: var(--win); }
.spark--loss { color: var(--loss); }
.spark--even { color: var(--muted); }

.badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.badge--win { color: var(--win); background: rgba(132, 227, 170, 0.12); }
.badge--loss { color: var(--loss); background: rgba(255, 160, 151, 0.12); }
td.col-streak .muted { font-size: 0.8125rem; white-space: nowrap; }

/* Riwayat */
#history { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; justify-items: start; }
.day { display: grid; gap: 12px; width: 100%; }
.day-games { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.game { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.game-note { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.game-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.game-lines li { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.game-lines li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-lines li span:last-child { font-weight: 600; white-space: nowrap; }
.game-actions { display: flex; gap: 8px; margin-inline: -8px; }
.link { min-height: 44px; padding: 0 8px; background: none; border: 0; border-radius: 4px; color: var(--muted); font-size: 0.875rem; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }

/* Log perubahan */
#log { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; justify-items: start; }
.log-list { display: grid; gap: 12px; width: 100%; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.log-actor { font-weight: 600; overflow-wrap: anywhere; }
.log-time { color: var(--muted); font-size: 0.8125rem; }
.log-diff { display: grid; gap: 4px; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Kunci PIN */
.lock { display: grid; place-items: center; min-height: 100dvh; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.lock-card { display: grid; gap: 12px; width: min(100%, 360px); padding: 32px; color: var(--ink); background: linear-gradient(160deg, #fffaf0, var(--bone) 60%, #e9e2cf); border-radius: 16px; box-shadow: 0 32px 64px -24px rgba(0, 0, 0, 0.7); transform: rotate(-1.5deg); }
.lock-card h1 { font-size: 1.75rem; line-height: 1.15; margin-bottom: 8px; }
.lock-card label { font-size: 0.875rem; font-weight: 600; }
.lock-card input { min-height: 48px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid #c9c2ae; border-radius: var(--radius-sm); color-scheme: light; }
.lock-card .error { color: #a3161c; }
.lock-field { display: grid; gap: 4px; }
.lock-note { color: var(--ink-soft); font-size: 0.875rem; }
.lock-card .link { justify-self: center; color: var(--ink-soft); }
.lock-card .link:hover { color: var(--ink); }

/* Form */
.sheet {
  width: min(100%, 560px);
  max-width: 100%;
  max-height: min(92dvh, var(--vv-h, 100dvh));
  margin: auto auto var(--kb, 0px);
  padding: 0;
  color: var(--text);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}
.sheet:focus { outline: none; }
.sheet[open] { display: flex; animation: rise 280ms var(--ease); }
.sheet::backdrop { background: rgba(3, 14, 10, 0.65); backdrop-filter: blur(2px); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 16px 8px; }
.sheet-head h2 { font-size: 1.5rem; }
.icon-btn { width: 44px; height: 44px; margin-right: -8px; background: none; border: 0; border-radius: var(--radius-sm); color: var(--muted); font-size: 1.75rem; line-height: 1; }
.icon-btn:hover { background: var(--surface-strong); color: var(--text); }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 24px; }
/* Padding bawah lega: Safari iOS mewarnai toolbar dari piksel tepi bawah, tombol emas terlalu dekat membuatnya olive. */
.sheet-foot { display: grid; gap: 8px; padding: 12px 16px calc(32px + env(safe-area-inset-bottom, 0px)); background: rgba(0, 0, 0, 0.18); border-top: 1px solid var(--line); }

.field-row { display: flex; flex-wrap: wrap; gap: 16px 12px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field--date { flex: 1 1 144px; }
.field--grow { flex: 3 1 176px; }
.field label, .field legend { padding: 0; color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.optional { font-weight: 400; }
.field-stack { display: grid; gap: 12px; }
.field-hint { font-size: 0.8125rem; }
.field legend { margin-bottom: 8px; }
.sheet input { width: 100%; min-height: 48px; padding: 0 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sheet input::placeholder { color: rgba(169, 194, 179, 0.6); }
.sheet input[type='date'] { appearance: none; min-width: 0; text-align: left; }
.sheet input::-webkit-date-and-time-value { text-align: left; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { min-height: 44px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; font-weight: 500; overflow-wrap: anywhere; }
.pick[aria-pressed='true'] { color: #2a1e05; background: var(--brass); border-color: var(--brass); font-weight: 600; }
.add-player { display: flex; gap: 8px; margin-top: 12px; }
.add-player input { flex: 1; min-width: 0; }
.add-player .btn { padding: 0 16px; }
.add-player--flush { margin-top: 0; }

.rows { display: grid; gap: 12px; }
.rows:empty { display: none; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1.5fr); gap: 4px 8px; align-items: center; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flip { min-height: 48px; padding: 0 4px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; }
.flip--win { color: var(--win); background: rgba(132, 227, 170, 0.12); border-color: rgba(132, 227, 170, 0.3); }
.flip--loss { color: var(--loss); background: rgba(255, 160, 151, 0.12); border-color: rgba(255, 160, 151, 0.3); }
.money { position: relative; min-width: 0; }
.money span { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.row-hint { grid-column: 1 / -1; color: var(--brass); font-size: 0.8125rem; text-align: right; }

.meter { position: relative; height: 6px; overflow: hidden; background: var(--surface-strong); border-radius: 3px; }
.meter::after { content: ''; position: absolute; inset: 0 auto 0 50%; width: 2px; margin-left: -1px; background: var(--felt-deep); }
.meter-bar { position: absolute; inset: 0; width: 100%; transition: transform 240ms var(--ease); }
.meter-bar--win { background: var(--win); transform: scaleX(0); transform-origin: right; right: 50%; left: auto; width: 100%; }
.meter-bar--loss { background: var(--loss); transform: scaleX(0); transform-origin: left; left: 50%; right: auto; width: 100%; }
.balance { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.balance--ok { color: var(--win); font-weight: 600; }
.error { color: var(--loss); font-size: 0.875rem; }

.users-status { color: var(--win); font-size: 0.875rem; font-weight: 600; }
.user-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.user { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.user-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 4px 8px 4px 16px; }
.user-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge--muted { color: var(--muted); background: var(--surface-strong); }
.badge--pending { color: var(--brass); background: rgba(230, 185, 87, 0.12); }
.user-panel { display: grid; gap: 12px; padding: 4px 16px 16px; }
.user-rename { display: flex; gap: 8px; }
.user-rename input { flex: 1; min-width: 0; }
.user-rename .btn { padding: 0 16px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-inline: -8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  color: var(--ink);
  background: var(--bone);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 32px -12px rgba(0, 0, 0, 0.6);
  font-weight: 600;
  transform: translateX(-50%);
  animation: toast-in 240ms var(--ease);
}
.toast button { min-height: 32px; padding: 0 8px; color: var(--red); background: none; border: 0; font-weight: 700; text-decoration: underline; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } }

.burst { position: fixed; bottom: 16vh; z-index: 20; color: var(--brass); font-size: 1.5rem; pointer-events: none; }
.burst:nth-of-type(even) { color: var(--bone); }

@media (min-width: 640px) {
  :root { --fan: 10%; }
  .panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-form, .col-streak { display: table-cell; }
  .streak-inline { display: none; }
  .chips-stack { grid-column: auto; grid-row: auto; }
  .streak-list li { grid-template-columns: minmax(0, 1fr) auto auto; }
  .sheet { margin: auto; border-radius: 16px; }
  .sheet[open] { max-height: 88dvh; }
  .sheet-head, .sheet-body, .sheet-foot { padding-inline: 24px; }
}

@media (min-width: 900px) {
  .page { gap: 80px; padding-top: 48px; padding-bottom: 80px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .topbar-cta { display: inline-flex; }
  .dock { display: none; }
  .col-trend { display: table-cell; }
  .topbar { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
  .toast { bottom: 32px; }
}

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