:root {
  color-scheme: dark;
  --bg: #241127;
  --panel: #35192d;
  --line: #694253;
  --text: #fff5df;
  --muted: #e0c3bf;
  --gold: #ffcf66;
  --red: #a3323b;
  font: 16px/1.5 system-ui, "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: radial-gradient(ellipse at 70% 7%, #7d2e3e 0, #3a192f 42%, #201326 78%); min-height: 100vh; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button, summary { cursor: pointer; }
button:disabled { opacity: .53; cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.shell { max-width: 1280px; margin: auto; padding: 12px 24px 0; }
.topbar { min-height: 69px; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #c37c55; border-bottom: 3px solid #9b532d; border-radius: 14px; background: linear-gradient(#822e3b, #571d2f); box-shadow: inset 0 1px #ffd19576, 0 5px 14px #19081080; }
.top-tools { display: flex; gap: 12px; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 900; letter-spacing: .07em; text-shadow: 0 2px #4e1828; }
.brand small { display: block; font-size: 10px; letter-spacing: .13em; color: #f5d6aa; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 2px solid #f4c572; border-radius: 50%; font-size: 23px; color: #fff1c7; background: radial-gradient(circle at 40% 28%, #c84745, #7b192e 75%); box-shadow: inset 0 0 0 2px #762133, 0 3px 6px #3a1427; }
.top-note, footer { color: var(--muted); font-size: 12px; }
.top-note i { display: inline-block; vertical-align: 1px; width: 7px; height: 7px; background: #ffd569; border-radius: 50%; margin-right: 5px; }
.lobby { display: grid; grid-template-columns: minmax(270px, .88fr) minmax(320px, 1.12fr); gap: clamp(24px, 6vw, 90px); align-items: center; min-height: min(650px, 75vh); padding: 56px 0; }
.eyebrow { font-size: 11px; letter-spacing: .19em; font-weight: 800; color: var(--gold); margin: 0 0 10px; }
h1 { font-size: clamp(42px, 6.6vw, 76px); font-weight: 950; letter-spacing: .025em; margin: 0; line-height: 1.13; color: #ffe4a4; text-shadow: 0 2px #a65b36, 0 4px #5d202d, 0 8px 18px #1b0d21; }
h1 span { color: #ffb847; }
.lead { color: var(--muted); font-size: 17px; margin: 20px 0 28px; }
label { font-weight: 650; font-size: 13px; }
input { min-width: 0; color: var(--text); background: #251322; border: 1px solid #9b6471; border-radius: 8px; padding: 11px 13px; }
input::placeholder { color: #d5b5bf; }
#entry { display: grid; gap: 9px; max-width: 350px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 44px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; white-space: nowrap; }
.primary { color: #492517; background: linear-gradient(#ffe18d 0%, #ffc75d 49%, #ef9d3c 100%); border-color: #ffe8a9; border-bottom: 3px solid #b9702a; box-shadow: 0 3px 7px #1b0d1a75, inset 0 1px #fff6cf; }
.primary:hover:not(:disabled) { background: #ffdb81; }
.secondary { background: linear-gradient(#72374a, #51253e); color: var(--text); border-color: #a86d70; border-bottom: 3px solid #482033; }
.secondary:hover:not(:disabled) { background: #824458; }
#enter { justify-content: space-between; }
details { color: var(--muted); font-size: 13px; }
#join-more { margin-top: 16px; }
#open-invite { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#open-invite input { flex: 1 1 160px; }
.error { color: #ffc1b3; font-size: 13px; min-height: 1.45em; margin: 8px 0 0; }
.lobby-art { background: linear-gradient(140deg, #8e3541, #4b2037 72%); border: 2px solid #c99658; border-radius: 24px; padding: 16px 19px; box-shadow: 0 20px 60px #190c20ad, inset 0 0 0 3px #602736; }
.art-caption { display: flex; justify-content: space-between; gap: 8px; color: #ffe9b3; font-size: 12px; font-weight: 900; letter-spacing: .13em; }
.art-felt { position: relative; height: clamp(180px, 26vw, 290px); border-radius: 49%; margin: 20px 0; overflow: hidden; border: 7px solid #d38e4f; background: radial-gradient(ellipse at 44% 34%, #2f9c71, #175c4c 72%, #0e4138); box-shadow: inset 0 0 0 3px #73322f, inset 0 0 36px #122b26, 0 13px 18px #2a0c24b0; }
.art-line { position: absolute; inset: 12px; border-radius: 48%; border: 1px solid #dbc38272; }
.art-monogram { position: absolute; inset: 0; display: grid; place-items: center; color: #d4e3b623; font: 230px/1 Georgia, serif; transform: translateX(19%); }
.art-cards { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0; }
.art-card { position: relative; width: clamp(72px, 10vw, 108px); aspect-ratio: 5/7; border: 1px solid #fff8e0; background: #faf1dc; color: #18352a; border-radius: 9px; font: 750 clamp(20px, 3vw, 30px)/.88 Georgia, serif; box-shadow: 4px 8px 20px #0b1b13a0; }
.art-card span { position: absolute; left: 8px; top: 9px; }
.art-card span:last-child { left: auto; top: auto; right: 8px; bottom: 9px; transform: rotate(180deg); }
.art-card small { display: block; font-size: .65em; text-align: center; margin-top: 3px; }
.art-card strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.75em; }
.first { transform: translateX(13%) rotate(-15deg); }
.second { transform: translateX(-7%) translateY(9%) rotate(11deg); color: var(--red); }
.art-chip { position: absolute; left: 22%; top: 65%; display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%; color: #24352b; border: 4px dashed #faf2dc; background: var(--gold); box-shadow: 1px 4px 8px #0b1b13af; }
.chip-two { left: 68%; top: 66%; transform: rotate(15deg); color: #fff2d8; background: #9e4650; }
.art-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; text-align: center; }
.art-stats div { padding: 6px 2px; background: linear-gradient(#fff0c9, #e8c17d); color: #673925; border: 1px solid #f7d795; border-radius: 8px; box-shadow: 0 3px #b77744; }
.art-stats small { display: block; font-size: 11px; font-weight: 750; }
.art-stats strong { color: #592938; font: 900 clamp(17px, 2.4vw, 25px)/1.35 system-ui, sans-serif; }
footer { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); padding: 16px 0 25px; }
.room { padding: 26px 0; }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.room-head h1 { font-size: clamp(29px, 4.4vw, 44px); }
#room-meta { color: var(--muted); font-size: 12px; margin: 7px 0 0; }
.felt { position: relative; isolation: isolate; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto minmax(145px, auto) auto; gap: 8px; padding: 16px clamp(10px, 2vw, 25px); border: 7px solid #b87143; border-radius: 64px; background: repeating-linear-gradient(45deg, #f4fbe904 0 1px, transparent 1px 3px), radial-gradient(ellipse at 46% 48%, #238b67, #135548 79%); box-shadow: 0 10px 22px #15091688, 0 0 0 1px #eead66, inset 0 0 0 3px #803c33, inset 0 0 36px #092e28; }
.felt::before { content: ""; position: absolute; z-index: -1; inset: 10px; border: 1px solid #dcc1826b; border-radius: inherit; pointer-events: none; }
.felt::after { content: "♠"; position: absolute; z-index: -1; inset: 0; display: grid; place-items: center; color: #e5d5a313; font: clamp(160px, 27vw, 270px)/1 Georgia, serif; pointer-events: none; }
.seats { display: contents; }
.seat { align-self: center; justify-self: center; display: grid; grid-template-rows: 1fr auto; text-align: center; width: min(100%, 158px); min-width: 0; padding: 6px 5px; min-height: 87px; background: linear-gradient(#43314a, #2e213a); border: 1px solid #ca9873; border-radius: 11px; box-shadow: 0 4px 9px #0b242688, inset 0 1px #edc5a43d; }
.seat:nth-child(1) { grid-area: 3 / 5 / 4 / 9; }
.seat:nth-child(2) { grid-area: 3 / 1 / 4 / 4; }
.seat:nth-child(3) { grid-area: 2 / 1 / 3 / 4; }
.seat:nth-child(4) { grid-area: 1 / 1 / 2 / 4; }
.seat:nth-child(5) { grid-area: 1 / 4 / 2 / 7; }
.seat:nth-child(6) { grid-area: 1 / 7 / 2 / 10; }
.seat:nth-child(7) { grid-area: 1 / 10 / 2 / 13; }
.seat:nth-child(8) { grid-area: 2 / 10 / 3 / 13; }
.seat:nth-child(9) { grid-area: 3 / 10 / 4 / 13; }
.seat.own { border-color: #ffd081; background: linear-gradient(#893d48, #512642); }
.seat.active { border-color: #ffe09a; box-shadow: 0 0 0 2px #e6c47a78, 0 0 22px #e6c47a40; }
.seat.empty { background: #104c40b0; color: #e2e6d4; border-color: #95b596; border-style: dashed; box-shadow: none; }
.seat.empty .seat-stack { color: #cce2b2; }
.seat.folded .hand-cards { opacity: .55; }
.seat-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 780; }
.seat-stack { color: var(--gold); font-size: 13px; font-variant-numeric: tabular-nums; }
.seat-tags { color: #c1d2c6; font-size: 10px; line-height: 1.2; }
.center { grid-area: 2 / 4 / 3 / 10; align-self: center; justify-self: center; text-align: center; }
.center .eyebrow { margin-bottom: 7px; }
.board, .hand-cards { display: flex; justify-content: center; gap: 5px; min-height: 28px; }
.card { position: relative; width: clamp(34px, 4.4vw, 52px); aspect-ratio: 5/7; display: grid; place-content: center; color: #17342a; background: linear-gradient(145deg, #fffdf5, #f5dfb5); border: 1px solid #fff7df; border-radius: 7px; box-shadow: 0 4px 9px #071c13b0; font: 750 clamp(16px, 3.4vw, 25px)/.94 Georgia, serif; }
.card-rank { position: absolute; top: 4px; left: 5px; font-size: .7em; }
.card b { font-size: 1.18em; transform: translateY(13%); }
.card.red { color: var(--red); }
.card.back { background: repeating-linear-gradient(45deg, #8b3f53 0 2px, #61283d 2px 4px); color: #ffe29c; border-color: #d3977e; }
.card.blank { color: #a8c0a568; background: #163b2e80; border: 1px dashed #a3ba9d85; box-shadow: none; }
.hand-cards .card { width: 27px; font-size: 14px; border-radius: 4px; }
.hand-cards .card-rank { left: 2px; top: 2px; }
.pot { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 6px; color: #e7eddd; background: #0c271dbf; border: 1px solid #a796627a; border-radius: 24px; font-size: 12px; margin-top: 11px; }
.pot strong { color: var(--gold); font-size: 16px; font-variant-numeric: tabular-nums; margin-left: 3px; }
.chip-icon { display: grid; place-items: center; width: 24px; height: 24px; border: 2px dashed #fff0c4; border-radius: 50%; background: #9c7438; color: #fff1c4; }
.action-panel { margin-top: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 13px; background: linear-gradient(#582d45, var(--panel)); border: 1px solid #ab725f; border-radius: 11px; }
.action-info { display: grid; gap: 3px; }
#timer { font-size: 12px; color: var(--muted); }
.actions, .raise { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.raise input { width: 106px; }
.room-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 5px; }
.quiet { color: var(--muted); border: 0; background: transparent; text-decoration: underline; padding: 1px 4px; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 290px); align-items: start; gap: 16px; }
.table-column { min-width: 0; }
.social, dialog { border: 1px solid #b77c68; border-radius: 12px; background: #32182c; box-shadow: 0 8px 18px #180a1a8c; }
.social { overflow: hidden; }
.social-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #6b2c43; border-bottom: 1px solid #bf8764; }
.social-tabs button, .rank-switch button { font: inherit; font-weight: 800; color: #ffedce; border: 0; background: transparent; padding: 9px 5px; }
.social-tabs button[aria-pressed="true"] { color: #55273a; background: linear-gradient(#ffe8ac, #f5bc68); }
#chat-panel, #ranks-panel { padding: 9px; }
.chat-log { height: clamp(160px, 32vh, 320px); overflow: auto; padding: 7px; border-radius: 7px; background: #251322; }
.chat-message { padding: 4px 5px; border-bottom: 1px solid #513045; overflow-wrap: anywhere; font-size: 13px; }
.chat-message strong { color: #ffd788; }
.chat-message time { margin-left: 6px; color: var(--muted); font-size: 10px; }
.chat-message p { margin: 2px 0; }
.chat-form { display: flex; gap: 5px; margin-top: 8px; }
.chat-form input { flex: 1; width: 0; font-size: 13px; padding: 8px; }
.chat-form .button { padding: 7px 10px; font-size: 13px; }
#chat-error:empty { display: none; }
.social-note { margin: 5px; color: var(--muted); font-size: 12px; }
.rank-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: #231222; border-radius: 8px; padding: 3px; margin-bottom: 7px; }
.rank-switch button { border-radius: 6px; padding: 4px; font-size: 13px; }
.rank-switch button[aria-pressed="true"] { color: #ffda83; background: #72354c; }
.rank-head { display: flex; justify-content: space-between; color: var(--muted); padding: 3px 5px; font-size: 11px; }
.rank-list { list-style: none; padding: 0; margin: 0; max-height: 278px; overflow: auto; }
.rank-list li { display: grid; grid-template-columns: 23px minmax(0, 1fr) auto; align-items: center; gap: 5px; border-bottom: 1px solid #57354a; padding: 5px 3px; font-size: 13px; }
.rank-number { border-radius: 6px; text-align: center; color: #f5dcd0; background: #5a344a; font-weight: 800; }
.rank-list li:first-child .rank-number { background: #ffd483; color: #4d2a25; }
.rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.positive { color: #ffda83; }
.rank-note { margin-top: 10px; }
dialog { color: var(--text); width: min(430px, calc(100% - 24px)); padding: 15px; }
dialog::backdrop { background: #160d1bd9; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.dialog-head h2 { margin: 0; color: #ffe5a4; }
.dialog-head button { min-height: 34px; padding: 4px 10px; }
#profile-form { display: grid; gap: 6px; margin-top: 12px; }
#account-panel, #sign-out { margin-top: 8px; }
#account-form { display: grid; gap: 5px; margin-top: 7px; }
.account-buttons { display: flex; gap: 6px; margin-top: 3px; }
.quick-raise { padding-inline: 9px; font-variant-numeric: tabular-nums; }
@media (max-width: 950px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .chat-log { height: 175px; }
}
@media (max-width: 700px) {
  .shell { padding: 8px 12px 0; }
  .topbar { min-height: 58px; padding: 6px 9px; }
  .top-note { display: none; }
  .top-tools .button { font-size: 12px; min-height: 36px; padding: 5px 8px; }
  .lobby { grid-template-columns: 1fr; gap: 18px; min-height: 0; padding: 27px 0; }
  #entry { max-width: none; }
  .lobby-art { padding: 12px 15px; }
  .art-felt { margin: 11px 0; }
  .felt { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto minmax(124px, auto) auto; border-radius: 24px; padding: 11px 8px; gap: 6px; border-width: 4px; }
  .felt::before { inset: 4px; }
  .seat { min-height: 72px; width: 100%; border-radius: 9px; padding: 4px 3px; }
  .seat:nth-child(1) { grid-area: 4 / 2; }
  .seat:nth-child(2) { grid-area: 4 / 1; }
  .seat:nth-child(3) { grid-area: 2 / 1; }
  .seat:nth-child(4) { grid-area: 1 / 1; }
  .seat:nth-child(5) { grid-area: 1 / 2; }
  .seat:nth-child(6) { grid-area: 1 / 3; }
  .seat:nth-child(7) { grid-area: 2 / 3; }
  .seat:nth-child(8) { grid-area: 2 / 2; }
  .seat:nth-child(9) { grid-area: 4 / 3; }
  .center { grid-area: 3 / 1 / 4 / 4; }
  .board .card { width: clamp(38px, 10vw, 48px); }
  .hand-cards { min-height: 22px; }
  .hand-cards .card { width: 22px; font-size: 12px; }
  .room { padding: 18px 0; }
  .room-head .button { font-size: 12px; padding: 6px 8px; }
  .action-panel { padding: 9px; }
  .action-panel .button { padding: 8px 9px; font-size: 14px; }
  .raise input { width: 78px; padding: 8px; }
}
