/* The modern app shell. Gameplay geometry and cosmetic choices remain in the engine. */
:root {
  --text: #eef3ee;
  --muted: #91a39b;
  --gold: #c4f279;
  --gold-deep: #a8d95f;
  --cream: #eef3ee;
  --blue: #c4f279;
  --red: #e4bca6;
  --ink: #13251f;
  --surface: #182320;
  --line: #2a3932;
  --radius: 16px;
  color-scheme: dark;
}
body { background: #101817; font-family: "DM Sans", sans-serif; }
button, input, select { font-family: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #c4f279; outline-offset: 4px; }
[hidden] { display: none !important; }
.patio-bg { background: radial-gradient(ellipse at 20% 40%, #1a2b24 0, transparent 60%), #101817; }
.patio-wall, .patio-glow, .string-lights, .barrio-extras, .table-grain { display: none; }
.home-topbar {
  position: absolute; inset: 0 0 auto; height: 88px; padding: 0 5%;
  display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end;
  gap: 8px; border-bottom: 1px solid var(--line);
  background: #101817f2; backdrop-filter: blur(10px);
  box-shadow: none; z-index: 10; overflow: hidden;
}
.home-topbar .user-profile {
  margin-right: 0;
  flex: 0 1 auto;
  width: auto;
  max-width: min(200px, 34vw);
  flex-wrap: nowrap;
  min-height: 40px;
}
.home-topbar .user-profile .user-id { min-width: 0; min-height: 0; padding: 2px 8px; }
.home-topbar .user-name,
.home-topbar .user-name-btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-topbar .icon-btn { flex-shrink: 0; }
.app-brand { display: flex; align-items: center; color: var(--text); font: 700 30px Outfit, sans-serif; text-decoration: none; letter-spacing: -1.5px; margin-right: auto; }
.brand-period { color: var(--gold); }
.brand-tile { display: inline-grid; place-items: center; width: 27px; height: 38px; border: 2px solid var(--gold); border-radius: 7px; color: var(--gold); transform: rotate(-14deg); font: 30px sans-serif; margin-right: 13px; }
.brand-caption { font: 600 9px "DM Sans", sans-serif; color: var(--muted); letter-spacing: 2px; border-left: 1px solid var(--line); margin-left: 23px; padding-left: 23px; }
.icon-btn { min-width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: #1b2722; color: #c9d7cd; box-shadow: none; font: 500 16px "DM Sans", sans-serif; }
.icon-btn:hover { background: #29392f; border-color: #617b5e; transform: none; }
.home-topbar .user-profile { margin-right: 10px; }
#screen-start { display: none; flex-direction: column; justify-content: center; align-items: center; padding: 124px 5% 88px; }
#screen-start.active { display: flex; }
.start-card { width: min(1160px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; column-gap: 8%; text-align: left; }
.start-brand { grid-column: 1; align-self: end; margin-bottom: 28px; }
.eyebrow { font: 600 10px "DM Sans", sans-serif; letter-spacing: 2.1px; color: var(--gold); text-transform: uppercase; }
.start-brand .eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.status-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; background: var(--gold); border-radius: 50%; }
.start-brand .title { font: 500 clamp(32px, 3.9vw, 56px)/1.1 Outfit, sans-serif; letter-spacing: -2.3px; color: var(--text); text-shadow: none; transform: none; }
.title-accent { color: var(--gold); }
.start-brand .subtitle { margin-top: 22px; max-width: 390px; color: var(--muted); font: 400 15px/1.8 "DM Sans", sans-serif; }
.start-table-preview { grid-column: 1; position: relative; width: 100%; height: 250px; margin: 0; padding: 0; border: 1px solid #32483b; border-radius: 24px; overflow: hidden; background: #1c3529; box-shadow: 0 20px 50px #0002; }
.start-table-preview::after { content: ""; position: absolute; inset: 13px; border: 1px solid #ffffff0b; border-radius: 15px; pointer-events: none; }
.start-table-preview .mini-felt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: radial-gradient(ellipse at 50% 40%, #2b4b36, #1c3429); box-shadow: none; transform: none; }
.preview-label { position: absolute; top: 25px; left: 28px; font-size: 9px; letter-spacing: 2px; color: #b9d0a5; z-index: 2; }
.preview-caption { position: absolute; bottom: 26px; width: 100%; text-align: center; font-size: 11px; color: #8daa94; z-index: 2; }
.preview-dominoes { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; transform: rotate(-13deg); }
.preview-dominoes .domino { position: relative !important; left: auto !important; top: auto !important; --long: 100px; --short: 50px; transform: none !important; }
.preview-dominoes .domino:nth-child(4) { transform: translateY(14px) !important; }
#menu-home { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; align-self: center; gap: 0; padding: 32px; background: #192420; border: 1px solid #2c3b33; border-radius: 24px; box-shadow: 0 20px 60px #0002; }
.setup-heading { margin-bottom: 26px; }
.setup-heading .eyebrow { margin-bottom: 10px; }
.setup-heading h2 { font: 500 28px Outfit, sans-serif; letter-spacing: -.7px; color: var(--text); margin-bottom: 8px; }
.setup-heading > p:last-child { font-size: 12px; line-height: 1.6; color: var(--muted); }
#game-modes-section { display: contents; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0 0 25px; padding: 0; background: none; }
.mode-card { min-height: 122px; padding: 18px 9px 14px; display: flex; align-items: flex-start; justify-content: center; gap: 8px; border: 1px solid #37473d; border-radius: 13px; background: #1a2922; color: var(--text); box-shadow: none; text-align: left; }
.mode-card::before, .mode-card::after { display: none; }
.mode-card { flex-direction: column; }
.mode-card.selected { background: #c4f27910; border: 1px solid #c4f279; box-shadow: inset 0 0 0 1px #c4f27910; }
.mode-card:hover { transform: translateY(-2px); background: #25372a; }
.mode-kicker { display: block; font-size: 9px; letter-spacing: 0; color: var(--muted); }
.mode-card strong { font: 500 26px Outfit, sans-serif; letter-spacing: -.5px; color: var(--text); }
.mode-card.selected strong { color: var(--gold); }
.mode-desc { display: block; font: 400 10px/1.5 "DM Sans", sans-serif; color: #9aafa0; }
.setup-label { color: #9bad9e; font-size: 9px; letter-spacing: 1.5px; margin-bottom: 12px; }
.vs-row { display: flex; gap: 8px; margin: 0 0 17px; }
.vs-switch { display: flex; flex: 1; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #111c17; box-shadow: none; }
.vs-opt { flex: 1; border-radius: 7px; letter-spacing: 0; text-transform: none; padding: 9px 7px; font-size: 11px; font-weight: 500; }
.vs-opt.active { background: #334333; color: #d8edc5; }
.vs-opt.active .vs-dot, .vs-opt[data-vs="ai"].active .vs-dot { background: var(--gold); }
.vs-dot { width: 5px; height: 5px; }
#screen-start .ai-gear { width: 42px; height: 42px; border-radius: 11px; }
.ai-sheet { background: #142019; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.btn { border-radius: 11px; box-shadow: none; text-shadow: none; font-family: "DM Sans", sans-serif; font-weight: 600; font-size: 13px; letter-spacing: .1px; }
.btn-primary, #screen-start .btn-primary, #screen-lobby .btn-primary { background: var(--gold); border: 1px solid var(--gold); border-radius: 11px; color: #18251a; box-shadow: none; }
.btn-primary:hover, #screen-start .btn-primary:hover { background: #d2ff8a; box-shadow: 0 4px 20px #c4f215; }
#btn-play { min-height: 52px; font-size: 13px; letter-spacing: 1.5px; text-align: center; position: relative; }
#btn-play::after { content: "↗"; position: absolute; right: 20px; font-size: 22px; top: 12px; }
.btn-ghost, .btn-goldline { border: 1px solid var(--line); color: var(--text); background: #243027; }
.practice-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 0; font-size: 10px; color: #97aa9d; }
#login-section { order: 4; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); text-align: center; }
.login-prompt { margin: 0; color: #83998c; font-size: 11px; }
#btn-google-login { min-height: 38px; padding: 9px 12px; margin-top: 12px; width: 100%; background: #233128; border-color: #3a4b3e; color: var(--text); font-size: 11px; }
.legal-links { margin-top: 10px; font-size: 10px; }
.legal-links a { color: #83998c; }
.guest-player .home-wallet, .guest-player .shop-hint, .guest-player .daily-panel { display: none; }
.home-wallet { margin-bottom: 15px; }
.shop-hint { font-size: 11px; color: var(--muted); }

/* Daily panel, in the shell's palette rather than the old gold-on-brown. */
.daily-panel { margin-bottom: 15px; padding: 11px 13px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); gap: 8px; }
.daily-kicker { font: 600 9px "DM Sans", sans-serif; letter-spacing: 1.8px; color: var(--muted); }
#comeback-line { font: 500 15px Outfit, sans-serif; letter-spacing: -.3px; color: var(--text); }
#btn-comeback { min-height: 30px; padding: 6px 13px; border-radius: 9px; border: 1px solid var(--line); background: #1e2b23; color: var(--gold); font: 600 10px "DM Sans", sans-serif; letter-spacing: 1px; }
#btn-comeback:disabled { color: var(--muted); border-color: var(--line); background: #172220; }
.daily-quests-collapse { border-top: 1px solid var(--line); }
.daily-quests-summary { font: 500 11px "DM Sans", sans-serif; color: var(--gold); }
.daily-quests-chevron { border-right-color: var(--muted); border-bottom-color: var(--muted); }
.quest-card { padding: 9px 11px; border-radius: 11px; background: #14201c; border: 1px solid var(--line); }
.quest-title { font: 400 12px "DM Sans", sans-serif; color: var(--text); }
.quest-meta { font-size: 10px; color: var(--muted); }
.quest-bar { background: #22302a; }
.quest-bar i { background: var(--gold); }
.home-footer { position: absolute; bottom: 28px; left: 5%; right: 5%; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #6c8275; font-size: 10px; letter-spacing: .4px; }
.home-footer > span:first-child { display: flex; align-items: center; gap: 8px; font-size: 9px; letter-spacing: 1.2px; }

/* The table fills the available space rather than being limited to a square. */
#screen-game.active { display: grid; grid-template-columns: minmax(0, 1fr) 248px; grid-template-rows: 64px minmax(0, 1fr); column-gap: 26px; row-gap: 16px; padding: 0 28px 20px; max-width: 1680px; margin: 0 auto; }
#screen-game .game-topbar { grid-column: 1 / -1; grid-row: 1; height: 64px; padding: 0; border-bottom: 1px solid var(--line); }
.topbar-center { display: flex; align-items: center; gap: 22px; }
.topbar-center strong { font: 600 28px Outfit, sans-serif; letter-spacing: -1px; }
.topbar-center strong .brand-period { display: inline; color: var(--gold); font: inherit; }
.topbar-center > span { font: 400 11px "DM Sans", sans-serif; color: var(--muted); border-left: 1px solid var(--line); padding-left: 22px; }
#btn-menu { background: transparent; border-color: transparent; font-size: 12px; padding: 0 8px 0 0; }
#screen-game #scoreboard { position: relative; top: auto; right: auto; grid-column: 2; grid-row: 2; align-self: stretch; width: 100%; height: auto; margin: 0; background: #17221d; color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 24px 20px; box-shadow: none; font-family: "DM Sans", sans-serif; display: flex; flex-direction: column; }
#scoreboard .score-head { display: block; color: #90a391; text-align: left; font-size: 9px; letter-spacing: 1.8px; margin-bottom: 22px; }
#scoreboard .score-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 10px; margin: 0; }
#scoreboard .score-col { display: flex; flex-direction: column; align-items: center; gap: 7px; border: 1px solid #2e4031; background: #1d2c22; padding: 14px 4px; border-radius: 12px; min-width: 0; }
#scoreboard .score-col.you { border-color: #bde77755; }
#scoreboard .score-avs { height: 32px; }
#scoreboard .avatar.mini { width: 30px; height: 30px; margin: 0; border: 1px solid #ffffff30; box-shadow: none; }
#scoreboard .score-name { color: #b4c4b4; font: 500 10px "DM Sans", sans-serif; letter-spacing: 0; text-transform: none; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#scoreboard .score-val { font: 500 38px/1 Outfit, sans-serif; }
#scoreboard .score-target { font: 500 9px "DM Sans", sans-serif; color: #8fa18d; letter-spacing: 1px; margin: 16px 0 0; padding: 0 0 22px; border-top: 0; border-bottom: 1px solid var(--line); }
.match-details { flex: 1; display: flex; flex-direction: column; padding-top: 24px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; color: #b3c4a5; font-size: 8px; letter-spacing: 1px; }
.match-details h2 { font: 500 24px/1.3 Outfit, sans-serif; letter-spacing: -.5px; margin: 14px 0 24px; }
.match-details dl { display: grid; gap: 17px; }
.match-details dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.match-details dt { color: #8ea08e; }
.match-details dd { color: #d7e4cd; }
.table-tip { display: flex; align-items: flex-start; gap: 12px; border-top: 1px solid var(--line); padding-top: 22px; margin-top: 28px; }
.tip-icon { color: var(--gold); font-size: 22px; }
.table-tip p { color: #91a48e; font-size: 11px; line-height: 1.8; }
.match-signature { margin-top: auto; padding-top: 22px; color: #698068; font: 500 11px Outfit, sans-serif; letter-spacing: 3px; text-align: center; }
.match-signature span { display: block; font-size: 7px; margin-top: 6px; letter-spacing: 2px; }
#play-area { grid-column: 1; grid-row: 2; width: 100%; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 70px minmax(0, 1fr) 170px; gap: 12px; min-height: 0; min-width: 0; }
#play-area .computer-row { grid-column: 1; grid-row: 1; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 22px; padding: 0; min-height: 0; min-width: 0; width: 100%; }
#play-area .computer-row .hand { display: flex; min-width: 0; max-width: 68%; min-height: 0; height: 58px; padding: 3px 4px 7px; gap: 6px; overflow: hidden; align-items: center; }
#play-area .computer-row .hand .domino { --long: 48px; --short: 25px; width: 25px; min-width: 0; max-width: 25px; height: 48px; min-height: 48px; max-height: 48px; flex: 0 1 25px; margin-left: 0; border-radius: 5px; }
#play-area .computer-row .domino:first-child { margin-left: 0; }
.hand-overflow { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 25px; height: 27px; padding: 0 4px; border: 1px solid #40583e; border-radius: 6px; background: #203426; color: #bfd4a5; font: 600 10px "DM Sans", sans-serif; }
#play-area .seat-hud { gap: 10px; margin: 0; }
#play-area .avatar-stack { width: 38px; height: 38px; }
#play-area .avatar { border: 1px solid #83927655; box-shadow: none; }
#play-area .hand-meta { gap: 5px; align-items: flex-start; flex-direction: column; margin: 0; }
#play-area .hand-label { color: #d4dfcc; font-size: 11px; font-weight: 500; letter-spacing: .2px; }
#play-area .hand-count { color: #8fa185; font-size: 10px; }
#play-area .table-frame { grid-column: 1; grid-row: 2; min-height: 0; height: 100%; width: 100%; padding: 0; }
#screen-game .wood-rail { width: 100%; height: 100%; max-width: none; max-height: none; min-height: 0; padding: 9px; background: #263c2e; border: 1px solid #44533a; border-radius: 30px; box-shadow: 0 10px 35px #0002, inset 0 0 0 3px #18291e; animation: none; }
#screen-game .felt { border-radius: 21px; }
body[data-table="patio"] #screen-game .felt { background: radial-gradient(ellipse at 50% 38%, #294c37, #1c382a); box-shadow: inset 0 0 0 1px #b9d89817, inset 0 0 65px #0d261d60; }
#screen-game .felt.your-turn { outline: 1px solid #c4f235; outline-offset: -1px; }
#screen-game .felt.their-turn { outline: none; }
#screen-game .felt-emblem { width: auto; height: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; border: 0; border-radius: 0; box-shadow: none; opacity: .12; }
#screen-game .felt-emblem::before, #screen-game .felt-emblem::after { display: none; }
#screen-game .emblem-mark { font: 600 44px Outfit, sans-serif; letter-spacing: -2px; color: #dcebc9; transform: none; text-shadow: none; }
.emblem-caption { color: #dcebc9; font-size: 7px; letter-spacing: 3px; margin-top: 4px; }
#screen-game .board-scroller { inset: 22px 20px 63px; }
#screen-game .table-hud { left: 20px; right: 20px; bottom: 16px; align-items: center; gap: 10px; }
#screen-game .turn-banner { border: 1px solid #90a97535; border-radius: 8px; background: #12271dcd; box-shadow: none; color: #d9e8cb; font: 400 11px "DM Sans", sans-serif; padding: 8px 12px; max-width: 78%; text-align: center; }
#turn-text { line-height: 1.4; }
.timer-readout { font-size: 11px; }
#screen-game .pozo { gap: 10px; color: #c5d2b7; font: 500 12px "DM Sans", sans-serif; }
#screen-game .pozo-stack { transform: scale(.72); transform-origin: left center; width: 22px; height: 38px; }
#play-area .player-row { grid-column: 1; grid-row: 3; position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 36px minmax(0, 1fr) 16px; gap: 4px 10px; padding: 0 12px; min-height: 0; border: 0; background: none; }
#hud-bottom { grid-column: 1; grid-row: 1; justify-self: start; }
#hud-bottom .avatar-stack { height: 28px; width: 28px; }
#hud-bottom .hand-meta { flex-direction: row; gap: 10px; align-items: center; }
#player-hand { grid-column: 1 / -1; grid-row: 2; width: 100%; min-height: 0; height: 100%; padding: 14px 8px 5px; justify-content: center; align-items: flex-end; gap: 0; }
#player-hand .domino { margin-left: calc(-1 * var(--hand-overlap)); border-radius: 9px; }
#player-hand .domino:first-child { margin-left: 0; }
#player-hand .domino.playable { box-shadow: 0 0 0 2px #c4f279, 0 4px 0 #708952, 0 8px 18px #0003; animation: none; }
#player-hand .domino.unplayable { filter: brightness(.7) saturate(.5); cursor: default; }
#player-hand .domino.selected { transform: translateY(-10px); box-shadow: 0 0 0 3px #d2ff87, 0 8px 20px #0004; }
.hand-hint { grid-column: 1 / -1; grid-row: 3; text-align: center; color: #74866f; font-size: 9px; letter-spacing: .2px; }
#play-area .play-actions { grid-column: 2; grid-row: 1; margin: 0; min-height: 0; align-self: center; }
#play-area .play-actions .btn { min-height: 32px; padding: 7px 16px; background: var(--gold); color: #1e301b; border: 0; font-size: 11px; }
/* Reactions above the hand; chat lives in the top bar only. */
.react-wrap { position: absolute; right: 0; top: 0; z-index: 14; }
.chat-tool { position: relative; display: inline-flex; align-items: center; }
.topbar-actions .chat-open, .react-open, .react-btn {
  width: 34px; height: 34px; border: 1px solid var(--line); background: transparent;
  border-radius: 10px; padding: 2px; cursor: pointer; touch-action: manipulation;
  position: relative; font-size: 17px; line-height: 1; color: var(--text);
}
.chat-open { display: grid; place-items: center; padding: 3px; transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.chat-tool.is-chat-open .chat-open {
  background: #c4f27914;
  border-color: #c4f27988;
  box-shadow: 0 0 0 1px #c4f27933;
}
.chat-open img, .react-open img, .react-btn img { width: 100%; height: 100%; object-fit: contain; animation: none; background: transparent; }
#react-bar { display: none; grid-template-columns: repeat(4, auto); gap: 8px; margin: 0; }
.react-wrap.is-open .react-open { display: none; }
.react-wrap.is-open #react-bar {
  display: grid;
  position: absolute; right: 0; bottom: calc(100% + 8px);
  padding: 10px; border-radius: 16px;
  background: #182920f0; border: 1px solid var(--line);
  box-shadow: 0 14px 40px #0006;
  grid-template-columns: repeat(4, 1fr);
}
.react-wrap.is-open .react-btn { width: 54px; height: 54px; border-radius: 14px; padding: 4px; }
.chat-compose {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  width: min(248px, calc(100vw - 96px));
  padding: 6px 8px;
  border-radius: 14px;
  background: #15241cf2;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px #0006;
  z-index: 40;
  transform: translateY(-50%) translateX(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.chat-tool.is-chat-open .chat-compose {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.topbar-actions .chat-open {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
}
.chat-compose[hidden] { display: none !important; opacity: 0; visibility: hidden; pointer-events: none; }
.chat-form-pill {
  margin: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: #0f1a16f5;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 #ffffff08;
}
.chat-form-pill input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
.chat-form-pill input::placeholder { color: #8a9a84; }
.btn-chat-send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  display: grid;
  place-items: center;
  font: 700 17px/1 Outfit, sans-serif;
  color: #1e301b;
  background: linear-gradient(180deg, #d2ff87, #b8e86a);
  box-shadow: 0 2px 0 #6a8f4a, 0 4px 12px #0003;
  transition: transform 0.12s ease, opacity 0.12s ease, filter 0.12s ease;
}
.btn-chat-send:active:not(:disabled) { transform: scale(0.94); }
.btn-chat-send:disabled {
  opacity: 0.38;
  cursor: default;
  filter: grayscale(0.35);
  box-shadow: none;
}
.chat-compose .chat-form-pill { box-shadow: 0 12px 32px #0006, inset 0 1px 0 #ffffff08; }
.lobby-chat .chat-form-pill { margin-top: 8px; background: #112018; border-color: #42533b; }
.lobby-chat .chat-form-pill input { font-size: 16px; }
@media (min-width: 761px) {
  .chat-form-pill input { font-size: 14px; }
  .lobby-chat .chat-form-pill input { font-size: 14px; }
}
#play-area .play-actions:has(button:not([hidden])) ~ .react-wrap { display: none; }
body:has(#game-mode-label) #screen-game:has(.match-details) .game-chat { background: #192a20; border-color: var(--line); }
.chat-log b { color: var(--gold); }
.chat-form input { border-color: var(--line); background: #14201c; }
.chat-pop { background: #182320; border-color: var(--line); }

/* Default tiles are ivory with flat, high contrast pips. Purchased skins still apply. */
.domino.skin-marfil, .domino.skin-marfil.board-tile { background: #f0f0e6; border: 1px solid #ffffffa0; box-shadow: 0 3px 0 #b6bcaa, 0 6px 12px #0003; }
.domino.skin-marfil::before { display: none; }
.domino.skin-marfil .pip { background: #253a2d; box-shadow: none; width: 61%; height: 61%; }
.domino.skin-marfil .divider { background: #b7bdae; box-shadow: none; flex-basis: 1px; }
.domino.skin-marfil.vertical .divider { height: 1px; }
.domino.back, .domino.skin-marfil.back, .domino.skin-ebano.back { background: #23382b; border: 1px solid #76836a; box-shadow: 0 2px 0 #142419; }
.domino.back::after { content: ""; position: absolute; inset: 4px; border: 1px solid #9daa7f38; border-radius: 3px; background: repeating-linear-gradient(45deg, transparent 0 4px, #cad69f0c 4px 5px); }
.end-spot, .drop-pad { border-color: #c4f279; color: #e1f5cc; background: #c4f2791a; }
.pozo-picker { background: #162d22ef; border: 1px solid #79935a; border-radius: 16px; backdrop-filter: blur(12px); }
.pozo-picker-hint { color: #d0debf; font-family: "DM Sans", sans-serif; }
.toast { background: #21362b; border: 1px solid #607350; color: #e0eed3; border-radius: 12px; font: 400 12px/1.5 "DM Sans", sans-serif; box-shadow: 0 12px 35px #0004; }

/* Four-player tables keep dedicated gutters for the other seats. */
#play-area.table-around .table-frame { padding: 0 72px; }
#play-area.table-around #seat-left-wrap { left: 0; top: 50%; transform: translateY(-50%); width: 62px; flex-direction: column; gap: 8px; }
#play-area.table-around #seat-right-wrap { left: auto; right: 0; top: 50%; transform: translateY(-50%); width: 62px; flex-direction: column-reverse; gap: 8px; }
#play-area.table-around .side-hand-slot { display: none; }
#play-area.table-around .seat-hud.compact { width: 62px; }
#play-area.table-around .hand-meta { align-items: center; }
.score-chip { border: 1px solid var(--line); border-radius: 9px; padding: 9px; background: #203026; color: var(--text); }
.score-chip.me { border-color: #c4f27977; }

/* Dialogs use the same quieter palette. */
.modal-overlay, .mm-overlay { background: #08110ee0; backdrop-filter: blur(12px); }
.modal, .modal.modal-patio, .lobby-card, .mm-card { color: var(--text); background: #1a2921; border: 1px solid #42533b; border-radius: 20px; box-shadow: 0 24px 90px #0006; font-family: "DM Sans", sans-serif; }
.modal-head { background: transparent; border-color: var(--line); }
.modal.modal-patio h2, .modal h2, .lobby-title, .mm-title { font-family: Outfit, sans-serif; color: var(--text); text-shadow: none; letter-spacing: -.5px; }
.field > span, .modal-body, .rules-body { color: #bdcbb5; }
.modal.modal-patio .field input, .modal.modal-patio .field select, .field input, .field select, .chat-form input { background: #112018; border: 1px solid #42533b; border-radius: 8px; color: var(--text); }
.modal .eyebrow { color: var(--gold); }
.modal-actions { border-color: var(--line); }
.round-score-row, .room-code-box, .room-size-box { background: #14231a; border-color: #405135; }
.round-score-row { color: var(--text); }
.flag-dot { background: linear-gradient(90deg, transparent 40%, #fff 40% 60%, transparent 60%), linear-gradient(0deg, transparent 38%, #fff 38% 62%, transparent 62%), conic-gradient(#cf3b3a 25%, #225394 0 50%, #cf3b3a 0 75%, #225394 0); }
.domino.skin-hueso, .domino.skin-hueso.board-tile { background: #dce5df; border: 1px solid #eef5ef; border-radius: 6px; box-shadow: 0 3px 0 #a2b4aa, 0 6px 12px #0003; }
.domino.skin-hueso .pip { background: #253a2d; box-shadow: none; }
.domino.skin-hueso .divider { background: #a8b6aa; flex-basis: 1px; box-shadow: none; }
.domino.skin-hueso.vertical .divider { height: 1px; }
.domino.skin-hueso.back { background: #283e30; border: 1px solid #7a8d74; box-shadow: 0 2px 0 #142419; }
/* Hidden opponent tiles have one consistent back, independent of face skins. */
#play-area .domino.opponent-back {
  background: repeating-linear-gradient(135deg, transparent 0 5px, #d5e8bf08 5px 6px), linear-gradient(145deg, #405d44, #243c2c);
  border: 1px solid #6f8865;
  box-shadow: inset 0 1px 0 #d7e5ba24, 0 2px 0 #0c1c12, 0 4px 7px #0004;
  animation: none;
}
#play-area .domino.opponent-back::before { display: block; inset: 3px; border: 1px solid #b8d29a35; border-radius: 2px; box-shadow: none; }
#play-area .domino.opponent-back::after { inset: auto; left: 50%; top: 50%; width: 6px; height: 6px; transform: translate(-50%, -50%) rotate(45deg); border: 1px solid #b2cd9399; border-radius: 1px; background: none; }
.result-flavor { font-family: "DM Sans", sans-serif; font-style: normal; }
.win-burst span { font-family: Outfit, sans-serif; text-shadow: 0 4px 25px #0006; }
#btn-sound { display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 1050px) {
  .start-card { column-gap: 5%; }
  #menu-home { padding: 25px; }
  #screen-game.active { grid-template-columns: minmax(0, 1fr) 205px; column-gap: 16px; padding: 0 18px 14px; }
  #screen-game #scoreboard { padding: 20px 14px; }
  .match-details h2 { font-size: 22px; }
  #play-area { grid-template-rows: 62px minmax(0, 1fr) 161px; gap: 8px; }
}
@media (max-width: 760px) {
  .home-topbar { height: 70px; padding: 0 22px; }
  .app-brand { font-size: 27px; }
  .brand-caption { display: none; }
  .brand-tile { height: 30px; width: 23px; font-size: 23px; }
  #screen-start { padding: 105px 22px 35px; justify-content: flex-start; }
  .start-card { width: min(490px, 100%); grid-template-columns: 1fr; gap: 0; }
  .start-brand { text-align: center; margin-bottom: 27px; }
  .start-brand .eyebrow { justify-content: center; font-size: 9px; margin-bottom: 18px; }
  .start-brand .title { font-size: clamp(31px, 8.2vw, 46px); letter-spacing: -1.5px; }
  .start-brand .subtitle { font-size: 12px; line-height: 1.7; margin: 15px auto 0; max-width: 340px; }
  .start-table-preview {
    display: block;
    grid-column: 1;
    height: 128px;
    margin: 0 0 18px;
    border-radius: 18px;
  }
  .start-table-preview .preview-dominoes .domino { --long: 64px; --short: 32px; }
  .preview-label, .preview-caption { font-size: 8px; }
  #menu-home { grid-column: 1; grid-row: auto; padding: 24px; border-radius: 20px; }
  .setup-heading { margin-bottom: 22px; }
  .setup-heading h2 { font-size: 24px; }
  .mode-grid { gap: 7px; margin-bottom: 20px; }
  .mode-card { min-height: 110px; padding: 14px 9px; }
  .mode-card strong { font-size: 25px; }
  .home-footer { position: relative; inset: auto; flex-direction: column; margin-top: 28px; font-size: 9px; }
  .home-footer > span:first-child { font-size: 8px; }
  .home-topbar .user-profile { max-width: min(132px, 32vw); padding: 2px 5px 2px 2px; }
  .home-topbar .user-profile .user-table,
  .home-topbar .user-profile .user-rating,
  .home-topbar .user-profile .user-level { display: none; }
  .home-topbar .user-profile .user-wallet {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    font-size: 9px;
    line-height: 1.1;
    color: var(--muted);
  }
  .home-topbar .user-profile .user-coins { display: inline; white-space: nowrap; }
  .home-topbar .user-actions { display: none; }
  #screen-game.active { grid-template-columns: minmax(0, 1fr); grid-template-rows: 55px 62px minmax(0, 1fr); padding: env(safe-area-inset-top) 12px max(10px, env(safe-area-inset-bottom)); gap: 8px; }
  #screen-game .game-topbar { height: 55px; grid-column: 1; }
  .game-topbar .icon-btn { height: 34px; min-width: 34px; border-radius: 9px; font-size: 14px; }
  .topbar-actions { gap: 5px; }
  .topbar-center { display: flex; flex-direction: column; gap: 2px; }
  .topbar-center strong { font-size: 23px; }
  .topbar-center > span { font-size: 8px; border: 0; padding: 0; }
  #btn-menu { font-size: 11px; }
  #screen-game #scoreboard { grid-column: 1; grid-row: 2; display: flex; flex-direction: row; align-items: center; padding: 9px 12px; border-radius: 13px; gap: 12px; }
  #scoreboard .score-head, .match-details { display: none; }
  #scoreboard .score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; }
  #scoreboard .score-col { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; gap: 7px; padding: 0; background: none; border: 0; align-items: center; }
  #scoreboard .score-avs { height: 25px; }
  #scoreboard .avatar.mini { width: 25px; height: 25px; }
  #scoreboard .score-name { text-align: left; font-size: 10px; max-width: 110px; }
  #scoreboard .score-val { font-size: 27px; }
  #scoreboard .score-target { font-size: 8px; max-width: 59px; text-align: center; border: 0; border-left: 1px solid var(--line); padding: 4px 0 4px 10px; margin: 0; line-height: 1.5; }
  #play-area { grid-column: 1; grid-row: 3; grid-template-rows: 51px minmax(0, 1fr) 147px; gap: 8px; }
  #play-area .computer-row { gap: 20px; }
  #play-area .computer-row .hand { height: 45px; gap: 4px; padding: 3px 3px 5px; }
  #play-area .computer-row .hand .domino { width: 21px; min-width: 0; max-width: 21px; height: 37px; min-height: 37px; max-height: 37px; flex-basis: 21px; }
  #play-area .avatar-stack { width: 32px; height: 32px; }
  #play-area .hand-label { font-size: 10px; }
  #play-area .hand-count { font-size: 9px; }
  #screen-game .wood-rail { border-radius: 23px; padding: 6px; }
  #screen-game .felt { border-radius: 17px; }
  #screen-game .board-scroller { inset: 14px 12px 53px; }
  #screen-game .table-hud { left: 12px; right: 12px; bottom: 11px; }
  #screen-game .turn-banner { font-size: 10px; padding: 7px 9px; }
  #play-area .player-row { grid-template-rows: 27px minmax(0, 1fr) 14px; padding: 0 4px; }
  #player-hand { padding: 10px 4px 4px; }
  #player-hand .domino { border-radius: 6px; }
  .hand-hint { font-size: 8px; }
  #hud-bottom .avatar-stack { width: 24px; height: 24px; }
  #hud-bottom .hand-meta { gap: 7px; }
  .react-open { width: 32px; height: 32px; }
  .react-wrap.is-open .react-btn { width: 50px; height: 50px; }
  .chat-compose {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    top: calc(env(safe-area-inset-top) + 55px + 6px);
    width: auto;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 50;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .chat-tool.is-chat-open .chat-compose { transform: none; }
  .chat-compose .chat-form-pill { width: 100%; }
  .react-wrap.is-open .react-btn { width: 50px; height: 50px; }
  #play-area.table-around .table-frame { padding: 0 41px; }
  #play-area.table-around #seat-left-wrap, #play-area.table-around #seat-right-wrap, #play-area.table-around .seat-hud.compact { width: 37px; }
  #play-area.table-around .seat-hud.compact .avatar-stack { height: 27px; width: 27px; }
  #play-area.table-around .hand-meta { font-size: 8px; max-width: 37px; }
  #scoreboard .score-multi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 5px; }
  #scoreboard .score-chip { display: grid; grid-template-columns: 1fr auto; padding: 4px; gap: 3px; font-size: 9px; }
  #scoreboard .score-chip .avatar { display: none; }
  #scoreboard .score-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #scoreboard .score-chip b { font-size: 20px; }
}
@media (max-width: 520px) {
  .home-topbar { gap: 5px; padding: 0 14px; }
  .home-topbar .user-profile {
    width: auto;
    flex: 0 1 auto;
    max-width: min(118px, 30vw);
  }
  .home-topbar .app-brand { font-size: 24px; min-width: 0; }
  .home-topbar .brand-tile { margin-right: 8px; }
}
@media (max-height: 730px) and (min-width: 761px) {
  #screen-start { justify-content: flex-start; padding-top: 105px; }
  .home-topbar { height: 72px; }
  .start-brand .title { font-size: 42px; }
  .start-table-preview { height: 215px; }
  #menu-home { padding: 24px; }
  .setup-heading { margin-bottom: 18px; }
  .mode-card { min-height: 100px; }
  .mode-grid { margin-bottom: 18px; }
  #login-section { margin-top: 15px; padding-top: 12px; }
  .match-details { padding-top: 15px; }
  .match-details h2 { font-size: 21px; margin: 10px 0 16px; }
  .table-tip { margin-top: 18px; padding-top: 15px; }
  .match-signature { display: none; }
  #play-area { grid-template-rows: 52px minmax(0, 1fr) 140px; }
}
@media (max-height: 680px) and (max-width: 760px) {
  #screen-game.active { grid-template-rows: 45px 48px minmax(0, 1fr); gap: 5px; }
  #screen-game .game-topbar { height: 45px; }
  #play-area { grid-template-rows: 40px minmax(0, 1fr) 119px; gap: 5px; }
  .hand-hint { display: none; }
  #play-area .player-row { grid-template-rows: 25px minmax(0, 1fr); }
}
@media (orientation: landscape) and (max-height: 500px) {
  #screen-game.active { grid-template-columns: minmax(0, 1fr) 160px; grid-template-rows: 43px minmax(0, 1fr); gap: 6px 12px; padding: 0 12px 6px; }
  #screen-game .game-topbar { grid-column: 1 / -1; height: 43px; }
  #screen-game #scoreboard { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: flex-start; padding: 14px 10px; }
  #scoreboard .score-row { display: grid; flex: 0; grid-template-columns: 1fr 1fr; }
  #scoreboard .score-col { display: flex; }
  #scoreboard .score-target { max-width: none; border: 0; padding: 6px 0; }
  .match-details { display: none; }
  #play-area { grid-row: 2; grid-column: 1; grid-template-rows: 32px minmax(0, 1fr) 89px; gap: 4px; }
  #play-area .computer-row .hand { height: 32px; padding: 1px 3px 3px; gap: 4px; }
  #play-area .computer-row .hand .domino { min-height: 28px; max-height: 28px; height: 28px; }
  #screen-game .board-scroller { inset: 8px 12px 36px; }
  #play-area .player-row { grid-template-rows: 20px minmax(0, 1fr); }
  #hud-bottom .avatar-stack { width: 19px; height: 19px; }
  #player-hand { padding-top: 5px; }
  #player-hand .domino { width: 29px; height: 58px; min-width: 29px; max-width: 29px; min-height: 58px; max-height: 58px; flex-basis: 29px; }
  .hand-hint { display: none; }
}
