* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --bg: #101512; --panel: #19201c; --surface: #202922; --line: #303c34;
  --text: #f1f5ee; --muted: #a7b5ab; --accent: #83e6b3; --dark-accent: #12251c;
  --positive: #94e8b8; --negative: #ffaaa4; --neutral: #c8d0c8;
  --radius: 21px; --page-gutter: clamp(15px, 4.4vw, 34px);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}
body { min-height: 100dvh; margin: 0; color: var(--text); background: #0b100e; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 44px; min-width: 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); color: inherit; font-weight: 670; cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}
button:disabled { opacity: .52; cursor: default; }
button:not(:disabled):active { transform: scale(.985); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, .profile-chart:focus-visible, .agreement-scroll:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
@media (hover: hover) { button:not(:disabled):hover { border-color: #648172; } }
a { color: var(--accent); text-underline-offset: .22em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 8vw, 3rem); line-height: 1.08; letter-spacing: -.055em; font-weight: 770; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; letter-spacing: -.028em; }
h3 { font-size: .99rem; letter-spacing: -.012em; }
p { line-height: 1.55; }
small { font-size: .76rem; }
svg, img { vertical-align: middle; }
.ui-icon { flex: none; }
.shell { max-width: 920px; min-height: 100dvh; margin: 0 auto; background: var(--bg); box-shadow: 0 0 85px #0005; }
main { padding: 7px max(var(--page-gutter), env(safe-area-inset-left)) 105px max(var(--page-gutter), env(safe-area-inset-right)); }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 10px; padding: max(13px, env(safe-area-inset-top)) max(var(--page-gutter), env(safe-area-inset-right)) 11px max(var(--page-gutter), env(safe-area-inset-left)); }
.top > strong { color: var(--muted); font-size: .84rem; }
.brand { display: flex; gap: 9px; align-items: center; font-size: .94rem; font-weight: 750; line-height: 1; letter-spacing: -.035em; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 11px; }
.brand b { color: var(--muted); font-weight: 690; }
.hero { padding: 11px 0 17px; }
.hero p:not(.eyebrow) { margin-top: 8px; }
.eyebrow { color: var(--accent); font-size: .74rem; font-weight: 720; letter-spacing: .015em; margin-bottom: 5px; }
.muted, .empty, .section-header > span { color: var(--muted); }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.neutral { color: var(--neutral); }
.primary { background: var(--accent); color: var(--dark-accent); border-color: transparent; font-weight: 800; }
.primary:not(:disabled):hover { background-color: #a2efc8; }
.secondary { background: var(--surface); }
.quiet { color: var(--muted); border-color: transparent; background: transparent; }
.wide { width: 100%; }
.button-icon, .back-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button-icon .ui-icon, .back-button .ui-icon { width: 18px; height: 18px; }
.back-button { padding-inline: 9px; }
.stack { display: grid; gap: 8px; }
.empty, .panel, .waiting, .result { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.empty { font-size: .86rem; }
.panel, .agreement { margin: 14px 0; }
.panel > h2, .panel > h3 { margin-bottom: 12px; }
.panel p + p { margin-top: 8px; }
.panel label, .waiting p { margin-bottom: 10px; }
.icon-box {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; background: #29382e; color: var(--accent);
}
.icon-box .ui-icon { width: 20px; height: 20px; }
.icon-box.positive { color: var(--positive); background: #253b2e; }
.icon-box.negative { color: var(--negative); background: #402b29; }
.icon-box.neutral { color: var(--neutral); background: #2c3530; }
.section-header { display: flex; min-height: 32px; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.section-header > span { font-size: .78rem; flex: none; }
.section-header p { margin-top: 3px; font-size: .84rem; }
.section-count { display: inline-grid; place-items: center; min-width: 27px; min-height: 27px; padding: 1px 6px; background: var(--surface); border-radius: 8px; }
.balance-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 48px; border-radius: 999px; padding: 7px 15px 7px 11px; font-variant-numeric: tabular-nums; white-space: nowrap; color: #effff5; background: linear-gradient(135deg, #163b2b, #10241c); border-color: #4a9d72; box-shadow: inset 0 0 0 1px #75d79b33, 0 0 18px #4ce98a22; }
.balance-pill .ton-icon { width: 25px; height: 25px; }
.ton-icon { display: inline-block; width: 1.15em; height: 1.15em; flex: none; }

.lobby-hero {
  position: relative; display: grid; align-content: end; min-height: clamp(270px, 34vw, 390px);
  margin-bottom: 13px; padding: clamp(18px, 5vw, 32px); border: 1px solid #3a5445; border-radius: 26px; overflow: hidden;
  background-color: #183528;
  background-image: linear-gradient(90deg, #07130ff2 0%, #07130fb9 34%, #07130f20 74%), url('/lobby-table.webp');
  background-size: cover, cover;
  background-position: center, center right;
  box-shadow: inset 0 0 0 1px #7df5a522, 0 20px 50px #0008;
}
.hero-copy { width: min(55%, 420px); }
.hero-copy h1 { text-wrap: balance; }
.hero-copy p:not(.eyebrow) { color: #d0dbd1; font-size: 1rem; max-width: 31ch; }
.welcome-hero { min-height: clamp(204px, 30vw, 270px); }
.welcome-hero .hero-copy { width: min(65%, 390px); }
.mode-grid, .demo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.mode-tile {
  --mode-ink: #98e6bc; --mode-wash: #284338;
  position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr;
  gap: 9px; align-items: start; min-height: 150px; padding: 14px 14px 15px;
  text-align: left; border-radius: 22px; background: linear-gradient(145deg, var(--mode-wash), var(--panel) 78%); box-shadow: inset 0 0 0 1px #ffffff0d, 0 10px 24px #0004;
}
.mode-tile.peach { --mode-ink: #f0b3a1; --mode-wash: #41312b; }
.mode-tile.blue { --mode-ink: #a9c9f0; --mode-wash: #2b384b; }
.mode-tile.purple { --mode-ink: #d1b5f5; --mode-wash: #392f49; }
.mode-tile.gold { --mode-ink: #f3d69e; --mode-wash: #413829; }
.mode-tile.active-mode { border-color: var(--accent); box-shadow: inset 0 0 0 1px #83e6b3aa, 0 0 20px #83e6b34d, 0 12px 28px #0006; }
.mode-emblem { grid-area: 1 / 1; display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; color: var(--mode-ink); background: #0e15137a; border: 1px solid #ffffff1a; font: 1.85rem/1 Georgia, serif; box-shadow: inset 0 0 15px #ffffff0b; }
.mode-copy { grid-area: 2 / 1 / 3 / 3; display: grid; gap: 4px; align-self: end; min-width: 0; }
.mode-name { font-size: 1.04rem; line-height: 1.15; font-weight: 780; }
.mode-copy small { color: #b8c5bb; font-weight: 500; }
.mode-indicator { grid-area: 1 / 2; display: grid; place-items: center; color: var(--mode-ink); }
.mode-indicator .ui-icon { width: 17px; height: 17px; }
.mode-art { position: absolute; right: 12px; bottom: 8px; color: var(--mode-ink); opacity: .3; font: 4rem/1 Georgia, serif; transform: rotate(-10deg); text-shadow: 0 0 18px currentColor; pointer-events: none; }
.mode-dice { grid-column: 1 / -1; min-height: 88px; grid-template-columns: auto 1fr auto; grid-template-rows: auto; align-items: center; }
.mode-dice .mode-copy { grid-area: 1 / 2; align-self: center; }
.mode-dice .mode-indicator { grid-area: 1 / 3; }
.section-header h2 { display: inline-flex; align-items: center; gap: 9px; }
.section-mark { color: var(--accent); font-size: 1.45rem; line-height: 1; text-shadow: 0 0 14px #83e6b388; }
.lobby-section { margin-top: 21px; }
.lobby-section.matchmaking { margin-bottom: 16px; }
.table-filters { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 7px; margin-bottom: 10px; }
.table-filters select { font-size: .79rem; padding-inline: 8px; }
.table-refresh { min-height: 36px; padding-inline: 6px; font-size: .8rem; }
#tables-message { margin: 0 0 7px; font-size: .79rem; }
#tables-message:empty { display: none; }
.limit-list { display: flex; gap: 7px; flex-wrap: wrap; margin: 9px 0 14px; }
.limit-list button { min-height: 46px; padding: 8px 14px; font-size: .84rem; font-variant-numeric: tabular-nums; border-radius: 15px; }
.limit-list .selected, .segmented .selected { border-color: #6ebc94; color: var(--accent); background: #294036; box-shadow: 0 0 14px #83e6b333; }
.matchmaking.panel { padding: 22px; border-radius: 25px; background: linear-gradient(145deg, #16362a, #14241d 72%); box-shadow: inset 0 0 0 1px #83e6b31c, 0 14px 32px #0005; }
.matchmaking .primary { min-height: 57px; border-radius: 18px; background: linear-gradient(135deg, #a7f3bd, #5fd980); box-shadow: 0 8px 22px #61e58a3d; }
.active-room { margin: 13px 0; border-color: #5e9679 !important; }
.active-room .row-body small { color: var(--accent); }
.demo-player { display: flex; align-items: center; gap: 8px; padding: 9px; min-height: 58px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); text-decoration: none; color: var(--text); }
.demo-player .avatar { width: 32px; height: 32px; }
.demo-player .ui-icon { width: 16px; margin-left: auto; color: var(--muted); }

.document-main { max-width: 660px; margin-inline: auto; }
.agreement { padding: clamp(15px, 4vw, 24px); border: 1px solid var(--line); border-radius: var(--radius); background: #151d18; display: grid; gap: 14px; font-size: .94rem; line-height: 1.55; }
.agreement h2 { font-size: clamp(1.28rem, 5vw, 1.75rem); line-height: 1.16; }
.agreement h3 { margin-top: 5px; }
.agreement-scroll { max-height: min(60dvh, 565px); overflow: auto; scrollbar-width: thin; }
.consent-controls, #support { display: grid; gap: 9px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 1px 0; }
.help-links, .history-list { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.menu-row, .list-row, .history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; min-height: 55px;
  padding: 10px 12px; text-align: left; font-size: .87rem;
}
.menu-row { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; }
.history-list > .menu-row, .help-links > .menu-row { border: 0; border-radius: 0; }
.help-links > .menu-row + .menu-row, .history-list > * + * { border-top: 1px solid var(--line); }
.menu-row > span:not(.icon-box), .row-body { flex: 1; min-width: 0; }
.menu-row > .ui-icon, .list-row > .ui-icon { width: 17px; height: 17px; color: var(--muted); }
.row-body { display: grid; gap: 4px; overflow-wrap: anywhere; }
.row-body small, .history-row small { color: var(--muted); font-weight: 500; }
.history-row { border-bottom: 1px solid var(--line); }
.history-row > div { min-width: 0; overflow-wrap: anywhere; }
.history-row small { display: block; margin-top: 4px; }
.row-amount { font-size: .85rem; font-weight: 720; text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty-state { display: flex; align-items: center; gap: 11px; padding: 15px; border: 1px dashed #3b5042; border-radius: 16px; background: #151d18; }
.empty-state p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.empty-state strong { font-size: .9rem; }

.bottom {
  position: fixed; z-index: 4; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; width: min(calc(100% - 24px), 530px);
  padding: 5px; background: #1a241ff5; border: 1px solid #415549; border-radius: 19px; box-shadow: 0 10px 33px #0008;
  backdrop-filter: blur(16px);
}
.bottom button { border: 1px solid transparent; border-radius: 13px; background: none; color: var(--muted); display: grid; justify-items: center; gap: 3px; line-height: 1.12; font-size: .76rem; padding: 6px 4px; }
.bottom .nav-icon { display: grid; place-items: center; height: 23px; }
.bottom .ton-icon { width: 21px; height: 21px; }
.bottom .selected { color: var(--accent); background: #2b4437; border-color: #446750; }

.quote-hero { display: flex; align-items: center; gap: 13px; }
.quote-hero .icon-box { width: 52px; height: 52px; border-radius: 15px; }
.quote-hero .icon-box .ui-icon { width: 27px; height: 27px; }
.quote-hero h1 { font-size: clamp(1.48rem, 6vw, 2.15rem); }
.details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 10px 12px; text-align: left; align-items: baseline; font-variant-numeric: tabular-nums; font-size: .9rem; }
.details dt { color: var(--muted); }
.details dd { text-align: end; margin: 0; font-weight: 680; overflow-wrap: anywhere; }
.join-panel .details, .result .details { padding-block: 13px; border-block: 1px solid var(--line); }
.join-panel p { margin: 0 0 16px; font-size: .88rem; }
label:not(.check) { display: grid; gap: 6px; font-size: .87rem; color: var(--muted); }
input:not([type=checkbox]), textarea, select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); padding: 10px 11px; background: #121a16; color: var(--text); border-radius: 10px; }
textarea { min-height: 90px; resize: vertical; }
input[type=range] { min-height: 34px; }
summary { cursor: pointer; }

.room-main { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.room-heading { display: flex; margin-bottom: 16px; align-items: center; justify-content: space-between; gap: 9px; }
.room-heading h1 { font-size: clamp(1.26rem, 5.6vw, 2rem); }
.timer-wrap { display: inline-flex; align-items: center; gap: 5px; padding: 8px; background: #28372e; border: 1px solid #3e5747; border-radius: 13px; white-space: nowrap; }
.timer-wrap .ui-icon { width: 16px; height: 16px; color: var(--accent); }
.timer { min-width: 31px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }
.timer.urgent { color: #ffc0ad; }
.connection { color: #ffd5bc; font-size: .82rem; padding: 4px 0; }
.waiting, .result { max-width: 560px; margin: 17px auto 0; text-align: center; }
.waiting-icon, .result-icon { display: inline-grid; place-items: center; width: 68px; height: 68px; border-radius: 22px; color: var(--accent); background: #2b4637; }
.waiting-icon .ui-icon, .result-icon .ui-icon { width: 31px; height: 31px; }
.result-icon.negative { color: var(--negative); background: #422e2d; }
.result-icon.neutral { color: var(--neutral); background: #313c35; }
.waiting h2, .result h2 { margin: 11px 0 5px; font-size: 1.6rem; }
.waiting button { margin-top: 6px; }
.table-stage {
  position: relative; isolation: isolate; min-height: clamp(290px, 52dvh, 500px); border: 1px solid #416653; border-radius: 25px;
  background: #1d4634; box-shadow: inset 0 0 22px #08171166;
}
.table-stage::before { content: ""; z-index: -1; position: absolute; inset: 7px; border: 1px solid #76b39325; border-radius: 19px; pointer-events: none; }
.opponent { display: flex; align-items: center; padding: 13px 14px 9px; gap: 9px; font-size: .91rem; }
.opponent small { display: block; color: #bbccc0; }
.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #365848; color: #d7f4e2; flex: none; font-weight: 790; object-fit: cover; }
.opponent-cards { display: flex; margin-left: auto; min-width: 24px; min-height: 29px; padding-left: 8px; }
.opponent-cards .card { width: 25px; height: 35px; margin-left: -8px; border-radius: 5px; }
.felt { padding: 7px 11px 13px; display: grid; grid-template-columns: 50px 1fr; gap: 8px; align-items: start; }
.trump { display: grid; text-align: center; justify-items: center; gap: 5px; }
.trump .card { width: 52px; height: 72px; }
.trump small { color: #c3d6c8; font-size: .7rem; }
.board { min-height: clamp(190px, calc(52dvh - 90px), 390px); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px 8px; }
.pair { display: flex; align-items: flex-start; width: 91px; min-height: 106px; }
.pair .card:nth-child(2) { z-index: 1; margin: 5px 0 0 -50px; transform: rotate(1deg); transform-origin: 50% 50%; }
.card { display: inline-grid; grid-template-rows: min-content 1fr; place-items: start; width: 46px; height: 63px; min-height: 0; padding: 5px 6px; color: #181e1a; background: #fbf6e9; border-radius: 8px; border: 1px solid #d6d8ca; box-shadow: 0 4px 7px #0006; flex: none; line-height: 1; font-size: .87rem; }
.card span { font-family: Georgia, serif; align-self: center; justify-self: center; font-size: 1.35rem; }
.card.red { color: #b23847; }
.card-back { color: #b9d9c7; background: #315943; border-color: #95b3a5; place-items: center; }
.card.playable { border: 2px solid var(--accent); }
.card.lifted { transform: translateY(-9px); outline: 2px solid var(--accent); }
.muck-anchor { position: absolute; inset: auto 16px 16px auto; width: 36px; height: 49px; }
.table-motion-layer { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.motion-card.card { position: absolute; margin: 0; }
.card[data-in-flight] { opacity: 0; }
.your-hand { margin: 11px 0 6px; }
.hand { display: flex; justify-content: safe center; min-height: 80px; align-items: center; padding: 6px; overflow-x: auto; gap: 4px; }
.hand .card { width: clamp(42px, 12vw, 54px); height: clamp(60px, 18vw, 76px); }
.actions { display: flex; align-items: stretch; justify-content: center; gap: 7px; flex-wrap: wrap; min-height: 44px; color: var(--muted); font-size: .9rem; }
.actions button { flex: 1 0 auto; }
.turn-status { display: inline-flex; gap: 7px; align-items: center; justify-content: center; font-weight: 600; }
.turn-status .ui-icon { width: 19px; height: 19px; color: var(--accent); }
.community { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.empty-card { width: 46px; height: 63px; border: 1px dashed #86a192; border-radius: 8px; background: #274637; }
#deposit, #withdraw { display: grid; gap: 8px; margin: 11px 0; }
.dice-stage { background: var(--panel); }
.dice-board { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 10px 0 13px; }
.dice-board > div { padding: 13px 6px; min-width: 0; text-align: center; border: 1px solid #405c4c; border-radius: 14px; background: #14271f; overflow-wrap: anywhere; }
.dice-faces { display: flex; justify-content: center; gap: clamp(5px, 2vw, 9px); padding: 12px 0 9px; }
.die {
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center;
  width: clamp(35px, 11vw, 56px); aspect-ratio: 1; padding: clamp(5px, 1.6vw, 8px);
  color: #26342a; background: #f3eddb; border: 1px solid #fdf6e4;
  border-radius: 10px; box-shadow: 0 3px 0 #a9a18e, 0 5px 9px #07120dc9;
}
.die-empty { display: grid; grid-template: 1fr / 1fr; color: #a4b9aa; background: #233a2f; border: 1px dashed #619277; box-shadow: none; }
.pip { width: 78%; aspect-ratio: 1; border-radius: 50%; background: currentColor; }
.pip-1 { grid-area: 1 / 1; }
.pip-3 { grid-area: 1 / 3; }
.pip-4 { grid-area: 2 / 1; }
.pip-5 { grid-area: 2 / 2; }
.pip-6 { grid-area: 2 / 3; }
.pip-7 { grid-area: 3 / 1; }
.pip-9 { grid-area: 3 / 3; }
.dice-reading { min-height: 42px; display: grid; align-content: center; justify-items: center; gap: 2px; color: var(--muted); }
.dice-score { color: var(--text); font-size: clamp(.91rem, 4.4vw, 1.36rem); font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }
.dice-score em { color: var(--accent); font-size: 1.17em; font-style: normal; }
.dice-tie { display: grid; gap: 3px; padding: 11px 13px; margin-bottom: 12px; border: 1px solid #527965; border-radius: 12px; background: #233a2f; }
.dice-tie strong { color: var(--accent); }
.dice-tie span { color: var(--muted); font-size: .8rem; }

.balance-hero { padding: clamp(16px, 5vw, 26px); border: 1px solid #4b7560; border-radius: 25px; margin-bottom: 14px; background: var(--panel); }
.balance-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.balance-heading > div { min-width: 0; }
.balance-heading > .ton-icon { width: 41px; height: 41px; }
.balance-total { font-size: clamp(2rem, 9vw, 3.5rem); line-height: 1.1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance-total small { color: var(--accent); font-size: 1.05rem; letter-spacing: 0; }
.balance-reserve { display: flex; align-items: center; gap: 7px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #527963; color: #d1e1d4; font-size: .8rem; }
.balance-reserve strong { margin-left: auto; white-space: nowrap; }
.balance-reserve .ui-icon { width: 17px; height: 17px; color: var(--accent); }
.finance-notice { margin: 14px 0; }
.payment-panel details { margin-top: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.payment-panel details summary { color: var(--text); font-weight: 690; }
.address { overflow-wrap: anywhere; max-width: 210px; }

.profile-head { display: flex; align-items: center; gap: 13px; padding: clamp(16px, 5vw, 28px); margin: 0 0 18px; border: 1px solid #406752; border-radius: 25px; background: var(--panel); }
.profile-head h1 { font-size: clamp(1.65rem, 6.7vw, 2.55rem); }
.profile-head p:not(.eyebrow) { font-size: .8rem; margin-top: 4px; }
.profile-avatar .avatar { width: clamp(60px, 17vw, 76px); height: clamp(60px, 17vw, 76px); border: 2px solid #7ccd9e; font-size: 1.8rem; box-shadow: 0 0 0 5px #8ae0af20; }
.profile-person { min-width: 0; }
.profile-last { color: #bacbbd; }
.profile-filters { display: grid; gap: 10px; margin-bottom: 11px; }
.mode-field, .admin-select { display: grid; gap: 6px; align-content: start; }
.mode-field select { background: #1b2820; font-weight: 690; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: #151e19; }
.segmented button { min-height: 39px; padding: 5px 3px; border-color: transparent; background: transparent; color: var(--muted); font-size: .79rem; line-height: 1.15; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.metric { min-width: 0; min-height: 99px; display: grid; align-content: start; gap: 3px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.metric .ui-icon { width: 19px; height: 19px; color: var(--accent); }
.metric strong { font-size: clamp(1.25rem, 6vw, 1.9rem); font-weight: 740; line-height: 1.15; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); line-height: 1.23; overflow-wrap: anywhere; }
.metric .metric-note { font-size: .67rem; }
.profile-charts { margin-top: 11px; display: grid; gap: 10px; }
.profile-charts .panel { margin: 0; min-width: 0; }
.chart-panel .empty-state { margin-top: 10px; }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.chart-heading h3 { color: var(--muted); }
.chart-heading .chart-value { margin: 3px 0 1px; font-size: clamp(1.65rem, 7.5vw, 2.5rem); font-weight: 760; line-height: 1.08; letter-spacing: -.045em; overflow-wrap: anywhere; }
.chart-value small { font-size: .85rem; letter-spacing: 0; }
.chart-reading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 7px 9px; margin-top: 9px; background: #23342a; border-radius: 9px; font-size: .74rem; color: #c2d1c5; }
.chart-reading strong { color: var(--text); text-align: right; }
.profile-chart { display: block; width: 100%; max-height: 244px; margin-top: 8px; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.profile-chart text { fill: #a7b8ad; font-family: inherit; font-size: 9px; pointer-events: none; }
.chart-guide { stroke: #43554a; }
.chart-zero { stroke: #607c6c; stroke-dasharray: 4 4; }
.chart-stroke { fill: none; stroke-width: 2.1px; stroke-linecap: round; stroke-linejoin: round; }
.chart-marker { stroke: #a2d9b7; stroke-dasharray: 4 3; opacity: .6; }
.chart-dot { fill: #adf3ca; stroke: #294638; stroke-width: 1.5px; }
.outcome-layout { display: grid; grid-template-columns: minmax(86px, 115px) minmax(0, 1fr); align-items: center; gap: 15px; }
.outcome-panel { display: flex; flex-direction: column; }
.outcome-ring { display: grid; place-items: center; }
.outcome-ring > * { grid-area: 1 / 1; }
.outcome-ring svg { display: block; width: 100%; overflow: visible; transform: rotate(-90deg); }
.outcome-ring circle { stroke-width: 8; fill: none; }
.ring-track { stroke: #34483b; }
.ring-wins { stroke: #89e2ad; }
.ring-losses { stroke: #ed9d95; }
.ring-draws { stroke: #a5aeb8; }
.outcome-ring div { text-align: center; display: grid; }
.outcome-ring strong { font-size: 1.17rem; line-height: 1.1; }
.outcome-ring span { color: var(--muted); font-size: .63rem; }
.outcome-legend { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; font-size: .81rem; }
.outcome-legend li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
.outcome-legend i { display: block; width: 8px; height: 8px; border-radius: 50%; }
.legend-wins { background: #89e2ad; }
.legend-losses { background: #ed9d95; }
.legend-draws { background: #a5aeb8; }
.profile-history, .profile-help { margin-top: 20px; }
.history-record summary { list-style: none; }
.history-record summary::-webkit-details-marker { display: none; }
.history-record[open] summary > .ui-icon { transform: rotate(90deg); }
.record-details { display: grid; gap: 6px; padding: 0 12px 10px 61px; color: var(--muted); font-size: .82rem; }
.record-details code { overflow-wrap: anywhere; }
.record-details button { justify-self: start; align-items: center; padding-left: 0; }
.record-details button .ui-icon { width: 15px; height: 15px; }
.more-history { margin-top: 9px; }
.preferences-panel { margin-top: 20px; }
.preferences-panel .preference { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; margin: 0; min-height: 56px; padding-block: 6px; cursor: pointer; color: var(--text); }
.preference + .preference { border-top: 1px solid var(--line); }
.preference .icon-box { width: 36px; height: 36px; }
.preference .toggle { appearance: none; position: relative; flex: none; width: 41px; height: 24px; margin: 0; border: 1px solid #64766a; border-radius: 999px; background: #36483d; cursor: pointer; }
.toggle::after { content: ""; position: absolute; inset: 3px auto 3px 3px; aspect-ratio: 1; border-radius: 50%; background: #e4eee7; transition: transform .18s ease; }
.toggle:checked { background: #78dba7; border-color: #8be9b5; }
.toggle:checked::after { transform: translateX(17px); background: #183b28; }
.logout-button { margin-top: 11px; }

#toast { position: fixed; bottom: calc(78px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(450px, 90vw); border-radius: 13px; background: #e5f7eb; color: #192e22; font-weight: 690; padding: 11px 14px; z-index: 9; font-size: .88rem; }
#toast[data-empty="true"] { display: none; }
#toast[data-empty="false"][role="alert"] { background: #ffe7e1; color: #351b18; }
#toast [data-toast-text] { overflow-wrap: anywhere; }
#toast [data-toast-close] { min-height: 34px; padding: 5px 8px; background: transparent; border-color: currentColor; color: inherit; font-size: .78rem; }
.loading { color: var(--muted); padding: 28px; text-align: center; }

.admin-shell { max-width: 1110px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.admin-grid > .panel { margin: 3px 0; }
.admin-form { display: grid; gap: 9px; margin: 10px 0; }
.admin-form label { margin: 0; }
.admin-select label { margin-bottom: 0; }
.admin-select select { font-size: .93rem; }
.admin-form textarea { min-height: 110px; }
.admin-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 8px; }
.admin-shell pre { white-space: pre-wrap; overflow-wrap: anywhere; color: #c4d7ca; font-size: .8rem; }
.admin-shell summary { margin: 7px 0; }
.admin-shell fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.admin-shell legend { color: var(--muted); font-size: .84rem; }
.admin-shell fieldset .check + .check { margin-top: 7px; }
.admin-login { max-width: 475px; margin-inline: auto; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.admin-tabs button[aria-current] { color: var(--accent); background: #2b4437; border-color: #5f9076; }
.admin-overview-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr)); gap: 8px; margin-bottom: 10px; }
.admin-identity { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); }
.admin-identity .ui-icon { width: 17px; height: 17px; }
.admin-list { padding: 0; margin: 0; list-style: none; }
.admin-list > li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.admin-badge { display: inline-flex; padding: 3px 6px; border-radius: 6px; color: var(--accent); background: #263a2e; font-size: .7rem; font-weight: 620; }
.admin-row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.admin-row-actions button { padding-inline: 7px; font-size: .77rem; }
.admin-action-dialog { width: min(450px, calc(100% - 30px)); border: 1px solid #4c6a57; border-radius: 20px; padding: 18px; background: var(--panel); color: var(--text); }
.admin-action-dialog::backdrop { background: #070d09b9; }
.admin-action-dialog .stack { grid-template-columns: 1fr 1fr; }
.admin-action-dialog [role=alert] { color: var(--negative); font-size: .84rem; }
.admin-action-dialog [role=alert]:empty { display: none; }
.audit-entry { padding-block: 7px; border-bottom: 1px solid var(--line); }

@media (min-width: 700px) {
  .lobby-layout { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, .93fr); gap: 20px; align-items: start; }
  .mode-tile { min-height: 122px; padding: 14px; }
  .mode-dice { min-height: 63px; }
  .profile-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr); align-items: end; }
  .profile-charts { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: stretch; }
  .outcome-layout { flex: 1; grid-template-columns: minmax(83px, 145px) minmax(0, 1fr); margin-block: 10px; }
  .metric { padding: 14px; }
  .room-main { max-width: 710px; margin-inline: auto; }
  .shell:has(> .bottom) > .top { position: sticky; top: 0; z-index: 3; background: #101512f5; backdrop-filter: blur(12px); }
  .bottom { top: max(12px, env(safe-area-inset-top)); bottom: auto; width: min(43vw, 405px); padding: 3px; border-radius: 14px; box-shadow: none; }
  .bottom button { display: flex; justify-content: center; align-items: center; gap: 5px; min-height: 38px; padding: 4px 2px; }
  .bottom .nav-icon, .bottom .ui-icon, .bottom .ton-icon { width: 17px; height: 17px; }
}
@media (max-width: 355px) {
  .mode-name, .menu-row { font-size: .82rem; }
  .balance-pill { font-size: .85rem; }
  .row-amount { font-size: .76rem; }
  .community .card, .empty-card { width: 40px; height: 57px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}

/* Calm table surfaces and touch-first card controls. */
.die { background: #f3eddb; }
.room-heading-actions { display: inline-flex; align-items: center; gap: 7px; }
.room-exit-link { min-height: 37px; padding-inline: 8px; color: #e7b4a8; }
.card-texture { display: block; padding: 0; overflow: hidden; background: transparent; border: 0; box-shadow: none; }
.card-texture > img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card-texture.playable { border: 0; outline: 2px solid var(--accent); outline-offset: 2px; }
.fan-position { display: inline-block; flex: 0 0 auto; transform: translateY(var(--fan-rise, 0px)) rotate(var(--fan-tilt, 0deg)); transform-origin: bottom center; transition: transform .16s ease, margin .16s ease; }
.durak-hand { display: flex; justify-content: safe center; align-items: end; min-height: 124px; padding: 25px 8px 8px; overflow-x: auto; overscroll-behavior-x: contain; touch-action: pan-x pinch-zoom; }
.durak-hand .fan-position + .fan-position { margin-left: -19px; }
.durak-hand .card { width: clamp(64px, 19vw, 82px); height: clamp(86px, 27vw, 112px); }
.durak-hand .card.lifted { transform: translateY(-10px); }
.durak-drag { position: fixed; z-index: 8; width: 64px; height: 88px; transform: translate(-50%, -50%) rotate(-4deg); pointer-events: none; box-shadow: 0 12px 22px #0008; }
.drop-ready { outline: 3px solid var(--accent); outline-offset: 3px; }
.durak-hint { display: flex; align-items: flex-start; gap: 7px; min-height: 22px; margin: 4px 0 8px; color: var(--muted); font-size: .82rem; }
.durak-hint .ui-icon { width: 17px; height: 17px; color: var(--accent); flex: none; }
.pair .card-texture { width: 70px; height: 98px; }
.trump .card-texture { width: 52px; height: 72px; }
.exit-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.exit-options .poker-leave { margin-top: 0; }
.room-main > .exit-sheet { z-index: 10; }
.table-motion-layer .card-texture > img { width: 100%; height: 100%; }
@media (max-width: 400px) {
  .room-heading { align-items: flex-start; }
  .room-heading-actions { flex-direction: column; align-items: end; }
  .durak-hand .fan-position + .fan-position { margin-left: -24px; }
}
@media (max-width: 699px) {
  .bottom { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); width: auto; transform: none; }
  .shell:has(.lobby-layout) > main { padding-bottom: 20px; }
  .shell:has(.lobby-layout) > .bottom { position: static; width: calc(100% - 24px); margin: 12px auto max(10px, env(safe-area-inset-bottom)); transform: none; }
}
