:root {
  color-scheme: dark;
  --cream: #f2e7ca;
  --muted: #c1b89f;
  --green: #21483b;
  --green-deep: #142f28;
  --gold: #d3aa5e;
  --red: #bd5546;
}

* { box-sizing: border-box; }

body {
  min-width: 0;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(ellipse at 50% -12%, rgba(196, 146, 77, .2), transparent 49%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 6px),
    #17251f;
  font-family: "Tahoma", "Arial", sans-serif;
}

button { font: inherit; }

.app-shell { width: min(1050px, calc(100% - 32px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(242,231,202,.13); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--cream); text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font: 700 25px "Traditional Arabic", "Tahoma", serif; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 19px "Traditional Arabic", "Tahoma", serif; }
.brand small { color: var(--muted); font-size: 11px; }
.topbar-note { color: var(--muted); font-size: 12px; }
.online-dot { display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: #83b878; box-shadow: 0 0 9px #83b878; }

.welcome { min-height: 182px; display: flex; justify-content: space-between; align-items: center; padding: 27px 35px; margin-top: 21px; overflow: hidden; position: relative; border: 1px solid rgba(211,170,94,.32); border-radius: 16px; background: linear-gradient(110deg, rgba(38,77,62,.94), rgba(31,59,48,.74)), url("assets/scene/cafe.webp") center 58% / cover, #1f3b30; }
.welcome:after { content: ""; position: absolute; width: 280px; height: 280px; left: 80px; top: -150px; border: 1px solid rgba(211,170,94,.12); border-radius: 50%; box-shadow: 0 0 0 24px rgba(211,170,94,.025), 0 0 0 48px rgba(211,170,94,.025); }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 11px; letter-spacing: .07em; }
h1, h2, h3, p { margin-top: 0; }
.welcome h1 { margin: 0; font: 700 clamp(23px, 4vw, 34px) "Traditional Arabic", "Tahoma", serif; }
.welcome-copy { margin: 7px 0 0; color: #d0c8b3; font-size: 13px; }
.tea-cup { z-index: 1; display: grid; width: 92px; height: 112px; place-items: center; }
.tea-cup img { display: block; width: 88px; height: 108px; object-fit: contain; filter: drop-shadow(0 8px 8px #0008); }

.game-tabs { display: flex; gap: 8px; margin: 23px 0 12px; }
.game-tab { display: flex; min-width: 120px; justify-content: center; align-items: center; gap: 9px; padding: 11px 20px; border: 1px solid rgba(242,231,202,.16); border-radius: 10px 10px 0 0; color: var(--muted); background: transparent; cursor: pointer; }
.game-tab.active { border-color: rgba(211,170,94,.48); color: var(--cream); background: rgba(211,170,94,.11); }
.tab-icon { color: var(--gold); font-size: 18px; }
.game-panel { padding: 21px; border: 1px solid rgba(211,170,94,.29); border-radius: 0 13px 13px 13px; background: rgba(27,42,35,.93); box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.hidden { display: none; }
.online-stage { position: fixed; z-index: 20; inset: 0; overflow: hidden; color: var(--cream); background: #101914; }
.online-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.online-stage-top { position: absolute; inset: max(10px, env(safe-area-inset-top)) 12px auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none; }
.online-stage-top > * { pointer-events: auto; }
.online-stage-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.online-stage-back, .online-stage-rules, .online-stage-summary, .online-stage-score, .online-stage-hint { border: 1px solid rgba(211,170,94,.48); border-radius: 12px; color: var(--cream); background: rgba(15,35,29,.88); box-shadow: 0 5px 18px #0006; backdrop-filter: blur(8px); }
.online-stage-back { flex: 0 0 auto; padding: 9px 13px; font-size: 13px; cursor: pointer; }
.online-stage-rules { flex: 0 0 auto; padding: 9px 13px; font-size: 13px; cursor: pointer; }
.online-stage-start { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--gold); border-radius: 12px; color: #17251f; background: var(--gold); box-shadow: 0 5px 18px #0006; font-size: 13px; font-weight: 700; cursor: pointer; }
.online-stage-start:disabled { border-color: rgba(211,170,94,.48); color: var(--cream); background: rgba(15,35,29,.88); cursor: wait; }
.online-stage-summary { display: grid; min-width: 0; gap: 3px; padding: 8px 13px; text-align: center; }
.online-stage-summary strong { overflow: hidden; color: var(--gold); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.online-stage-summary span { max-width: 42vw; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.online-room-code {
  display: inline-flex;
  justify-self: center;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #efbd6855;
  border-radius: 8px;
  color: #e8dfc7;
  background: #071918aa;
  font-size: 10px;
  cursor: pointer;
}
.online-room-code.hidden { display: none; }
.online-room-code b { color: #f5d18a; direction: ltr; letter-spacing: .12em; }
.online-stage-score { flex: 0 0 auto; padding: 9px 12px; font-size: 13px; }
.online-stage-hint { position: absolute; inset: auto 12px max(12px, env(safe-area-inset-bottom)); width: fit-content; max-width: calc(100% - 24px); padding: 9px 13px; font-size: 12px; }
.online-stage-hint:empty { display: none; }
.online-rules-overlay { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); background: rgba(8,16,13,.72); backdrop-filter: blur(5px); }
.online-rules-overlay.hidden { display: none; }
.online-rules-card { width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 20px; border: 1px solid rgba(211,170,94,.65); border-radius: 16px; color: var(--cream); background: rgba(18,39,31,.97); box-shadow: 0 18px 55px #000b; }
.online-rules-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.online-rules-heading h2 { margin: 0; color: var(--gold); font: 700 24px "Traditional Arabic", "Tahoma", serif; }
.online-rules-heading button { width: 36px; height: 36px; border: 1px solid rgba(211,170,94,.4); border-radius: 50%; color: var(--cream); font-size: 24px; cursor: pointer; }
.online-rules-card ul { margin: 14px 0; padding-inline-start: 22px; color: #e0d7c2; font-size: 14px; line-height: 1.9; }
.online-rules-card li + li { margin-top: 6px; }
.online-rules-card p { margin: 0; color: #cbb985; font-size: 12px; line-height: 1.8; }
.online-jben-color { z-index: 4; }
.online-jben-color h2 { margin: 0 0 16px; color: var(--gold); font: 700 22px "Traditional Arabic", "Tahoma", serif; }
.jben-color-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.jben-color-options button { min-height: 48px; border: 1px solid rgba(211,170,94,.48); border-radius: 9px; color: var(--cream); background: rgba(211,170,94,.1); cursor: pointer; }
.jben-color-options button:hover, .jben-color-options button:focus-visible { border-color: var(--gold); background: rgba(211,170,94,.22); }
@media (max-width: 560px) {
  .online-game-picker { grid-template-columns: 1fr; gap: 7px; }
  .online-game-option { min-height: 66px; }
  .online-game-option img { flex-basis: 44px; width: 44px; height: 52px; }
  .online-game-option:first-child img { height: 44px; }
  .online-stage-top { inset-inline: 8px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
  .online-stage-actions { gap: 4px; }
  .online-stage-back, .online-stage-rules, .online-stage-start, .online-stage-score { padding: 7px; font-size: 10px; }
  .online-stage-actions { gap: 3px; }
  .online-stage-summary { padding: 7px 8px; }
  .online-stage-summary strong { font-size: 12px; }
  .online-stage-summary span { max-width: 100%; font-size: 10px; }
  .online-stage-hint { inset-inline: 8px; bottom: max(8px, env(safe-area-inset-bottom)); max-width: calc(100% - 16px); }
  .online-rules-card { padding: 16px; }
  .online-rules-card ul { font-size: 13px; }
}
.game-heading { display: flex; align-items: center; justify-content: space-between; }
.game-heading h2 { margin: 0; font: 700 27px "Traditional Arabic", "Tahoma", serif; }
.secondary-button { padding: 9px 14px; border: 1px solid rgba(211,170,94,.55); border-radius: 8px; color: var(--cream); background: rgba(211,170,94,.1); cursor: pointer; }
.secondary-button:hover { background: rgba(211,170,94,.2); }

.score-strip { display: grid; grid-template-columns: 1fr minmax(190px, 1.3fr) 1fr; align-items: center; gap: 12px; margin: 16px 0; padding: 10px 15px; border: 1px solid rgba(242,231,202,.1); border-radius: 10px; background: rgba(0,0,0,.12); }
.player-score { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; font-size: 12px; }
.player-score strong { grid-row: span 2; color: var(--gold); font-size: 23px; }
.player-score small { color: var(--muted); font-size: 10px; }
.opponent-score { text-align: left; }
.turn-indicator { color: #e6d7b6; text-align: center; font-size: 12px; }

.ronda-table { padding: 12px 14px; border: 1px solid rgba(211,170,94,.18); border-radius: 12px; background: radial-gradient(ellipse at center, #27604a, #1d493a 78%); }
.opponent-area, .player-area, .table-area { text-align: center; }
.area-label { display: flex; justify-content: space-between; gap: 8px; margin: 3px auto 8px; color: #e1d7bc; font-size: 11px; }
.area-label span:last-child { color: rgba(242,231,202,.66); }
.card-row { min-height: 112px; display: flex; direction: ltr; justify-content: center; align-items: center; gap: 9px; }
.table-area { min-height: 140px; margin: 8px 0; padding: 10px 0; border-top: 1px dashed rgba(242,231,202,.2); border-bottom: 1px dashed rgba(242,231,202,.2); }
.table-cards { flex-wrap: wrap; }
.playing-card { position: relative; display: flex; flex: 0 0 69px; width: 69px; height: 98px; flex-direction: column; justify-content: space-between; padding: 7px; overflow: hidden; border: 2px solid #e8dfc7; border-radius: 7px; color: #513f2c; background: #f5eedb; box-shadow: 0 4px 8px rgba(0,0,0,.25); direction: ltr; }
.playing-card:before, .playing-card:after { content: ""; position: absolute; width: 37px; height: 37px; border: 1px solid rgba(94,71,41,.19); border-radius: 50%; }
.playing-card:before { top: 28px; left: 14px; }
.playing-card:after { top: 33px; left: 19px; width: 27px; height: 27px; }
.card-corner { z-index: 1; align-self: flex-start; font: 700 15px Georgia, serif; line-height: 1; text-align: center; }
.card-corner small { display: block; margin-top: 1px; font-size: 10px; }
.card-suit { z-index: 1; align-self: center; font-size: 25px; }
.suit-oro { color: #bd8f2f; }
.suit-copa { color: #3a7452; }
.suit-espada { color: #3c526b; }
.suit-basto { color: #9c463c; }
.playing-card.back { border-color: #e1c98f; color: #e9d7a8; background: repeating-linear-gradient(45deg, #7a3430 0 4px, #8b4038 4px 7px); }
.playing-card.back:before, .playing-card.back:after { border-color: rgba(245,238,219,.45); }
.playing-card.back .card-suit { color: #f0dfb8; }
button.playing-card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
button.playing-card:hover, button.playing-card:focus-visible { z-index: 2; transform: translateY(-7px); box-shadow: 0 8px 15px rgba(0,0,0,.35); outline: 2px solid var(--gold); }
.player-area .playing-card { height: 105px; }
.empty-table { color: rgba(242,231,202,.56); font-size: 12px; }

.rules-box { margin-top: 13px; color: var(--muted); font-size: 12px; }
.rules-box summary { width: fit-content; color: var(--gold); cursor: pointer; }
.rules-box p { max-width: 790px; margin: 8px 0 0; line-height: 1.8; }
footer { padding: 19px 0 28px; color: rgba(242,231,202,.47); text-align: center; font-size: 11px; }
footer span { padding: 0 6px; color: var(--gold); }

.dama-layout { display: grid; grid-template-columns: minmax(280px, 1fr) 235px; align-items: start; gap: 20px; }
.board-frame { width: min(100%, 620px); margin: 0 auto; padding: 9px; border: 1px solid var(--gold); border-radius: 5px; background: #6a482b; box-shadow: 0 8px 25px #0005, inset 0 0 0 3px #956b3c; }
.dama-board { display: grid; grid-template-columns: repeat(8, 1fr); overflow: hidden; border: 2px solid #2c2017; }
.square { position: relative; display: grid; aspect-ratio: 1; place-items: center; background: #ead9b5; }
.square.dark { background: #64452e; }
.square.selectable { cursor: pointer; }
.square.selected:after, .square.legal:after { content: ""; position: absolute; inset: 9%; border: 3px solid #e9bf63; border-radius: 50%; pointer-events: none; }
.square.legal:after { inset: 34%; border: 0; background: rgba(239,197,92,.85); }
.piece { z-index: 1; display: grid; width: 74%; height: 74%; place-items: center; border: 3px solid rgba(0,0,0,.24); border-radius: 50%; box-shadow: inset 0 3px 4px #fff5, 0 3px 3px #0006; }
.piece.red { color: #f3d9b6; background: radial-gradient(circle at 34% 27%, #d67864, #a63e34 73%); }
.piece.black { color: #dfc48a; background: radial-gradient(circle at 34% 27%, #67625a, #252521 72%); }
.piece.king:after { content: "♛"; font-size: clamp(11px, 2vw, 20px); }
.dama-side { display: grid; gap: 10px; }
.side-card, .move-hint { padding: 16px; border: 1px solid rgba(211,170,94,.2); border-radius: 10px; background: rgba(0,0,0,.13); }
.side-icon { color: var(--gold); font-size: 22px; }
.side-card h3 { margin: 7px 0; font: 700 18px "Traditional Arabic", "Tahoma", serif; }
.side-card ul { margin: 0; padding-inline-start: 18px; color: var(--muted); font-size: 11px; line-height: 1.9; }
.move-hint { color: var(--gold); font-size: 11px; line-height: 1.7; }

@media (max-width: 700px) {
  .welcome { min-height: 155px; padding: 22px 18px; }
  .tea-cup { width: 62px; height: 62px; flex: 0 0 62px; }
  .tea-cup span { font-size: 29px; }
  .game-panel { padding: 13px; }
  .score-strip { grid-template-columns: 1fr 1fr; }
  .turn-indicator { grid-column: 1 / -1; grid-row: 1; padding-bottom: 5px; }
  .opponent-score { text-align: left; }
  .card-row { gap: 5px; min-height: 95px; }
  .playing-card { flex-basis: 57px; width: 57px; height: 82px; padding: 5px; }
  .playing-card:before { top: 23px; left: 10px; width: 32px; height: 32px; }
  .playing-card:after { top: 27px; left: 14px; width: 24px; height: 24px; }
  .card-suit { font-size: 21px; }
  .area-label { font-size: 10px; }
  .dama-layout { grid-template-columns: 1fr; }
  .dama-side { grid-template-columns: 1fr 1fr; }
  .piece { border-width: 2px; }
}

@media (max-width: 430px) {
  .topbar-note { font-size: 10px; }
  .welcome h1 { font-size: 24px; }
  .dama-side { grid-template-columns: 1fr; }
  .board-frame { padding: 5px; }
  .square.selected:after { border-width: 2px; }
}

.mode-bar { display: flex; gap: 8px; margin: 14px 0 10px; }
.mode-button { padding: 8px 13px; border: 1px solid rgba(242,231,202,.17); border-radius: 8px; color: var(--muted); background: rgba(0,0,0,.1); cursor: pointer; }
.mode-button.active { border-color: var(--gold); color: var(--cream); background: rgba(211,170,94,.14); }
.sound-toggle { margin-inline-start: auto; }
.sound-toggle[aria-pressed="true"] { border-color: #83b878; color: #d7edca; }
.sound-status { margin: -4px 0 10px; color: var(--muted); font-size: 11px; }
.character-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 14px; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.character-picker.hidden { display: none; }
.character-options { display: flex; flex-wrap: wrap; gap: 7px; }
.character-option { display: flex; align-items: center; gap: 7px; min-width: 105px; padding: 5px 8px; border: 1px solid rgba(242,231,202,.17); border-radius: 9px; color: var(--cream); background: rgba(0,0,0,.13); cursor: pointer; }
.character-option.active, .character-option:focus-visible { border-color: var(--gold); background: rgba(211,170,94,.15); outline: none; }
.character-option img { width: 39px; height: 39px; border-radius: 50%; object-fit: cover; object-position: center 24%; background: #39251c; }
.room-controls { margin: 0 0 12px; padding: 14px; border: 1px solid rgba(211,170,94,.25); border-radius: 12px; background: rgba(0,0,0,.12); }
.online-game-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.online-game-option { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 9px; border: 1px solid rgba(242,231,202,.16); border-radius: 11px; color: var(--cream); background: rgba(0,0,0,.16); text-align: start; cursor: pointer; transition: border-color .16s, background .16s, transform .16s; }
.online-game-option:hover { transform: translateY(-2px); }
.online-game-option.active, .online-game-option:focus-visible { border-color: var(--gold); background: rgba(211,170,94,.14); outline: none; box-shadow: 0 0 0 2px rgba(211,170,94,.13); }
.online-game-option img { flex: 0 0 54px; width: 54px; height: 66px; border-radius: 7px; object-fit: cover; background: #30251d; }
.online-game-option:first-child img { height: 54px; border-radius: 50%; }
.online-game-option span, .online-game-option strong, .online-game-option small { display: block; min-width: 0; }
.online-game-option strong { color: var(--gold); font-size: 15px; }
.online-game-option small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.room-options { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.room-options > label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.room-options input, .room-options select { min-width: 155px; padding: 9px 10px; border: 1px solid rgba(242,231,202,.2); border-radius: 7px; color: var(--cream); background: #17251f; font: inherit; }
.room-actions, .join-room { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.join-room { color: var(--muted); font-size: 12px; }
.join-room input { width: 110px; padding: 9px; border: 1px solid rgba(242,231,202,.25); border-radius: 7px; color: var(--cream); background: #17251f; font: 600 15px "Tahoma", sans-serif; letter-spacing: .16em; }
.room-message { margin-top: 9px; color: var(--muted); font-size: 12px; }
.room-code { display: inline-block; margin: 0 3px; color: var(--gold); font: 700 20px "Tahoma", sans-serif; letter-spacing: .15em; direction: ltr; }

.ronda-table { position: relative; width: min(100%, 520px); max-height: min(1050px, 82svh); aspect-ratio: 1 / 2; min-height: 0; margin: 0 auto; overflow: hidden; border: 1px solid #9a7046; border-radius: 13px; background: #30251d; isolation: isolate; box-shadow: 0 16px 34px #0008; }
.ronda-scene { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.ronda-table:before { content: none; }
.opponent-area { position: absolute; z-index: 1; inset: 0; height: auto; text-align: center; pointer-events: none; }
.opponent-character { position: static; width: 100%; height: 100%; margin: 0; perspective: 700px; }
.character-caption { position: absolute; z-index: 4; top: 21%; right: auto; left: 50%; display: block; padding: 3px 8px; border: 1px solid #d2ae6c; border-radius: 12px; color: #efdbad; font: 700 12px "Traditional Arabic", "Tahoma", serif; background: rgba(24,30,24,.82); text-shadow: 0 2px 6px #000; transform: translateX(-50%); }
.avatar-portrait { position: absolute; z-index: 4; top: 25%; right: auto; left: 50%; display: block; width: clamp(52px, 14%, 72px); height: auto; aspect-ratio: 1; border: 2px solid #d2ae6c; border-radius: 50%; object-fit: cover; object-position: center 24%; background: #39251c; box-shadow: 0 4px 10px #100a07aa; transform: translateX(-50%); transition: filter .2s, box-shadow .2s; }
.online-mode-active .character-caption, .online-mode-active .avatar-portrait { display: none; }
.ronda-table[data-action="cpu-thinking"] .avatar-portrait { animation: character-thinking .55s ease-in-out infinite alternate; }
.ronda-table[data-action="cpu-plays"] .avatar-portrait { animation: character-playing .72s ease-out; }
.ronda-table[data-action="human-plays"] .avatar-portrait { filter: brightness(.9); }
.ronda-table[data-action="cpu-plays"] .character-caption { border-color: #f0d27c; color: #fff1bd; }
.opponent-cards { position: absolute; z-index: 6; top: 46%; right: 0; bottom: auto; left: 0; min-height: 52px; gap: 3px; }
.opponent-cards .playing-card { flex-basis: 31px; width: 31px; height: 46px; padding: 0; border-width: 1px; border-radius: 4px; }
.opponent-cards .playing-card:before { top: 10px; left: 6px; width: 18px; height: 18px; }
.opponent-cards .playing-card:after { top: 13px; left: 9px; width: 12px; height: 12px; }
.opponent-cards .card-suit { font-size: 12px; }

.table-area { position: absolute; z-index: 2; inset: 0; min-height: 0; margin: 0; padding: 0; overflow: visible; border: 0; text-align: center; pointer-events: none; }
.table-area:before, .table-inlay, .first-person-hands, .player-label { display: none; }
.table-meta { position: absolute; z-index: 3; top: 52%; right: 4%; left: 4%; display: flex; justify-content: space-between; max-width: none; margin: 0 auto; color: #ead9b5; font-size: 11px; text-shadow: 0 2px 5px #000; }
.table-meta span:last-child { color: #d3c09d; }
.table-inlay { position: absolute; z-index: 0; top: 65px; right: 21%; left: 21%; height: 93px; border: 1px solid #dbbb7550; border-radius: 50%; box-shadow: inset 0 0 0 7px #ffffff09; pointer-events: none; }
.table-cards { position: absolute; z-index: 3; top: 56%; right: 4%; left: 4%; min-height: 99px; margin: 0 auto; gap: 5px; pointer-events: auto; }
.table-cards .playing-card { flex-basis: 53px; width: 53px; height: 76px; padding: 5px; }
.table-cards .playing-card:before { top: 19px; left: 9px; width: 30px; height: 30px; }
.table-cards .playing-card:after { top: 23px; left: 13px; width: 22px; height: 22px; }
.first-person-hands { position: absolute; z-index: 6; right: 0; bottom: -9px; left: 0; height: 104px; pointer-events: none; }
.forearm { position: absolute; bottom: 1px; width: 42%; height: 54px; border: 2px solid #62472d; background: linear-gradient(180deg, #d6aa5d, #75502f); box-shadow: inset 0 6px 9px #ffdf9a40, 0 -3px 7px #100a06aa; }
.forearm-left { left: -5%; border-radius: 0 65% 0 0; transform: rotate(-7deg); }
.forearm-right { right: -5%; border-radius: 65% 0 0 0; transform: rotate(7deg); }
.hand-palm { position: absolute; bottom: 25px; width: 88px; height: 47px; border: 2px solid #78472f; border-radius: 55% 52% 38% 38%; background: radial-gradient(ellipse at 38% 25%, #f0c49d, #c17e55 70%, #8b5438); box-shadow: inset 0 -5px 8px #613a2a44, 0 3px 5px #100a08a8; }
.hand-palm:before { content: ""; position: absolute; top: -25px; left: 22px; width: 15px; height: 42px; border: 2px solid #78472f; border-radius: 12px 12px 8px 8px; background: linear-gradient(90deg, #bc7953, #f0c49d 48%, #c17e55); box-shadow: -12px 7px 0 -1px #d49a71, -23px 13px 0 -2px #c88761, inset -4px 0 5px #75452f44; }
.hand-palm:after { content: ""; position: absolute; top: -10px; right: -9px; width: 22px; height: 34px; border: 2px solid #78472f; border-radius: 15px; background: linear-gradient(90deg, #b97853, #e8b88f); transform: rotate(36deg); }
.palm-left { left: 30%; transform: rotate(-18deg); }
.palm-right { right: 30%; transform: rotate(18deg); }
.palm-right:before { right: 22px; left: auto; box-shadow: 12px 7px 0 -1px #d49a71, 23px 13px 0 -2px #c88761, inset 4px 0 5px #75452f44; }
.palm-right:after { right: auto; left: -9px; transform: rotate(-36deg); }
.player-label { position: relative; z-index: 4; max-width: 500px; margin: -4px auto 0; color: #eee0bf; }
#human-hand { position: absolute; z-index: 5; right: 0; bottom: 4%; left: 0; min-height: 106px; gap: 8px; pointer-events: auto; touch-action: manipulation; }
#human-hand .playing-card { flex-basis: 62px; width: 62px; height: 89px; box-shadow: 0 7px 12px #090f0c99; }
#human-hand .playing-card:hover { transform: translateY(-10px) rotate(-2deg); }
.table-cards .empty-table { color: #e6d9bb; }
.cpu-card-flight { transform-origin: center; }
.ronda-table[data-action="human-plays"] #human-hand { animation: hand-playing .42s ease-out; }
.ronda-table[data-action="cpu-plays"] .opponent-cards { animation: hand-playing .42s ease-out; }
@keyframes character-thinking { to { transform: translate(-50%, -5px) rotate(4deg) scale(1.04); } }
@keyframes character-playing { 35% { transform: translate(-50%, 12px) rotate(-9deg) scale(1.12); filter: brightness(1.25); } 100% { transform: translate(-50%, 0) rotate(0) scale(1); } }
@keyframes hand-playing { 45% { transform: translateY(11px) rotate(-2deg); } }
.card-preview { position: fixed; z-index: 1200; top: 50vh; left: 50vw; width: 100vw; height: 100dvh; display: grid; place-items: center; background: rgba(8,12,10,.64); pointer-events: none; transform: translate(-50%, -50%); animation: preview-in .12s ease-out both; }
.card-preview .playing-card { width: min(58vw, 270px); height: min(82vw, 400px); flex: none; padding: 0; border: 2px solid #e8dfc7; border-radius: 10px; background: #f5eedb; box-shadow: 0 22px 65px #000d, 0 0 35px #f4d37855; transform: scale(.92) rotate(-2deg); }
.card-preview .card-face-art { border-radius: 7px; }
@keyframes preview-in { to { opacity: 1; } }

@media (max-width: 600px) {
  .ronda-table { width: min(100%, 430px); }
  .opponent-area { height: auto; }
  .opponent-character { height: 100%; transform: none; }
  .character-picker { align-items: flex-start; flex-direction: column; }
  .character-option { min-width: 90px; font-size: 11px; }
  .table-area { min-height: 0; }
  #human-hand { min-height: 93px; gap: 5px; }
  #human-hand .playing-card { flex-basis: 45px; width: 45px; height: 68px; }
}

.lobby-heading { margin: 24px 0 17px; }
.lobby-heading h2 { margin: 0; font: 700 29px "Traditional Arabic", "Tahoma", serif; }
.lobby-heading > p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.game-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.game-choice { position: relative; display: flex; min-height: 214px; align-items: center; gap: 20px; overflow: hidden; padding: 22px; border: 1px solid rgba(211,170,94,.36); border-radius: 16px; color: var(--cream); text-align: right; background: linear-gradient(132deg, rgba(41,76,59,.98), rgba(24,44,35,.97)); box-shadow: 0 10px 24px #0003; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; }
.game-choice:after { content: ""; position: absolute; width: 210px; height: 210px; left: -74px; bottom: -132px; border: 1px solid #d3aa5e2e; border-radius: 50%; box-shadow: 0 0 0 19px #d3aa5e0b, 0 0 0 39px #d3aa5e0b; pointer-events: none; }
.game-choice:hover, .game-choice:focus-visible { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 17px 30px #0005, 0 0 0 2px #d3aa5e29; outline: none; }
.choice-art { position: relative; display: grid; width: 116px; height: 144px; flex: 0 0 116px; place-items: center; }
.cards-art i { position: absolute; width: 67px; height: 102px; border: 2px solid #e8d9b4; border-radius: 7px; background: #f3ead2; box-shadow: 0 8px 14px #0007; }
.cards-art i:before { content: ""; position: absolute; inset: 5px; border: 1px solid #b7493b; }
.cards-art i:after { content: "✦"; position: absolute; top: 33px; right: 0; left: 0; color: #b7493b; text-align: center; font-size: 26px; }
.cards-art i:nth-child(1) { transform: rotate(-17deg) translate(-9px, 5px); }
.cards-art i:nth-child(2) { z-index: 1; transform: rotate(0) translateY(-5px); }
.cards-art i:nth-child(3) { transform: rotate(17deg) translate(10px, 5px); }
.board-art { perspective: 300px; }
.board-art i { width: 112px; height: 112px; border: 8px solid #8e633c; outline: 2px solid #d3aa5e; background: repeating-conic-gradient(#493021 0% 25%, #e8d5ad 0% 50%) 0 0 / 25% 25%; box-shadow: 0 20px 20px #0007, inset 0 0 0 2px #3a2418; transform: rotateX(47deg) rotateZ(-8deg); }
.board-art i:before, .board-art i:after { content: ""; position: absolute; width: 23px; height: 23px; border: 3px solid #77352d; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #e49a74, #a63e34 65%); box-shadow: 39px 27px 0 -2px #24201c, 48px -20px 0 -2px #28231f; }
.board-art i:before { top: 20px; left: 16px; }
.board-art i:after { right: 18px; bottom: 17px; background: radial-gradient(circle at 30% 25%, #57544e, #201e1b 65%); }
.choice-copy { position: relative; z-index: 1; display: grid; gap: 7px; }
.choice-copy strong { font: 700 25px "Traditional Arabic", "Tahoma", serif; }
.choice-copy small { color: #c9c1ad; font-size: 12px; }
.choice-detail { color: #cfb982; font-size: 11px; }
.choice-cta { margin-top: 13px; color: var(--gold); font-size: 12px; }
.choice-cta b { display: inline-grid; width: 25px; height: 25px; margin-inline-start: 5px; place-items: center; border: 1px solid #d3aa5e68; border-radius: 50%; }
.online-choice { grid-column: 1 / -1; min-height: 174px; }
.crowd-art img { position: absolute; width: 70px; height: 82px; border: 2px solid #d3aa5e; border-radius: 48% 48% 38% 38%; object-fit: cover; background: #19372f; box-shadow: 0 9px 15px #0008; }
.crowd-art img:first-child { z-index: 1; left: 7px; bottom: 10px; transform: rotate(-9deg); }
.crowd-art img:nth-child(2) { z-index: 2; left: 46px; top: 17px; }
.crowd-art img:last-child { z-index: 1; right: 4px; bottom: 7px; transform: rotate(9deg); }
.lobby-message { margin: 0 0 14px; padding: 10px 13px; border: 1px solid #d3aa5e55; border-radius: 9px; color: #f0d7a7; background: #d3aa5e12; font-size: 12px; }
.lobby-message.hidden { display: none; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.back-button { padding: 8px 11px; border: 1px solid rgba(242,231,202,.2); border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.back-button:hover { border-color: var(--gold); color: var(--cream); }
.card-face-art, .card-back-art { display: block; width: 100%; height: 100%; }
.playing-card { padding: 0; overflow: visible; border: 0; color: inherit; background: transparent; box-shadow: 0 8px 14px #0008; }
.playing-card:before, .playing-card:after { content: none; }
.playing-card svg { overflow: visible; filter: drop-shadow(0 1px 0 #fff8); }
.playing-card.back { border: 0; padding: 0; background: transparent; }
.playing-card.back .card-back-art { display: block; width: 100%; height: 100%; border-radius: 7px; object-fit: cover; box-shadow: 0 4px 8px #0005; }
.playing-card:not(.back) { padding: 3px; border-color: #e8dfc7; background: #f5eedb; }
.playing-card:not(.back):before, .playing-card:not(.back):after { display: none; }
.card-face-art { display: block; width: 100%; height: 100%; border-radius: 3px; object-fit: fill; }
.playing-card img.card-face-art { filter: drop-shadow(0 1px 0 #fff8); }
#human-hand .playing-card { flex-basis: 72px; width: 72px; height: 108px; transition: transform .22s, filter .22s; }
#human-hand .playing-card:hover, #human-hand .playing-card:focus-visible { filter: drop-shadow(0 0 7px #f4d378); outline: none; }
.opponent-cards .playing-card { flex-basis: 31px; width: 31px; height: 46px; }
.table-cards .playing-card { flex-basis: 57px; width: 57px; height: 86px; transition: transform .25s; }
.card-flight { position: fixed !important; z-index: 1000 !important; flex: none !important; pointer-events: none; margin: 0; transform-style: preserve-3d; box-shadow: 0 14px 28px #000b !important; }
.card-flight:before, .card-flight:after { content: none !important; }
.card-flight svg, .card-flight img { width: 100%; height: 100%; }
.ronda-table { background: radial-gradient(ellipse at 50% 1%, #886044, #3e2d21 78%); }
.ronda-table:before { background: repeating-linear-gradient(90deg, transparent 0 74px, rgba(255,230,174,.035) 75px, transparent 77px), linear-gradient(180deg, #765339, #3b2b20 45%, #59432e); }
.table-area:before { background: radial-gradient(ellipse at 50% 1%, #44855f, #1d5038 68%, #123627); }

.dama-table-scene { position: relative; display: flex; min-height: 530px; align-items: center; justify-content: center; gap: 12px; overflow: hidden; padding: 29px 14px 20px; border: 1px solid #9a7046; border-radius: 15px; background: radial-gradient(ellipse at 50% 36%, #876044, #3c291f 80%); box-shadow: inset 0 0 24px #170f0b99, 0 15px 25px #0004; }
.dama-table-scene:before { content: ""; position: absolute; inset: 0; opacity: .43; background: repeating-linear-gradient(91deg, transparent 0 50px, #f8d49b0c 51px 53px), repeating-linear-gradient(0deg, transparent 0 120px, #110b0717 121px 123px); pointer-events: none; }
.dama-table-scene:after { content: ""; position: absolute; right: 12px; bottom: 10px; left: 12px; height: 17px; border: 1px solid #c49259; border-radius: 50%; background: linear-gradient(#855936, #41291b); box-shadow: 0 7px 8px #130d09; }
.board-frame { position: relative; z-index: 1; width: min(100%, 435px); flex: 1 1 390px; margin: 0; padding: 13px; border: 3px solid #b3844c; border-radius: 5px; background: linear-gradient(145deg, #805a35, #402919); box-shadow: 0 23px 24px #0008, 0 8px 0 #332016, inset 0 0 0 2px #d0a76e; transform: perspective(1050px) rotateX(8deg); transform-origin: center top; }
.dama-board { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); overflow: hidden; border: 3px solid #392819; transform-style: preserve-3d; box-shadow: 0 0 0 2px #c09961; }
.square { min-width: 0; padding: 0; border: 0; appearance: none; background: linear-gradient(135deg, #f1dfbd, #cbb28a); }
.square.dark { background: linear-gradient(135deg, #68452e, #442d20); }
.piece { position: relative; width: 76%; height: 76%; border: 2px solid #34261c; border-radius: 50%; box-shadow: inset 0 2px 3px #fff8, 0 6px 5px #120b07aa, 0 1px 0 #ffeda55c; transform: translateZ(7px); transition: transform .15s, box-shadow .15s; }
.square.selected .piece { transform: translateZ(11px) scale(1.09); box-shadow: inset 0 4px 5px #fff7, 0 9px 10px #0008, 0 0 12px #f4d076; }
.piece.red { background: repeating-conic-gradient(#e77b57 0deg 7deg, #a83227 7deg 12deg); }
.piece.black { background: repeating-conic-gradient(#a59b85 0deg 7deg, #34312c 7deg 12deg); }
.piece:before { content: ""; position: absolute; inset: 14%; border: 1px solid #ffffff79; border-radius: 50%; background: radial-gradient(circle at 35% 27%, #ef956c, #a9382d 72%); box-shadow: inset 0 2px 4px #fff7, inset 0 -3px 5px #4e1b19a6; }
.piece.black:before { background: radial-gradient(circle at 35% 27%, #b8ad96, #454039 72%); box-shadow: inset 0 2px 4px #fff7, inset 0 -3px 5px #171512b8; }
.cap-top, .king-mark { position: relative; z-index: 1; display: grid; width: 100%; height: 100%; place-items: center; color: #ffdf97; font-size: clamp(8px, 1.4vw, 15px); text-shadow: 0 1px 2px #61231f; }
.piece.black .cap-top { color: #eee0be; text-shadow: 0 1px 2px #171512; }
.piece .king-mark { position: absolute; inset: 0; color: #ffe083; font-size: clamp(11px, 1.9vw, 21px); text-shadow: 0 1px 3px #322014, 0 0 5px #fff1b7; }
.piece.king:after { content: none; }
.piece-flight .cap-top, .piece-flight .king-mark { pointer-events: none; }
.piece-flight { position: absolute !important; z-index: 9 !important; margin: 0; pointer-events: none; transition: left .22s cubic-bezier(.2,.7,.2,1), top .22s cubic-bezier(.2,.7,.2,1), transform .2s; transform: translateZ(16px) scale(1.1); }
.piece-hidden { opacity: 0; }
.tea-service { position: relative; z-index: 4; display: grid; width: 88px; flex: 0 0 88px; justify-items: center; margin-top: 85px; filter: drop-shadow(0 11px 8px #100a07); }
.tea-service img { display: block; width: 78px; height: 108px; object-fit: contain; filter: drop-shadow(0 5px 5px #0006); }
.tea-service span { margin-top: -6px; color: #f0d7a7; font: 700 12px "Traditional Arabic", "Tahoma", serif; text-shadow: 0 2px 3px #20150f; }
.scene-carpet { position: absolute; z-index: 0; right: 11px; bottom: 36px; width: 72px; height: 119px; border: 4px solid #a34a37; outline: 1px solid #e0b65f; background: repeating-linear-gradient(45deg, #9d4536 0 7px, #b45b43 7px 13px, #783529 13px 18px); box-shadow: inset 0 0 0 4px #ddb663, 0 8px 12px #0005; transform: rotate(-12deg); opacity: .74; pointer-events: none; }
.scene-carpet:before { content: ""; position: absolute; inset: 13px; border: 1px solid #f0d17c; background: repeating-linear-gradient(45deg, transparent 0 13px, #e0b86455 14px 15px); }
.dama-layout { grid-template-columns: minmax(320px, 1fr) 230px; gap: 15px; }
.dama-side { position: relative; z-index: 1; }
.dama-side .side-card, .dama-side .move-hint { border-color: #ba8c55; background: linear-gradient(145deg, #31523f, #202f27); box-shadow: 0 8px 15px #0003; }
.dama-side .side-card { margin-top: 3px; }
.dama-side .side-card li { margin-bottom: 5px; }
.dama-side .side-icon { color: #ebc46d; text-shadow: 0 2px 3px #000; }
.dama-layout + .rules-box { position: relative; z-index: 1; }

@media (max-width: 760px) {
  .game-choices { grid-template-columns: 1fr; }
  .game-choice { min-height: 175px; }
  .dama-layout { grid-template-columns: 1fr; }
  .dama-table-scene { display: block; min-height: auto; padding: 20px 12px 102px; }
  .board-frame { width: 100%; padding: 8px; }
  .tea-service { position: absolute; right: 9px; bottom: 14px; width: 73px; }
  .tea-service img { width: 48px; height: 66px; }
  .tea-service span { font-size: 9px; }
  .scene-carpet { right: 68px; bottom: 12px; width: 57px; height: 68px; border-width: 3px; }
  .scene-carpet:before { inset: 6px; }
  .dama-side { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .game-choice { gap: 12px; padding: 16px; }
  .choice-art { width: 87px; flex-basis: 87px; transform: scale(.82); }
  .heading-actions { gap: 5px; }
  .back-button, .secondary-button { padding: 7px 8px; font-size: 11px; }
  .dama-side { grid-template-columns: 1fr; }
  .board-frame { transform: perspective(850px) rotateX(5deg); }
  #human-hand .playing-card { flex-basis: 56px; width: 56px; height: 85px; }
  .opponent-cards .playing-card { flex-basis: 27px; width: 27px; height: 40px; }
  .table-cards .playing-card { flex-basis: 49px; width: 49px; height: 74px; }
}

.offline-player-count, .room-options, .camera-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.player-count-option { padding: 7px 11px; border: 1px solid rgba(242,231,202,.18); border-radius: 8px; color: var(--cream); background: rgba(0,0,0,.12); cursor: pointer; }
.player-count-option.active { border-color: var(--gold); background: rgba(211,170,94,.16); }
.room-options { gap: 12px; margin-bottom: 10px; }
.room-options label { display: flex; align-items: center; gap: 7px; }
.room-options input, .room-options select { min-width: 90px; padding: 7px 9px; border: 1px solid rgba(242,231,202,.22); border-radius: 7px; color: var(--cream); background: #17251f; }
.camera-controls { justify-content: center; margin: 12px auto 0; }
.camera-controls label { display: flex; align-items: center; gap: 5px; }
.camera-controls input { width: 90px; accent-color: var(--gold); }
.camera-controls .back-button { padding: 6px 9px; }

.ronda-table {
  aspect-ratio: 4 / 5;
  max-height: min(760px, 82svh);
  transform: perspective(1100px) rotateX(var(--camera-tilt, 0deg)) rotateZ(var(--camera-rotation, 0deg)) scale(var(--camera-zoom, 1));
  transform-origin: center;
  transition: transform .12s ease-out;
  background: radial-gradient(ellipse at 50% 42%, #367052, #173b2c 80%);
}
.ronda-scene { opacity: .22; filter: saturate(.65) brightness(.78); }
.ronda-table:after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 5px;
  border: 8px solid #805632;
  border-radius: 15px;
  background: linear-gradient(140deg, rgba(28,83,57,.58), rgba(17,54,39,.83));
  box-shadow: inset 0 0 0 2px #d1a96b80, inset 0 0 35px #0b2117aa, 0 3px 8px #0007;
  pointer-events: none;
}
#other-player-seats { position: absolute; z-index: 5; inset: 0; pointer-events: none; }
.player-seat {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 112px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(17,34,27,.56);
  text-shadow: 0 1px 5px #000;
  transition: border-color .2s, filter .2s, transform .2s;
}
.player-seat.is-active { border-color: #e9c66e; filter: drop-shadow(0 0 8px #e9c66e99); animation: seat-thinking .55s ease-in-out infinite alternate; }
.player-seat.waiting-seat { border-style: dashed; border-color: #d2ae6c66; }
.seat-name { max-width: 100%; overflow: hidden; color: #f0dfb8; font: 700 12px "Traditional Arabic", "Tahoma", serif; white-space: nowrap; text-overflow: ellipsis; }
.seat-avatar { width: 46px; height: 46px; border: 2px solid #d2ae6c; border-radius: 50%; object-fit: cover; object-position: center 24%; background: #39251c; box-shadow: 0 4px 10px #100a07aa; }
.seat-waiting-status { color: #d8c49a; font-size: 10px; }
.seat-waiting-status:empty { display: none; }
.player-seat .opponent-cards { min-height: 44px; gap: 2px; }
.player-seat .opponent-cards .playing-card { flex-basis: 25px; width: 25px; height: 37px; }
.player-seat.seat-1 { top: 3%; left: 50%; transform: translateX(-50%); }
.player-seat.seat-2 { top: 39%; left: 1%; }
.player-seat.seat-3 { top: 39%; right: 1%; }
.player-seat.seat-2 .opponent-cards, .player-seat.seat-3 .opponent-cards { flex-wrap: wrap; }
.player-seat.seat-2.is-active, .player-seat.seat-3.is-active { animation-name: seat-side-thinking; }
@keyframes seat-thinking { to { transform: translateX(-50%) translateY(-4px); } }
@keyframes seat-side-thinking { to { translate: 0 -4px; } }

@media (max-width: 600px) {
  .ronda-table { aspect-ratio: 4 / 5; max-height: 76svh; }
  .player-seat { width: 92px; }
  .seat-avatar { width: 39px; height: 39px; }
  .player-seat .opponent-cards .playing-card { flex-basis: 21px; width: 21px; height: 32px; }
  .player-seat.seat-2, .player-seat.seat-3 { top: 40%; }
  .camera-controls input { width: 66px; }
}
.dama-character { position: relative; z-index: 4; display: grid; width: 70px; flex: 0 0 70px; justify-items: center; margin-top: 85px; color: #f0d7a7; font: 700 11px "Traditional Arabic", "Tahoma", serif; text-shadow: 0 2px 3px #20150f; }
.dama-character img { width: 64px; height: 70px; border: 2px solid #d2ae6c; border-radius: 45% 45% 38% 38%; object-fit: cover; object-position: center 22%; background: #39251c; box-shadow: 0 8px 11px #100a07aa; }
.dama-table-scene[data-turn="black"] .dama-character img { animation: dama-character-thinking .55s ease-in-out infinite alternate; }
@keyframes dama-character-thinking { to { transform: translateY(-5px) rotate(3deg); filter: brightness(1.16); } }
@media (max-width: 760px) {
  .dama-character { position: absolute; left: 12px; bottom: 11px; width: 62px; margin: 0; }
  .dama-character img { width: 51px; height: 54px; }
}

:root {
  --cream: #fff3d8;
  --muted: #c4c6ad;
  --green: #214f43;
  --green-deep: #102b28;
  --gold: #efbd68;
  --red: #c45d47;
}

body {
  background:
    radial-gradient(ellipse at 9% 12%, #a34a3524, transparent 33%),
    radial-gradient(ellipse at 90% 4%, #d7a34818, transparent 32%),
    repeating-linear-gradient(45deg, #ffffff06 0 1px, transparent 1px 14px),
    #102320;
}

.app-shell { width: min(1120px, calc(100% - 34px)); }
.topbar { min-height: 82px; height: auto; gap: 12px; }
.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid #efbd6880;
  border-radius: 15px 15px 15px 5px;
  color: #152f2a;
  background: linear-gradient(145deg, #f7d58d, #d9994e);
  box-shadow: 0 5px 16px #0004, inset 0 1px 1px #fff8;
  font: 700 22px Tahoma, Arial, sans-serif;
}
.brand strong { letter-spacing: .01em; }
.topbar-note { padding: 8px 11px; border: 1px solid #ffffff18; border-radius: 999px; background: #ffffff07; }
.online-dot { background: #8dd298; box-shadow: 0 0 10px #8dd298; }
.welcome {
  min-height: 195px;
  margin-top: 24px;
  border-color: #efbd6845;
  border-radius: 21px;
  background:
    linear-gradient(105deg, #102d26f2 4%, #143b33df 58%, #1b4639bd),
    url("assets/scene/cafe.webp") center 58% / cover,
    #17382f;
  box-shadow: 0 18px 40px #0003, inset 0 1px #fff1;
}
.welcome:after { border-color: #efbd6820; box-shadow: 0 0 0 24px #efbd6809, 0 0 0 48px #efbd6809; }
.welcome h1 { max-width: 720px; line-height: 1.25; }
.welcome-copy { color: #e0d7c3; }
.tea-cup img { filter: drop-shadow(0 10px 12px #0009); }

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  align-items: center;
  gap: clamp(20px, 5vw, 64px);
  margin: 25px 0 36px;
  padding: clamp(20px, 4vw, 42px);
  border: 1px solid #efbd6833;
  border-radius: 22px;
  background:
    linear-gradient(135deg, #193c34f2, #122d29f5),
    repeating-linear-gradient(45deg, transparent 0 17px, #ffffff08 18px 19px);
  box-shadow: 0 22px 50px #0003, inset 0 1px #ffffff12;
}
.auth-intro h2 {
  max-width: 460px;
  margin: 0 0 9px;
  font: 700 clamp(25px, 4vw, 38px) "Traditional Arabic", Tahoma, serif;
  line-height: 1.25;
}
.auth-intro > p:last-child { max-width: 440px; margin: 0; color: #d0cbb8; font-size: 13px; line-height: 1.8; }
.auth-card {
  padding: 21px;
  border: 1px solid #efbd6840;
  border-radius: 17px;
  background: #0e2422c9;
  box-shadow: inset 0 1px #ffffff0b, 0 10px 24px #0002;
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; padding: 4px; border: 1px solid #ffffff14; border-radius: 11px; background: #07191866; }
.auth-tab { padding: 9px 10px; border: 0; border-radius: 8px; color: #c4c6ad; background: transparent; cursor: pointer; }
.auth-tab.active { color: #152b25; background: linear-gradient(135deg, #f3cf83, #dba252); box-shadow: 0 3px 8px #0003; font-weight: 700; }
#auth-form { display: grid; gap: 8px; }
#auth-form label { margin-top: 2px; color: #eee2c9; font-size: 12px; }
#auth-form input {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #ffffff24;
  border-radius: 9px;
  outline: 0;
  color: #fff3d8;
  background: #071918aa;
}
#auth-form input:focus { border-color: #efbd68; box-shadow: 0 0 0 3px #efbd6822; }
#auth-username, #auth-password { direction: ltr; text-align: left; }
.auth-hint { margin: 0 0 3px; color: #adb7a2; font-size: 11px; line-height: 1.6; }
.auth-submit {
  min-height: 45px;
  margin-top: 4px;
  border: 1px solid #f4d492;
  border-radius: 10px;
  color: #183229;
  background: linear-gradient(135deg, #f5d992, #dca453);
  box-shadow: 0 6px 16px #0003;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .15s;
}
.auth-submit:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.auth-submit:disabled, .account-logout:disabled { opacity: .6; cursor: wait; }
.auth-message { min-height: 18px; margin: 0; color: #9cdda5; font-size: 12px; line-height: 1.5; }
.auth-message.error { color: #ff9a86; }
.account-open {
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid #ffe27a;
  border-radius: 12px;
  color: #392609;
  background: linear-gradient(135deg, #ffe58a, #efb932);
  box-shadow: 0 5px 16px #e2ad3533, inset 0 1px #fff9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.account-open:hover, .account-open:focus-visible { border-color: #fff0a6; filter: brightness(1.05); outline: none; }
.account-authenticated #account-open { display: none !important; }
.account-logout { padding: 7px 10px; border: 1px solid #efbd6850; border-radius: 8px; color: var(--cream); background: #efbd6812; cursor: pointer; }
.game-lobby { padding-bottom: 10px; }
.lobby-heading { margin-top: 30px; }
.game-choice {
  min-height: 220px;
  border-color: #efbd6847;
  border-radius: 19px;
  background:
    linear-gradient(135deg, #193e34f5, #122c29fa),
    repeating-linear-gradient(45deg, transparent 0 15px, #ffffff08 16px 17px);
  box-shadow: 0 16px 30px #0003, inset 0 1px #ffffff12;
}
.game-choice:nth-child(2) { background: linear-gradient(135deg, #284435f5, #172c28fa); }
.game-choice:after { border-color: #efbd6833; box-shadow: 0 0 0 19px #efbd680a, 0 0 0 39px #efbd6808; }
.choice-copy strong { font-size: 27px; }
.choice-cta { width: fit-content; margin-top: 7px; padding: 8px 12px; border: 1px solid #efbd6845; border-radius: 9px; color: #f4d28f; background: #efbd6812; }
.game-choice:hover .choice-cta { color: #17352b; background: #f0c879; }
footer { color: #a7b3a5; }

@media (max-width: 700px) {
  .auth-panel { grid-template-columns: 1fr; gap: 20px; }
  .auth-intro { text-align: center; }
  .auth-intro > p:last-child, .auth-intro h2 { margin-right: auto; margin-left: auto; }
  .auth-card { width: min(100%, 430px); margin: 0 auto; }
  .online-choice { grid-column: auto; }
}

@media (max-width: 480px) {
  .app-shell { width: min(100% - 22px, 1120px); }
  .topbar { min-height: 72px; }
  .topbar-note { display: none; }
  .account-logout { padding: 6px 8px; }
  .welcome { min-height: 174px; padding: 21px; }
  .tea-cup { width: 62px; flex: 0 0 62px; }
  .tea-cup img { width: 64px; }
  .auth-panel { margin-top: 16px; padding: 18px 14px; border-radius: 16px; }
  .auth-card { padding: 16px; }
}

.auth-panel.hidden { display: none; }

.auth-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  align-content: center;
  gap: 24px;
  width: 100%;
  max-height: 100svh;
  overflow: auto;
  margin: 0;
  padding: 32px max(24px, calc((100vw - 960px) / 2));
  border: 0;
  border-radius: 0;
  background: rgba(5, 17, 14, .82);
  backdrop-filter: blur(12px);
}
.auth-overlay .auth-intro { position: relative; }
.auth-dismiss {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #efbd6855;
  border-radius: 12px;
  color: var(--cream);
  background: #071918aa;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}
.auth-overlay .auth-intro h2 { padding-inline-end: 42px; }

@media (max-width: 700px) {
  .auth-overlay {
    grid-template-columns: minmax(0, 1fr);
    align-content: end;
    gap: 12px;
    padding: 18px 14px max(18px, env(safe-area-inset-bottom));
  }
  .auth-overlay .auth-intro { padding-inline-end: 44px; text-align: right; }
  .auth-overlay .auth-intro > p:last-child { margin: 0; }
  .auth-overlay .auth-intro h2 { margin-bottom: 5px; }
  .auth-overlay .auth-card { width: 100%; max-width: 520px; padding: 17px; margin: 0 auto; }
}

@media (max-width: 600px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .app-shell { width: min(100% - 20px, 520px); }
  .topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    min-height: 64px;
    padding: 7px 0;
    border-bottom-color: #efbd6829;
    background: #10251fee;
    backdrop-filter: blur(14px);
  }
  .brand { gap: 8px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; font-size: 21px; }
  .brand strong { font-size: 17px; }
  .brand small { font-size: 10px; }
  .topbar-note { display: none; }
  .account-open { min-height: 42px; padding: 7px 10px; font-size: 11px; }

  .account-logout { min-height: 40px; padding: 6px 8px; }
  .welcome {
    min-height: 136px;
    margin-top: 12px;
    padding: 18px 15px;
    border-radius: 17px;
    background-position: center, center 58%, center;
  }
  .welcome h1 { max-width: 280px; font-size: clamp(22px, 6vw, 29px); }
  .welcome-copy { max-width: 280px; font-size: 11px; line-height: 1.65; }
  .tea-cup { width: 54px; height: 62px; flex-basis: 54px; }
  .tea-cup img { width: 54px; height: 66px; }
  .lobby-heading { margin: 20px 2px 13px; }
  .lobby-heading h2 { font-size: 25px; }
  .lobby-heading > p:last-child { font-size: 11px; line-height: 1.7; }
  .game-choices { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .game-choice, .online-choice {
    grid-column: auto;
    min-height: 136px;
    gap: 8px;
    padding: 13px;
    border-radius: 16px;
  }
  .game-choice:after { width: 150px; height: 150px; }
  .choice-art { width: 72px; height: 94px; flex-basis: 72px; transform: scale(.8); }
  .cards-art i { width: 56px; height: 84px; }
  .cards-art i:after { top: 27px; font-size: 22px; }
  .board-art i { width: 94px; height: 94px; }
  .crowd-art img { width: 54px; height: 65px; }
  .crowd-art img:nth-child(2) { left: 28px; top: 9px; }
  .choice-copy { gap: 5px; }
  .choice-copy strong { font-size: clamp(20px, 5.5vw, 24px); line-height: 1.2; }
  .choice-copy small { font-size: 10.5px; line-height: 1.6; }
  .choice-detail { font-size: 10px; line-height: 1.5; }
  .choice-cta { min-height: 39px; display: flex; align-items: center; margin-top: 3px; font-size: 11px; }
}

@media (max-width: 380px) {
  .app-shell { width: calc(100% - 16px); }
  .brand small { display: none; }
  .welcome { min-height: 126px; }
  .welcome h1 { font-size: 22px; }
  .game-choice, .online-choice { min-height: 128px; padding: 10px; }
  .choice-art { width: 61px; flex-basis: 61px; }
  .choice-copy strong { font-size: 20px; }
}

/* Start page: a warm Moroccan café entrance, separate from the in-game tables. */
body:not(.playing-dama) {
  background:
    radial-gradient(ellipse at 85% 4%, #9f58272b, transparent 34rem),
    radial-gradient(ellipse at 0 42%, #32644825, transparent 32rem),
    repeating-linear-gradient(45deg, #f8e6c405 0 1px, transparent 1px 13px),
    #1b1712;
}
.app-shell { width: min(1200px, calc(100% - 40px)); }
.topbar {
  min-height: 80px;
  border-bottom-color: #e9c27b30;
}
.brand-mark {
  border: 1px solid #e7bd72;
  border-radius: 15px;
  background: linear-gradient(145deg, #f5d992, #ca8650);
  box-shadow: 0 7px 20px #0006, inset 0 1px #fff9;
}
.brand-mark img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.topbar-note { border-color: #e9c27b30; background: #e9c27b0a; }
.account-open {
  border-color: #e9bd7070;
  border-radius: 999px;
  color: #281a11;
  background: linear-gradient(135deg, #f6d98d, #d39455);
  box-shadow: 0 5px 16px #0004;
}
.account-logout { border-color: #e9bd7050; border-radius: 999px; }
.welcome {
  min-height: 340px;
  gap: clamp(20px, 5vw, 58px);
  margin-top: 24px;
  padding: clamp(22px, 4vw, 48px);
  border-color: #ddb46c65;
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 85% 50%, #86532b22, transparent 45%),
    linear-gradient(130deg, #33251b, #1d281f 70%);
  box-shadow: 0 24px 55px #0006, inset 0 1px #fff2;
}
.welcome:after { display: none; }
.welcome-content { max-width: 610px; }
.welcome .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #e9bc6d;
  font-size: 12px;
  font-weight: 700;
}
.welcome .eyebrow:before {
  width: 22px;
  height: 1px;
  content: "";
  background: currentColor;
}
.welcome h1 {
  max-width: 600px;
  color: #fff1d2;
  font-size: clamp(35px, 5.2vw, 58px);
  line-height: 1.18;
  text-wrap: balance;
}
.welcome-copy { max-width: 480px; color: #dccbb0; font-size: 15px; line-height: 1.9; }
.welcome-tags { gap: 8px; margin-top: 18px; }
.welcome-tags span {
  border-color: #e9bd7040;
  color: #f2d9a8;
  background: #1716118c;
}
.welcome-art {
  position: relative;
  width: min(34vw, 330px);
  height: 285px;
  flex: 0 0 min(34vw, 330px);
  overflow: hidden;
  border: 1px solid #f0cb817a;
  border-radius: 180px 180px 22px 22px;
  background: #34251a;
  box-shadow: 0 18px 34px #090705a8, inset 0 0 0 6px #ffffff0b;
  transform: rotate(-2deg);
}
.welcome-art:after {
  position: absolute;
  inset: 45% 0 0;
  content: "";
  background: linear-gradient(0deg, #17120dd9, transparent);
  pointer-events: none;
}
.welcome-art .welcome-scene {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 49%;
  filter: saturate(.82) contrast(1.04);
}
.welcome-stamp {
  position: absolute;
  z-index: 1;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #f0cb8170;
  border-radius: 999px;
  color: #fff0cc;
  background: #1d1712d9;
  font-size: 11px;
}
.welcome-stamp b { color: #e9bd70; font-size: 15px; }
.game-lobby { padding: 4px 0 22px; }
.lobby-heading {
  align-items: center;
  margin: 34px 3px 18px;
}
.lobby-heading .eyebrow { color: #e9bd70; }
.lobby-heading h2 {
  color: #fff0d0;
  font-size: clamp(27px, 3.2vw, 36px);
}
.lobby-heading > p:last-child { color: #c9bba5; }
.game-choices {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}
.game-choice,
.game-choice:first-child,
.online-choice {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-color: #c39b6152;
  border-radius: 19px;
  background: linear-gradient(145deg, #31261c, #1d211b);
  box-shadow: 0 15px 32px #0005, inset 0 1px #fff1;
}
.game-choice:nth-child(2) {
  background:
    radial-gradient(ellipse at 100% 0, #9e6d3c22, transparent 50%),
    linear-gradient(145deg, #292920, #1b211b);
}
.game-choice:before {
  position: absolute;
  inset: 0 0 auto;
  height: 154px;
  content: "";
  background: linear-gradient(0deg, #211c16 0%, #211c1600 70%);
  pointer-events: none;
}
.game-choice:after {
  width: 170px;
  height: 170px;
  left: -85px;
  bottom: -105px;
  border-color: #e9bd7030;
}
.game-choice:hover,
.game-choice:focus-visible {
  transform: translateY(-4px);
  border-color: #e9bd70;
  box-shadow: 0 20px 36px #0007, 0 0 0 2px #e9bd7020;
}
.choice-art {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 150px;
  flex: 0 0 150px;
  place-items: center;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  background:
    radial-gradient(ellipse at center, #9f713b39, transparent 70%),
    #2a251e;
  transform: none;
}
.choice-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cards-art img {
  width: auto;
  height: 125px;
  object-fit: contain;
  filter: drop-shadow(0 13px 15px #0009);
  transform: rotate(-8deg);
}
.board-art img { object-position: 76% 18%; }
.crowd-art img {
  position: absolute;
  top: 17px;
  left: calc(50% - 87px);
  width: 82px;
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px #0006);
}
.crowd-art img:nth-child(2) { z-index: 1; top: 8px; left: calc(50% - 37px); }
.crowd-art img:nth-child(3) { left: calc(50% + 13px); }
.choice-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  align-items: flex-start;
  padding: 15px 17px 17px;
}
.choice-label {
  border-color: #e9bd7040;
  color: #e9bd70;
  background: #17140f;
}
.choice-copy strong { color: #fff0d0; font-size: clamp(20px, 2vw, 25px); }
.choice-copy small { color: #c9bba5; line-height: 1.7; }
.choice-detail { color: #b6a58c; }
.choice-cta {
  justify-content: space-between;
  width: 100%;
  margin-top: auto;
  border-color: #e9bd7050;
  color: #f2d497;
  background: #e9bd7012;
}
.game-choice:hover .choice-cta {
  color: #281a11;
  background: linear-gradient(135deg, #f6d98d, #d39455);
}
footer { color: #a99a85; }

@media (max-width: 760px) {
  .game-choices { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .game-choice,
  .game-choice:first-child,
  .online-choice {
    display: flex;
    min-height: 142px;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }
  .game-choice:before { inset: 0 auto 0 0; width: 110px; height: auto; }
  .choice-art,
  .online-choice .choice-art {
    width: 104px;
    height: auto;
    min-height: 142px;
    flex: 0 0 104px;
    border-radius: 0 18px 18px 0;
  }
  .cards-art img { height: 110px; }
  .choice-copy { justify-content: center; padding: 13px 14px; }
  .choice-copy strong { font-size: 21px; }
  .choice-cta { min-height: 38px; margin-top: 8px; }
  .crowd-art img { top: 18px; left: calc(50% - 63px); width: 60px; height: 92px; }
  .crowd-art img:nth-child(2) { top: 13px; left: calc(50% - 29px); }
  .crowd-art img:nth-child(3) { left: calc(50% + 5px); }
}
@media (max-width: 600px) {
  .app-shell { width: min(100% - 20px, 520px); }
  .topbar { min-height: 64px; }
  .welcome {
    min-height: 0;
    gap: 10px;
    margin-top: 14px;
    padding: 20px 14px;
    border-radius: 21px;
  }
  .welcome-content { flex: 1; min-width: 0; }
  .welcome .eyebrow { margin-bottom: 9px; font-size: 10px; }
  .welcome h1 { font-size: clamp(23px, 6.4vw, 31px); }
  .welcome-copy { font-size: 11px; line-height: 1.7; }
  .welcome-tags { gap: 5px; margin-top: 12px; }
  .welcome-tags span { padding: 5px 7px; font-size: 9px; }
  .welcome-art {
    width: 31%;
    height: 188px;
    flex: 0 0 31%;
    border-radius: 120px 120px 14px 14px;
  }
  .welcome-stamp { right: 5px; bottom: 6px; gap: 4px; padding: 5px 7px; font-size: 8px; }
  .welcome-stamp b { font-size: 12px; }
  .lobby-heading { display: block; margin: 25px 3px 13px; }
  .lobby-heading .eyebrow { margin-bottom: 4px; }
  .lobby-heading h2 { margin-bottom: 5px; font-size: 26px; }
  .lobby-heading > p:last-child { font-size: 11px; line-height: 1.7; }
}
@media (max-width: 380px) {
  .app-shell { width: calc(100% - 16px); }
  .welcome { gap: 7px; padding: 17px 10px; }
  .welcome h1 { font-size: 22px; }
  .welcome-art { width: 29%; height: 166px; flex-basis: 29%; }
  .welcome-tags span { padding: 5px 6px; font-size: 8px; }
  .choice-art,
  .online-choice .choice-art { width: 84px; flex-basis: 84px; }
  .choice-copy { padding: 11px 10px; }
  .choice-copy strong { font-size: 19px; }
  .choice-copy small { font-size: 10px; }
}

:root {
  --cream: #f5f2e7;
  --muted: #a9b8ad;
  --green: #2b7654;
  --green-deep: #0c2118;
  --gold: #f2c56e;
  --red: #dc725e;
}

body {
  background:
    radial-gradient(ellipse at 12% 0, #3fae7b20, transparent 34rem),
    radial-gradient(ellipse at 95% 22%, #f2c56e13, transparent 30rem),
    linear-gradient(150deg, #07120e, #10271c 55%, #09140f);
  font-family: "Tahoma", "Arial", sans-serif;
}

.app-shell { width: min(1180px, calc(100% - 40px)); }

.topbar {
  min-height: 76px;
  border-color: #d7e5d11f;
}

.brand-mark {
  border: 1px solid #f2c56e88;
  background: linear-gradient(145deg, #225b40, #123421);
  box-shadow: 0 7px 22px #0006, inset 0 1px #ffffff20;
}

.welcome {
  min-height: 300px;
  border-color: #f2c56e70;
  border-radius: 28px;
  background:
    linear-gradient(100deg, #071c13f5 0%, #0c3525db 56%, #12412aa6 100%),
    url("assets/scene/cafe.webp") center 58% / cover,
    #10271c;
  box-shadow: 0 28px 65px #0007, inset 0 1px #ffffff20;
}

.welcome h1 { color: #fff9eb; }
.welcome-copy { color: #d7e2d8; }
.welcome-tags span {
  border-color: #b6d7bd45;
  color: #e4efdF;
  background: #07180fd9;
}
.welcome-stamp {
  border: 1px solid #f2c56e66;
  border-radius: 14px;
  background: #07180fd9;
}

.lobby-heading h2 {
  color: #fff5dc;
  font-size: clamp(28px, 5vw, 36px);
}

.game-choice,
.game-choice:first-child,
.online-choice {
  overflow: hidden;
  border-color: #c3d7c143;
  border-radius: 23px;
  background:
    radial-gradient(ellipse at 100% 0, #2d986020, transparent 65%),
    linear-gradient(145deg, #162e22, #0d1d16);
  box-shadow: 0 18px 36px #0005, inset 0 1px #ffffff18;
}

.game-choice:nth-child(2) {
  background:
    radial-gradient(ellipse at 100% 0, #eab95921, transparent 62%),
    linear-gradient(145deg, #292719, #171c14);
}

.game-choice:hover,
.game-choice:focus-visible {
  border-color: #f2c56e;
  box-shadow: 0 23px 42px #0007, 0 0 0 2px #f2c56e28;
}

.choice-art {
  background:
    radial-gradient(ellipse at 50% 35%, #edc46b24, transparent 72%),
    linear-gradient(145deg, #193c2a, #101b14);
}

.choice-copy { gap: 7px; }
.choice-copy strong { color: #fff7e6; }
.choice-copy small { color: #c7d2c8; }
.choice-detail { color: #a7b9aa; }
.choice-label {
  border-color: #f2c56e45;
  color: #f2c56e;
  background: #07180fa8;
}
.choice-cta {
  min-height: 43px;
  border-color: #f2c56e65;
  border-radius: 12px;
  color: #ffe4a0;
  background: #f2c56e12;
}
.game-choice:hover .choice-cta {
  color: #142319;
  background: linear-gradient(135deg, #ffe49a, #e9a945);
}

.online-game-option,
.player-count-option,
.game-tab,
.secondary-button,
.back-button,
.mode-button,
.friends-nav-button {
  border-color: #b7cfbd38;
  border-radius: 13px;
  color: #eaf0e8;
  background: linear-gradient(145deg, #173323, #102318);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.online-game-option:hover,
.player-count-option:hover,
.secondary-button:hover,
.back-button:hover,
.mode-button:hover,
.friends-nav-button:hover {
  border-color: #f2c56e99;
  transform: translateY(-1px);
}

.online-game-option.active,
.player-count-option.active,
.mode-button.active,
.friends-nav-button.active {
  border-color: #f2c56e;
  color: #fff1ca;
  background: linear-gradient(145deg, #335335, #1d3924);
  box-shadow: inset 0 0 0 1px #f2c56e30, 0 7px 17px #0003;
}

.game-panel {
  border: 1px solid #a9ceae3b;
  border-radius: 25px;
  background:
    radial-gradient(ellipse at 100% 0, #2a805321, transparent 54%),
    linear-gradient(145deg, #12291dF5, #0b1c14f5);
  box-shadow: 0 24px 58px #0006, inset 0 1px #ffffff12;
}

.game-heading { border-color: #a9ceae28; }
.game-heading h2,
.dama-heading h2 { color: #fff0c8; }
.turn-indicator {
  border: 1px solid #a8cbae39;
  border-radius: 999px;
  color: #e9efdf;
  background: #091a11b8;
}

.player-score {
  border-color: #b2cbb33c;
  border-radius: 16px;
  background: linear-gradient(145deg, #1a3b28, #102619);
  box-shadow: inset 0 1px #ffffff12, 0 8px 18px #0003;
}
.player-score strong { color: #f5cf7a; }
.player-score.opponent-score { border-color: #ca89705c; }

.ronda-table {
  overflow: hidden;
  border: 1px solid #f2c56e5c;
  border-radius: 26px;
  background: radial-gradient(ellipse at center, #276c4a, #123a29 77%);
  box-shadow: inset 0 0 0 5px #0a251849, 0 22px 40px #0005;
}
.table-meta span,
.area-label { color: #f3e7cb; }

.dama-table-scene {
  border: 1px solid #f2c56e45;
  border-radius: 23px;
  background:
    radial-gradient(ellipse at 50% 0, #39885d45, transparent 66%),
    linear-gradient(145deg, #142d1d, #0a1a12);
  box-shadow: inset 0 1px #ffffff12, 0 20px 36px #0005;
}
.board-frame {
  border-color: #b2793c;
  background: linear-gradient(145deg, #986b3e, #634326);
  box-shadow: 0 15px 32px #0008, inset 0 1px #ffe0a25c;
}
.square.light { background: linear-gradient(145deg, #e5d6b3, #c8b188); }
.square.dark { background: linear-gradient(145deg, #315c40, #183d2a); }
.piece.red { background: repeating-conic-gradient(#ed9973 0deg 7deg, #bd4638 7deg 12deg); }
.piece.black { background: repeating-conic-gradient(#d5d2c4 0deg 7deg, #535a51 7deg 12deg); }

.dama-side .side-card,
.dama-side .move-hint {
  border-color: #a9ceae4a;
  border-radius: 17px;
  background: linear-gradient(145deg, #183824, #0e2418);
  box-shadow: inset 0 1px #ffffff12, 0 10px 24px #0004;
}

.room-controls {
  border-color: #9dcaaa48 !important;
  border-radius: 26px !important;
  background:
    radial-gradient(ellipse at 100% 0, #36936521, transparent 45%),
    linear-gradient(145deg, #12291df5, #0b1a13fa) !important;
  box-shadow: 0 26px 62px #0007, inset 0 1px #ffffff14 !important;
}

.room-controls-heading {
  border-color: #9dcaaa32 !important;
}

.room-controls-heading .eyebrow,
.room-section-label,
.lan-auto-badge { color: #9ed5ab !important; }

.lan-room-browser,
.lan-create-panel,
.room-join-manual,
.room-options,
.room-friend-invites {
  border-color: #aac6ad38 !important;
  border-radius: 18px !important;
  background: linear-gradient(145deg, #142e1f, #0d1e15) !important;
}

.lan-browser-heading strong,
.lan-create-heading h3,
.room-controls-heading h2 { color: #fff0cc !important; }

.lan-room-results,
.room-join-controls input,
.room-options select {
  border-color: #aac6ad48 !important;
  border-radius: 12px !important;
  color: #f3f1e7 !important;
  background: #091910 !important;
}

.room-actions .secondary-button,
.room-join-controls .secondary-button,
.room-controls-back {
  min-height: 48px;
  border-color: #f2c56e85;
  color: #182318;
  background: linear-gradient(135deg, #ffdc8a, #d99a43);
  box-shadow: 0 5px 0 #805521, 0 12px 22px #0004;
  font-weight: 800;
}

.room-message {
  border-radius: 13px;
  color: #f3e5bf;
  background: #f2c56e14;
}

.online-stage { background: #08130d; }
.online-stage-back,
.online-stage-rules,
.online-stage-summary,
.online-stage-score,
.online-stage-hint {
  border-color: #c4d6bd50;
  border-radius: 14px;
  color: #f5f2e7;
  background: #0a1b12eF;
  box-shadow: 0 8px 24px #0007, inset 0 1px #ffffff15;
}
.online-stage-start {
  border-color: #ffe3a2;
  border-radius: 14px;
  color: #182318;
  background: linear-gradient(135deg, #ffdc8a, #d99a43);
  font-weight: 800;
}
.online-stage-summary strong,
.online-room-code b { color: #f4cd78; }
.online-rules-card {
  border-color: #d6b76d80;
  border-radius: 24px;
  background: linear-gradient(145deg, #163322f7, #091a10fa);
}

.camera-controls input { accent-color: #f2c56e; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 620px); }
  .welcome {
    min-height: 255px;
    border-radius: 23px;
  }
  .game-panel { border-radius: 20px; }
  .room-controls { padding: 16px !important; }
}

@media (max-width: 420px) {
  .app-shell { width: calc(100% - 18px); }
  .welcome { min-height: 220px; }
  .game-panel { padding: 12px; }
  .room-controls { padding: 12px !important; }
  .room-actions .secondary-button,
  .room-join-controls .secondary-button,
  .room-controls-back { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-choice,
  .online-game-option,
  .player-count-option,
  .secondary-button,
  .back-button,
  .mode-button,
  .friends-nav-button { transition: none; }
}
body {
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 12% 0, #3a805d25, transparent 34rem),
    radial-gradient(ellipse at 100% 42%, #efbd6810, transparent 32rem),
    linear-gradient(160deg, #0d1d19, #132d24 48%, #0c1a17);
}
.app-shell { width: min(1120px, calc(100% - 40px)); }
.topbar {
  min-height: 78px;
  border-bottom: 1px solid #d5bd8430;
}
.brand-mark {
  border-radius: 15px;
  background: linear-gradient(145deg, #f8d99a, #dfa553);
  box-shadow: 0 7px 20px #0005, inset 0 1px #fff9;
}
.brand-mark img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.welcome {
  min-height: 290px;
  justify-content: space-between;
  margin-top: 20px;
  padding: clamp(24px, 5vw, 55px);
  border: 1px solid #efbd6850;
  border-radius: 28px;
  background:
    linear-gradient(105deg, #0c241df7 0%, #113a2cde 55%, #163b30ad 100%),
    url("assets/scene/cafe.webp") center 58% / cover,
    #17382f;
  box-shadow: 0 25px 55px #0006, inset 0 1px #fff2;
}
.welcome:after {
  left: -70px;
  top: auto;
  bottom: -240px;
  width: 420px;
  height: 420px;
  border-color: #efbd6829;
  box-shadow: 0 0 0 27px #efbd680b, 0 0 0 56px #efbd6808;
}
.welcome-content { position: relative; z-index: 1; max-width: 660px; }
.welcome .eyebrow { font-weight: 700; }
.welcome h1 { font-size: clamp(32px, 5vw, 52px); }
.welcome-copy { max-width: 510px; font-size: 15px; line-height: 1.8; }
.welcome-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.welcome-tags span {
  padding: 7px 11px;
  border: 1px solid #efbd6845;
  border-radius: 999px;
  color: #f4dfb4;
  background: #0c231b99;
  font-size: 11px;
}
.welcome-art {
  position: relative;
  z-index: 1;
  width: 240px;
  height: 205px;
  flex: 0 0 240px;
}
.welcome-art img {
  position: absolute;
  z-index: 2;
  right: 7px;
  bottom: -11px;
  width: 110px;
  height: 145px;
  object-fit: contain;
  filter: drop-shadow(0 13px 15px #0009);
}
.welcome-glow {
  position: absolute;
  right: 5px;
  bottom: 1px;
  width: 152px;
  height: 152px;
  border-radius: 50%;
  background: radial-gradient(circle, #efbd6835, #efbd6800 70%);
}
.welcome-card {
  position: absolute;
  display: grid;
  width: 70px;
  height: 102px;
  place-items: center;
  border: 2px solid #f4e4c3;
  border-radius: 9px;
  color: #8d342b;
  background: #fbf0d7;
  box-shadow: 0 15px 25px #0008;
  font: 800 24px Georgia, serif;
}
.welcome-card-back {
  left: 18px;
  top: 29px;
  color: #f1d89d;
  background: repeating-linear-gradient(45deg, #24533d 0 5px, #1a402f 5px 10px);
  transform: rotate(-17deg);
}
.welcome-card-front {
  z-index: 1;
  left: 66px;
  top: 53px;
  transform: rotate(10deg);
}
.welcome-card-front small { font-size: 31px; }
.welcome-steam {
  position: absolute;
  z-index: 3;
  right: 45px;
  top: 5px;
  color: #f7d99a;
  font-size: 44px;
  transform: rotate(90deg);
  opacity: .8;
}
.game-lobby { padding: 5px 0 24px; }
.lobby-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 2px 16px;
}
.lobby-heading h2 { font-size: 31px; }
.lobby-heading > p:last-child { max-width: 430px; line-height: 1.7; }
.game-choices { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 14px; }
.game-choice {
  min-height: 224px;
  gap: 13px;
  padding: clamp(16px, 2.5vw, 28px);
  border-color: #83b98a4a;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 0 100%, #efbd6815, transparent 50%),
    linear-gradient(145deg, #1b4936f5, #10271ff5);
  box-shadow: 0 17px 35px #0005, inset 0 1px #ffffff12;
}
.game-choice:nth-child(2) {
  background:
    radial-gradient(ellipse at 100% 0, #efbd6817, transparent 54%),
    linear-gradient(145deg, #1a3e32f5, #10241ff5);
}
.game-choice:first-child { min-height: 252px; }
.game-choice:after {
  left: -90px;
  bottom: -140px;
  border-color: #efbd6838;
}
.game-choice:hover, .game-choice:focus-visible {
  transform: translateY(-3px);
  border-color: #efbd68;
  box-shadow: 0 21px 40px #0007, 0 0 0 2px #efbd6820;
}
.choice-art { width: 105px; height: 135px; flex-basis: 105px; }
.choice-copy { gap: 8px; }
.choice-label {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid #efbd6840;
  border-radius: 999px;
  color: #edcc8c;
  background: #0d211a88;
  font-size: 10px;
}
.choice-copy strong { font-size: clamp(22px, 2.3vw, 28px); line-height: 1.2; }
.choice-copy small { line-height: 1.7; }
.choice-cta {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-inline: 12px;
  margin-top: 4px;
  border-color: #efbd6850;
  border-radius: 12px;
}
.online-choice {
  grid-column: 1 / -1;
  min-height: 150px;
  background:
    radial-gradient(ellipse at 0 100%, #efbd6812, transparent 50%),
    linear-gradient(110deg, #193e31, #10271f);
}
.online-choice .choice-art { width: 114px; height: 108px; flex-basis: 114px; }
.online-choice .crowd-art img { width: 61px; height: 74px; }
.online-choice .crowd-art img:nth-child(2) { left: 35px; top: 2px; }
.choice-detail { line-height: 1.6; }

@media (max-width: 700px) {
  .app-shell { width: min(100% - 24px, 520px); }
  .topbar { min-height: 66px; }
  .welcome {
    min-height: 225px;
    gap: 4px;
    padding: 22px 18px;
    border-radius: 22px;
  }
  .welcome h1 { max-width: 310px; font-size: clamp(27px, 7vw, 36px); }
  .welcome-copy { max-width: 300px; font-size: 12px; }
  .welcome-tags { gap: 5px; margin-top: 13px; }
  .welcome-tags span { padding: 6px 8px; font-size: 9px; }
  .welcome-art { width: 126px; height: 146px; flex: 0 0 126px; transform: scale(.78); transform-origin: center right; }
  .welcome-art img { right: 1px; bottom: -5px; width: 90px; height: 115px; }
  .welcome-glow { right: 0; width: 120px; height: 120px; }
  .welcome-card { width: 58px; height: 86px; }
  .welcome-card-back { left: 0; top: 23px; }
  .welcome-card-front { left: 38px; top: 42px; }
  .welcome-steam { right: 24px; top: 0; font-size: 35px; }
  .lobby-heading { display: block; margin: 22px 3px 12px; }
  .lobby-heading h2 { font-size: 26px; }
  .lobby-heading > p:last-child { margin-top: 5px; font-size: 11px; }
  .game-choices { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .game-choice, .game-choice:first-child, .online-choice {
    grid-column: auto;
    min-height: 151px;
    gap: 12px;
    padding: 13px 12px;
    border-radius: 18px;
  }
  .choice-art { width: 75px; height: 108px; flex-basis: 75px; transform: scale(.8); }
  .choice-copy { gap: 5px; }
  .choice-copy strong { font-size: 22px; }
  .choice-copy small { font-size: 10px; }
  .choice-cta { min-height: 40px; }
  .online-choice .choice-art { width: 76px; height: 92px; flex-basis: 76px; }
  .online-choice .crowd-art img { width: 47px; height: 58px; }
  .online-choice .crowd-art img:nth-child(2) { left: 19px; top: 0; }
  .choice-detail { font-size: 9px; }
}

@media (max-width: 380px) {
  .app-shell { width: calc(100% - 18px); }
  .welcome { min-height: 211px; padding: 18px 13px; }
  .welcome h1 { font-size: 26px; }
  .welcome-art { width: 105px; flex-basis: 105px; transform: scale(.68); }
  .welcome-tags span { font-size: 8px; }
  .game-choice, .game-choice:first-child, .online-choice { min-height: 144px; padding: 11px 9px; }
  .choice-art { width: 65px; flex-basis: 65px; }
  .choice-copy strong { font-size: 20px; }
}

body:not(.playing-dama) {
  background:
    radial-gradient(ellipse at 85% 4%, #9f58272b, transparent 34rem),
    radial-gradient(ellipse at 0 42%, #32644825, transparent 32rem),
    repeating-linear-gradient(45deg, #f8e6c405 0 1px, transparent 1px 13px),
    #1b1712;
}
.app-shell { width: min(1200px, calc(100% - 40px)); }
.topbar { min-height: 80px; border-bottom-color: #e9c27b30; }
.brand-mark { border: 1px solid #e7bd72; border-radius: 15px; background: linear-gradient(145deg, #f5d992, #ca8650); }
.brand-mark img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.topbar-note { border-color: #e9c27b30; background: #e9c27b0a; }
.account-open { border-color: #ffe27a; border-radius: 999px; color: #392609; background: linear-gradient(135deg, #ffe58a, #efb932); box-shadow: 0 5px 16px #e2ad3533, inset 0 1px #fff9; }
.welcome {
  min-height: 340px;
  gap: clamp(20px, 5vw, 58px);
  margin-top: 24px;
  padding: clamp(22px, 4vw, 48px);
  border-color: #ddb46c65;
  border-radius: 26px;
  background: radial-gradient(ellipse at 85% 50%, #86532b22, transparent 45%), linear-gradient(130deg, #33251b, #1d281f 70%);
  box-shadow: 0 24px 55px #0006, inset 0 1px #fff2;
}
.welcome:after { display: none; }
.welcome-content { max-width: 610px; }
.welcome .eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; color: #e9bc6d; font-size: 12px; font-weight: 700; }
.welcome .eyebrow:before { width: 22px; height: 1px; content: ""; background: currentColor; }
.welcome h1 { max-width: 600px; color: #fff1d2; font-size: clamp(35px, 5.2vw, 58px); line-height: 1.18; }
.welcome-copy { max-width: 480px; color: #dccbb0; font-size: 15px; line-height: 1.9; }
.welcome-tags { gap: 8px; margin-top: 18px; }
.welcome-tags span { border-color: #e9bd7040; color: #f2d9a8; background: #1716118c; }
.welcome-art {
  width: min(34vw, 330px);
  height: 285px;
  flex: 0 0 min(34vw, 330px);
  overflow: hidden;
  border: 1px solid #f0cb817a;
  border-radius: 180px 180px 22px 22px;
  background: #34251a;
  box-shadow: 0 18px 34px #090705a8, inset 0 0 0 6px #ffffff0b;
  transform: rotate(-2deg);
}
.welcome-art:after { position: absolute; inset: 45% 0 0; content: ""; background: linear-gradient(0deg, #17120dd9, transparent); pointer-events: none; }
.welcome-art img.welcome-scene { position: static; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 49%; filter: saturate(.82) contrast(1.04); }
.welcome-stamp { position: absolute; z-index: 1; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid #f0cb8170; border-radius: 999px; color: #fff0cc; background: #1d1712d9; font-size: 11px; }
.welcome-stamp b { color: #e9bd70; font-size: 15px; }
.lobby-heading { align-items: center; margin: 34px 3px 18px; }
.lobby-heading .eyebrow { color: #e9bd70; }
.lobby-heading h2 { color: #fff0d0; font-size: clamp(27px, 3.2vw, 36px); }
.lobby-heading > p:last-child { color: #c9bba5; }
.game-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.game-choice, .game-choice:first-child, .online-choice {
  display: flex;
  grid-column: auto;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-color: #c39b6152;
  border-radius: 19px;
  background: linear-gradient(145deg, #31261c, #1d211b);
  box-shadow: 0 15px 32px #0005, inset 0 1px #fff1;
}
.game-choice:nth-child(2) { background: radial-gradient(ellipse at 100% 0, #9e6d3c22, transparent 50%), linear-gradient(145deg, #292920, #1b211b); }
.game-choice:before { position: absolute; inset: 0 0 auto; height: 154px; content: ""; background: linear-gradient(0deg, #211c16 0%, #211c1600 70%); pointer-events: none; }
.game-choice:after { width: 170px; height: 170px; left: -85px; bottom: -105px; border-color: #e9bd7030; }
.game-choice:hover, .game-choice:focus-visible { transform: translateY(-4px); border-color: #e9bd70; box-shadow: 0 20px 36px #0007, 0 0 0 2px #e9bd7020; }
.choice-art {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 150px;
  flex: 0 0 150px;
  place-items: center;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  background: radial-gradient(ellipse at center, #9f713b39, transparent 70%), #2a251e;
  transform: none;
}
.choice-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cards-art img { width: auto; height: 125px; object-fit: contain; filter: drop-shadow(0 13px 15px #0009); transform: rotate(-8deg); }
.board-art img { object-position: 76% 18%; }
.crowd-art img { position: absolute; top: 17px; left: calc(50% - 87px); width: 82px; height: 110px; object-fit: contain; filter: drop-shadow(0 8px 8px #0006); }
.crowd-art img:nth-child(2) { z-index: 1; top: 8px; left: calc(50% - 37px); }
.crowd-art img:nth-child(3) { left: calc(50% + 13px); }
.choice-copy {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 15px 17px 17px;
}
.choice-label { border-color: #e9bd7040; color: #e9bd70; background: #17140f; }
.choice-copy strong { color: #fff0d0; font-size: clamp(20px, 2vw, 25px); }
.choice-copy small { color: #c9bba5; line-height: 1.7; }
.choice-detail { color: #b6a58c; }
.choice-cta { justify-content: space-between; width: 100%; margin-top: auto; border-color: #e9bd7050; color: #f2d497; background: #e9bd7012; }
.game-choice:hover .choice-cta { color: #281a11; background: linear-gradient(135deg, #f6d98d, #d39455); }
footer { color: #a99a85; }

@media (max-width: 760px) {
  .game-choices { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .game-choice, .game-choice:first-child, .online-choice { min-height: 142px; flex-direction: row; align-items: stretch; padding: 0; }
  .game-choice:before { inset: 0 auto 0 0; width: 110px; height: auto; }
  .choice-art, .online-choice .choice-art { width: 104px; height: auto; min-height: 142px; flex: 0 0 104px; border-radius: 0 18px 18px 0; }
  .cards-art img { height: 110px; }
  .choice-copy { justify-content: center; padding: 13px 14px; }
  .choice-copy strong { font-size: 21px; }
  .choice-cta { min-height: 38px; margin-top: 8px; }
  .crowd-art img { top: 18px; left: calc(50% - 63px); width: 60px; height: 92px; }
  .crowd-art img:nth-child(2) { top: 13px; left: calc(50% - 29px); }
  .crowd-art img:nth-child(3) { left: calc(50% + 5px); }
}
@media (max-width: 600px) {
  .app-shell { width: min(100% - 20px, 520px); }
  .topbar { min-height: 64px; }
  .welcome { min-height: 0; gap: 10px; margin-top: 14px; padding: 20px 14px; border-radius: 21px; }
  .welcome-content { flex: 1; min-width: 0; }
  .welcome .eyebrow { margin-bottom: 9px; font-size: 10px; }
  .welcome h1 { font-size: clamp(23px, 6.4vw, 31px); }
  .welcome-copy { font-size: 11px; line-height: 1.7; }
  .welcome-tags { gap: 5px; margin-top: 12px; }
  .welcome-tags span { padding: 5px 7px; font-size: 9px; }
  .welcome-art { width: 31%; height: 188px; flex: 0 0 31%; border-radius: 120px 120px 14px 14px; transform: none; }
  .welcome-art img.welcome-scene { width: 100%; height: 100%; right: auto; bottom: auto; }
  .welcome-stamp { right: 5px; bottom: 6px; gap: 4px; padding: 5px 7px; font-size: 8px; }
  .welcome-stamp b { font-size: 12px; }
  .lobby-heading { display: block; margin: 25px 3px 13px; }
  .lobby-heading .eyebrow { margin-bottom: 4px; }
  .lobby-heading h2 { margin-bottom: 5px; font-size: 26px; }
  .lobby-heading > p:last-child { font-size: 11px; line-height: 1.7; }
}
@media (max-width: 380px) {
  .app-shell { width: calc(100% - 16px); }
  .welcome { gap: 7px; padding: 17px 10px; }
  .welcome h1 { font-size: 22px; }
  .welcome-art { width: 29%; height: 166px; flex-basis: 29%; }
  .welcome-tags span { padding: 5px 6px; font-size: 8px; }
  .choice-art, .online-choice .choice-art { width: 84px; flex-basis: 84px; }
  .choice-copy { padding: 11px 10px; }
  .choice-copy strong { font-size: 19px; }
  .choice-copy small { font-size: 10px; }
}
.dama-board.online-black { transform: rotate(180deg); }
.dama-board.online-black .square > * { transform: rotate(180deg); }
.welcome { min-height: 390px; }
.welcome-art {
  width: min(45vw, 500px);
  height: 330px;
  flex-basis: min(45vw, 500px);
  border-radius: 22px;
  transform: none;
}
.welcome-art img.welcome-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 49%;
}
.welcome-art .welcome-live-scene {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  background: #101914;
  transition: opacity .65s ease;
  pointer-events: none;
}
.welcome-art.has-live-scene .welcome-live-scene { opacity: 1; }
.welcome-stamp { z-index: 2; }
.game-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.online-choice {
  grid-column: 1 / -1;
  min-height: 160px;
  flex-direction: row;
  align-items: stretch;
}
.online-choice .choice-art { width: 150px; height: auto; min-height: 160px; flex: 0 0 150px; border-radius: 0 18px 18px 0; }
.online-choice .choice-copy { justify-content: center; padding: 15px 19px; }
.online-choice .choice-cta { margin-top: 8px; }
@media (max-width: 760px) {
  .online-choice .choice-art { width: 104px; min-height: 142px; flex-basis: 104px; }
  .online-choice .choice-copy { padding: 13px 14px; }
}
@media (max-width: 600px) {
  .welcome { min-height: 0; flex-direction: column; align-items: stretch; }
  .welcome-art {
    order: -1;
    width: 100%;
    height: clamp(210px, 62vw, 285px);
    flex: 0 0 auto;
    border-radius: 18px;
  }
  .welcome-art img.welcome-scene { right: auto; bottom: auto; }
  .game-choices { grid-template-columns: minmax(0, 1fr); }
  .online-choice { min-height: 142px; }
}
@media (max-width: 380px) {
  .welcome-art { height: 205px; }
  .online-choice .choice-art { width: 84px; flex-basis: 84px; }
}

.online-choice {
  border: 3px solid #d5aa5e;
  box-shadow: 0 15px 32px #0005, inset 0 0 0 1px #fff2, 0 0 0 3px #d5aa5e24;
}
.game-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.online-choice {
  grid-column: auto;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}
.online-choice .choice-art {
  width: 100%;
  height: 150px;
  min-height: 150px;
  flex: 0 0 150px;
  border-radius: 18px 18px 0 0;
}
.online-choice .choice-art:after { position: absolute; z-index: 4; inset: 0; background: linear-gradient(0deg, #0006, transparent 62%); content: ""; pointer-events: none; }
.online-choice .crowd-art .online-cafe-photo { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; border: 0; border-radius: inherit; object-fit: cover; object-position: center 52%; transform: none; }
.online-choice .choice-copy { justify-content: initial; padding: 15px 17px 17px; }
.online-choice .choice-cta { margin-top: auto; }
.online-choice .choice-copy strong { font-weight: 800; }
.online-choice .choice-cta { min-height: 44px; border-width: 2px; font-weight: 800; }
.online-choice:hover, .online-choice:focus-visible { border-width: 3px; }
.room-controls-back { justify-self: end; }
@media (max-width: 760px) {
  .game-choices { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .online-choice { min-height: 142px; flex-direction: row; align-items: stretch; padding: 0; }
  .online-choice .choice-art { width: 104px; height: 142px; min-height: 142px; flex: 0 0 104px; border-radius: 0 18px 18px 0; }
  .online-choice .choice-copy { justify-content: center; padding: 13px 14px; }
  .online-choice .choice-cta { margin-top: 8px; }
  .online-choice { border-width: 3px; }
  .online-choice .choice-cta { min-height: 40px; }
}
@media (max-width: 380px) {
  .online-choice .choice-art { width: 84px; flex-basis: 84px; }
  .online-choice .choice-copy { padding: 11px 10px; }
}

body:not(.online-mode-active) {
  --home-header-height: 82px;
  min-height: 100svh;
  overflow: hidden;
}
.home-game {
  position: fixed;
  z-index: 1;
  inset: var(--home-header-height) 0 0;
  background: #101914;
}
.home-game iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(1200px, calc(100% - 32px));
  height: var(--home-header-height);
  min-height: var(--home-header-height);
  margin: 0 auto;
  padding: 0 12px;
  background: #101914;
}
.account-player-id { display: block; color: #b7c8b9; font-size: 10px; }
.account-player-id b { color: #f5d18a; direction: ltr; unicode-bidi: isolate; }
.friend-search button, .my-player-card > button, .room-invite-code button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #efbd6880;
  border-radius: 10px;
  color: #fff0d0;
  background: #173a30ee;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.game-home-active .welcome, .game-home-active #game-lobby, .game-home-active footer { display: none !important; }
body.online-mode-active { overflow: auto; }
body.online-mode-active .home-game { display: none; }
body.online-mode-active .topbar {
  display: flex;
  position: sticky;
  inset: auto;
  width: min(1050px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
  padding: 8px 0;
  border-bottom: 1px solid #efbd6829;
  background: #10251fee;
  backdrop-filter: blur(14px);
}
body.online-mode-active .topbar .brand { display: flex; }
body.online-mode-active .app-shell { width: min(1050px, calc(100% - 32px)); }
body.online-mode-active #room-controls:not(.hidden) { display: block; max-height: calc(100svh - 78px); overflow: auto; }
.friends-panel {
  position: fixed;
  z-index: 40;
  inset: max(18px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
  display: flex;
  width: min(1120px, calc(100vw - 40px));
  flex-direction: column;
  overflow: hidden;
  margin-inline: auto;
  padding: clamp(15px, 2.2vw, 26px);
  border: 1px solid #68cfff88;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 96% 0, #168bd34d, transparent 35%),
    radial-gradient(ellipse at 0 100%, #f28a3636, transparent 36%),
    linear-gradient(145deg, #0d1725fc, #14283cfc 55%, #101c2cfc);
  box-shadow: 0 24px 80px #020711e8, inset 0 1px #ffffff1c;
  backdrop-filter: blur(16px);
}
.friends-panel.hidden { display: none; }
.friends-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 0 0 14px;
  border-bottom: 1px solid #76d5ff36;
}
.friends-heading h2 { margin: 0; color: #f5f8ff; font-size: clamp(24px, 4vw, 34px); letter-spacing: .02em; }
.friends-heading .eyebrow { color: #68d0ff; }
.friends-heading button { width: 42px; height: 42px; border: 1px solid #6acfff7a; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #1c3b56, #132238); font-size: 24px; cursor: pointer; }
.friends-workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(205px, 250px) minmax(0, 1fr);
  gap: 16px;
  padding-top: 15px;
}
.friends-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  padding-inline-end: 14px;
  border-inline-end: 1px solid #70cfff32;
}
.friends-content { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.friends-view { display: grid; min-height: 100%; align-content: start; gap: 15px; }
.friends-view[hidden], .friends-view.hidden { display: none; }
.friends-view-heading { display: grid; gap: 6px; padding: 4px 2px 6px; }
.friends-view-heading .eyebrow { margin: 0; color: #72d8ff; }
.friends-view-heading h3 { margin: 0; color: #f4f8ff; font-size: clamp(22px, 2.5vw, 30px); }
.friends-view-heading > p:last-child { margin: 0; color: #bdcfe0; font-size: 13px; line-height: 1.65; }
.friends-nav { display: grid; gap: 7px; }
.friends-nav-button {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #c1d5e6;
  background: #1022389c;
  text-align: start;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s, transform .16s;
}
.friends-nav-button > span { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border-radius: 8px; color: #81dcff; background: #168bc52b; font-size: 17px; }
.friends-nav-button:hover { border-color: #61ceff4c; color: #fff; background: #1b3853; }
.friends-nav-button.active { border-color: #6ad1ff88; color: #fff; background: linear-gradient(110deg, #197ab5a8, #17508a70); box-shadow: inset 3px 0 #ff9a45, 0 6px 16px #0002; }
.friends-nav-button.active > span { color: #271909; background: linear-gradient(135deg, #ffd17e, #f28a36); }
.friends-nav-count:not(.hidden) { display: inline-grid; min-width: 22px; height: 22px; place-items: center; margin-inline-start: auto; padding: 0 6px; border-radius: 999px; color: #211708; background: linear-gradient(135deg, #ffd17e, #f28a36); font-size: 10px; }
.my-player-card, .social-card, .room-invite-code {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #75c9f53b;
  border-radius: 15px;
  background: linear-gradient(110deg, #1a3851bb, #122238aa);
  box-shadow: inset 0 1px #ffffff09;
}
.my-player-card {
  min-height: 76px;
  padding: 10px;
  flex-wrap: wrap;
  border-inline-start: 4px solid #ff9a45;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 0 50%, #1386c342, transparent 55%),
    linear-gradient(110deg, #193b54f2, #111f31f2);
  box-shadow: 0 8px 22px #0003, inset 0 1px #ffffff12;
}
.my-player-card > button { width: 100%; min-height: 34px; padding: 6px 8px; border: 1px solid #6acfff51; border-radius: 9px; color: #a9eaff; background: #168bc51e; font-size: 11px; font-weight: 800; cursor: pointer; }
.friend-skin {
  --friend-outfit: #e9e3d6;
  position: relative;
  display: grid;
  width: 56px;
  height: 62px;
  flex: 0 0 56px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #6acfff99;
  border-radius: 13px;
  color: #fff0d0;
  background:
    radial-gradient(ellipse at 50% 24%, #e8ba91 0 17%, transparent 18%),
    radial-gradient(ellipse at 50% 83%, var(--friend-outfit) 0 39%, transparent 40%),
    linear-gradient(145deg, #287bb0, #173047);
  font-size: 0;
}
.friend-skin[data-gender="f"] { border-radius: 15px 15px 20px 20px; }
.my-player-card > span:nth-child(2), .social-card-copy { display: grid; min-width: 0; flex: 1; gap: 3px; }
.my-player-card small, .social-card small { color: #b7cde0; font-size: 11px; }
.my-player-card b, .social-card-id { color: #74d5ff; direction: ltr; unicode-bidi: isolate; }
.profile-room-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 13px;
  border: 1px solid #ffad5c63;
  border-radius: 14px;
  background: linear-gradient(125deg, #633e2252, #182a3ad9 70%);
}
.profile-room-invite.hidden { display: none; }
.profile-room-invite > div { display: grid; gap: 4px; }
.profile-room-invite > div strong { color: #ffd18a; font-size: 13px; }
.profile-room-invite > div b { color: #fff; font-size: 17px; letter-spacing: .13em; }
.profile-room-invite > button { grid-column: 2; grid-row: 1; }
.profile-room-invite > p { grid-column: 1 / -1; margin: 0; color: #c1d2e0; font-size: 11px; }
.friend-search {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid #5ecbff55;
  border-radius: 14px;
  background: linear-gradient(120deg, #10243b, #142e43);
  box-shadow: inset 0 1px #ffffff0b;
}
.friend-search label, .friends-panel h3, .room-friend-invites h3 { margin: 0; color: #79d8ff; font-size: 14px; }
.friend-search > div { display: flex; gap: 7px; }
.friend-search input { min-width: 0; flex: 1; padding: 11px 12px; border: 1px solid #68cfff62; border-radius: 11px; color: #f3f8ff; background: #0b1928cc; }
.friend-search button { border: 1px solid #ffbd6a; border-radius: 11px; color: #241707; background: linear-gradient(135deg, #ffd17e, #f28a36); font-weight: 800; cursor: pointer; }
.social-message { min-height: 18px; margin: 0; padding: 8px 11px; border-radius: 10px; color: #a4e8b0; background: #102a24b8; font-size: 12px; }
.social-message.error { color: #ff9a86; }
.friends-result-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid #6bcfff40;
  border-radius: 15px;
  background:
    linear-gradient(145deg, #192e43e8, #101d2eea),
    #13253a;
  box-shadow: 0 8px 22px #0002, inset 0 1px #ffffff0b;
}
.friends-result-card h3 {
  display: flex;
  min-height: 26px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ffffff16;
}
#friends-online-count,
#friend-request-count {
  padding: 4px 8px;
  border: 1px solid #61d0ff3d;
  border-radius: 999px;
  color: #a8e8ff;
  background: #168bc522;
  font-size: 10px;
  white-space: nowrap;
}
.social-list { display: grid; gap: 7px; }
.social-card { min-width: 0; padding: 9px; border-radius: 12px; background: linear-gradient(110deg, #1c3c55db, #14283ddb); }
.social-card-copy { overflow: hidden; }
.social-card-copy strong, .social-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-card-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 5px; }
.social-card-actions button { min-height: 36px; padding: 7px 11px; border: 1px solid #70d3ff72; border-radius: 10px; color: #c7efff; background: #168bc522; font-size: 11px; font-weight: 800; cursor: pointer; }
.social-card-actions button.primary { border-color: #ffc274; color: #241707; background: linear-gradient(135deg, #ffd17e, #f28a36); }
.social-card-actions button:disabled { opacity: .58; cursor: default; }
.room-friend-invites { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid #efbd6840; border-radius: 12px; background: #07191866; }
.room-friend-invites.hidden { display: none; }
.room-invite-code { justify-content: space-between; flex-wrap: wrap; }
.room-invite-code strong { color: #f5d18a; font-size: 16px; letter-spacing: .12em; }
.room-friend-invites .social-card-actions button { min-height: 32px; }
.room-friend-invites .social-card .friend-skin { width: 38px; height: 44px; flex-basis: 38px; }
.room-friend-invites .social-card-actions button.invited { color: #9cdda5; }
@media (max-width: 600px) {
  body:not(.online-mode-active) { --home-header-height: 64px; }
  body:not(.online-mode-active) .topbar { padding: 0 6px; }
  body:not(.online-mode-active) .brand { gap: 7px; }
  body:not(.online-mode-active) .brand-mark { width: 36px; height: 36px; }
  body:not(.online-mode-active) .brand strong { font-size: 16px; }
  body:not(.online-mode-active) .brand small { font-size: 9px; }
  body.online-mode-active .topbar { inset-inline: auto; bottom: auto; gap: 5px; }
  .topbar .account-open, .account-logout { min-height: 38px; padding: 6px 9px; font-size: 10px; }
  .friends-panel { inset: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom)); width: auto; padding: 12px; border-radius: 17px; }
  .friends-heading { padding-bottom: 10px; }
  .friends-heading h2 { font-size: 23px; }
  .friends-heading button { width: 38px; height: 38px; }
  .friends-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding-top: 10px; }
  .friends-sidebar { gap: 8px; padding: 0 0 9px; border: 0; border-bottom: 1px solid #70cfff32; }
  .my-player-card { min-height: 58px; flex-wrap: nowrap; gap: 8px; padding: 6px 8px; }
  .my-player-card .friend-skin { width: 40px; height: 44px; flex-basis: 40px; }
  .my-player-card > button { width: auto; min-height: 32px; flex: 0 0 auto; padding: 5px 8px; }
  .friends-nav { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-inline: contain; padding: 1px 0 4px; scrollbar-width: thin; }
  .friends-nav-button { min-width: max-content; min-height: 42px; gap: 6px; padding: 6px 9px; border-radius: 10px; font-size: 11px; }
  .friends-nav-button > span { width: 23px; height: 23px; flex-basis: 23px; font-size: 14px; }
  .friends-content { padding: 0 1px 2px; }
  .friends-view { gap: 11px; }
  .friends-view-heading { gap: 4px; padding-top: 2px; }
  .friends-view-heading h3 { font-size: 22px; }
  .friends-view-heading > p:last-child { font-size: 12px; }
  .friends-result-card { gap: 8px; padding: 10px; }
  .friend-search { padding: 10px; }
  .social-card { gap: 7px; }
  .social-card-actions { max-width: 118px; justify-content: flex-end; }
}

body.online-mode-active {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 92% 3%, rgba(54,151,163,.22), transparent 36%),
    radial-gradient(ellipse at 8% 85%, rgba(125,94,173,.14), transparent 40%),
    #101820;
}
body.online-mode-active .app-shell { width: min(1050px, calc(100% - 40px)); padding-bottom: 32px; }
body.online-mode-active .welcome,
body.online-mode-active #game-lobby { display: none; }
body.online-mode-active .topbar { margin-bottom: 8px; }
body.online-mode-active .room-controls {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
  grid-template-areas:
    "heading heading"
    "lan lan"
    "toggle-label toggle-label"
    "toggles toggles"
    "game-label player-label"
    "games player"
    "join join"
    "message message"
    "friends friends"
    "back back";
  align-items: start;
  gap: 12px 24px;
  margin: 18px auto 0;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(92,185,197,.45);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 100% 0, rgba(77,169,184,.14), transparent 42%),
    linear-gradient(145deg, rgba(30,48,62,.98), rgba(17,29,39,.99));
  box-shadow: 0 22px 54px #0006, inset 0 1px #ffffff12;
}
body.online-mode-active .room-controls.hidden { display: none; }
body.online-mode-active .room-controls-heading {
  grid-area: heading;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 5px;
  padding: 0 0 17px;
  border-bottom: 1px solid rgba(92,185,197,.3);
}
body.online-mode-active .room-controls-heading .eyebrow { margin: 0 0 3px; color: #83d4d7; font-size: 13px; }
body.online-mode-active .room-controls-heading h2 { margin: 0; color: var(--cream); font-size: clamp(25px, 3vw, 34px); }
body.online-mode-active .room-controls-heading > p { max-width: 390px; margin: 0; color: #c0d0da; font-size: 13px; line-height: 1.7; }

html.android-app,
html.android-app body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}
html.android-app body { padding: 0 !important; }
html.android-app .app-shell { width: 100%; height: 100%; margin: 0; padding: 0; }
html.android-app .topbar { display: none !important; }
html.android-app .home-game { position: fixed; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; }
html.android-app .home-game iframe { display: block; width: 100%; height: 100%; border: 0; }
html.android-app .online-choice,
html.android-app #friends-panel,
html.android-app #room-controls,
html.android-app #online-stage { display: none !important; }
html.android-app .auth-panel:not(.hidden) {
  z-index: 100;
  grid-template-columns: minmax(0, min(440px, 100%));
  align-content: center;
  justify-items: center;
  gap: 8px;
  max-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse at 50% 25%, rgba(32, 75, 58, .92), rgba(4, 17, 15, .95)),
    #07110e;
}
html.android-app .auth-overlay .auth-intro { width: min(100%, 440px); padding: 0 42px 10px; text-align: center; }
html.android-app .auth-overlay .auth-intro h2 { padding: 0; margin: 0 0 6px; font-size: clamp(24px, 7vw, 32px); }
html.android-app .auth-overlay .auth-intro > p:last-child { margin: 0; font-size: 12px; }
html.android-app .auth-dismiss { top: 0; inset-inline-end: 0; width: 36px; height: 36px; }
html.android-app .auth-overlay .auth-card { width: min(100%, 440px); max-width: 440px; padding: 16px; }
.auth-offline-continue {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid rgba(211, 170, 94, .46);
  border-radius: 9px;
  color: var(--cream);
  background: rgba(211, 170, 94, .1);
  font-weight: 700;
  cursor: pointer;
}
html:not(.android-app) .auth-offline-continue { display: none; }
.online-sound-toggle { min-width: 38px; }
body.online-mode-active .room-game-label { grid-area: game-label; }
body.online-mode-active .room-player-label { grid-area: player-label; }
body.online-mode-active #online-game-settings-label { grid-area: toggle-label; }
body.online-mode-active .online-game-settings { grid-area: toggles; }
body.online-mode-active .room-friend-invites { grid-area: friends; }
body.online-mode-active .room-section-label {
  align-self: end;
  margin: 0 0 4px;
  color: #83d4d7;
  font-size: 13px;
  font-weight: 800;
}
body.online-mode-active .room-controls .online-game-picker {
  grid-area: games;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  margin: 0;
}
body.online-mode-active .room-controls .online-game-option {
  min-height: 70px;
  gap: 12px;
  padding: 8px 11px;
  border-color: rgba(242,231,202,.17);
  border-radius: 10px;
  background: rgba(5,16,11,.25);
}
body.online-mode-active .room-controls .online-game-option.active {
  border-color: var(--gold);
  background: rgba(211,170,94,.13);
  box-shadow: inset -3px 0 var(--gold);
}
body.online-mode-active .room-controls .online-game-option img {
  flex-basis: 44px;
  width: 44px;
  height: 52px;
  border-radius: 7px;
}
body.online-mode-active .room-controls .online-game-option:first-child img { height: 44px; }
body.online-mode-active .room-controls .online-game-option strong { color: var(--cream); font-size: 15px; }
body.online-mode-active .room-controls .online-game-option.active strong { color: var(--gold); }
body.online-mode-active .room-controls .online-game-option small { margin-top: 3px; font-size: 11px; }
body.online-mode-active .room-controls .room-options {
  grid-area: player;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  margin: 0;
  padding: 13px;
  border: 1px solid rgba(92,185,197,.3);
  border-radius: 12px 20px 12px 20px;
  background: rgba(7,18,28,.28);
}
body.online-mode-active .room-controls .room-options > label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: #ccdae2;
  font-size: 12px;
  font-weight: 700;
}
body.online-mode-active .room-controls .room-options input,
body.online-mode-active .room-controls .room-options select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(130,190,202,.3);
  border-radius: 10px;
  color: #edf6f7;
  background: #182b36;
  font: inherit;
}
body.online-mode-active .room-controls .room-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin: 8px 0 0;
}
body.online-mode-active .room-controls .room-actions > .secondary-button,
body.online-mode-active .room-join-controls .secondary-button {
  min-height: 43px;
  padding: 9px 15px;
  border: 1px solid rgba(92,185,197,.55);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}
body.online-mode-active .room-controls #create-room {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  border: 1px solid #8ce2dc;
  border-radius: 18px 7px 18px 7px;
  color: #08232b;
  background: linear-gradient(110deg, #a4f0e2, #5fc2c6 58%, #5199c0);
  box-shadow: 0 9px 22px #217d8c45, inset 0 1px #ffffffb3;
  font-size: 16px;
  transition: filter .16s, transform .16s, box-shadow .16s;
}
body.online-mode-active .room-controls #create-room:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px #217d8c66, inset 0 1px #ffffffb3;
}
body.online-mode-active .room-join {
  grid-area: join;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid rgba(92,185,197,.3);
  border-radius: 12px 20px 12px 20px;
  background: rgba(7,18,28,.24);
}
body.online-mode-active .room-join-label { margin: 0; color: #c7dce4; font-size: 12px; font-weight: 700; }
body.online-mode-active .room-join-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 8px;
}
body.online-mode-active .room-join-controls input {
  box-sizing: border-box;
  width: min(100%, 260px);
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(130,190,202,.3);
  border-radius: 10px;
  color: #edf6f7;
  background: #182b36;
  font: 600 15px "Tahoma", sans-serif;
  letter-spacing: .14em;
  text-align: center;
}
body.online-mode-active .room-join-controls .secondary-button { width: min(100%, 260px); }
body.online-mode-active .room-controls .room-message {
  grid-area: message;
  min-height: 20px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(92,185,197,.2);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(7,18,28,.24);
  font-size: 12px;
  line-height: 1.6;
}
body.online-mode-active .room-controls .room-controls-back {
  grid-area: back;
  justify-self: center;
  width: min(100%, 220px);
  min-height: 40px;
  margin-top: 22px;
  border: 1px solid rgba(130,190,202,.35);
  border-radius: 10px 18px 10px 18px;
  color: #c7dce4;
  background: rgba(14,32,43,.7);
}
@media (max-width: 760px) {
  body.online-mode-active .app-shell { width: min(100% - 24px, 560px); padding-bottom: 22px; }
  body.online-mode-active .topbar-note { display: none; }
  body.online-mode-active .room-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "lan"
      "toggle-label"
      "toggles"
      "game-label"
      "games"
      "player-label"
      "player"
      "join"
      "message"
      "friends"
      "back";
    gap: 12px;
    margin-top: 12px;
    padding: 16px;
    border-radius: 14px;
  }
  body.online-mode-active .room-controls-heading { align-items: flex-start; flex-direction: column; gap: 5px; padding-bottom: 11px; }
  body.online-mode-active .room-controls-heading h2 { font-size: 25px; }
  body.online-mode-active .room-controls-heading > p { max-width: none; font-size: 12px; }
  body.online-mode-active .room-controls .online-game-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  body.online-mode-active .room-controls .online-game-option {
    height: 148px;
    min-height: 148px;
    gap: 10px;
    padding: 9px 5px;
  }
  body.online-mode-active .room-controls .online-game-option img,
  body.online-mode-active .room-controls .online-game-option:first-child img {
    flex-basis: 48px;
    width: 40px;
    height: 48px;
  }
  body.online-mode-active .room-controls .online-game-option strong { font-size: 11px; }
  body.online-mode-active .room-controls .online-game-option small { min-height: 28px; font-size: 9px; line-height: 1.4; }
  body.online-mode-active .room-controls .room-options { gap: 9px; padding: 10px; }
  body.online-mode-active .room-controls .room-controls-back { justify-self: center; margin-top: 20px; }
  body.online-mode-active .room-join { gap: 7px; padding: 10px; }
  body.online-mode-active .room-join-controls { justify-items: stretch; }
  body.online-mode-active .room-join-controls input,
  body.online-mode-active .room-join-controls .secondary-button { width: 100%; }
}
@media (max-width: 420px) {
  body.online-mode-active .app-shell { width: calc(100% - 18px); }
  body.online-mode-active .room-controls { padding: 13px 11px; }
  body.online-mode-active .room-controls .room-actions > .secondary-button,
  body.online-mode-active .room-join-controls .secondary-button { padding-inline: 10px; font-size: 12px; }
  body.online-mode-active .room-controls #create-room { min-width: 0; }
  body.online-mode-active .room-controls .room-controls-back { margin-top: 14px; }
}

.room-join { margin-top: 10px; }
.room-join-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.room-join-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.room-join-controls input { width: 110px; padding: 9px; border: 1px solid rgba(242,231,202,.25); border-radius: 7px; color: var(--cream); background: #17251f; font: 600 15px "Tahoma", sans-serif; letter-spacing: .16em; }

body.online-mode-active .room-controls {
  border-color: #5cb9c799;
  border-radius: 10px 27px 10px 27px;
  background:
    radial-gradient(ellipse at 100% 0, #4da9b82e, transparent 42%),
    linear-gradient(145deg, #1e303efe, #111d27fe 69%);
  box-shadow: 0 28px 65px #0008, inset 0 0 0 1px #ffffff0a;
}
body.online-mode-active .room-controls-heading {
  position: relative;
  min-height: 86px;
  align-items: center;
  padding: 4px 8px 16px;
}
body.online-mode-active .room-controls-heading::after {
  position: absolute;
  inset: auto auto 14px 8px;
  width: 72px;
  height: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, #83d4d7, #609bc4);
  content: "";
}
body.online-mode-active .room-controls-heading .eyebrow {
  color: #83d4d7;
  font-size: 11px;
  margin-bottom: 7px;
  font-weight: 900;
  letter-spacing: .12em;
}
body.online-mode-active .room-controls-heading h2 {
  margin-top: 3px;
  font-size: clamp(32px, 4vw, 45px);
}
body.online-mode-active .room-controls .room-section-label {
  color: #83d4d7;
  font-size: 11px;
  margin-bottom: 7px;
  font-weight: 900;
  letter-spacing: .1em;
}
body.online-mode-active .room-controls .online-game-option {
  box-sizing: border-box;
  width: 100%;
  height: 164px;
  min-height: 164px;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  padding: 13px 8px;
  border: 1px solid var(--game-border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0, var(--game-glow), transparent 62%),
    linear-gradient(155deg, var(--game-surface), #0c1713 78%);
  text-align: center;
  transition: border-color .18s, box-shadow .18s, transform .18s, filter .18s;
}
body.online-mode-active .room-controls .online-game-option[data-online-game="dama"] {
  --game-accent: #74dfc2;
  --game-border: #74dfc24d;
  --game-glow: #74dfc22e;
  --game-surface: #17473d;
}
body.online-mode-active .room-controls .online-game-option[data-online-game="ronda"] {
  --game-accent: #f2c56b;
  --game-border: #f2c56b55;
  --game-glow: #f2c56b30;
  --game-surface: #49371e;
}
body.online-mode-active .room-controls .online-game-option[data-online-game="jben"] {
  --game-accent: #c2a6ff;
  --game-border: #c2a6ff55;
  --game-glow: #9c79ff2b;
  --game-surface: #34284d;
}
body.online-mode-active .room-controls .online-game-option:hover {
  filter: brightness(1.13);
  transform: translateY(-2px);
}
body.online-mode-active .room-controls .online-game-option.active {
  border-color: var(--game-accent);
  box-shadow: 0 10px 24px #0005, inset 0 0 0 2px var(--game-accent), inset 0 -4px 0 var(--game-accent);
}
body.online-mode-active .room-controls .online-game-option img,
body.online-mode-active .room-controls .online-game-option:first-child img {
  box-sizing: border-box;
  flex: 0 0 58px;
  width: 48px;
  height: 58px;
  border: 1px solid var(--game-border);
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 6px 13px #0007;
}
body.online-mode-active .room-controls .room-options {
  padding: 15px;
  border: 1px solid #5cb9c74d;
  border-radius: 12px 20px 12px 20px;
  background: #07121c47;
}
body.online-mode-active .room-controls .online-game-option span {
  width: 100%;
}
body.online-mode-active .room-controls .online-game-option strong {
  color: var(--game-accent);
  font-size: 13px;
  line-height: 1.4;
}
body.online-mode-active .room-controls .online-game-option small {
  min-height: 30px;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.5;
}
body.online-mode-active .room-controls #create-room {
  min-height: 64px;
  border: 1px solid #8ce2dc;
  border-radius: 18px 7px 18px 7px;
  color: #08232b;
  background:
    linear-gradient(110deg, #a4f0e2, #5fc2c6 58%, #5199c0);
  box-shadow: 0 9px 22px #217d8c45, inset 0 1px #ffffffb3;
  font-size: 16px;
  font-weight: 900;
}
body.online-mode-active .room-controls #create-room:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}
body.online-mode-active .room-join {
  padding: 14px;
  border-color: #5cb9c74d;
  border-radius: 12px 20px 12px 20px;
  background: linear-gradient(105deg, #4da9b812, #ffffff05);
}
body.online-mode-active .room-join-label { color: #c7dce4; font-weight: 800; }
body.online-mode-active .room-join-controls input { min-height: 48px; }
body.online-mode-active .room-controls .room-message {
  border-color: #5cb9c733;
  background: #4da9b80d;
  line-height: 1.8;
}
body.online-mode-active .room-controls .room-friend-invites {
  padding: 14px;
  border-color: #5cb9c755;
  background: linear-gradient(105deg, #4da9b812, #ffffff04);
}
@media (max-width: 600px) {
  body.online-mode-active .room-controls-heading { min-height: 0; }
  body.online-mode-active .room-controls-heading::after { inset-inline-start: 0; bottom: 10px; }
  body.online-mode-active .room-controls .room-options { padding: 11px; }
}
@media (max-width: 380px) {
  body.online-mode-active .room-controls #create-room { min-height: 56px; font-size: 15px; }
  body.online-mode-active .room-controls .online-game-picker { gap: 6px; }
  body.online-mode-active .room-controls .online-game-option { padding-inline: 3px; }
  body.online-mode-active .room-controls .online-game-option strong { font-size: 10px; }
  body.online-mode-active .room-controls .online-game-option small { font-size: 8px; }
}

body.online-mode-active .lan-room-browser {
  grid-area: lan;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  padding: 14px;
  border: 1px solid #d3aa5e50;
  border-radius: 15px;
  background: linear-gradient(120deg, #d3aa5e12, #ffffff04);
}
.lan-browser-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lan-browser-heading > div { display: grid; gap: 4px; }
.lan-browser-heading strong { color: #ffe2a2; font-size: 15px; }
.lan-browser-heading small,
.lan-host-status { color: #c1cbbd; font-size: 11px; line-height: 1.6; }
.lan-browser-heading button { min-height: 40px; border-radius: 9px; }
.lan-host-status { grid-column: 1 / -1; margin: 0; }
.lan-room-results { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.lan-room-results > p { grid-column: 1 / -1; margin: 0; color: #c1cbbd; font-size: 11px; line-height: 1.7; }
.lan-room-card { display: grid; gap: 9px; padding: 13px; border: 1px solid #8cc9a04d; border-radius: 10px; background: linear-gradient(145deg, #173328, #10241b); box-shadow: inset 0 1px #ffffff0a; }
.lan-room-card strong { color: #ffe2a2; font-size: 13px; }
.lan-room-card span { color: #c1cbbd; font-size: 11px; }
.lan-room-card button { min-height: 40px; border: 1px solid #f0d99b; border-radius: 7px; color: #14251b; background: linear-gradient(110deg, #f1d58f, #d9b866); font-weight: 800; cursor: pointer; transition: filter .18s, transform .18s; }
.lan-room-card button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.room-invite-code { display: flex; align-items: center; gap: 10px; }
.room-invite-code > div { display: flex; flex-wrap: wrap; gap: 7px; }
.profile-room-invite { grid-template-columns: 1fr auto auto; }
.profile-room-invite > p { grid-column: 1 / -1; }

@media (max-width: 600px) {
  body.online-mode-active .lan-room-browser { grid-template-columns: 1fr; padding: 11px; }
  .lan-browser-heading { align-items: stretch; flex-direction: column; }
  .profile-room-invite { grid-template-columns: 1fr 1fr; }
  .profile-room-invite > div,
  .profile-room-invite > p { grid-column: 1 / -1; }
}

body.online-mode-active #room-controls {
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid #d3aa5e70;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 92% 0, #d3aa5e18, transparent 34%),
    linear-gradient(145deg, #1d3329f5, #12241dF5 68%, #182820f5);
  box-shadow: 0 22px 55px #050b08a8, inset 0 1px #fff1;
}
body.online-mode-active #room-controls:not(.hidden) { display: grid; }
body.online-mode-active .room-controls-heading {
  gap: 12px 24px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid #d3aa5e30;
}
body.online-mode-active .room-controls-heading h2 {
  color: #ffe2a2;
  font-size: clamp(25px, 4vw, 34px);
}
body.online-mode-active .room-controls-heading > p {
  max-width: 520px;
  color: #d3d9cc;
  line-height: 1.8;
}
body.online-mode-active .room-section-label {
  margin: 20px 0 10px;
  color: #edc77d;
  font-size: 13px;
  font-weight: 800;
}
.online-game-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.online-game-switch {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 66px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d3aa5e38;
  border-radius: 13px;
  color: var(--cream);
  background: linear-gradient(135deg, #243e30, #172b22);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.online-game-switch:hover { transform: translateY(-1px); border-color: #e9c77f99; }
.online-game-switch > input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.online-game-switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border: 1px solid #9a8b6a;
  border-radius: 999px;
  background: #394039;
  transition: background .18s, border-color .18s;
}
.online-game-switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e7e0d1;
  content: "";
  transition: transform .18s, background .18s;
}
.online-game-switch > input:checked + .online-game-switch-track {
  border-color: #efd18d;
  background: #647d42;
}
.online-game-switch > input:checked + .online-game-switch-track::after {
  background: #ffe6ad;
  transform: translateX(18px);
}
.online-game-switch > input:focus-visible + .online-game-switch-track {
  outline: 2px solid #ffe2a2;
  outline-offset: 3px;
}
.online-game-switch > span:last-child { display: grid; min-width: 0; gap: 3px; }
.online-game-switch strong { overflow: hidden; color: #ffe2a2; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.online-game-switch small { color: #bdc9b8; font-size: 10px; line-height: 1.5; }
.online-game-switch:has(input:not(:checked)) { border-color: #83908055; background: #18251e; }
.online-game-switch:has(input:not(:checked)) strong { color: #c1c8be; }
.online-game-picker { gap: 12px; }
.online-game-option[hidden] { display: none !important; }
body.online-mode-active .room-controls .online-game-option {
  min-height: 86px;
  padding: 13px;
  border-color: #d3aa5e40;
  border-radius: 15px;
  background: linear-gradient(145deg, #294332, #192d23);
}
body.online-mode-active .room-controls .online-game-option:hover { border-color: #e2bd76; }
body.online-mode-active .room-controls .online-game-option.active {
  border-color: #f0ca7d;
  background: linear-gradient(135deg, #664d2b88, #273d2c);
  box-shadow: 0 0 0 2px #eac67925, 0 10px 22px #0003;
}
body.online-mode-active .room-controls .online-game-option:not(.active) strong { color: #f2dfb6; }
.room-empty-games {
  margin: 8px 0;
  padding: 12px 14px;
  border: 1px dashed #d3aa5e80;
  border-radius: 12px;
  color: #ffe2a2;
  background: #d3aa5e12;
  font-size: 12px;
}
body.online-mode-active .room-controls .room-join,
body.online-mode-active .room-controls .room-friend-invites {
  border: 1px solid #d3aa5e38;
  border-radius: 15px;
  background: linear-gradient(120deg, #d3aa5e0e, #ffffff04);
}
body.online-mode-active .room-controls .room-message {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d3aa5e24;
  border-radius: 11px;
  color: #e8dfcb;
  background: #07140e70;
}
.friends-panel {
  border-color: #d3aa5e85;
  background:
    radial-gradient(ellipse at 96% 0, #d3aa5e24, transparent 36%),
    radial-gradient(ellipse at 0 100%, #42745035, transparent 40%),
    linear-gradient(145deg, #14231cfb, #1d3328fb 55%, #101d17fb);
  box-shadow: 0 24px 80px #020711e8, inset 0 1px #ffffff18;
}
.friends-heading { border-color: #d3aa5e38; }
.friends-heading h2 { color: #fff1d2; }
.friends-heading .eyebrow,
.friends-view-heading .eyebrow { color: #e9c77f; }
.friends-heading button {
  border-color: #d3aa5e78;
  background: linear-gradient(145deg, #455438, #26382c);
}
.friends-workspace { gap: 18px; }
.friends-sidebar { border-color: #d3aa5e35; }
.friends-nav-button {
  border-color: #d3aa5e15;
  color: #d7ddcf;
  background: #10251caa;
}
.friends-nav-button > span {
  color: #f0cf8b;
  background: #d3aa5e20;
}
.friends-nav-button:hover,
.friends-nav-button.active {
  border-color: #d3aa5e82;
  color: #fff4dc;
  background: linear-gradient(110deg, #80633970, #234432a8);
}
.friends-nav-button.active { box-shadow: inset 3px 0 #f0cf8b, 0 6px 16px #0002; }
.friends-nav-button.active > span {
  color: #261b0c;
  background: linear-gradient(135deg, #ffe2a2, #c99a4e);
}
.my-player-card,
.social-card,
.room-invite-code,
.friend-search,
.friends-result-card {
  border-color: #d3aa5e32;
  background: linear-gradient(135deg, #21392bbd, #13251dbd);
}
.my-player-card { border-inline-start-color: #e9bd69; }
.my-player-card > button {
  border-color: #d3aa5e55;
  color: #ffe2a2;
  background: #d3aa5e14;
}
.my-player-card b,
.social-card-id,
.friend-search label,
.friends-panel h3,
.room-friend-invites h3 { color: #edc77d; }
.friend-search input { border-color: #d3aa5e48; background: #0b1912cc; }
.friend-search button { border-color: #e4be77; background: linear-gradient(135deg, #f3d28d, #c89346); }
.friends-result-card h3 { border-color: #ffffff19; }
#friends-online-count,
#friend-request-count { border-color: #d3aa5e46; color: #ffe2a2; background: #d3aa5e15; }
.social-card { background: linear-gradient(110deg, #284432db, #172b20e8); }
.profile-room-invite { border-color: #d3aa5e70; background: linear-gradient(125deg, #694b2445, #18291ed9 70%); }
.profile-room-invite > div strong { color: #ffe2a2; }
@media (max-width: 720px) {
  .online-game-settings { grid-template-columns: 1fr; }
  .online-game-switch { min-height: 58px; }
}
@media (max-width: 600px) {
  .friends-panel { width: calc(100vw - 16px); inset-block: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-bottom)); padding: 13px; }
  .friends-workspace { grid-template-columns: 1fr; gap: 10px; padding-top: 10px; }
  .friends-sidebar { gap: 9px; padding: 0 0 10px; border-inline-end: 0; border-bottom: 1px solid #d3aa5e35; }
  .friends-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .friends-nav-button { min-height: 42px; gap: 6px; padding: 7px; font-size: 11px; }
  .friends-content { min-height: 0; }
  body.online-mode-active #room-controls { border-radius: 16px; }
}

body.online-mode-active .room-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  grid-template-areas:
    "heading heading"
    "lan create"
    "join join"
    "message message"
    "friends friends"
    "back back";
  align-items: stretch;
  gap: 16px;
  max-height: calc(100svh - 78px);
  overflow: auto;
  border: 1px solid #d3aa5e70;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 92% 0, #d3aa5e18, transparent 34%),
    linear-gradient(145deg, #1d3329f5, #12241df5 68%, #182820f5);
  box-shadow: 0 22px 55px #050b08a8, inset 0 1px #fff1;
}
body.online-mode-active .room-controls-heading {
  grid-area: heading;
  min-height: 0;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #d3aa5e30;
}
body.online-mode-active .room-controls-heading .eyebrow {
  margin-bottom: 5px;
  color: #e9c77f;
  font-size: 12px;
  font-weight: 800;
}
body.online-mode-active .room-controls-heading h2 {
  color: #fff0cf;
  font-size: clamp(25px, 4vw, 34px);
}
body.online-mode-active .room-controls-heading > p {
  max-width: 390px;
  color: #d3d9cc;
  line-height: 1.7;
}
body.online-mode-active .lan-room-browser,
body.online-mode-active .lan-create-panel {
  min-width: 0;
  padding: clamp(13px, 2vw, 20px);
  border: 1px solid #d3aa5e40;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 100% 0, #d3aa5e10, transparent 55%),
    linear-gradient(145deg, #20382bf2, #14261df2);
  box-shadow: inset 0 1px #ffffff0b;
}
body.online-mode-active .lan-room-browser {
  grid-area: lan;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 13px;
}
body.online-mode-active .lan-browser-heading {
  align-items: flex-start;
  gap: 10px;
}
body.online-mode-active .lan-browser-heading > div { gap: 6px; }
.lan-auto-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #79c89b55;
  border-radius: 999px;
  color: #b6e8c8;
  background: #347b4a24;
  font-size: 10px;
  font-weight: 800;
}
.lan-auto-badge > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #80d89c;
  box-shadow: 0 0 9px #80d89caa;
  animation: lan-search-pulse 1.8s ease-in-out infinite;
}
@keyframes lan-search-pulse {
  50% { opacity: .42; transform: scale(.78); }
}
body.online-mode-active .lan-browser-heading strong {
  color: #fff0cf;
  font-size: 18px;
}
body.online-mode-active .lan-browser-heading small,
body.online-mode-active .lan-host-status { color: #bfccbd; font-size: 11px; }
body.online-mode-active .lan-browser-actions {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 8px;
}
.lan-room-count {
  color: #f0d48f;
  font-size: 11px;
  font-weight: 800;
}
body.online-mode-active .lan-browser-heading button {
  min-height: 36px;
  padding-inline: 11px;
  border-color: #d3aa5e55;
  border-radius: 10px;
  color: #f4e3bf;
  background: #d3aa5e15;
  font-size: 11px;
}
body.online-mode-active .lan-host-status {
  grid-column: auto;
  padding: 9px 10px;
  border: 1px solid #ffffff0c;
  border-radius: 10px;
  background: #07140e55;
}
body.online-mode-active .lan-room-results {
  grid-template-columns: minmax(0, 1fr);
  max-height: clamp(130px, 29vh, 280px);
  overflow: auto;
  padding-inline-end: 2px;
}
body.online-mode-active .lan-room-results > p {
  padding: 12px;
  border: 1px dashed #d3aa5e45;
  border-radius: 12px;
  color: #d7ddcf;
  background: #07140e38;
  font-size: 12px;
  text-align: center;
}
body.online-mode-active .lan-room-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 12px;
  border-color: #d3aa5e55;
  border-radius: 13px;
  background: linear-gradient(120deg, #284332, #192d23);
}
body.online-mode-active .lan-room-card strong { color: #ffe2a2; font-size: 13px; }
body.online-mode-active .lan-room-card span { grid-column: 1; font-size: 11px; }
body.online-mode-active .lan-room-card button {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 86px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid #f0d99b;
  border-radius: 10px;
  color: #14251b;
  background: linear-gradient(110deg, #f1d58f, #d9b866);
  font-size: 12px;
  font-weight: 900;
}
body.online-mode-active .lan-create-panel {
  grid-area: create;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 10px;
}
body.online-mode-active .lan-create-panel .room-game-label { grid-area: auto; }
.lan-create-heading {
  display: grid;
  gap: 5px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d3aa5e25;
}
.lan-step {
  color: #a7d7c5;
  font-size: 11px;
  font-weight: 800;
}
.lan-create-heading h3 {
  margin: 0;
  color: #fff0cf;
  font-size: 19px;
}
.lan-create-heading p {
  margin: 0;
  color: #bfccbd;
  font-size: 11px;
  line-height: 1.6;
}
body.online-mode-active .lan-create-panel .room-section-label {
  margin: 1px 0 0;
  color: #edc77d;
  font-size: 12px;
}
body.online-mode-active .lan-create-panel .online-game-picker {
  grid-area: auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}
body.online-mode-active .lan-create-panel .online-game-option {
  height: auto;
  min-height: 58px;
  gap: 10px;
  padding: 7px 10px;
  border-color: #d3aa5e40;
  border-radius: 12px;
  background: #0c1a1245;
}
body.online-mode-active .lan-create-panel .online-game-option img,
body.online-mode-active .lan-create-panel .online-game-option:first-child img {
  flex-basis: 36px;
  width: 36px;
  height: 44px;
  border-radius: 7px;
}
body.online-mode-active .lan-create-panel .online-game-option strong { color: #f2dfb6; font-size: 12px; }
body.online-mode-active .lan-create-panel .online-game-option small { min-height: 0; margin-top: 2px; font-size: 9px; }
body.online-mode-active .lan-create-panel .online-game-option.active {
  border-color: #f0ca7d;
  background: linear-gradient(110deg, #80633940, #23443280);
  box-shadow: inset 3px 0 #f0cf8b;
}
body.online-mode-active .lan-create-panel .room-options {
  grid-area: auto;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
body.online-mode-active .lan-create-panel .room-options > label { color: #d3d9cc; }
body.online-mode-active .lan-create-panel .room-options select { min-height: 40px; }
body.online-mode-active .lan-create-panel .room-actions { margin-top: 0; }
body.online-mode-active .lan-create-panel #create-room {
  min-height: 50px;
  border-radius: 12px;
  color: #17251a;
  background: linear-gradient(110deg, #ffe2a2, #d3aa5e);
  box-shadow: 0 8px 18px #0003, inset 0 1px #ffffffa6;
  font-size: 14px;
}
body.online-mode-active .online-settings-details {
  padding-top: 9px;
  border-top: 1px solid #ffffff12;
}
body.online-mode-active .online-settings-details > summary,
body.online-mode-active .room-join-manual > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #d9c18d;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
body.online-mode-active .online-settings-details > summary::-webkit-details-marker,
body.online-mode-active .room-join-manual > summary::-webkit-details-marker { display: none; }
body.online-mode-active .online-settings-details > summary::after,
body.online-mode-active .room-join-manual > summary::after {
  color: #edc77d;
  content: "＋";
  font-size: 16px;
}
body.online-mode-active .online-settings-details[open] > summary::after,
body.online-mode-active .room-join-manual[open] > summary::after { content: "−"; }
body.online-mode-active .online-settings-details .online-game-settings { grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 10px; }
body.online-mode-active .online-settings-details .online-game-switch { min-height: 48px; }
body.online-mode-active .room-join-manual {
  grid-area: join;
  padding: 12px 14px;
  border: 1px solid #d3aa5e38;
  border-radius: 14px;
  background: #07140e4d;
}
body.online-mode-active .room-join-manual .room-join {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 0;
  border: 0;
  background: transparent;
}
body.online-mode-active .room-join-manual .room-join-label { margin: 0; }
body.online-mode-active .room-join-manual .room-join-controls {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-items: stretch;
}
body.online-mode-active .room-join-manual .room-join-controls input,
body.online-mode-active .room-join-manual .room-join-controls .secondary-button { width: 100%; }
body.online-mode-active .room-controls .room-message { grid-area: message; }
body.online-mode-active .room-controls .room-friend-invites { grid-area: friends; }
body.online-mode-active .room-controls .room-controls-back {
  grid-area: back;
  justify-self: center;
  margin-top: 0;
}

@media (max-width: 760px) {
  body.online-mode-active .room-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "lan"
      "create"
      "join"
      "message"
      "friends"
      "back";
    gap: 11px;
    padding: 13px;
    border-radius: 18px;
  }
  body.online-mode-active .room-controls-heading {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
    padding-bottom: 11px;
  }
  body.online-mode-active .room-controls-heading > p { max-width: 50%; font-size: 11px; }
  body.online-mode-active .lan-room-browser,
  body.online-mode-active .lan-create-panel { padding: 12px; border-radius: 14px; }
  body.online-mode-active .lan-room-results { max-height: 22vh; }
  body.online-mode-active .lan-create-panel .online-game-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  body.online-mode-active .lan-create-panel .online-game-option {
    height: auto;
    min-height: 92px;
    align-content: center;
    gap: 4px;
    padding: 6px 4px;
  }
  body.online-mode-active .lan-create-panel .online-game-option img,
  body.online-mode-active .lan-create-panel .online-game-option:first-child img {
    flex-basis: 34px;
    width: 30px;
    height: 38px;
  }
  body.online-mode-active .lan-create-panel .online-game-option span { min-width: 0; }
  body.online-mode-active .lan-create-panel .online-game-option strong { font-size: 10px; }
  body.online-mode-active .lan-create-panel .online-game-option small { display: none; }
  body.online-mode-active .lan-create-panel .room-options {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: end;
    gap: 8px;
  }
  body.online-mode-active .lan-create-panel .room-actions { margin: 0; }
  body.online-mode-active .room-join-manual .room-join { grid-template-columns: minmax(0, 1fr); }
  body.online-mode-active .room-join-manual .room-join-controls { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 420px) {
  body.online-mode-active .room-controls { padding: 10px; }
  body.online-mode-active .room-controls-heading { flex-direction: column; }
  body.online-mode-active .room-controls-heading > p { max-width: none; margin: 0; }
  body.online-mode-active .lan-browser-heading { flex-direction: row; align-items: center; }
  body.online-mode-active .lan-browser-actions { gap: 5px; }
  body.online-mode-active .lan-room-card { grid-template-columns: minmax(0, 1fr) auto; padding: 9px; }
  body.online-mode-active .lan-room-card button { min-width: 72px; padding-inline: 7px; font-size: 11px; }
  body.online-mode-active .lan-create-panel .room-options { grid-template-columns: minmax(0, 1fr); }
  body.online-mode-active .lan-create-panel .room-actions { margin-top: 2px; }
  body.online-mode-active .room-join-manual .room-join-controls { grid-template-columns: minmax(0, 1fr); }
}
html.android-app body.online-mode-active #room-controls {
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 12px);
  margin-top: 0;
}

body.online-mode-active {
  --room-ink: #edf5ff;
  --room-muted: #9fb0c6;
  --room-cyan: #62e5d1;
  --room-blue: #79aaff;
  --room-panel: #111d31;
  --room-panel-deep: #0c1628;
  background:
    radial-gradient(ellipse at 92% 5%, #236c7852, transparent 38%),
    radial-gradient(ellipse at 4% 92%, #60477a35, transparent 42%),
    #080f1c;
}
body.online-mode-active .room-controls {
  grid-template-areas:
    "heading heading"
    "create lan"
    "join join"
    "message message"
    "friends friends"
    "back back";
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 16px;
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid #6be4db52;
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 0 0, #5398f31b, transparent 35%),
    linear-gradient(145deg, #121f33f5, #0d1728f5 72%, #111d30f5);
  box-shadow: 0 26px 70px #0008, inset 0 1px #ffffff12;
}
body.online-mode-active .room-controls-heading {
  min-height: 78px;
  padding: 0 0 14px;
  border-bottom-color: #9bb9e025;
}
body.online-mode-active .room-controls-heading .eyebrow {
  color: var(--room-cyan);
  font-size: 12px;
}
body.online-mode-active .room-controls-heading h2 {
  color: var(--room-ink);
  font-size: clamp(27px, 4vw, 36px);
}
body.online-mode-active .room-controls-heading > p {
  color: var(--room-muted);
}
body.online-mode-active .lan-room-browser,
body.online-mode-active .lan-create-panel {
  align-content: start;
  gap: 14px;
  padding: clamp(15px, 2.2vw, 22px);
  border: 1px solid #8da7cf2b;
  border-radius: 21px;
  background:
    radial-gradient(ellipse at 100% 0, #428ec91c, transparent 55%),
    linear-gradient(155deg, #17253a, #101a2b 82%);
  box-shadow: 0 15px 32px #0003, inset 0 1px #ffffff0b;
}
body.online-mode-active .lan-room-browser { grid-area: lan; }
body.online-mode-active .lan-create-panel { grid-area: create; }
body.online-mode-active .lan-create-heading {
  gap: 7px;
  padding: 0 0 14px;
  border-bottom-color: #8da7cf26;
}
body.online-mode-active .lan-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--room-cyan);
  font-size: 11px;
  letter-spacing: .04em;
}
body.online-mode-active .lan-step > span {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #62e5d155;
  border-radius: 9px;
  color: var(--room-cyan);
  background: #62e5d114;
  font-size: 10px;
}
body.online-mode-active .lan-create-heading h3 {
  color: var(--room-ink);
  font-size: 25px;
}
body.online-mode-active .lan-create-heading p {
  max-width: 460px;
  color: var(--room-muted);
  font-size: 12px;
}
body.online-mode-active .lan-create-panel .room-section-label {
  color: #c7d7f0;
  font-size: 12px;
}
body.online-mode-active .lan-create-panel .online-game-picker {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
body.online-mode-active .lan-create-panel .online-game-option {
  position: relative;
  min-height: 130px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  overflow: hidden;
  border: 1px solid #a8bbd229;
  border-radius: 17px;
  background: linear-gradient(155deg, #1d2b40, #121d30);
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
}
body.online-mode-active .lan-create-panel .online-game-option:hover {
  transform: translateY(-2px);
  border-color: #79aaff82;
}
body.online-mode-active .lan-create-panel .online-game-option img,
body.online-mode-active .lan-create-panel .online-game-option:first-child img {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 15px;
  object-fit: cover;
  box-shadow: 0 7px 17px #0005;
}
body.online-mode-active .lan-create-panel .online-game-option span {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}
body.online-mode-active .lan-create-panel .online-game-option strong {
  color: #e7eefb;
  font-size: 12px;
}
body.online-mode-active .lan-create-panel .online-game-option small {
  color: #a4b4c9;
  font-size: 9px;
  line-height: 1.45;
}
body.online-mode-active .lan-create-panel .online-game-option.active {
  border-color: var(--room-cyan);
  background:
    radial-gradient(ellipse at 50% 0, #62e5d125, transparent 68%),
    linear-gradient(155deg, #1d3844, #14283a);
  box-shadow: inset 0 0 0 1px #62e5d13d, 0 8px 22px #238e9533;
}
body.online-mode-active .lan-create-panel .online-game-option.active::after {
  position: absolute;
  inset: 9px 9px auto auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--room-cyan);
  box-shadow: 0 0 12px #62e5d1;
  content: "";
}
body.online-mode-active .lan-create-panel .online-game-option.active strong {
  color: #a8fff0;
}
body.online-mode-active .lan-create-panel .room-options {
  gap: 9px;
  padding: 13px;
  border: 1px solid #8da7cf27;
  border-radius: 15px;
  background: #09142670;
}
body.online-mode-active .lan-create-panel .room-options > label {
  color: #d3def0;
  font-size: 12px;
}
body.online-mode-active .lan-create-panel .room-options select {
  min-height: 46px;
  border-color: #94acd138;
  border-radius: 12px;
  color: var(--room-ink);
  background: #101c30;
}
body.online-mode-active .lan-create-panel #create-room {
  min-height: 58px;
  border: 1px solid #98fff0;
  border-radius: 15px;
  color: #08232c;
  background: linear-gradient(110deg, #8cf7dc, #52d9d3 55%, #78b9ff);
  box-shadow: 0 10px 24px #31b6b04a, inset 0 1px #ffffffc4;
  font-size: 15px;
  font-weight: 900;
}
body.online-mode-active .lan-create-panel #create-room:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px #31b6b066, inset 0 1px #ffffffc4;
}
body.online-mode-active .lan-room-browser {
  border-color: #79aaff35;
  background:
    radial-gradient(ellipse at 100% 0, #79aaff18, transparent 56%),
    linear-gradient(155deg, #17263d, #101a2c);
}
body.online-mode-active .lan-browser-heading strong {
  color: var(--room-ink);
  font-size: 19px;
}
body.online-mode-active .lan-browser-heading small,
body.online-mode-active .lan-host-status { color: var(--room-muted); }
body.online-mode-active .lan-room-count { color: var(--room-cyan); }
body.online-mode-active .lan-browser-heading button {
  border-color: #79aaff47;
  color: #d8e6ff;
  background: #79aaff12;
}
body.online-mode-active .lan-host-status {
  border-color: #8da7cf20;
  color: #b6c7dd;
  background: #09142680;
}
body.online-mode-active .lan-room-results > p {
  border-color: #79aaff4c;
  color: #c6d3e6;
  background: #09142680;
}
body.online-mode-active .lan-room-card {
  border-color: #79aaff3b;
  border-radius: 15px;
  background: linear-gradient(125deg, #203653, #16263d);
}
body.online-mode-active .lan-room-card strong { color: #a9fff0; }
body.online-mode-active .lan-room-card span { color: #b7c8df; }
body.online-mode-active .lan-room-card button {
  border-color: #98fff0;
  border-radius: 12px;
  color: #08232c;
  background: linear-gradient(110deg, #8cf7dc, #62cce3);
}
body.online-mode-active .room-join-manual {
  border-color: #8da7cf2d;
  border-radius: 16px;
  background: #111d31;
}
body.online-mode-active .room-join-manual > summary { color: #c4d4ec; }
body.online-mode-active .room-join-controls input {
  border-color: #94acd138;
  border-radius: 12px;
  color: var(--room-ink);
  background: #101c30;
}
body.online-mode-active .room-join-controls .secondary-button {
  border-color: #79aaff56;
  border-radius: 12px;
  color: #d9e7ff;
  background: #79aaff18;
}
body.online-mode-active .room-controls .room-message {
  border-color: #8da7cf24;
  color: var(--room-muted);
  background: #0a1424;
}
body.online-mode-active .room-controls .room-controls-back {
  border-color: #8da7cf38;
  color: #cedcf0;
  background: #111d31;
}

@media (max-width: 760px) {
  body.online-mode-active .room-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "create"
      "lan"
      "join"
      "message"
      "friends"
      "back";
    gap: 12px;
    padding: 12px;
    border-radius: 22px;
  }
  body.online-mode-active .room-controls-heading {
    min-height: 0;
    flex-direction: row;
    align-items: center;
    padding-bottom: 12px;
  }
  body.online-mode-active .room-controls-heading > p { max-width: 48%; font-size: 11px; }
  body.online-mode-active .lan-create-panel,
  body.online-mode-active .lan-room-browser { gap: 12px; padding: 14px; border-radius: 18px; }
  body.online-mode-active .lan-create-heading h3 { font-size: 22px; }
  body.online-mode-active .lan-create-panel .online-game-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  body.online-mode-active .lan-create-panel .online-game-option {
    min-height: 118px;
    gap: 7px;
    padding: 9px 4px;
    border-radius: 15px;
  }
  body.online-mode-active .lan-create-panel .online-game-option img,
  body.online-mode-active .lan-create-panel .online-game-option:first-child img {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
  }
  body.online-mode-active .lan-create-panel .online-game-option strong { font-size: 11px; }
  body.online-mode-active .lan-create-panel .online-game-option small { display: block; font-size: 8px; }
  body.online-mode-active .lan-create-panel .room-options { grid-template-columns: minmax(0, 1fr); padding: 11px; }
  body.online-mode-active .room-controls-heading h2 { font-size: 26px; }
}
@media (max-width: 420px) {
  body.online-mode-active .room-controls-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  body.online-mode-active .room-controls-heading > p { max-width: none; }
  body.online-mode-active .lan-create-panel,
  body.online-mode-active .lan-room-browser { padding: 12px; }
  body.online-mode-active .lan-create-panel .online-game-picker { gap: 5px; }
  body.online-mode-active .lan-create-panel .online-game-option { min-height: 108px; }
  body.online-mode-active .lan-create-panel .online-game-option img,
  body.online-mode-active .lan-create-panel .online-game-option:first-child img {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }
  body.online-mode-active .lan-create-panel .online-game-option strong { font-size: 10px; }
  body.online-mode-active .lan-create-panel .online-game-option small { font-size: 7px; }
}
