:root {
  --ink: #fff8e8;
  --muted: rgba(255,248,232,.65);
  --night: #120c11;
  --plum: #281923;
  --plum-2: #432936;
  --gold: #d6a645;
  --gold-light: #f5d991;
  --green: #159477;
  --red: #b51f36;
  --line: rgba(214,166,69,.28);
  --panel: linear-gradient(145deg, rgba(29,20,26,.96), rgba(57,35,45,.92));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { width: 100%; min-height: 100%; overflow-x: clip; background: var(--plum); }
body { width: 100%; min-width: 320px; min-height: 100vh; margin: 0; overflow-x: clip; color: var(--ink); background: radial-gradient(circle at 52% 34%, rgba(112,61,82,.58), transparent 48rem), repeating-linear-gradient(118deg,rgba(255,255,255,.016) 0 1px,transparent 1px 5px), var(--plum); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
.hidden { display: none !important; }

.topbar { position: sticky; z-index: 50; top: 0; display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 16px; padding: 9px clamp(12px,2.4vw,34px); border-bottom: 1px solid rgba(214,166,69,.24); background: rgba(18,12,17,.96); backdrop-filter: blur(18px); }
.brand { display: flex; min-width: 0; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: block; width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; filter: drop-shadow(0 0 13px rgba(214,166,69,.24)); }
.brand strong,.brand small { display: block; }
.brand strong { font-family: Georgia,serif; font-size: 19px; letter-spacing: .16em; }
.brand small { overflow: hidden; max-width: 220px; margin-top: 1px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.music-controls { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.035); }
.music-toggle { min-height: 31px; padding: 5px 9px; color: var(--ink); border: 0; border-radius: 8px; background: rgba(214,166,69,.15); font-size: 11px; font-weight: 850; }.music-toggle.muted { color: var(--muted); background: transparent; }
.music-volume { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 8px; }.music-volume input { width: 70px; accent-color: var(--gold); }.music-volume output { width: 28px; font-size: 8px; }
.language-control { display: flex; min-height: 39px; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid rgba(255,255,255,.13); border-radius: 11px; background: rgba(255,255,255,.04); }
.language-control select { min-width: 44px; color: var(--ink); border: 0; outline: 0; background: transparent; font-size: 11px; font-weight: 850; }
.language-control option { color: #191116; background: #fffaf0; }
.connection { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: #67e1b4; box-shadow: 0 0 10px #67e1b4; }
.connection.offline i { background: #ee6c7c; box-shadow: 0 0 9px #ee6c7c; }
.icon-button,.ghost { min-height: 39px; padding: 0 13px; color: var(--ink); border: 1px solid rgba(255,255,255,.15); border-radius: 11px; background: rgba(255,255,255,.04); font-weight: 850; }
.icon-button { width: 39px; padding: 0; }
.app-shell { width: min(1560px,100%); margin: 0 auto; padding: clamp(14px,2vw,28px); }
.loading { display: grid; min-height: 60vh; place-content: center; justify-items: center; color: var(--muted); }
.loading span { width: 35px; height: 35px; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: 0 18px 42px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.035); }
.hero { display: grid; min-height: 330px; grid-template-columns: minmax(0,1.2fr) minmax(300px,.8fr); align-items: center; gap: 38px; overflow: hidden; padding: clamp(28px,5vw,66px); border: 1px solid var(--line); border-radius: 30px; background: radial-gradient(circle at 86% 44%,rgba(181,31,54,.38),transparent 25rem), linear-gradient(135deg,rgba(17,12,17,.98),rgba(67,38,51,.95)); box-shadow: 0 24px 55px rgba(0,0,0,.3); }
.hero-kicker { color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { max-width: 760px; margin: 10px 0 13px; font-family: Georgia,serif; font-size: clamp(40px,6vw,78px); line-height: .96; letter-spacing: -.045em; }
.hero h1 em { color: #f2d58a; font-style: normal; }
.hero p { max-width: 650px; color: var(--muted); line-height: 1.65; }
.hero-cards { position: relative; min-height: 225px; }
.hero-game-logo { position: absolute; z-index: 3; top: -16px; left: 50%; width: 210px; height: 210px; object-fit: contain; transform: translateX(-50%); filter: drop-shadow(0 20px 30px rgba(0,0,0,.5)) drop-shadow(0 0 18px rgba(214,166,69,.2)); }
.hero-card { position: absolute; z-index: 1; top: 118px; width: 82px; aspect-ratio: 225/315; border: 2px solid rgba(255,255,255,.8); border-radius: 10px; background-image: url("assets/playing-cards.png"); background-size: 1300% 400%; box-shadow: 0 18px 28px rgba(0,0,0,.44); opacity: .76; }
.hero-card.one { left: 8%; background-position: 75% 0; transform: rotate(-18deg); }
.hero-card.two { left: calc(50% - 41px); top: 132px; background-position: 83.333% 66.667%; transform: rotate(-2deg); }
.hero-card.three { right: 8%; background-position: 100% 100%; transform: rotate(18deg); }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 17px; }
.home-card { padding: clamp(20px,3vw,32px); }
.home-card h2 { margin: 0 0 5px; font-family: Georgia,serif; font-size: 27px; }
.home-card > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.form-row { display: grid; grid-template-columns: minmax(0,1fr) 110px; gap: 10px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label,.settings-label { color: #efd28c; font-size: 11px; font-weight: 850; }
.field input,.field select { width: 100%; min-height: 47px; padding: 10px 12px; color: var(--ink); border: 1px solid rgba(255,255,255,.13); outline: 0; border-radius: 12px; background: rgba(4,6,8,.28); }
.field input:focus,.field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214,166,69,.1); }
.variant-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.variant-option { position: relative; display: block; }
.variant-option input { position: absolute; opacity: 0; }
.variant-option span { display: grid; min-height: 72px; align-content: center; gap: 3px; padding: 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(0,0,0,.16); cursor: pointer; }
.variant-option strong { font-size: 13px; }
.variant-option small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.variant-option input:checked + span { border-color: var(--gold); background: rgba(214,166,69,.12); box-shadow: inset 0 0 18px rgba(214,166,69,.08); }
.primary,.secondary { min-height: 47px; padding: 10px 16px; border-radius: 12px; font-weight: 900; }
.primary { color: white; border: 1px solid #24b48d; background: linear-gradient(135deg,#0b765f,#159477); box-shadow: 0 10px 20px rgba(8,111,87,.18); }
.secondary { color: #f8dfa5; border: 1px solid rgba(214,166,69,.52); background: rgba(214,166,69,.06); }
.wide { width: 100%; }

.lobby { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; }
.lobby-card { padding: clamp(22px,4vw,42px); }
.lobby-card h1 { margin: 8px 0; font-family: Georgia,serif; font-size: clamp(34px,5vw,58px); }
.lobby-card p { color: var(--muted); }
.room-code { margin: 22px 0; color: var(--gold-light); font-family: Georgia,serif; font-size: clamp(46px,8vw,82px); font-weight: 900; letter-spacing: .12em; text-shadow: 0 0 28px rgba(214,166,69,.2); }
.share-box { display: flex; gap: 8px; }
.share-box input { min-width: 0; flex: 1; padding: 10px 12px; color: var(--muted); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(0,0,0,.2); }
.lobby-players { padding: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.section-heading h2 { margin: 0; color: #f5dfa9; font-family: Georgia,serif; }
.player-list { display: grid; gap: 8px; margin-bottom: 15px; }
.lobby-player { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(0,0,0,.17); }
.lobby-player > span { min-width: 0; flex: 1; }.lobby-player strong,.lobby-player small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.lobby-player small { color: var(--muted); }
.bot-controls { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin: 0 0 10px; padding: 10px; border: 1px dashed rgba(89,218,176,.35); border-radius: 13px; background: rgba(11,118,95,.1); }.bot-controls select { min-width: 0; padding: 8px; color: var(--ink); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: #241820; }.bot-pill,.host-pill { padding: 4px 7px; border-radius: 99px; font-size: 8px; font-weight: 950; }.bot-pill { color: #a9f4dc; background: rgba(21,148,119,.24); }.bot-remove { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; color: #ffc1c8; border: 1px solid rgba(224,95,106,.35); border-radius: 9px; background: rgba(181,31,54,.12); font-size: 18px; }
.avatar { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; color: #3e250b; font-family: Georgia,serif; font-weight: 900; border: 2px solid #c89838; border-radius: 12px 12px 20px 12px; background: linear-gradient(145deg,#f0d58e,#a87826); }
.player-avatar { display: block; aspect-ratio: 1; object-fit: cover; border: 2px solid #d7ab4a; border-radius: 50%; background: #17131a; box-shadow: 0 4px 12px rgba(0,0,0,.42); user-select: none; }
.lobby-avatar,.result-avatar { width: 48px; height: 48px; flex: 0 0 48px; }
.lobby-player > span { min-width: 0; flex: 1; }
.lobby-player strong,.lobby-player small { display: block; }
.lobby-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-player small { color: var(--muted); font-size: 10px; }
.host-pill { flex: 0 0 auto !important; padding: 4px 7px; color: var(--gold-light); border: 1px solid var(--line); border-radius: 99px; font-size: 8px; font-weight: 900; }
.game-settings { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.setting-pill { padding: 7px 9px; color: var(--muted); border: 1px solid rgba(255,255,255,.1); border-radius: 99px; background: rgba(0,0,0,.17); font-size: 10px; }
.voice-opt-in { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 14px; padding: 10px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; background: rgba(21,148,119,.06); cursor: pointer; }
.voice-opt-in input { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--green); }
.voice-opt-in strong,.voice-opt-in small { display: block; }.voice-opt-in strong { color: var(--ink); font-size: 12px; }.voice-opt-in small { margin-top: 2px; font-size: 9px; line-height: 1.4; }

.game-shell { position: relative; display: grid; gap: 8px; }
body.game-active { height: 100dvh; overflow: hidden; }
body.game-active .topbar { display: none; }
body.game-active .app-shell { height: 100dvh; padding: 8px; overflow: hidden; }
body.game-active .game-shell { height: 100%; grid-template-rows: auto minmax(0,1fr) auto; }
.game-toolbar { position: fixed; z-index: 45; top: 8px; right: 8px; display: flex; gap: 5px; }
.quick-button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; color: var(--ink); border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: rgba(16,11,15,.8); box-shadow: 0 5px 14px rgba(0,0,0,.28); font-weight: 900; }
.quick-button.enabled { border-color: rgba(89,218,176,.55); }
.turn-banner { display: flex; min-height: 68px; align-items: center; gap: 13px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 21px; background: linear-gradient(135deg,rgba(25,18,22,.98),rgba(67,38,50,.98)); }
.turn-banner.mine { border-color: rgba(67,222,177,.5); background: linear-gradient(135deg,#075846,#0d8065); }
.turn-emblem { display: grid; width: 43px; height: 43px; flex: 0 0 43px; place-items: center; color: #40131b; border-radius: 50%; background: var(--gold); }
.turn-banner h1,.turn-banner p { margin: 0; }
.turn-banner h1 { font-size: 21px; }
.turn-banner p { margin-top: 2px; color: rgba(255,255,255,.72); font-size: 12px; }
.opponents { display: flex; min-width: 0; min-height: 116px; align-items: start; justify-content: center; gap: clamp(5px,1.2vw,16px); overflow: visible; padding: 4px 118px 2px 4px; }
.opponent { position: relative; display: grid; min-width: 0; max-width: 154px; min-height: 108px; flex: 1 1 0; grid-template-rows: auto auto 36px; justify-items: center; align-content: start; gap: 2px; padding: 4px 6px 3px; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: linear-gradient(180deg,rgba(27,20,26,.82),rgba(11,10,12,.52)); }
.opponent.turn-now { border-color: #59dab0; animation: turn-glow 1.35s ease-in-out infinite; }
@keyframes turn-glow { 50% { box-shadow: 0 0 22px rgba(70,236,183,.62), inset 0 0 14px rgba(70,236,183,.12); } }
.opponent.defender { border-color: #e56c7b; }
.opponent-avatar-wrap { position: relative; width: 55px; height: 55px; }
.opponent-avatar { width: 55px; height: 55px; }
.opponent-nameplate { display: block; width: 100%; min-width: 0; overflow: hidden; padding: 2px 6px; color: #fff4da; border: 1px solid rgba(214,166,69,.42); border-radius: 4px; background: rgba(8,8,10,.88); font-size: 10px; line-height: 14px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.opponent-card-row { position: relative; width: min(82px,100%); height: 36px; }
.opponent-card-back { position: absolute; z-index: var(--mini-index); top: 1px; left: var(--mini-left); width: 25px; height: 34px; border: 1px solid #d7ad54; border-radius: 4px; background: repeating-linear-gradient(45deg,rgba(255,255,255,.09) 0 1px,transparent 1px 4px), radial-gradient(circle,#4c315f,#13172a 72%); box-shadow: 1px 2px 3px rgba(0,0,0,.42); transform: translateX(var(--mini-shift)); }
.opponent-finished { display: grid; height: 34px; place-items: center; color: #59dab0; font-size: 18px; font-weight: 900; }
.role { position: absolute; top: 4px; left: 4px; display: inline-block; max-width: calc(100% - 8px); overflow: hidden; padding: 2px 5px; color: #fff0c6; border-radius: 99px; background: rgba(32,20,23,.88); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.voice-button { position: relative; display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; padding: 0; color: #e9f4f2; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(4,8,10,.62); }
.voice-button.muted,.voice-button.off { color: #f0a2a7; border-color: rgba(224,95,106,.42); }.voice-button.connected::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 6px; height: 6px; border-radius: 50%; background: #57d8aa; box-shadow: 0 0 7px #57d8aa; }
.opponent .opponent-audio { position: absolute; right: -7px; bottom: -2px; width: 25px; height: 25px; font-size: 10px; }

.table-area { position: relative; display: grid; min-height: 0; grid-template-columns: 105px minmax(0,1fr) 88px; gap: 8px; align-items: center; padding: 10px; overflow: hidden; }
.table-area::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(214,166,69,.14); border-radius: 18px; pointer-events: none; }
.deck-zone,.discard-zone { position: relative; z-index: 1; display: grid; justify-items: center; color: var(--muted); text-align: center; }
.deck-stack { position: relative; width: 94px; height: 114px; }
.deck-cards { position: absolute; z-index: 2; inset: 0; }
.deck-card { position: absolute; z-index: var(--deck-z); top: 10px; left: 2px; width: 74px; height: 104px; border: 3px solid #d5a849; border-radius: 10px; background: repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 2px,transparent 2px 7px), radial-gradient(circle at 42% 40%,#543564,#172039 68%); box-shadow: -1px 2px 0 rgba(240,208,131,.2),0 4px 8px rgba(0,0,0,.34); transform: translate(calc(var(--deck-layer) * 3px),calc(var(--deck-layer) * -1.6px)); }
.deck-count { position: absolute; z-index: 20; right: -7px; bottom: -8px; display: grid; width: 35px; height: 35px; place-items: center; color: #24150b; border: 2px solid #f0d083; border-radius: 50%; background: var(--gold); font-weight: 950; }
.trump-card { position: absolute; z-index: 1; top: 24px; left: 42px; width: 65px !important; transform: rotate(90deg); transform-origin: center; }
.empty-deck-trump { display: grid; width: 80px; height: 80px; place-items: center; font-family: Georgia,serif; font-size: 68px; line-height: 1; filter: drop-shadow(0 5px 8px rgba(0,0,0,.46)); }
.empty-deck-trump.red { color: #d94250; }.empty-deck-trump.black { color: #111319; text-shadow: 0 0 1px #e2c878; }
.discard-stack { position: relative; display: block; width: 65px; height: 91px; }
.discard-stack i { position: absolute; inset: 0; border: 2px solid #bc9441; border-radius: 8px; background: repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 2px,transparent 2px 7px), radial-gradient(circle at 42% 40%,#543564,#172039 68%); box-shadow: 0 5px 10px rgba(0,0,0,.35); }
.discard-stack i:nth-child(1) { transform: rotate(-9deg); }.discard-stack i:nth-child(2) { transform: rotate(4deg); }.discard-stack i:nth-child(3) { transform: rotate(-1deg) translate(3px,-2px); }
.table-center { position: relative; z-index: 1; display: grid; min-width: 0; min-height: 0; align-content: center; }
.table-hint { max-width: 100%; margin-bottom: 13px; overflow-wrap: anywhere; color: var(--gold-light); text-align: center; font-size: 12px; font-weight: 800; }
.attack-grid { display: grid; min-height: 0; grid-template-columns: repeat(6,minmax(0,94px)); align-items: center; justify-content: center; gap: clamp(5px,1vw,13px); overflow: visible; padding: 7px; }
.attack-empty { display: grid; min-height: 180px; place-content: center; color: rgba(255,248,232,.34); text-align: center; }
.attack-empty span { font-size: 44px; }.attack-empty small { margin-top: 5px; }
.card-pair { position: relative; width: 100%; min-width: 0; max-width: 94px; height: 166px; }
.card-pair .playing-card { position: absolute; top: 0; left: 0; width: 100%; }
.card-pair .defense-card { z-index: 2; top: 32px; left: 14px; transform: rotate(5deg); }
.card-pair.targetable .attack-card { outline: 3px solid #f0c35e; outline-offset: 3px; animation: pulse-target 1.25s ease-in-out infinite; }
.card-pair.selected-target .attack-card { outline-color: #62e5bc; box-shadow: 0 0 25px rgba(75,221,174,.38); }
@keyframes pulse-target { 50% { outline-color: rgba(240,195,94,.28); } }
.round-actions { display: flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; margin-top: 3px; }

.playing-card { position: relative; display: block; width: 112px; aspect-ratio: 225/315; flex: 0 0 auto; padding: 0; overflow: hidden; border: 1px solid rgba(0,0,0,.65); border-radius: 9px; background-color: white; background-image: url("assets/playing-cards.png"); background-repeat: no-repeat; background-size: 1300% 400%; box-shadow: 0 7px 15px rgba(0,0,0,.38); }
.card-col-0 { --card-x: 0%; }.card-col-1 { --card-x: 8.3333%; }.card-col-2 { --card-x: 16.6667%; }.card-col-3 { --card-x: 25%; }.card-col-4 { --card-x: 33.3333%; }.card-col-5 { --card-x: 41.6667%; }.card-col-6 { --card-x: 50%; }.card-col-7 { --card-x: 58.3333%; }.card-col-8 { --card-x: 66.6667%; }.card-col-9 { --card-x: 75%; }.card-col-10 { --card-x: 83.3333%; }.card-col-11 { --card-x: 91.6667%; }.card-col-12 { --card-x: 100%; }
.card-row-0 { --card-y: 0%; }.card-row-1 { --card-y: 33.3333%; }.card-row-2 { --card-y: 66.6667%; }.card-row-3 { --card-y: 100%; }
.playing-card[class*="card-col-"] { background-position: var(--card-x) var(--card-y); }
button.playing-card { transition: transform .15s ease,box-shadow .15s ease,filter .15s ease; }
button.playing-card:hover,button.playing-card:focus-visible { z-index: 8; transform: translateY(-13px); box-shadow: 0 16px 25px rgba(0,0,0,.52); }
.playing-card.selected { outline: 4px solid #58dcb0; outline-offset: 3px; transform: translateY(-15px); }
.playing-card.unplayable { filter: brightness(.55) saturate(.55); }
.trump-badge { position: absolute; z-index: 4; right: 4px; bottom: 4px; display: grid; width: 22px; height: 22px; place-items: center; color: #32120e; border-radius: 50%; background: var(--gold); font-size: 12px; box-shadow: 0 2px 5px rgba(0,0,0,.4); }

.hand-dock { position: relative; z-index: 20; display: grid; min-height: 142px; grid-template-columns: 40px minmax(0,1fr); gap: 4px; padding: 6px 11px; overflow: visible; border: 0; background: transparent; box-shadow: none; }
.hand-controls { display: grid; align-content: center; justify-content: center; }
.hand-cards { position: relative; width: min(760px,100%); min-width: 0; height: 128px; justify-self: center; overflow: visible; }
.hand-cards::before { content: ""; position: absolute; z-index: -1; right: 7%; bottom: 3px; left: 7%; height: 18px; border-radius: 50%; background: rgba(70,236,183,.26); filter: blur(13px); opacity: 0; }
.hand-dock.turn-now .hand-cards::before { animation: hand-turn-glow 1.35s ease-in-out infinite; }
@keyframes hand-turn-glow { 50% { opacity: 1; transform: scaleX(1.04); } }
.hand-cards .hand-card { position: absolute; bottom: 3px; left: 0; width: 90px; transform: none; transform-origin: center bottom; }
.hand-cards .hand-card:hover,.hand-cards .hand-card:focus-visible,.hand-cards .hand-card.selected { z-index: 50 !important; transform: translateY(-8px); }

.finished { padding: clamp(30px,6vw,70px); text-align: center; }
.finished-icon { font-size: 76px; }
.finished h1 { margin: 5px 0; font-family: Georgia,serif; font-size: clamp(42px,7vw,76px); }
.finished p { color: var(--muted); }
.results { display: grid; max-width: 640px; gap: 8px; margin: 24px auto; text-align: left; }
.result-player { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(0,0,0,.18); }
.result-player .name { flex: 1; }.result-player.loser { border-color: #d85768; background: rgba(181,31,54,.14); }

.social-launch { position: fixed; z-index: 44; right: 17px; bottom: 17px; min-height: 49px; padding: 10px 15px; color: #fff6dc; border: 1px solid rgba(214,166,69,.75); border-radius: 16px; background: linear-gradient(145deg,#33242d,#171317); box-shadow: 0 12px 28px rgba(0,0,0,.4); font-weight: 900; }
.social-panel { position: fixed; z-index: 60; top: 80px; right: 14px; display: grid; width: min(390px,calc(100% - 28px)); height: min(70vh,620px); grid-template-rows: auto auto minmax(0,1fr); color: var(--ink); border: 1px solid rgba(214,166,69,.42); border-radius: 19px; background: rgba(20,14,19,.98); box-shadow: 0 22px 60px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transform: translateX(calc(100% + 30px)); transition: .2s; }
.social-panel.open { opacity: 1; pointer-events: auto; transform: none; }
.social-head { display: flex; align-items: center; justify-content: space-between; padding: 13px; border-bottom: 1px solid rgba(255,255,255,.09); }
.social-close { width: 33px; height: 33px; color: var(--ink); border: 1px solid rgba(255,255,255,.13); border-radius: 9px; background: rgba(255,255,255,.05); }
.social-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 7px; }
.social-tabs button { min-height: 38px; color: var(--muted); border: 0; border-radius: 9px; background: transparent; font-weight: 850; }
.social-tabs button.active { color: var(--gold-light); background: rgba(214,166,69,.14); }
.social-pane { display: grid; min-height: 0; grid-template-rows: minmax(0,1fr) auto; }
.social-pane[hidden] { display: none; }
.social-feed { display: flex; min-height: 0; flex-direction: column; gap: 8px; overflow-y: auto; padding: 12px; }
.chat-message,.log-entry { padding: 8px 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(255,255,255,.045); }
.chat-message.mine { align-self: flex-end; max-width: 86%; border-color: rgba(67,222,177,.25); background: rgba(15,119,91,.25); }
.chat-message header { display: flex; justify-content: space-between; gap: 12px; color: var(--gold-light); font-size: 9px; }.chat-message p,.log-entry p { margin: 4px 0 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.log-entry { color: rgba(255,248,232,.82); font-size: 11px; }
.chat-form { display: grid; grid-template-columns: minmax(0,1fr) 43px; gap: 6px; padding: 9px; border-top: 1px solid rgba(255,255,255,.09); }
.chat-form input { min-width: 0; padding: 9px 11px; color: var(--ink); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(0,0,0,.22); }.chat-form button { padding: 0; }

.rules-dialog { width: min(850px,calc(100% - 24px)); max-height: 90vh; padding: clamp(22px,4vw,42px); overflow-y: auto; color: var(--ink); border: 1px solid rgba(214,166,69,.48); border-radius: 24px; background: linear-gradient(145deg,#171116,#3b2631); box-shadow: 0 30px 80px rgba(0,0,0,.62); }
.rules-dialog::backdrop { background: rgba(3,5,7,.76); backdrop-filter: blur(7px); }
.dialog-close { position: absolute; top: 13px; right: 13px; width: 37px; height: 37px; color: var(--ink); border: 1px solid rgba(255,255,255,.14); border-radius: 11px; background: rgba(255,255,255,.05); font-size: 22px; }
.rules-kicker { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.rules-dialog h2 { margin: 8px 0 24px; font-family: Georgia,serif; font-size: clamp(32px,5vw,52px); }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.rules-grid section { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 10px; padding: 13px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(0,0,0,.15); }
.rules-grid section > b { color: var(--gold); }.rules-grid h3,.rules-grid p { margin: 0; }.rules-grid h3 { font-size: 14px; }.rules-grid p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.variant-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }.variant-rules article { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(214,166,69,.06); }.variant-rules span { color: var(--gold-light); font-weight: 900; }.variant-rules p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }.rules-source { margin-bottom: 0; color: var(--muted); font-size: 10px; }.rules-source a { color: var(--gold-light); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 22px; max-width: calc(100% - 28px); padding: 12px 16px; color: white; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: #102d29; box-shadow: 0 12px 32px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transform: translate(-50%,12px); transition: .2s; }.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width:900px) {
  .hero { grid-template-columns: 1fr; }.hero-cards { display: block; width: min(100%,380px); min-height: 210px; margin: 0 auto; }
  .home-grid,.lobby { grid-template-columns: 1fr; }
  .table-area { grid-template-columns: 72px minmax(0,1fr) 64px; }
  .attack-grid { grid-template-columns: repeat(3,minmax(0,78px)); }
}

@media (max-width:620px) {
  .topbar { min-height: 61px; padding: 7px 9px; }.brand-mark { width: 38px; height: 38px; flex-basis: 38px; }.brand strong { font-size: 15px; }.brand small,.connection,.music-volume,.music-toggle span { display: none; }.top-actions { gap: 5px; }.music-toggle { width: 34px; padding: 0; }.language-control span { display: none; }.language-control { min-height: 36px; }.icon-button,.ghost { min-height: 36px; }.ghost { padding-inline: 8px; font-size: 10px; }
  .app-shell { padding: 9px; }.hero { min-height: 280px; padding: 25px 20px; border-radius: 22px; }.hero h1 { font-size: 42px; }.home-grid { margin-top: 9px; gap: 9px; }.home-card { padding: 18px; }.form-row { grid-template-columns: 1fr 82px; }
  .room-code { font-size: 47px; }.share-box { flex-direction: column; }
  body.game-active .app-shell { padding: 5px; }
  body.game-active .game-shell { gap: 5px; }
  .game-toolbar { top: 83px; right: 9px; flex-direction: column; gap: 3px; }.quick-button { width: 29px; height: 29px; border-radius: 9px; font-size: 11px; }
  .opponents { min-height: 91px; gap: 3px; padding: 2px 38px 1px 1px; }
  .opponent { max-width: 100px; min-height: 88px; grid-template-rows: auto auto 26px; gap: 1px; padding: 2px 3px; border-radius: 11px; }
  .opponents.single-opponent { padding-right: 1px; }
  .opponent-avatar-wrap,.opponent-avatar { width: 40px; height: 40px; }.opponent-nameplate { padding: 1px 2px; font-size: 8px; line-height: 12px; }.opponent-card-row { width: min(58px,100%); height: 26px; }.opponent-card-back { width: 19px; height: 25px; border-radius: 3px; }.role { display: none; }.opponent .opponent-audio { right: -5px; bottom: -2px; width: 20px; height: 20px; font-size: 8px; }
  .table-area { min-height: 0; grid-template-columns: 57px minmax(0,1fr) 50px; gap: 3px; padding: 6px 4px; border-radius: 16px; }
  .table-area::before { inset: 4px; border-radius: 13px; }
  .deck-stack { width: 68px; height: 80px; }.deck-card { top: 10px; left: 0; width: 50px; height: 70px; border-width: 2px; border-radius: 7px; transform: translate(calc(var(--deck-layer) * 3px),calc(var(--deck-layer) * -1.6px)); }.trump-card { top: 14px; left: 43px; width: 44px !important; }.deck-count { right: -3px; bottom: -5px; width: 25px; height: 25px; font-size: 9px; }.empty-deck-trump { width: 52px; height: 60px; font-size: 46px; }
  .discard-stack { width: 43px; height: 61px; }.discard-stack i { border-width: 1px; border-radius: 6px; }
  .attack-grid { grid-template-columns: repeat(3,minmax(0,58px)); gap: 4px 7px; padding: 3px; }.card-pair { max-width: 58px; height: 112px; }.card-pair .defense-card { top: 22px; left: 8px; }.card-pair.targetable .attack-card { outline-width: 2px; outline-offset: 1px; }
  .round-actions { min-height: 34px; margin-top: 1px; flex-wrap: wrap; }.round-actions button { min-height: 33px; padding: 5px 9px; font-size: 9px; }
  .hand-dock { min-height: 110px; grid-template-columns: 32px minmax(0,1fr); padding: 4px 6px; }.hand-controls .voice-button { width: 29px; height: 29px; font-size: 11px; }.hand-cards { width: 100%; height: 100px; }.hand-cards .hand-card { width: 66px; }
  .rules-grid,.variant-rules { grid-template-columns: 1fr; }
  .social-panel { top: auto; right: 0; bottom: 0; width: 100%; max-width: none; height: min(76vh,640px); border-radius: 20px 20px 0 0; transform: translateY(calc(100% + 20px)); }.social-panel.open { transform: none; }.social-launch { right: 7px; bottom: 7px; min-height: 38px; padding: 7px 10px; font-size: 11px; }
}

@media (max-height:680px) and (max-width:900px) {
  .opponents { min-height: 72px; }.opponent { min-height: 69px; grid-template-rows: auto auto 19px; }.opponent-avatar-wrap,.opponent-avatar { width: 31px; height: 31px; }.opponent-nameplate { line-height: 10px; font-size: 7px; }.opponent-card-row { height: 19px; }.opponent-card-back { width: 15px; height: 19px; }
  .hand-dock { min-height: 94px; }.hand-cards { height: 84px; }.hand-cards .hand-card { width: 56px; }
  .card-pair { height: 95px; max-width: 50px; }.attack-grid { grid-template-columns: repeat(3,minmax(0,50px)); }
}
