:root {
  color-scheme: dark;
  --bg: #081c17;
  --panel: #102b23;
  --line: #2a503e;
  --paper: #f4f6ed;
  --muted: #a5bcad;
  --mint: #9de7b7;
  --gold: #f4d089;
  --danger: #ffa69a;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--paper);
  background: var(--bg);
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(ellipse at 50% 0, #17372a 0, var(--bg) 48rem); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.95rem; letter-spacing: -.04em; }
h2 { font-size: 1.14rem; }
small, .small { font-size: .82rem; }
[hidden] { display: none !important; }
.shell { max-width: 618px; margin: auto; padding: 0 clamp(12px, 4vw, 24px) max(24px, env(safe-area-inset-bottom)); }
.site-head { display: flex; align-items: center; justify-content: center; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.35rem; font-weight: 850; }
main { padding-top: 14px; }
.stack { display: grid; gap: 14px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.positive { color: var(--mint); }
.negative { color: var(--danger); }
.num { font-variant-numeric: tabular-nums; }
.row, .between { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.expand { flex: 1; }
.center { text-align: center; }
.link { border: 0; background: transparent; color: var(--mint); padding: 8px 3px; min-height: 38px; }
.panel { border: 1px solid var(--line); border-radius: 15px; padding: 14px; background: var(--panel); }
.panel + .panel { margin-top: 0; }
.button { border: 1px solid transparent; border-radius: 11px; min-height: 46px; padding: 9px 15px; font-weight: 700; text-align: center; }
.primary { background: #a6e6b2; color: #10251b; }
.primary:not(:disabled):active { background: #83d69d; }
.secondary { background: #18372b; border-color: #3a5e4a; }
.secondary:not(:disabled):active { background: #254b3a; }
.field { min-width: 0; width: 100%; min-height: 44px; padding: 9px 11px; color: var(--paper); background: #0a211a; border: 1px solid #3a5e4a; border-radius: 9px; }
.field::placeholder { color: #8da598; }
.field-label { display: grid; gap: 6px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
.section-title { margin: 8px 0 1px; }
.mode-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; padding: 5px; border-radius: 12px; background: #0c241c; border: 1px solid var(--line); }
.mode-tabs button { min-height: 40px; padding: 6px 3px; border: 0; background: transparent; border-radius: 8px; font-size: .84rem; }
.mode-tabs button[aria-pressed=true] { background: #f2d08c; color: #291e0c; font-weight: 800; }
.list-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; }
.status-banner { border-left: 3px solid var(--gold); background: #263526; border-radius: 5px; color: var(--gold); padding: 8px 10px; font-size: .85rem; }
.page-title { display: flex; align-items: center; gap: 9px; }
.page-title .link { width: 32px; font-size: 1.7rem; line-height: 1; }
.page-title h1 { flex: 1; }
.screen-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: clamp(214px,57vw,320px);
  display: flex; flex-direction: column; justify-content: end; align-items: start; gap: 8px;
  padding: clamp(19px,6vw,43px); border: 1px solid #beffec; border-radius: 21px;
  background: linear-gradient(0deg,#031f15b3,transparent 70%), #065441 url("/art/neon-table.webp") center top / 100% auto no-repeat;
  box-shadow: 0 0 14px #54fbd36b;
}
.hero .eyebrow { color: #d2e5ca; font-size: .76rem; letter-spacing: .19em; }
.hero h1 { font-size: clamp(2.35rem, 11vw, 3.4rem); letter-spacing: -.06em; line-height: 1.02; padding: 1px 0 3px; }
.hero p { color: #d4e4d8; font-size: .92rem; }
.nine {
  --ball: 116px;
  width: var(--ball); height: var(--ball); display: inline-grid; place-items: center; border-radius: 50%;
  background: url("/art/neon-nine.webp") center / cover no-repeat, radial-gradient(circle at 34% 25%, #fff9c7, #f4cc5c 21%, #d99b24 53%, #955713 86%);
  box-shadow: inset 0 1px 3px #fff6ab, inset -6px -10px 16px #42230455, 0 15px 23px #00180fa0;
}
.nine b {
  display: none;
}
.nine.mini { --ball: 24px; box-shadow: none; }
.hero .nine { --ball: clamp(96px,28vw,175px); position: absolute; top: 19%; right: 10%; z-index: -1; }
body[data-view="home"] { background: radial-gradient(ellipse at 50% 24%,#073b29,#031b14 69%); }
body[data-view="home"] main { padding-top: 5px; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.home-actions .button { min-height: 49px; border-radius: 14px; }
.home-actions .secondary {
  border-color: #b4fff1; color: #fff; background: #08392d; box-shadow: 0 0 7px #5efad06b;
}
.home-actions [data-action="join"] { border-color: #ffe786; background: #2e310d; box-shadow: 0 0 7px #ffda5570; }
body[data-view="home"] .section-title { flex-wrap: wrap; gap: 0 10px; }
body[data-view="home"] .section-title .link { font-size: .88rem; }
body[data-view="invite"] .site-head { display: none; }
body[data-view="invite"] .shell { max-width: 440px; }
body[data-view="invite"] main { padding-top: max(24px, calc(env(safe-area-inset-top) + 16px)); }
.room-code { text-align: center; }
.room-code strong { display: block; margin-top: 3px; font-size: 2.4rem; color: var(--gold); letter-spacing: .16em; }
.seat-badge { display: inline-grid; place-items: center; width: 33px; height: 33px; border-radius: 50%; background: #28543c; color: var(--mint); }
.rule-line { display: grid; grid-template-columns: 1fr 70px 19px; align-items: center; gap: 9px; }
.rule-line .field { text-align: center; }
.rules-form { gap: 9px; }

body[data-view="room"], body[data-view="profile"] {
  background: radial-gradient(ellipse at 50% 11%, #073e31, #031713 64%);
}
body[data-view="room"] .shell, body[data-view="profile"] .shell { max-width: 600px; padding-inline: 0; }
body[data-view="room"] .site-head, body[data-view="profile"] .site-head { display: none; }
body[data-view="room"] main, body[data-view="profile"] main { padding-top: env(safe-area-inset-top); }

.game-screen { display: grid; gap: 8px; padding-top: 4px; }
.game-screen > .status-banner { margin: 0 10px; }
.score-head { text-align: center; padding: 0 11px; min-height: 42px; }
.score-head h1 { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: clamp(1.26rem, 6.1vw, 2rem); letter-spacing: .01em; white-space: nowrap; text-shadow: 0 2px 4px #001411; }
.score-head .link, .profile-heading .link { color: white; }
.score-head .nine.mini { --ball: clamp(24px, 8.2vw, 40px); }
.meta {
  justify-self: center; display: flex; justify-content: center; align-items: center; gap: 0;
  max-width: 96%; padding: 4px 8px; border: 1px solid #eaf8ed; border-radius: 30px;
  color: #fcfff9; background: #001811b3; font-weight: 750; font-size: clamp(.64rem, 3vw, .9rem); white-space: nowrap;
}
.meta span { padding: 0 clamp(5px, 1.8vw, 11px); }
.meta span + span { border-left: 1px solid #deebe1; }
.meta b { color: #ffec57; }

.table {
  --portrait-size: clamp(63px, 18vw, 102px);
  --score-size: clamp(1.35rem, 7vw, 2.6rem);
  --game-action-size: clamp(45px, 13vw, 70px);
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.86fr) minmax(0,1fr);
  grid-template-rows: auto 1fr auto; align-items: center; justify-items: center;
  column-gap: clamp(5px,1.7vw,12px); row-gap: clamp(16px,5vw,28px);
  min-height: clamp(510px, calc(100svh - 138px), 930px);
  padding: clamp(26px,8vw,48px) 4.5% clamp(30px,9vw,52px);
  color: #fff; background: #065441 url("/art/neon-table.webp") center / 100% 100% no-repeat;
}
.game-seat { display: grid; justify-items: center; gap: clamp(9px,2.7vw,16px); width: 100%; min-width: 0; }
.game-seat.self { grid-column: 1 / -1; grid-row: -2 / -1; width: min(48%,220px); --portrait-size: clamp(70px,21vw,112px); }
.seat { width: 100%; display: grid; justify-items: center; align-content: start; }
.portrait {
  --portrait-x: 0%; --portrait-y: 0%;
  display: grid; place-items: center; width: var(--portrait-size); height: var(--portrait-size); border-radius: 50%;
  border: clamp(2px, .8vw, 4px) solid #78deff; background: #113641 url("/art/neon-portraits.webp") var(--portrait-x) var(--portrait-y) / 200% 200% no-repeat;
  box-shadow: 0 0 11px #42d4ff, 0 0 20px #1888ffaa, inset 0 0 4px #fff7;
}
.portrait-1 { --portrait-x: 100%; }
.portrait-2 { --portrait-y: 100%; }
.portrait-3 { --portrait-x: 100%; --portrait-y: 100%; }
.uploaded-avatar { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; border-radius: 50%; object-fit: cover; }
.self .portrait, .profile-portrait {
  border-color: #fff1a0; box-shadow: 0 0 10px #ffee8e, 0 0 20px #fabe3888, inset 0 0 4px #fff7;
}
.mode-3 .slot-2 .portrait, .mode-4 .slot-2 .portrait { border-color: #b2ffce; box-shadow: 0 0 12px #56ff9d, 0 0 19px #1dff8599; }
.seat-active .portrait { outline: 2px solid #eafff2; outline-offset: 3px; }
.seat-name, .seat-score { background: linear-gradient(160deg,#103d32,#031c16 75%); text-shadow: 0 2px 4px #001411; }
.seat-name {
  position: relative; z-index: 1; display: block; min-width: 53%; max-width: 94%; margin-top: -5px; padding: 2px 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; border-radius: 18px; border: 1px solid #ceeadc;
  color: #fff; font-size: clamp(.71rem, 3.4vw, 1.2rem); font-weight: 820;
}
.seat-name span { color: #fff; }
.mode-3 .slot-2 .seat-name span, .mode-4 .slot-2 .seat-name span, .mode-4 .slot-3 .seat-name span { color: #ff5656; }
.seat-score {
  display: flex; align-items: baseline; justify-content: center; gap: 4px; min-width: 66%; padding: 3px 7px 2px; margin-top: -3px;
  border: 1px solid #e3faec; border-radius: 25px; color: #ffe537; line-height: .99; font-size: var(--score-size); font-weight: 900;
}
.seat-score small { color: #f7fcf5; font-size: 46%; }
.player-actions {
  position: relative; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: clamp(5px, 1.55vw, 11px);
  width: 100%; padding: clamp(6px, 1.7vw, 11px); border: 2px solid #dcfff1;
  border-radius: 16px; background: linear-gradient(152deg,#0a4638ed,#02291feF 80%);
  box-shadow: 0 0 5px #f1fff5, 0 0 13px #34ffbc92, inset 0 0 12px #2de0bc59, 0 5px 12px #001910b0;
}
.player-actions::before {
  content: ""; position: absolute; top: -6px; left: calc(50% - 5px); width: 9px; height: 9px; transform: rotate(45deg);
  background: #f9fff8; box-shadow: 0 0 8px #73ffba;
}
.action {
  --highlight: #fff; --middle: #ccc; --shade: #347;
  min-width: 0; height: var(--game-action-size); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px;
  padding: 3px 2px; font-size: clamp(.65rem, 3.2vw, 1.03rem); line-height: .99; font-weight: 900;
  border: 1px solid var(--highlight); border-radius: clamp(8px, 2.7vw, 18px);
  color: #fff; text-shadow: 0 1px 3px #0009;
  background: linear-gradient(172deg,var(--highlight) -25%,var(--middle) 23%,var(--shade) 78%,var(--middle));
  box-shadow: inset 0 1px 4px #fff9, inset 0 -1px 5px var(--highlight), 0 3px 6px #001b15, 0 0 4px var(--highlight);
}
.action:not(:disabled):active { filter: brightness(1.22); transform: scale(.98); }
.action.red { --highlight: #ffb0a1; --middle: #ff4a39; --shade: #a60300; }
.action.blue { --highlight: #a1eaff; --middle: #0599ff; --shade: #00358f; }
.action.green { --highlight: #a2f8b6; --middle: #12bb61; --shade: #00631f; }
.action.yellow { --highlight: #fff1a6; --middle: #ffb51b; --shade: #a46000; }
.game-icon { display: inline-block; line-height: 1; font-weight: 850; }
.action .game-icon { color: #fff; font-size: 1.38em; filter: grayscale(1) brightness(0) invert(1); }
.action.red .game-icon {
  font-family: system-ui,sans-serif; background: #fff; width: 1.12em; height: 1.12em; display: grid; place-items: center;
  color: #e72216; border-radius: 50%; text-shadow: none; filter: none; font-size: 1.14em;
}
.game-action-label { display: grid; justify-items: center; gap: 1px; white-space: nowrap; }
.game-action-label strong { color: #fff22a; font-size: 1.25em; }
.game-action-label strong small { font-size: .67em; }

.mode-2 {
  --portrait-size: clamp(70px,21vw,110px);
  --game-action-size: clamp(52px,15vw,76px);
}
.mode-2 .slot-1, .mode-4 .slot-1 { grid-column: 1 / -1; grid-row: 1; width: min(76%,440px); }
.mode-2 .slot-1 .player-actions, .mode-4 .slot-1 .player-actions { grid-template-columns: repeat(4,minmax(0,1fr)); }
.mode-3 { --game-action-size: clamp(51px,16.1vw,83px); grid-template-rows: 1fr auto; }
.mode-3 .player-actions { grid-template-columns: minmax(0,1fr); gap: clamp(8px,2.75vw,16px); }
.mode-3 .action { flex-direction: row; justify-content: space-evenly; gap: 2px; font-size: clamp(.7rem,3.4vw,1.12rem); }
.mode-3 .action .game-icon { font-size: 1.7em; }
.mode-3 .action.red .game-icon { font-size: 1.35em; }
.mode-3 .slot-1, .mode-4 .slot-2 { grid-column: 1; }
.mode-3 .slot-2, .mode-4 .slot-3 { grid-column: 3; }
.mode-3 .slot-1, .mode-3 .slot-2 { grid-row: 1; }
.mode-4 .slot-2, .mode-4 .slot-3 { grid-row: 2; }
.mode-4 { --portrait-size: clamp(56px,16vw,90px); --game-action-size: clamp(42px,11vw,61px); }

.pool-area { grid-column: 2; grid-row: 2; width: 100%; max-width: 156px; }
.mode-2 .pool-area { grid-column: 1 / -1; width: min(37%,156px); }
.mode-3 .pool-area { grid-row: 1; }
.pool {
  position: relative; display: grid; justify-items: center; align-content: start; width: 100%; min-height: 92px; aspect-ratio: .85;
  padding: 17% 0 8%; border: 0; background: url("/art/neon-pool.webp") center / 100% 100% no-repeat;
  color: #fffbed; font-size: clamp(.85rem, 4vw, 1.55rem); font-weight: 900; text-shadow: 0 1px 4px #281703, 0 2px 2px #000;
  filter: drop-shadow(0 0 9px #ffc82b9a);
}
.pool > span { line-height: 1.02; }
.pool .pool-label { font-size: .55em; color: #fff0be; }
.pool strong {
  position: absolute; inset: auto 8% 11% 8%; font-size: 1.36em; line-height: 1.12; border-radius: 25px; border: 1px solid #ffdd6d;
  color: #fff49a; background: linear-gradient(#301e02da,#1b1206f8); box-shadow: 0 0 6px #ffd67d82;
}
.pool strong small { font-size: .5em; }
.pool .pool-tap { position: absolute; bottom: -7%; font-size: .52em; white-space: nowrap; }
.pool:not(:disabled):active { filter: drop-shadow(0 0 16px #ffe946) brightness(1.1); }
.table-foot {
  margin: 0 9px; display: flex; align-items: stretch; overflow: hidden; border: 1px solid #b4eee3; border-radius: 23px;
  background: linear-gradient(155deg,#185752,#05241f 63%); box-shadow: inset 0 0 7px #bbeedf70, 0 2px 8px #001310;
}
.table-foot button { flex: 1; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 50px; padding: 4px 1px; font-size: clamp(.63rem, 3vw, .93rem); font-weight: 800; color: #effffb; white-space: nowrap; }
.table-foot button + button { border-left: 1px solid #b9e0d0a6; }
.table-foot .game-icon { font-size: 1.58em; }
.table-foot .primary { border-radius: 21px; border: 1px solid #a1ffce; color: #d0ffed; background: linear-gradient(#0cd020,#007740 62%,#079b64); box-shadow: inset 0 0 7px #8fffb6; }
.table-foot .primary:not(:disabled):active { background: #0ca45b; }

.profile-screen { --portrait-size: clamp(66px, 17vw, 116px); display: grid; gap: 10px; padding: 0 11px; }
.profile-editor { --portrait-size: 88px; }
.profile-editor .profile-portrait { justify-self: center; }
.profile-editor input[type="file"] { width: 100%; min-width: 0; }
.profile-edit-link { display: block; padding: 3px 0; color: var(--mint); font-size: .75rem; }
.profile-mast {
  display: grid; padding: 1px 0 4px; background: linear-gradient(0deg,#042419 0%,#04241900 42%,#00120fa0), url("/art/neon-profile.webp") right center / cover;
  margin: 0 -11px; overflow: hidden;
}
.profile-heading { position: relative; text-align: center; min-height: 46px; padding: 2px 10px 5px; filter: drop-shadow(0 1px 1px #1b140b); }
.profile-heading .link { position: absolute; left: 11px; }
.profile-heading h1 { font-size: clamp(1.23rem, 6vw, 2rem); color: #fff6de; text-shadow: 0 2px 4px #1f1404; }
.profile-heading .game-icon { margin-right: 7px; color: #ffdb74; }
.profile-heading::after { position: absolute; content: ""; bottom: 1px; left: 17%; right: 17%; height: 2px; background: linear-gradient(90deg,transparent,#ffaa37,#fffac6,#ffaa37,transparent); box-shadow: 0 0 9px #ffcf43a0; }
.profile-hero { min-height: clamp(80px, 21vw, 145px); padding: 7px 12px 1px 18px; display: flex; align-items: center; gap: clamp(8px, 3vw, 18px); }
.profile-portrait { flex: 0 0 var(--portrait-size); }
.profile-identity { flex: 1; min-width: 0; text-shadow: 0 2px 3px #001914; }
.profile-identity h2 { font-size: clamp(1.03rem, 5.1vw, 1.75rem); color: #ffe28b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-identity p, .profile-id { font-size: clamp(.66rem, 3.05vw, .94rem); color: #f4fff5; white-space: nowrap; }
.profile-id .link { color: #fff; min-height: 25px; padding: 2px; }
.profile-rank {
  align-self: end; flex: 0 0 clamp(59px, 20vw, 125px); height: clamp(59px,20vw,120px); position: relative;
  background: url("/art/neon-trophy.webp") center / contain no-repeat; filter: drop-shadow(0 1px 4px #ffc03a80);
}
.profile-rank span {
  position: absolute; left: -1%; right: -1%; bottom: 11%; text-align: center; font-size: clamp(.53rem, 2.7vw, .84rem); font-weight: 850;
  background: linear-gradient(#df4026,#87070b); color: #fff0bf; border: 1px solid #e99c42; border-radius: 2px;
  box-shadow: 0 1px 3px #0008;
}
.profile-content { display: grid; gap: 8px; }
.profile-content .mode-tabs {
  background: linear-gradient(#143b33,#06271f); border: 1px solid #b3d3c7; border-radius: 35px;
  padding: 1px; gap: 0; margin: 0 10px; box-shadow: inset 0 0 7px #86b5a866;
}
.profile-content .mode-tabs button { min-height: 32px; border-radius: 35px; font-weight: 850; font-size: clamp(.71rem, 3.45vw, 1rem); }
.profile-content .mode-tabs button[aria-pressed=true] { background: linear-gradient(#ffeb9a,#ffbf3d 55%,#d89014); color: #1e1703; border: 1px solid #fff3b3; box-shadow: inset 0 0 6px #ffecc2, 0 0 8px #ffbf5460; }
.metrics { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: clamp(5px, 1.6vw, 10px); text-align: center; }
.metric {
  --metric-a: #72ffbf; --metric-b: #0e7052; --metric-c: #063a27;
  min-width: 0; min-height: clamp(62px, 14.1vw, 91px); display: grid; justify-items: center; align-content: center; gap: 4px; padding: 5px 2px;
  border-radius: clamp(10px, 3vw, 19px); color: #fff; background: radial-gradient(ellipse at 50% 5%,var(--metric-c),#04251e 75%);
  border: 1px solid var(--metric-a); box-shadow: inset 0 0 12px var(--metric-b), 0 0 5px color-mix(in srgb,var(--metric-a) 36%,transparent);
}
.metric-red { --metric-a: #ffa2a3; --metric-b: #974952; --metric-c: #4d211f; }
.metric-gold { --metric-a: #ffdd76; --metric-b: #8c690b; --metric-c: #544418; }
.metric-blue { --metric-a: #83d1ff; --metric-b: #14689a; --metric-c: #0d4661; }
.profile-matches .metric { background: radial-gradient(ellipse at 50% 5%,#085743,#032c22 75%); border-color: #51cda3; box-shadow: inset 0 0 12px #15906c, 0 0 5px #4fffbd44; }
.metric span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-size: clamp(.72rem, 3vw, 1rem); font-weight: 760; }
.metric .game-icon { color: var(--metric-a); font-size: 1.14em; font-family: system-ui,sans-serif; }
.metric strong { color: var(--metric-a); line-height: 1; font-weight: 900; font-size: clamp(1.38rem, 7vw, 2.5rem); text-shadow: 0 2px 4px #001710; }
.metric strong small { color: #ddf5ed; font-size: .35em; margin-left: 2px; }
.history-heading { margin: 1px 2px -5px; }
.history-heading .game-icon { color: #ffda6b; margin-right: 6px; }
.history-heading h2 { font-size: clamp(.97rem, 4.6vw, 1.4rem); }
.history-heading .link { font-size: clamp(.67rem, 3.05vw, .93rem); }
.profile-history { display: grid; gap: 4px; }
.history-entry {
  display: grid; grid-template-columns: minmax(0,.9fr) auto minmax(0,1fr) auto auto; align-items: center; gap: clamp(4px, 1.35vw, 9px);
  width: 100%; min-height: 35px; padding: 6px 6px; text-align: left; color: #f2fff8;
  background: linear-gradient(170deg,#164a41,#052f27); border: 1px solid #398e79; border-radius: 9px;
  font-size: clamp(.64rem, 3.05vw, .95rem); white-space: nowrap;
}
.history-entry .game-icon { margin-right: 3px; }
.history-entry strong { font-size: 1.18em; }
.history-kind { border: 1px solid #ffcc5a; background: #5b4713; color: #fff0b4; border-radius: 12px; padding: 0 4px; font-size: .88em; }
.history-kind.single { border-color: #5cc8ff; color: #cbeeff; background: #114b6b; }
.profile-privacy {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; min-height: 53px; padding: 7px 9px;
  background: linear-gradient(156deg,#17654e,#06362a); border: 1px solid #76e0ba; box-shadow: inset 0 0 9px #3ed9aa65;
}
.profile-privacy > .game-icon { font-size: 1.6rem; color: #ffdc7a; }
.profile-privacy strong, .profile-privacy small { display: block; line-height: 1.18; }
.profile-privacy strong { font-size: clamp(.83rem, 3.7vw, 1.12rem); }
.profile-privacy small { color: #d8f6ea; font-size: clamp(.58rem, 2.8vw, .85rem); margin-top: 3px; }
.privacy-switch { width: 42px; height: 25px; border: 0; border-radius: 20px; padding: 2px; background: #45685d; }
.privacy-switch::after { content: ""; display: block; width: 21px; height: 21px; border-radius: 50%; background: #f5fff9; box-shadow: 0 0 3px #052d23; }
.privacy-switch[aria-checked=true] { background: #29d967; }
.privacy-switch[aria-checked=true]::after { transform: translateX(17px); }
.profile-privacy-detail { display: flex; align-items: center; justify-content: end; gap: 6px; }
.profile-privacy-detail .field { width: auto; min-height: 30px; padding: 2px 4px; }

.app-nav {
  display: grid; grid-template-columns: repeat(5,1fr); align-items: center; min-height: 57px; margin-top: 6px; padding: 2px 3px;
  background: linear-gradient(165deg,#154039,#04271e); border: 1px solid #ffda83; border-radius: 36px;
  box-shadow: 0 0 5px #ffda83aa, inset 0 0 9px #dda95980;
}
.app-nav button { display: grid; justify-items: center; align-content: center; gap: 3px; color: #f6fff9; font-size: clamp(.62rem, 3vw, .86rem); font-weight: 800; min-height: 43px; padding: 1px; }
.app-nav button + button { border-left: 1px solid #e6efdc66; }
.app-nav .game-icon { font-size: 1.58em; }
.app-nav .current { color: #89ffb7; }
.app-nav .nav-room { position: relative; border: 1px solid #ffdb7a; border-radius: 50%; height: 61px; margin: -10px 1px 0; border-left-color: #ffdb7a; background: #092a23; box-shadow: 0 0 9px #ffcc42a0; }
.app-nav .nine.mini { --ball: 28px; }

.event, .history { display: grid; gap: 5px; }
.highlight-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; text-align: center; }
.highlight-counts div { padding: 8px 2px; border-radius: 8px; background: #0a241c; }
.highlight-counts dt { color: var(--muted); font-size: .82rem; }
.highlight-counts dd { margin: 3px 0 0; font-size: 1.3rem; font-weight: 800; }
.highlight-counts dd small { margin-left: 2px; font-weight: 500; }
.highlight-poster { display: block; width: min(100%, 384px); height: auto; margin: auto; border: 1px solid #9a7845; border-radius: 15px; box-shadow: 0 8px 28px #0008; }
.highlight-preview { display: flex; align-items: center; gap: 13px; }
.highlight-preview img { flex: none; border-radius: 13px; }
.highlight-preview h1 { font-size: 1.06rem; margin: 0 0 4px; }
.highlight-preview p { margin: 5px 0 0; }
.highlight-share textarea { resize: vertical; }
.highlight-share .screen-actions .button { display: grid; place-items: center; }
.notice { position: fixed; z-index: 5; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: 90%; white-space: normal; overflow-wrap: anywhere; text-align: center; background: #e0f2e2; color: #143225; border-radius: 10px; box-shadow: 0 8px 30px #0006; padding: 11px 17px; }
dialog { width: min(92%, 390px); border: 1px solid #5a836b; border-radius: 17px; padding: 20px; background: #16382a; color: var(--paper); }
dialog::backdrop { background: #03150ebd; }
dialog p { margin: 10px 0 18px; color: #d6e6d6; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; }
@media (min-width: 500px) {
  body[data-view="home"] .brand { font-size: 1.65rem; }
}
@media (max-width: 360px) {
  .site-head { min-height: 52px; }
}
