.panel, .stat-card, .auth-card, .modal, .game-row, .notice-panel {
  background: linear-gradient(180deg, rgba(42, 31, 64, 0.92), rgba(22, 16, 34, 0.94));
  border-radius: var(--radius-lg);
  box-shadow: var(--inset), var(--shadow);
}
.panel, .auth-card { padding: 16px; }
.stat-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-card span, .stake small, .mini-label, .mini-sub { color: var(--text-muted); font-size: 0.82rem; }
.stat-card strong { font-size: 1.35rem; }
.btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-weight: 700;
}
.btn-primary { background: #ff7a14; color: #110c1b; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-ghost { background: rgba(255, 255, 255, 0.06); }
.btn-block { width: 100%; height: 42px; }
.icon-btn { width: 36px; height: 36px; padding: 0; }
.btn:disabled { opacity: 0.55; cursor: default; }
#deposit-result[hidden], #deposit-memo[hidden], #deposit-open[hidden], #withdraw-note[hidden] { display: none; }
.balance, .user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
.avatar-photo {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: center 20%; flex: 0 0 auto;
}
.avatar, .swatch {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 800; color: #1a1020; flex: 0 0 auto;
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-empty { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.avatar[data-color="#ff7a14"], .swatch[data-color="#ff7a14"] { background: #ff7a14; }
.avatar[data-color="#a855f7"], .swatch[data-color="#a855f7"] { background: #a855f7; }
.avatar[data-color="#3dd68c"], .swatch[data-color="#3dd68c"] { background: #3dd68c; }
.avatar[data-color="#38bdf8"], .swatch[data-color="#38bdf8"] { background: #38bdf8; }
.avatar[data-color="#fb7185"], .swatch[data-color="#fb7185"] { background: #fb7185; }
.avatar[data-color="#eab308"], .swatch[data-color="#eab308"] { background: #eab308; }
.avatar[data-color="#22d3ee"], .swatch[data-color="#22d3ee"] { background: #22d3ee; }
.avatar[data-color="#c084fc"], .swatch[data-color="#c084fc"] { background: #c084fc; }
.avatar[data-color="#84cc16"], .swatch[data-color="#84cc16"] { background: #84cc16; }
.avatar[data-color="#f97316"], .swatch[data-color="#f97316"] { background: #f97316; }
.avatar[data-color="#818cf8"], .swatch[data-color="#818cf8"] { background: #818cf8; }
.avatar[data-color="#f43f5e"], .swatch[data-color="#f43f5e"] { background: #f43f5e; }
.field, .field-label { display: block; width: 100%; }
.field-label { margin: 12px 0 6px; color: var(--text-muted); font-size: 0.85rem; }
.field {
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border-default);
  background: rgba(8, 6, 14, 0.55);
  padding: 0 12px;
}
textarea.field { height: auto; padding: 10px 12px; }
.field-error { color: var(--danger); font-size: 0.82rem; margin-top: 4px; }
.banner { padding: 10px 12px; border-radius: 14px; background: rgba(255, 122, 20, 0.12); }
.game-list { display: flex; flex-direction: column; gap: 10px; }
.game-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}
.players, .person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person b, .user-name { display: block; }
.person small, .vs { color: var(--text-muted); }
.vs { font-size: 0.75rem; }
.side { border-radius: 999px; padding: 2px 8px; font-weight: 800; }
.side-heads { color: #2a1204; background: rgba(255, 122, 20, 0.9); }
.side-tails { color: #2e1065; background: rgba(168, 85, 247, 0.9); }
.stake { text-align: right; }
.stake strong { display: block; }
.chat-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 10px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.chat-bar > span, .chat-meta { color: #d5cce6; font-size: 0.875rem; font-weight: 650; }
.chat-meta { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.chat-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #ff7a14;
  box-shadow: 0 0 0 2px rgba(255, 122, 20, 0.35);
  animation: chat-live 1.6s ease-out infinite;
}
.chat-log { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.chat-line { display: flex; gap: 8px; align-items: flex-start; }
.chat-line .avatar { width: 28px; height: 28px; font-size: 0.72rem; }
.chat-line p { margin: 0; color: #f1ecf8; line-height: 1.45; word-break: break-word; }
.chat-line b { display: inline; margin-right: 6px; font-weight: 700; }
.chat-line b[data-color="#ff7a14"] { color: #ff7a14; }
.chat-line b[data-color="#a855f7"] { color: #a855f7; }
.chat-line b[data-color="#3dd68c"] { color: #3dd68c; }
.chat-line b[data-color="#38bdf8"] { color: #38bdf8; }
.chat-line b[data-color="#fb7185"] { color: #fb7185; }
.chat-line b[data-color="#eab308"] { color: #eab308; }
.chat-line b[data-color="#22d3ee"] { color: #22d3ee; }
.chat-line b[data-color="#c084fc"] { color: #c084fc; }
.chat-line b[data-color="#84cc16"] { color: #84cc16; }
.chat-line b[data-color="#f97316"] { color: #f97316; }
.chat-line b[data-color="#818cf8"] { color: #818cf8; }
.chat-line b[data-color="#f43f5e"] { color: #f43f5e; }
.chat-form { position: relative; display: flex; }
.chat-form input {
  width: 100%; height: 48px; border-radius: 12px; border: 0;
  background: rgba(8, 6, 14, 0.55); color: #f1ecf8; padding: 0 52px 0 14px;
}
.chat-form input::placeholder { color: #d5cce6; }
.chat-send {
  position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; border-radius: 10px;
  display: grid; place-items: center; background: transparent; color: #f1ecf8;
}
.chat-guest {
  display: flex; align-items: center; justify-content: space-between; width: 100%; height: 48px;
  padding: 0 14px; border: 0; border-radius: 12px; background: #3c3454; color: #f1ecf8; font-weight: 650;
}
.chat-guest svg, .chat-send svg { width: 18px; height: 18px; }
.chat-form input:focus-visible, .chat-send:focus-visible, .chat-guest:focus-visible {
  outline: 2px solid #ff7a14; outline-offset: 2px;
}
.empty { color: var(--text-muted); padding: 8px 0; }
.sidebar-close, .chat-fab, .nav-toggle { display: none; }
.jackpot-mini { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,0.04); }
.jackpot-mini strong { font-size: 1.3rem; }
.online { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.82rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #ff7a14; box-shadow: 0 0 8px #ff7a14; }
.modal { border: 0; padding: 22px; color: var(--text-primary); width: min(440px, calc(100% - 24px)); background: #2a2038; border-radius: 22px; }
.auth-modal { background: #2a2340; width: min(420px, calc(100% - 32px)); padding: 22px 22px 18px; border-radius: 18px; box-shadow: none; }
.auth-modal h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: 0; }
.auth-modal .modal-head { margin-bottom: 16px; }
.auth-modal .field-label { display: flex; align-items: center; gap: 6px; color: #f4f1f8; font-weight: 700; font-size: 0.95rem; margin: 0 0 8px; }
.auth-modal .field-label svg { width: 16px; height: 16px; color: #ff7a14; }
.auth-modal .field { height: 46px; border: 0; border-radius: 12px; background: #1b1528; font-size: 0.95rem; }
.auth-modal .field::placeholder { color: #8f849f; }
.login-ack { display: block; margin: 14px 2px 0; color: #a99bb4; font-size: 0.92rem; line-height: 1.45; }
.login-ack a { color: #ff7a14; font-weight: 700; }
.login-profile { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 0; background: transparent; }
.login-profile .avatar, .login-profile img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: center 20%; background: #1b1528; box-shadow: 0 0 0 2px #3a3350; }
#login-avatar-fallback { background: #ff7a14; color: #1a1020; font-size: 1.15rem; font-weight: 800; }
.login-profile-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.login-profile-copy b { font-size: 1rem; }
.profile-link { display: inline-flex; align-items: center; gap: 4px; width: fit-content; color: #ff7a14; font-size: 0.82rem; font-weight: 700; }
.profile-link svg { width: 13px; height: 13px; }
.phrase-row { position: relative; }
.phrase-row .field { width: 100%; }
.phrase-words { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; width: 100%; min-height: 72px; padding: 14px 46px 14px 14px; border-radius: 14px; background: #1b1528; }
.phrase-words span { display: inline-flex; align-items: center; padding: 0; background: transparent; color: #f7f4fb; font-weight: 650; font-size: 0.98rem; }
#phrase-copy {
  position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border-radius: 10px;
  background: transparent; color: #d5cce6; box-shadow: none;
}
#login-error { margin-top: 10px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
#phrase-copy:active { transform: translateY(1px); box-shadow: none; }
#login-profile[hidden], #login-avatar[hidden], #login-avatar-fallback[hidden], #phrase-copy[hidden], #phrase-words[hidden], #popup-username[hidden], #login-error[hidden], #login-ack[hidden], #login-icon-key[hidden], #login-icon-user[hidden] { display: none; }
.auth-modal .modal-actions { margin-top: 18px; gap: 10px; }
.auth-modal .modal-actions .btn {
  height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 700;
  background: #3c3454; color: #f7f4fb;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 3px 0 #241c33;
}
.auth-modal .modal-actions .btn:hover { background: #4d4468; }
.auth-modal .modal-actions .btn:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.35); }
.auth-modal .modal-actions .btn-line {
  background: #ff7a14; color: #1a1020;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 0 #c45a0c;
}
.auth-modal .modal-actions .btn-line:hover { background: #ff8d33; }
.auth-modal .modal-actions .btn-line:active { box-shadow: inset 0 2px 0 rgba(0,0,0,0.18); }
dialog::backdrop { background: rgba(8, 6, 16, 0.5); backdrop-filter: blur(8px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn-line { background: transparent; color: var(--text-primary); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22); }
.hint a { color: #ff7a14; }
button.avatar { border: 0; padding: 0; cursor: pointer; }
button.user-chip { border: 0; cursor: pointer; }
@keyframes chat-live {
  0% { box-shadow: 0 0 0 0 rgba(255, 122, 20, 0.55); }
  100% { box-shadow: 0 0 0 7px rgba(255, 122, 20, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-pulse { animation: none; }
}
dialog.profile-sheet {
  position: fixed; top: 16px; right: 16px; bottom: 16px; left: auto; margin: 0; height: auto;
  width: min(480px, calc(100% - 32px)); max-width: none; padding: 22px; border: 0; border-radius: 28px;
  background: #241833; color: var(--text-primary);
}
.sheet-brand, .sheet-player, .sheet-bar { display: flex; align-items: center; }
.sheet-brand { justify-content: space-between; }
.sheet-player { position: relative; width: fit-content; margin: 28px 0 18px; flex-direction: column; gap: 8px; }
.sheet-player .avatar-lg { width: 92px; height: 92px; font-size: 2rem; }
.sheet-player .side-badge { position: absolute; left: 64px; top: 64px; }
.sheet-bar { justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.05); }
.flip-modal { width: min(560px, calc(100% - 24px)); }
.modal-x { position: absolute; top: 12px; right: 12px; }
.item-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.item-pick {
  flex: 1 1 140px; min-height: 72px; display: flex; align-items: center; gap: 8px;
  padding: 8px; border: 0; border-radius: 16px; background: #1b1528; color: #f1ecf8; text-align: left;
}
.item-pick.is-on { box-shadow: inset 0 0 0 2px #ff7a14; }
.item-plate { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; }
.item-plate-crown { background: #3a2210; }
.item-plate-cape { background: #2a1848; }
.item-plate-lantern { background: #1e2a22; }
.item-plate-horn { background: #14302c; }
.item-copy { min-width: 0; }
.item-copy b, .item-copy small { display: block; }
.item-copy b { font-size: 0.92rem; }
.item-copy small { color: #d5cce6; }
.side-picker, .quick-row { display: flex; gap: 8px; margin: 8px 0 12px; }
.side-btn, .quick-row button { flex: 1; height: 40px; background: rgba(255,255,255,0.06); }
.side-btn.is-on[data-side="heads"] { background: var(--heads); color: #2a1204; }
.side-btn.is-on[data-side="tails"] { background: var(--tails); color: #2e1065; }
.toasts { position: fixed; z-index: 50; top: 88px; right: 16px; display: flex; flex-direction: column; gap: 8px; width: min(320px, calc(100% - 32px)); }
.toast { padding: 12px 14px; border-radius: 16px; background: #24182f; box-shadow: var(--shadow); }
.toast-win { box-shadow: 0 0 0 1px rgba(61, 214, 140, 0.45), var(--shadow); }
.toast-lose { box-shadow: 0 0 0 1px rgba(255, 93, 115, 0.45), var(--shadow); }
.notice-panel { position: fixed; z-index: 45; top: 88px; right: 16px; width: min(320px, calc(100% - 32px)); padding: 12px; }
.notice-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }
.sheet { width: 100%; border-collapse: collapse; }
.sheet th, .sheet td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border-default); white-space: nowrap; }
.sheet th { color: var(--text-muted); font-weight: 650; font-size: 0.82rem; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item, .entry { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; }
.entry { border-bottom: 1px solid var(--border-default); }
.auth-card, .narrow { max-width: 460px; }
.fair-title { margin: 0; color: #f1ecf8; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
.fair-label { display: block; margin: 0 0 8px; color: #d5cce6; font-size: 0.95rem; font-weight: 650; }
.fair-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fair-pick {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px;
  border: 0; border-radius: 12px; background: #3c3454; color: #f1ecf8; font-weight: 700;
}
.fair-pick.is-on { background: #ff7a14; color: #1a1020; }
.fair-box { position: relative; }
.fair-input {
  width: 100%; color: #f1ecf8; background: #120c1c; border: 0; border-radius: 12px; line-height: 1.5;
}
textarea.fair-input { min-height: 72px; padding: 14px 52px 14px 14px; }
.fair-copy {
  position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: 0; border-radius: 10px;
  display: grid; place-items: center; background: #3c3454; color: #f1ecf8;
}
.fair-copy.is-on { background: #ff7a14; color: #1a1020; }
.fair-result {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 96px; border-radius: 16px; background: #120c1c;
}
.fair-result[hidden], .fair-coin[hidden] { display: none; }
.fair-coin {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1.3rem; color: #1a1020;
}
.fair-result.is-heads .fair-coin { background: #ff7a14; }
.fair-result.is-tails .fair-coin { background: #a855f7; color: #f1ecf8; }
.fair-result strong { font-size: 1.8rem; color: #f1ecf8; }
.fair-result.is-note { min-height: 0; justify-content: flex-start; padding: 14px 16px; }
.fair-result.is-note strong { font-size: 0.95rem; font-weight: 650; line-height: 1.5; }
.fair-notes { display: flex; flex-direction: column; gap: 4px; color: #d5cce6; font-size: 0.95rem; line-height: 1.5; }
.fair-notes p { margin: 0; text-wrap: pretty; }
.fair-pick:focus-visible, .fair-copy:focus-visible { outline: 2px solid #ff7a14; outline-offset: 2px; }
#fairness-panel .field-label, #fairness-panel label + .field { margin-top: 0; }
.auth-switch { margin-top: 14px; }
.profile-hero { display: flex; align-items: center; gap: 16px; }
.balance-lg { font-size: 1.8rem; font-weight: 800; }
.result-banner { margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,0.06); text-align: center; font-weight: 800; }
.result-win { color: var(--success); }
.result-lose { color: var(--danger); }
.seed-line { color: var(--text-muted); font-size: 0.75rem; word-break: break-all; }
svg.lucide { width: 18px; height: 18px; }
.nav-links button {
  display: inline-flex; align-items: center; height: 36px; padding: 0 10px; gap: 6px;
  color: #c8bdd8; font-weight: 650; background: transparent; border: 0; border-radius: 999px;
}
.nav-links button:hover, .nav-links button.is-on { color: #f7f4fb; background: rgba(255, 255, 255, 0.07); }
.nav-links button svg { width: 16px; height: 16px; }
.board-modal {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  background: #1a1526;
  padding: 20px 20px 16px;
}
.board-modal h2 { font-size: 1.2rem; text-wrap: balance; }
.board-tools { display: flex; align-items: center; gap: 8px; }
.board-tabs {
  flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  height: 52px; padding: 4px; border-radius: 12px; background: #120c1c;
}
.board-tab {
  height: 44px; border: 0; border-radius: 8px; background: transparent;
  color: #d5cce6; font-weight: 650;
}
.board-tab.is-on { background: #3c3454; color: #f1ecf8; }
.board-filter {
  height: 44px; border: 0; border-radius: 12px; background: #3c3454; color: #f1ecf8;
  padding: 0 12px; font-weight: 650;
}
.board-tab:focus-visible, .board-filter:focus-visible, .nav-links button:focus-visible {
  outline: 2px solid #ff7a14; outline-offset: 2px;
}
.board-sheet { margin-top: 14px; border-radius: 14px; background: #120c1c; overflow: auto; max-height: min(560px, calc(100vh - 220px)); }
.board-head, .board-row {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  min-height: 52px; padding: 8px 14px;
}
.board-head { color: #d5cce6; font-size: 0.82rem; font-weight: 650; min-height: 40px; }
.board-row + .board-row { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.board-rank { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #f1ecf8; }
.board-medal {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 800; color: #1a1020;
}
.board-medal[data-place="1"] { background: #eab308; }
.board-medal[data-place="2"] { background: #d5cce6; }
.board-medal[data-place="3"] { background: #e08a3c; }
.board-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.board-person .avatar { width: 32px; height: 32px; font-size: 0.85rem; }
.board-person b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-value { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #ff7a14; }
.board-value.is-down { color: #fb7185; }
.board-value svg { width: 14px; height: 14px; }
@media (max-width: 720px) {
  .board-tools { flex-direction: column; align-items: stretch; }
  .board-filter { width: 100%; }
}
