:root {
  color-scheme: dark;
  --ink: #f8f1df;
  --muted: #a8b7b1;
  --night: #031313;
  --deep: #062020;
  --felt: #0b4a43;
  --felt-light: #176b5f;
  --wood: #5c2f20;
  --wood-light: #a0643d;
  --cream: #f1e4c5;
  --cobalt: #175ca7;
  --ember: #ed5b32;
  --gold: #f5be4c;
  --red: #d74736;
  --blue: #3e8bc8;
  --shadow: 0 18px 45px rgba(0, 0, 0, .42);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; margin: 0; background: var(--night); }

body {
  color: var(--ink);
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(245, 190, 76, .7); outline-offset: 3px; }

.ambient {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(233, 120, 53, .16), transparent 36%),
    radial-gradient(circle at 10% 80%, rgba(31, 116, 103, .18), transparent 40%);
}

.spark { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: drift 7s ease-in-out infinite; opacity: .45; }
.spark-a { left: 12%; top: 34%; }
.spark-b { right: 16%; top: 19%; animation-delay: -2s; }
.spark-c { left: 70%; bottom: 13%; animation-delay: -4s; }
@keyframes drift { 50% { transform: translate3d(22px, -34px, 0) scale(1.5); opacity: .9; } }

.backend-status {
  position: fixed; z-index: 100; top: calc(var(--safe-top) + 62px); right: 12px;
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); min-height: 32px;
  padding: 7px 11px; border: 1px solid rgba(255,112,91,.48); border-radius: 999px;
  color: #ffe7df; background: rgba(72,18,16,.94); box-shadow: 0 8px 24px rgba(0,0,0,.38);
  font-size: 10px; font-weight: 900; line-height: 1.2; pointer-events: none;
  transition: opacity .2s ease, background .2s ease, border-color .2s ease;
}
.backend-status i { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: #f05243; box-shadow: 0 0 0 3px rgba(240,82,67,.15), 0 0 10px rgba(240,82,67,.65); }
.backend-status.is-online { top: calc(var(--safe-top) + 7px); right: 8px; min-height: 0; padding: 3px; border-color: transparent; background: transparent; box-shadow: none; }
.backend-status.is-online i { background: #43d17d; box-shadow: 0 0 0 3px rgba(67,209,125,.14), 0 0 10px rgba(67,209,125,.75); animation: backend-pulse 2.2s ease-in-out infinite; }
.backend-status.is-online span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes backend-pulse { 50% { opacity: .68; transform: scale(.88); } }
.connection-overlay {
  position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; text-align: center; background: #030f0e;
}
.connection-overlay[hidden] { display: none; }
.connection-overlay .connection-overlay-brand {
  font-size: clamp(64px, 22vw, 132px); font-weight: 900; letter-spacing: .12em;
  line-height: 1; color: #ffe7df; text-transform: uppercase;
  text-shadow: 0 0 28px rgba(240,82,67,.55);
}
.connection-overlay p {
  margin: 0; color: #ff8a76; font-size: 17px; font-weight: 900; letter-spacing: .01em;
}
.connection-overlay button { width: min(100%, 280px); margin-top: 0; }
.connection-overlay button[hidden] { display: none; }
#app { min-height: 100dvh; position: relative; isolation: isolate; }
.screen { display: none; min-height: 100dvh; }
.screen.is-active { display: flex; }

.home-screen {
  align-items: center; flex-direction: column; padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 18px);
  background:
    linear-gradient(rgba(3, 19, 19, .45), rgba(3, 19, 19, .95)),
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(241, 228, 197, .022) 22px 24px),
    radial-gradient(circle at 50% 25%, #18594f 0, #062725 42%, #031313 78%);
}

.home-topbar { width: min(100%, 480px); display: flex; align-items: center; gap: 10px; }
.icon-button, .back-button {
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(4, 23, 22, .52); backdrop-filter: blur(12px);
  min-width: 44px; height: 44px; border-radius: 50%; font-weight: 800;
}
.back-button { border-radius: 999px; padding: 0 18px; align-self: flex-start; }
.home-icon-button {
  min-width: 44px; height: 32px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid rgba(255, 236, 189, .5);
  background: linear-gradient(155deg, #ffcf6b 0%, #ff9d3c 45%, #e2661b 100%);
  box-shadow: 0 4px 0 #93400c, 0 8px 16px rgba(147, 64, 12, .45), inset 0 1px 0 rgba(255, 255, 255, .55);
  transition: transform .12s ease, box-shadow .12s ease;
}
.home-icon-button svg { fill: #3a1c02; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .35)); }
.home-icon-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #93400c, 0 3px 8px rgba(147, 64, 12, .4), inset 0 1px 0 rgba(255, 255, 255, .55); }
.game-help-button { display: grid; place-items: center; color: #ffe19a; font: 900 21px/1 Georgia, serif; }

.brand-lockup { text-align: center; margin: clamp(24px, 6vh, 64px) 0 22px; }
.eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 900; letter-spacing: .22em; color: var(--gold); }
.brand-lockup h1 { margin: -3px 0; font: 900 clamp(74px, 22vw, 118px)/.9 Georgia, "Times New Roman", serif; letter-spacing: -.07em; text-shadow: 0 7px 0 rgba(0, 0, 0, .18); }
.brand-subtitle { margin: 9px 0 0; font: italic 18px/1.2 Georgia, serif; color: #d9cbaa; }
.home-version { margin: 7px 0 0; color: rgba(217,203,170,.7); font: 800 9px/1 Arial, sans-serif; letter-spacing: .18em; }

.ceramic-panel {
  background:
    linear-gradient(90deg, var(--cobalt) 0 5px, transparent 5px calc(100% - 5px), var(--cobalt) calc(100% - 5px)),
    linear-gradient(var(--cream), #e9d9b4);
  color: #102d2c; border: 5px solid var(--cream); outline: 2px solid var(--cobalt); box-shadow: var(--shadow);
}
.home-card { width: min(100%, 440px); padding: 22px; border-radius: 18px; }
.field-label { display: block; font-size: 11px; font-weight: 900; letter-spacing: .1em; margin-bottom: 7px; color: #47605d; }
.name-input, .join-row input {
  width: 100%; height: 48px; color: #092b29; background: rgba(255, 255, 255, .52); border: 1px solid rgba(13, 68, 64, .22);
  border-radius: 10px; padding: 0 14px; font-weight: 800; box-shadow: inset 0 2px 4px rgba(64, 40, 20, .08);
}

.primary-button {
  width: 100%; min-height: 64px; border: 0; border-radius: 12px; margin-top: 16px; padding: 10px 20px;
  text-transform: uppercase; letter-spacing: .08em; font-size: 18px; font-weight: 950; position: relative; overflow: hidden;
}
.button-kicker { display: block; font-size: 9px; letter-spacing: .18em; opacity: .76; margin-bottom: 2px; }
.ember-button { background: linear-gradient(135deg, #ff7846, #d83c27); box-shadow: 0 8px 0 #92291f, 0 13px 25px rgba(174, 45, 29, .28); }
.ember-button:active { transform: translateY(5px); box-shadow: 0 3px 0 #92291f; }
.ember-button::after { content: ""; position: absolute; inset: -120% 35%; background: rgba(255,255,255,.16); transform: rotate(25deg); transition: transform .5s; }
.ember-button:hover::after { transform: translate(100%, 100%) rotate(25deg); }

.mode-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
.mode-grid[hidden] { display: none; }
.secondary-button {
  display: flex; align-items: center; text-align: left; gap: 9px; min-height: 62px; padding: 10px; border: 1px solid rgba(14, 66, 63, .2);
  color: #123a37; background: rgba(255,255,255,.27); border-radius: 11px;
}
.secondary-button strong, .secondary-button small { display: block; }
.secondary-button strong { font-size: 13px; }
.secondary-button small { color: #5e716d; font-size: 10px; margin-top: 2px; }
.button-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: #0f5350; color: white; font-size: 18px; }
.search-wide { width: 100%; height: 48px; padding: 0; margin-top: 10px; }
.join-row { display: flex; gap: 8px; margin-top: 12px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .2em; text-align: center; }
.compact-button { border: 0; border-radius: 9px; padding: 0 18px; height: 48px; background: #0e4a45; font-weight: 900; flex: none; }
.home-divider { height: 1px; margin: 18px 4px; border: 0; background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent); opacity: .55; }
.home-divider-cobalt { margin-top: 8px; background: linear-gradient(90deg, transparent, var(--cobalt) 50%, transparent); }

/* "Buscar taula" i el selector de seient en entrar amb codi: mateix diàleg. */
.room-search-list { display: grid; gap: 8px; margin: 4px 0 6px; max-height: 50vh; overflow-y: auto; }
.room-search-card { padding: 11px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.04); text-align: left; }
.room-search-card strong { display: block; margin-bottom: 8px; font-size: 13px; }
.room-search-card small { color: var(--muted); font-size: 10px; }
.room-seat-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.room-seat-choice { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: #0e4a45; color: #fdf6e3; font-weight: 900; font-size: 11px; }
.room-search-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0; }
.room-search-status { margin: 10px 0 4px; padding: 12px; border-radius: 11px; background: rgba(255,255,255,.05); font-size: 12px; text-align: center; }

/* Sol·licituds pendents de "Buscar taula": només les veu l'amfitrió, al lobby. */
.lobby-join-requests { width: min(100%, 430px); margin: 4px 0 8px; }
.lobby-join-requests .eyebrow { margin-bottom: 8px; }
.join-request-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  border: 1px solid rgba(245,190,76,.3); border-radius: 12px; background: rgba(245,190,76,.06);
  margin-bottom: 8px; text-align: left;
}
.join-request-card strong, .join-request-card small { display: block; }
.join-request-card small { color: var(--muted); font-size: 10px; }
.join-request-actions { display: flex; gap: 6px; }
.join-request-accept, .join-request-reject { min-height: 34px; padding: 0 12px; border: 0; border-radius: 9px; font-weight: 900; font-size: 10px; }
.join-request-accept { background: #2f8f5b; color: #fff; }
.join-request-reject { background: rgba(255,255,255,.1); color: #fdf6e3; }
.home-footnote { margin: auto 0 0; padding-top: 22px; color: var(--muted); font-size: 11px; }
.live-dot { display: inline-block; width: 7px; height: 7px; background: #58d395; border-radius: 50%; box-shadow: 0 0 8px #58d395; margin-right: 5px; }

.lobby-screen {
  flex-direction: column; align-items: center; text-align: center; padding: calc(var(--safe-top) + 20px) 22px calc(var(--safe-bottom) + 25px);
  background: radial-gradient(circle at 50% 30%, #174d47, #031313 70%);
}
.lobby-screen .eyebrow { margin-top: 30px; }
.lobby-screen h2 { margin: 0 0 20px; font: 700 32px/1.05 Georgia, serif; }
.room-code { width: min(100%, 360px); border-radius: 14px; padding: 16px; }
.room-code small, .room-code span { display: block; color: #53716c; font-size: 10px; letter-spacing: .14em; }
.room-code strong { display: block; color: #0a3935; font-size: 41px; letter-spacing: .18em; margin: 3px 0; }
.lobby-invite {
  width: min(100%, 430px); margin-top: 10px; padding: 14px; border-radius: 14px; text-align: left;
  border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.05);
}
.lobby-invite .eyebrow { margin: 0 0 6px; }
.lobby-invite-url { margin: 0 0 10px; font-size: 12px; word-break: break-all; color: #d9cbaa; }
.lobby-invite small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.lobby-seats { width: min(100%, 430px); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 8px; }
.lobby-seat { display: flex; gap: 10px; align-items: center; text-align: left; padding: 12px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.05); border-radius: 12px; }
.lobby-seat i { width: 37px; overflow: hidden; height: 37px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.1); font-style: normal; font-weight: 900; }
.lobby-seat i .avatar-photo { width: 100%; height: 100%; object-fit: cover; }
.lobby-seat strong, .lobby-seat small { display: block; }
.lobby-seat small { color: var(--muted); font-size: 10px; }
.lobby-screen .primary-button { width: min(100%, 430px); margin-top: auto; }
.lobby-note { color: var(--muted); font-size: 11px; max-width: 380px; }

.game-screen {
  flex-direction: column; height: 100dvh; min-height: 0; overflow-x: hidden; overflow-y: auto;
  background: linear-gradient(#051b1a, #020d0d); padding: calc(var(--safe-top) + 8px) 8px calc(var(--safe-bottom) + 8px);
}
.game-header { height: 44px; display: flex; align-items: center; justify-content: space-between; z-index: 5; }
.finish-game-button {
  min-width: 54px; height: 32px; padding: 0 13px; border: 1px solid rgba(255,126,92,.58);
  border-radius: 999px; color: #ffd5c8; background: linear-gradient(145deg, rgba(143,42,28,.94), rgba(79,20,18,.96));
  box-shadow: 0 5px 14px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.1);
  font-size: 10px; font-weight: 950; letter-spacing: .13em;
}
.finish-game-button:disabled { opacity: .45; }
.auto-mode-toggle {
  min-width: 96px; height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 99px; background: rgba(4,28,27,.82); color: #9eb1ac;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); font-size: 9px; font-weight: 950; letter-spacing: .08em;
}
.auto-mode-toggle strong { min-width: 19px; color: #d5b46e; font-size: 9px; }
.auto-mode-toggle i {
  position: relative; width: 25px; height: 14px; border-radius: 99px; background: #283b38; box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
.auto-mode-toggle i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: #81928e;
  transition: transform .2s ease, background .2s ease;
}
.auto-mode-toggle.is-on { border-color: rgba(245,190,76,.65); background: linear-gradient(135deg, #174f42, #0b302b); color: #fff2c9; }
.auto-mode-toggle.is-on strong { color: var(--gold); }
.auto-mode-toggle.is-on i { background: #27765e; }
.auto-mode-toggle.is-on i::after { transform: translateX(11px); background: #ffe19a; box-shadow: 0 0 9px rgba(245,190,76,.65); }
.auto-mode-toggle:disabled { opacity: .48; cursor: not-allowed; }

.turn-strip {
  width: min(100%, 520px); min-height: 30px; display: grid; place-items: center;
  margin: 0 auto 2px; padding: 2px 8px; z-index: 7;
}
#turn-copy {
  display: block; width: 100%; overflow: hidden; color: var(--gold); font-size: 13px; font-weight: 900; line-height: 1.35;
  letter-spacing: .025em; text-align: center; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 8px rgba(0,0,0,.72);
}

.llm-trace {
  width: min(100%, 520px); max-height: 92px; overflow-y: auto; margin: 0 auto 4px; padding: 5px 10px;
  z-index: 7; font-style: italic; font-size: 11.5px; line-height: 1.45; text-align: left;
  color: rgba(240,235,220,.86); background: rgba(0,0,0,.32); border: 1px solid rgba(255,207,69,.18);
  border-radius: 10px; box-shadow: inset 0 1px 6px rgba(0,0,0,.35); scrollbar-width: thin;
}
.llm-trace .llm-line { margin: 0 0 2px; overflow-wrap: anywhere; }
.llm-trace .llm-call_start { color: rgba(255,207,69,.82); }
.llm-trace .llm-decision { color: rgba(150,225,170,.92); }
.llm-trace .llm-error { color: rgba(255,150,140,.95); font-weight: 700; }

.voice-ptt {
  position: absolute; right: 4px; top: -62px; margin: 0; z-index: 9;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,207,69,.55);
  background: radial-gradient(circle at 50% 35%, #2a6a5f, #123c39); color: #fdf6e3;
  box-shadow: 0 6px 18px rgba(0,0,0,.45); touch-action: none; -webkit-user-select: none; user-select: none;
  cursor: pointer; transition: box-shadow .12s ease, background .12s ease;
}
.voice-ptt .voice-ptt-icon { font-size: 20px; line-height: 1; }
.voice-ptt .voice-ptt-label { font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.voice-ptt.is-recording {
  background: radial-gradient(circle at 50% 35%, #d8593a, #8f2f22); border-color: #ffd24a;
  transform: scale(1.14); box-shadow: 0 0 0 6px rgba(216,89,58,.25), 0 8px 22px rgba(0,0,0,.5);
  animation: voice-pulse 1s ease-in-out infinite, voice-blink .7s steps(1,end) infinite;
}
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 6px rgba(216,89,58,.28), 0 8px 22px rgba(0,0,0,.5); } 50% { box-shadow: 0 0 0 12px rgba(216,89,58,.12), 0 8px 22px rgba(0,0,0,.5); } }
@keyframes voice-blink { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.voice-indicator {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 30; max-width: min(88vw, 420px);
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; font-style: italic;
  color: #fdf6e3; background: rgba(0,0,0,.6); border: 1px solid rgba(255,207,69,.3);
  box-shadow: 0 4px 14px rgba(0,0,0,.4); text-align: center;
}
.voice-indicator.is-tappable { cursor: pointer; border-color: #ffd24a; }

.ios-install-hint {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: min(92vw, 440px);
  padding: 12px 40px 12px 16px; border-radius: 14px; text-align: left;
  color: #fdf6e3; background: linear-gradient(180deg, #17403b, #0c2a27);
  border: 1px solid rgba(255,207,69,.4); box-shadow: 0 10px 26px rgba(0,0,0,.5);
}
.ios-install-hint strong { display: block; font-size: 14px; margin-bottom: 3px; color: #ffd24a; }
.ios-install-hint span { display: block; font-size: 12.5px; line-height: 1.4; }
.ios-install-hint b { color: #fdf6e3; }
.ios-install-close {
  position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.3); color: #fdf6e3; font-size: 18px; line-height: 1; cursor: pointer;
}

.table-shell { position: relative; width: min(92vw, 500px); height: clamp(315px, 46vh, 450px); min-height: 255px; margin: auto auto 0; flex: 0 1 auto; }
.table-rim, .table-felt { position: absolute; border-radius: 42% / 28%; }
.table-rim {
  inset: 11% 3%; background:
    linear-gradient(120deg, rgba(255,255,255,.15), transparent 24% 70%, rgba(0,0,0,.3)),
    repeating-linear-gradient(95deg, transparent 0 18px, rgba(47, 20, 11, .14) 19px 21px),
    linear-gradient(#9a5b39, #522717);
  box-shadow: 0 26px 35px rgba(0,0,0,.55), inset 0 0 0 3px rgba(46,18,10,.45), inset 0 0 0 7px rgba(255,220,157,.1);
}
.table-felt {
  inset: calc(11% + 13px) calc(3% + 14px); overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.065), transparent 45%),
    repeating-linear-gradient(50deg, rgba(255,255,255,.014) 0 1px, transparent 1px 5px),
    var(--felt);
  box-shadow: inset 0 0 38px rgba(0,0,0,.55);
}
.felt-mark {
  position: absolute; left: 50%; top: 50%; z-index: 1; width: 96px; height: 96px; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed rgba(226,201,141,.2);
  border-radius: 50%; color: rgba(235,213,165,.22); box-shadow: inset 0 0 0 6px rgba(226,201,141,.035), 0 0 0 1px rgba(2,34,30,.32);
}
.felt-mark::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(226,201,141,.1); border-radius: 50%; }
.felt-mark span, .felt-mark small, .felt-mark .felt-version { position: relative; z-index: 1; display: block; text-align: center; text-shadow: 1px 1px rgba(2,28,25,.8), -1px 0 rgba(244,225,183,.08); }
.felt-mark span { font: italic 700 20px Georgia, serif; letter-spacing: .04em; line-height: 1; }
.felt-mark small { margin-top: 4px; font: 900 8px/1 Arial, sans-serif; letter-spacing: .24em; text-transform: uppercase; }
.felt-mark .felt-version { margin-top: 5px; font: 800 7px/1 Arial, sans-serif; letter-spacing: .12em; }
.pot-pill { position: absolute; left: 50%; top: 13%; transform: translateX(-50%); padding: 4px 10px; border-radius: 99px; background: rgba(0,0,0,.25); color: #cfddcf; font-size: 9px; font-weight: 900; letter-spacing: .12em; }

.score-stones-layer { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.score-bank {
  position: absolute; width: 78px; min-height: 27px; padding: 2px 3px 3px; transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.48));
}
.score-bank.pos-0 { left: 50%; top: 84%; }
.score-bank.pos-1 { left: 14%; top: 50%; }
.score-bank.pos-2 { left: 50%; top: 16%; }
.score-bank.pos-3 { left: 86%; top: 50%; }
.stone-groups { min-height: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; }
.stone-group { position: relative; width: 12px; height: 10px; flex: 0 0 12px; }
.score-stone, .award-stone, .flying-stone {
  display: block; width: 7px; height: 6px; border: 1px solid rgba(255,255,255,.18); border-radius: 48% 55% 45% 52%;
  background: radial-gradient(circle at 33% 25%, #d8c8a4 0 12%, #8b8068 40%, #403b32 76%, #211f1b);
  box-shadow: inset -1px -1px 2px rgba(0,0,0,.55), 0 2px 2px rgba(0,0,0,.48);
}
.score-bank.team-0 .score-stone, .flying-stone.team-0 { background: radial-gradient(circle at 33% 25%, #d8e5e6 0 12%, #7e9a9d 42%, #405b61 77%, #1b2d32); }
.score-bank.team-1 .score-stone, .flying-stone.team-1 { background: radial-gradient(circle at 33% 25%, #ead5b5 0 12%, #aa7b63 42%, #633e34 77%, #2e1d19); }
.stone-group .score-stone { position: absolute; }
.stone-group .score-stone:nth-child(1) { left: 0; bottom: 0; transform: rotate(-10deg); }
.stone-group .score-stone:nth-child(2) { right: 0; bottom: 0; transform: rotate(12deg); }
.stone-group .score-stone:nth-child(3) { left: 3px; top: 0; transform: rotate(3deg); }
.score-stone.is-pending { opacity: 0; }
.score-stone.is-placed { animation: stoneLand .28s cubic-bezier(.2,.85,.3,1.35); }
@keyframes stoneLand { 0% { opacity: 0; scale: .4; } 65% { scale: 1.35; } }

.round-settlement {
  position: absolute; left: 50%; top: 50%; z-index: 9; width: min(92%, 390px); max-height: 94%; overflow-y: auto;
  transform: translate(-50%, -50%); padding: 10px; border: 1px solid rgba(245,190,76,.5); border-radius: 14px;
  background: linear-gradient(155deg, rgba(24,55,50,.98), rgba(4,21,20,.98));
  box-shadow: 0 16px 36px rgba(0,0,0,.68), inset 0 1px rgba(255,255,255,.08);
}
.round-settlement[hidden] { display: none; }
.round-settlement > small, .round-settlement > strong { display: block; text-align: center; }
.round-settlement > small { color: var(--gold); font-size: 7px; font-weight: 950; letter-spacing: .15em; }
.round-settlement > strong { margin: 2px 0 6px; font: 800 14px Georgia, serif; }
.revealed-hands { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 6px; }
.revealed-player { min-width: 0; padding: 4px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.045); }
.revealed-player.team-0 { border-color: rgba(113,185,236,.45); }
.revealed-player.team-1 { border-color: rgba(240,112,95,.45); }
.revealed-player header { position: relative; min-height: 16px; padding-right: 18px; }
.revealed-player header strong, .revealed-player header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.revealed-player header strong { color: white; font-size: 8px; }
.revealed-player header small { color: var(--muted); font-size: 5px; font-weight: 900; letter-spacing: .03em; }
.revealed-mano { position: absolute; right: 0; top: 0; padding: 1px 3px; border-radius: 99px; background: var(--gold); color: #30210b; font-size: 5px; }
.revealed-cards { height: clamp(34px, 5.5vh, 46px); display: flex; align-items: center; justify-content: center; gap: 2px; }
.revealed-cards .card { width: auto; height: 100%; aspect-ratio: 384 / 597; flex: 0 0 auto; border-radius: 4px; box-shadow: 0 3px 7px rgba(0,0,0,.42); }
.revealed-cards .card img { image-rendering: auto; }
.revealed-cards .card:disabled { opacity: 1; filter: none; }
.round-settlement ul { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.round-settlement li { display: grid; grid-template-columns: 13px 1fr auto; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 7px; background: rgba(255,255,255,.055); transition: .2s; }
.round-settlement li.no-envit { opacity: .72; border: 1px dashed rgba(255,255,255,.16); }
.round-settlement li.no-envit > i { color: var(--muted); font-style: normal; text-align: center; }
.round-settlement li.is-active { background: rgba(245,190,76,.16); box-shadow: inset 0 0 0 1px rgba(245,190,76,.3); }
.round-settlement li.is-paid { opacity: .68; }
.round-settlement li span, .round-settlement li span strong { display: block; }
.round-settlement li span { font-size: 7px; line-height: 1.25; color: #d8d1bf; }
.round-settlement li span strong { color: white; font-size: 8px; }
.round-settlement li > b { color: var(--gold); font: 900 14px Georgia, serif; }
.round-settlement .award-stone { width: 9px; height: 8px; }
.round-settlement li.team-0 .award-stone { background: radial-gradient(circle at 33% 25%, #d8e5e6, #64868c 48%, #263e44 80%); }
.round-settlement li.team-1 .award-stone { background: radial-gradient(circle at 33% 25%, #ead5b5, #a26c55 48%, #4b2c25 80%); }
.settlement-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.settlement-totals span { padding: 4px; border-radius: 6px; font-size: 7px; font-weight: 900; text-align: center; }
.settlement-totals span.team-0 { color: #a9daf8; background: rgba(62,139,200,.14); }
.settlement-totals span.team-1 { color: #ffad9f; background: rgba(215,71,54,.14); }
.settlement-totals b { display: block; font-size: 10px; }
.round-settlement > p { margin: 5px 0 0; color: var(--muted); font-size: 6px; line-height: 1.25; text-align: center; }
.round-settlement.is-counted { border-color: rgba(101,215,161,.58); }
.flying-stone { position: fixed; z-index: 40; width: 11px; height: 9px; pointer-events: none; }

.players-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.player { --signal-duration: 900ms; position: absolute; width: 90px; text-align: center; transform: translate(-50%, -50%); }
.player.pos-0 { left: 50%; top: 94%; }
.player.pos-1 { left: 5%; top: 50%; }
.player.pos-2 { left: 50%; top: 7%; }
.player.pos-3 { left: 95%; top: 50%; }
.avatar { position: relative; width: 47px; height: 47px; display: grid; place-items: center; margin: auto; border-radius: 50%; background: linear-gradient(145deg, #335f59, #0d2725); border: 3px solid #6ea39a; box-shadow: 0 8px 13px rgba(0,0,0,.35); font-weight: 950; }
.team-1 .avatar { border-color: #ad5d4f; background: linear-gradient(145deg, #713b32, #281514); }
.avatar.has-photo { background: #102d2c; }
.avatar-photo { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.player.is-turn .avatar { box-shadow: 0 0 0 4px rgba(245,190,76,.2), 0 0 24px rgba(245,190,76,.55); border-color: var(--gold); animation: turnPulse 1.7s ease-in-out infinite; }
@keyframes turnPulse { 50% { transform: translateY(-2px); } }
.player-name { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 900; text-shadow: 0 2px 3px #000; }
.player-role { display: block; font-size: 8px; color: var(--muted); text-transform: uppercase; }
.player-hand { height: 20px; display: flex; justify-content: center; align-items: center; margin-top: 2px; }
.mini-card {
  width: 13px; height: 19px; display: block; margin-left: -4px; border: 1px solid #e3d4b1; border-radius: 2px;
  background:
    linear-gradient(45deg, transparent 43%, rgba(255,255,255,.22) 44% 56%, transparent 57%),
    linear-gradient(135deg, #1c68ad, #0b355d);
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.mini-card:first-child { margin-left: 0; }
.player.is-turn .mini-card { border-color: var(--gold); }
.dealer-chip { position: absolute; right: 8px; top: -3px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--cream); color: #143936; font-size: 8px; font-weight: 950; border: 2px solid #fff; }
.avatar::after { content: ""; position: absolute; inset: -8px; pointer-events: none; opacity: 0; }
[class*="signal-"] .avatar::after {
  z-index: 5; inset: auto; left: 50%; top: -19px; min-width: 36px; padding: 2px 6px;
  border: 1px solid rgba(255,225,124,.8); border-radius: 999px;
  background: rgba(5,24,22,.94); color: #ffe17c; font-size: 13px; line-height: 18px;
  text-align: center; text-shadow: 0 0 8px rgba(255,207,69,.85);
  opacity: 1; transform: translateX(-50%);
}
.player.signal-major .avatar::after { content: "⌃⌃"; }
.player.signal-basto .avatar::after { content: "◉—"; }
.player.signal-manilla-espases .avatar::after { content: "◡›"; }
.player.signal-manilla-oros .avatar::after { content: "‹◡"; }
.player.signal-tres .avatar::after { content: "⌣"; }
.player.signal-envit-33 .avatar::after { content: "● ●"; }
.player.signal-envit-32 .avatar::after { content: "⌃"; }
.player.signal-cego .avatar::after { content: "— —"; }
.player.signal-major .avatar { animation: eyebrows var(--signal-duration) ease; }
.player.signal-basto .avatar { animation: wink var(--signal-duration) ease; }
.player.signal-manilla-espases .avatar { animation: nudgeRight var(--signal-duration) ease; }
.player.signal-manilla-oros .avatar { animation: nudgeLeft var(--signal-duration) ease; }
.player.signal-tres .avatar, .player.signal-envit-33 .avatar, .player.signal-envit-32 .avatar, .player.signal-cego .avatar { animation: signalGlow var(--signal-duration) ease; }
@keyframes eyebrows { 35% { transform: translateY(-5px) scaleY(.86); box-shadow: 0 -9px 0 -6px var(--gold), 0 0 25px var(--gold); } }
@keyframes wink { 35% { transform: rotate(-7deg) scaleX(.82); } }
@keyframes nudgeRight { 35% { transform: translateX(7px) skewX(-8deg); } }
@keyframes nudgeLeft { 35% { transform: translateX(-7px) skewX(8deg); } }
@keyframes signalGlow { 40% { transform: scale(1.12); box-shadow: 0 0 28px var(--gold); } }
.turn-strip.is-partner-signal { box-shadow: 0 0 22px rgba(255,207,69,.22); }

.played-cards { position: absolute; inset: 0; z-index: 2; transition: opacity .18s; }
.played-card {
  --tx: -50%; --ty: -50%; --rot: 0deg; --from-x: -50%; --from-y: -50%; --from-rot: 0deg;
  --stack-x: 0%; --stack-y: 0%; --stack-rot: 0deg; --stack-z: 1;
  position: absolute; left: 50%; top: 51%; width: clamp(60px, 15vw, 78px); aspect-ratio: 330 / 521;
  z-index: calc(2 + var(--stack-z)); transform-origin: center;
  transform: translate(calc(var(--tx) + var(--stack-x)), calc(var(--ty) + var(--stack-y))) rotate(calc(var(--rot) + var(--stack-rot)));
  filter: drop-shadow(0 5px 5px rgba(0,0,0,.5));
}
.played-card.pos-0 { left: 62%; top: 70%; --rot: 0deg; --from-x: -50%; --from-y: 330%; --from-rot: 0deg; }
.played-card.pos-1 { left: 15%; top: 74%; --rot: 0deg; --from-x: -520%; --from-y: -50%; --from-rot: -5deg; }
.played-card.pos-2 { left: 35%; top: 26%; --rot: 0deg; --from-x: -50%; --from-y: -430%; --from-rot: 3deg; }
.played-card.pos-3 { left: 85%; top: 26%; --rot: 0deg; --from-x: 420%; --from-y: -50%; --from-rot: 5deg; }
.played-card.is-new { animation: dealToTable .58s cubic-bezier(.18,.82,.2,1); }
.played-card.is-settled { animation: settleCard .28s ease-out; }
.played-card.is-winner .card { outline: 3px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 24px rgba(245,190,76,.85), 0 8px 16px rgba(0,0,0,.55); }
@keyframes dealToTable {
  from { opacity: .08; transform: translate(var(--from-x), var(--from-y)) rotate(var(--from-rot)) scale(.55); }
  72% { opacity: 1; transform: translate(calc(var(--tx) + var(--stack-x)), calc(var(--ty) + var(--stack-y))) rotate(calc(var(--rot) + var(--stack-rot))) scale(1.08); }
  to { transform: translate(calc(var(--tx) + var(--stack-x)), calc(var(--ty) + var(--stack-y))) rotate(calc(var(--rot) + var(--stack-rot))) scale(1); }
}
@keyframes settleCard { from { opacity: .78; } }

.trick-result {
  position: absolute; z-index: 6; left: 50%; bottom: 9%; transform: translate(-50%, 12px) scale(.94); width: max-content; max-width: 82%;
  padding: 7px 13px; border: 1px solid rgba(255,255,255,.22); border-radius: 11px; text-align: center;
  background: rgba(2,22,20,.94); box-shadow: 0 10px 30px rgba(0,0,0,.48); opacity: 0; pointer-events: none;
}
.trick-result.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); animation: resultPop .3s ease-out; }
.trick-result small, .trick-result strong { display: block; }
.trick-result small { color: var(--gold); font-size: 7px; font-weight: 950; letter-spacing: .13em; }
.trick-result strong { margin-top: 2px; color: white; font: 700 12px Georgia, serif; }
.trick-result.team-0 { border-color: rgba(80,168,229,.7); }
.trick-result.team-1 { border-color: rgba(233,100,80,.7); }
.trick-result.is-parda { border-color: rgba(245,190,76,.65); }
@keyframes resultPop { from { opacity: 0; transform: translate(-50%, 12px) scale(.86); } }
.response-banner {
  position: absolute; z-index: 9; left: 50%; top: 50%; min-width: 138px; padding: 11px 22px 10px;
  transform: translate(-50%, -50%) scale(.68) rotate(-2deg); border: 2px solid rgba(255,255,255,.42); border-radius: 13px;
  text-align: center; opacity: 0; pointer-events: none; box-shadow: 0 14px 38px rgba(0,0,0,.58);
}
.response-banner small, .response-banner strong { display: block; }
.response-banner small { color: rgba(255,255,255,.82); font-size: 8px; font-weight: 950; letter-spacing: .2em; }
.response-banner strong { margin-top: 2px; color: white; font: 950 27px/1 Georgia, serif; letter-spacing: .035em; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
/* VULL/NO VULL/subir queda 3 s en pantalla. */
.response-banner.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); animation: responseStamp 3s ease both; }
.response-banner.is-accept { background: linear-gradient(145deg, #238b64, #0b4f3e); border-color: #9af0c3; }
.response-banner.is-decline { background: linear-gradient(145deg, #b54d38, #69251e); border-color: #ffc0a8; transform: translate(-50%, -50%) scale(.68) rotate(2deg); }
.response-banner.is-decline.is-visible { transform: translate(-50%, -50%) scale(1) rotate(2deg); }
.response-banner.is-call { background: linear-gradient(145deg, #c98a2e, #7a4d13); border-color: var(--gold); }
@keyframes responseStamp {
  0% { opacity: 0; scale: .72; }
  18%, 78% { opacity: 1; scale: 1.08; }
  100% { opacity: 0; scale: .96; }
}
/* El cant de truc/envit queda 5 s en pantalla: entrada i eixida ràpides, la
   resta és el temps de lectura. */
.response-banner.is-call.is-visible { animation: callStamp 5s ease both; }
@keyframes callStamp {
  0% { opacity: 0; scale: .72; }
  6%, 90% { opacity: 1; scale: 1.08; }
  100% { opacity: 0; scale: .96; }
}

.game-screen.is-resolving .hand .card { pointer-events: none; filter: none; }

.card {
  --suit-glow: rgba(232, 177, 61, .22);
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  -webkit-user-drag: none;
}
.card.suit-oros { --suit-glow: rgba(244, 184, 35, .38); }
.card.suit-copas { --suit-glow: rgba(205, 45, 42, .3); }
.card.suit-espadas { --suit-glow: rgba(54, 132, 190, .3); }
.card.suit-bastos { --suit-glow: rgba(45, 145, 79, .28); }
.played-card .card { width: 100%; height: 100%; }
.card-image { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; filter: none; transform: scale(1.08); transform-origin: center; pointer-events: none; user-select: none; -webkit-user-drag: none; }

.hand-zone { position: relative; width: min(100%, 540px); margin: 0 auto; flex: 0 0 auto; z-index: 8; }
.waiting-action.is-auto { border-style: solid; border-color: rgba(245,190,76,.32); color: #f7d989; background: rgba(16,63,53,.72); }
.hand-meta { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 10px 3px; font-size: 9px; color: var(--muted); font-weight: 900; letter-spacing: .1em; }
.hand-meta > :last-child { justify-self: end; }
.hand-instruction { color: #f7d989; font-size: 8px; text-align: center; white-space: nowrap; }
.signal-heading { justify-self: start; display: grid; gap: 1px; color: var(--gold); line-height: 1; }
.signal-heading strong { font-size: 9px; font-weight: 950; }
.signal-heading small { color: #b9a975; font-size: 6px; letter-spacing: .08em; }
.hand-content { display: grid; grid-template-columns: clamp(104px, 29vw, 136px) minmax(0, 1fr); align-items: end; min-height: clamp(136px, 17vh, 142px); }
.hand-content:not(.has-signals) { grid-template-columns: 0 minmax(0, 1fr); }
.hand { min-width: 0; height: clamp(102px, 17vh, 142px); display: flex; justify-content: center; align-items: flex-end; padding: 0 5px 1px; }
.hand .card { width: auto; height: 100%; aspect-ratio: 384 / 597; flex: 0 0 auto; transition: transform .18s, box-shadow .18s; }
.hand .card + .card { margin-left: clamp(-17px, -3vw, -10px); }
.hand .card:nth-child(1) { transform: translateY(3px); transform-origin: 70% 100%; }
.hand .card:nth-child(2) { transform: translateY(-4px); z-index: 2; }
.hand .card:nth-child(3) { transform: translateY(3px); transform-origin: 30% 100%; z-index: 3; }
.hand .card:not(:disabled) { box-shadow: 0 0 0 2px rgba(255,205,86,.48), 0 13px 24px rgba(0,0,0,.48), 0 3px 7px rgba(91,48,10,.3), inset 0 1px 0 rgba(255,255,255,.95); }
.hand .card:not(:disabled):active { transform: translateY(-17px) scale(1.04); }
.hand .card:disabled { filter: none; opacity: 1; cursor: default; box-shadow: 0 9px 18px rgba(0,0,0,.36), 0 2px 5px rgba(64,31,6,.22), inset 0 1px 0 rgba(255,255,255,.9); }

.action-bar { width: min(100%, 560px); min-height: 57px; display: flex; flex: 0 0 auto; gap: 7px; margin: 5px auto 0; padding: 0 3px; z-index: 9; overflow-x: auto; scrollbar-width: none; }
.action-bar:empty { min-height: 0; }
.waiting-action {
  width: 100%; height: 46px; display: grid; place-items: center; border: 1px dashed rgba(255,255,255,.15); border-radius: 11px;
  background: rgba(8,36,33,.58); color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .04em;
}
.advance-turn {
  flex: 2 0 205px; min-height: 52px; display: grid; place-content: center; border: 1px solid #9edcf5; border-radius: 12px;
  background: linear-gradient(135deg, #2388b7, #15577c); color: white; box-shadow: 0 5px 0 #0b3852, 0 9px 22px rgba(24,113,156,.32);
}
.advance-turn span, .advance-turn strong { display: block; }
.advance-turn span { color: #ccefff; font-size: 8px; font-weight: 950; letter-spacing: .13em; }
.advance-turn strong { margin-top: 2px; font-size: 12px; font-weight: 950; letter-spacing: .06em; }
.advance-turn:active { transform: translateY(4px); box-shadow: 0 1px 0 #0b3852; }
.advance-turn:disabled { opacity: .5; cursor: wait; }
.game-screen.is-resolving .advance-turn:not(.is-pause) { pointer-events: none; opacity: .42; }
.advance-turn.is-pause {
  border-color: #ffe19a; background: linear-gradient(135deg, #e9ad38, #ad671f); color: #1c1408;
  box-shadow: 0 5px 0 #704014, 0 9px 22px rgba(222,151,42,.3);
}
.advance-turn.is-pause span { color: #4b2b0b; }
.action-button { flex: 1 0 auto; min-width: 92px; height: 50px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; background: linear-gradient(#183e3a, #0b2826); font-size: 11px; font-weight: 950; text-transform: uppercase; letter-spacing: .06em; box-shadow: 0 5px 0 #031817; }
.action-button.call-envit { color: #ffd474; border-color: rgba(245,190,76,.35); }
.action-button.call-truc { color: #ff8c69; border-color: rgba(237,91,50,.45); }
.action-button.fold { color: #a6b9b4; background: #102523; }
.game-over-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.game-over-actions .action-button { width: 100%; height: auto; min-height: 54px; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.game-over-actions .action-button small { font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: none; opacity: .78; }

dialog { color: var(--ink); }
.sheet-dialog {
  width: min(100% - 18px, 520px); max-height: 84dvh; margin: auto auto 0; border: 1px solid rgba(255,255,255,.13); border-radius: 24px 24px 0 0; padding: 25px 22px calc(var(--safe-bottom) + 24px);
  background: linear-gradient(160deg, #123e3a, #061b1a 65%); box-shadow: 0 -20px 55px rgba(0,0,0,.5); overflow-y: auto;
}
dialog::backdrop { background: rgba(0,8,8,.76); backdrop-filter: blur(5px); }
.dialog-handle { width: 40px; height: 4px; border-radius: 9px; background: rgba(255,255,255,.25); margin: -12px auto 15px; }
.dialog-close { position: absolute; right: 15px; top: 13px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); font-size: 23px; }
.sheet-dialog h2 { margin: 0 0 18px; font: 700 31px Georgia, serif; }
.rule-block { display: grid; grid-template-columns: 41px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.09); }
.rule-block p { margin: 0; color: #bdccc7; font-size: 13px; line-height: 1.45; }
.rule-block strong { color: white; }
.rule-number { color: var(--gold); font: 700 18px Georgia, serif; }
.source-note, .dialog-intro { color: var(--muted); font-size: 11px; }
.source-note a { color: var(--gold); }
.signal-guide { margin-top: 8px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.09); }
.signal-guide-heading { display: grid; grid-template-columns: 41px 1fr; gap: 10px; align-items: start; }
.signal-guide-heading h3 { margin: 0 0 4px; color: white; font: 700 20px Georgia, serif; }
.signal-guide-heading p { margin: 0; color: #bdccc7; font-size: 12px; line-height: 1.45; }
.signal-guide-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.signal-guide-item { display: grid; grid-template-columns: 45px 1fr; gap: 9px; align-items: center; min-height: 82px; padding: 10px; border: 1px solid rgba(245,190,76,.16); border-radius: 13px; background: linear-gradient(145deg, rgba(245,190,76,.09), rgba(255,255,255,.035)); }
.signal-guide-cue { width: 43px; min-height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,225,124,.55); border-radius: 999px; background: rgba(5,24,22,.94); color: #ffe17c; font-size: 14px; font-weight: 900; text-align: center; text-shadow: 0 0 8px rgba(255,207,69,.85); box-shadow: 0 5px 15px rgba(0,0,0,.22); }
.signal-guide-item strong, .signal-guide-item b, .signal-guide-item small { display: block; }
.signal-guide-item strong { color: white; font-size: 11px; line-height: 1.2; }
.signal-guide-item b { margin-top: 3px; color: var(--gold); font-size: 9px; letter-spacing: .025em; }
.signal-guide-item small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.signal-guide-note { margin: 11px 0 4px; padding: 10px 12px; border-left: 3px solid var(--gold); border-radius: 0 9px 9px 0; background: rgba(245,190,76,.08); color: #d8e2de; font-size: 10px; line-height: 1.4; }
.signal-guide-note strong { color: var(--gold); }
@media (max-width: 420px) { .signal-guide-list { grid-template-columns: 1fr; } .signal-guide-item { min-height: 72px; } }

.envit-number-dialog { text-align: center; }
.envit-number-row { display: grid; grid-template-columns: 52px 1fr 52px; gap: 9px; align-items: center; margin: 20px 0 6px; }
.envit-number-row button, .envit-number-row input { height: 58px; border: 1px solid rgba(245,190,76,.28); border-radius: 12px; }
.envit-number-row button { background: rgba(245,190,76,.1); color: var(--gold); font-size: 28px; font-weight: 900; }
.envit-number-row input { min-width: 0; width: 100%; background: rgba(255,255,255,.08); color: white; text-align: center; font: 900 28px Georgia, serif; }
.envit-number-row input::-webkit-inner-spin-button { display: none; }
.signal-options { min-width: 0; display: flex; flex-direction: column; align-self: stretch; justify-content: flex-start; gap: 3px; padding: 0 4px 1px 0; }
.signal-option { position: relative; width: 100%; min-height: 31px; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 5px; padding: 3px 5px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; border: 1px solid rgba(245,190,76,.32); border-radius: 9px; background: linear-gradient(145deg, rgba(245,190,76,.12), rgba(255,255,255,.045)); text-align: left; }
.signal-option::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,225,124,.25), transparent); transform: translateX(-110%); }
.signal-option.is-holding { border-color: #ffe17c; background: rgba(245,190,76,.22); box-shadow: 0 0 13px rgba(245,190,76,.25); }
.signal-option.is-holding::after { animation: signalHoldSweep .7s linear infinite; }
.signal-option:disabled { opacity: .42; cursor: not-allowed; }
.signal-option-cue { width: 26px; height: 23px; display: grid; place-items: center; border-radius: 999px; background: rgba(5,24,22,.9); color: #ffe17c; font-size: 9px; font-weight: 950; }
.signal-option strong { min-width: 0; color: #f7e7b0; font-size: 8px; line-height: 1.08; }
@keyframes signalHoldSweep { to { transform: translateX(110%); } }
.seat-picker { display: grid; gap: 9px; margin: 15px 0 8px; }
.seat-choice { display: grid; grid-template-columns: 43px 1fr auto; align-items: center; gap: 10px; min-height: 64px; padding: 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.045); text-align: left; }
.seat-choice .seat-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; background: #174e49; color: var(--gold); font-weight: 950; }
.seat-choice .seat-label strong, .seat-choice .seat-label small { display: block; }
.seat-choice .seat-label small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.seat-choice .seat-select {
  min-width: 118px; max-width: 42vw; padding: 9px 10px; border-radius: 10px;
  border: 1px solid rgba(245,190,76,.28); background: rgba(8,30,24,.85); color: #fdf6e3;
  font-size: 12px; font-weight: 800; text-align: right;
}
.seat-choice.is-human .seat-select { border-color: rgba(86,179,219,.35); color: #8bd6f1; }
.seat-choice .seat-select:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,190,76,.16); }

.challenge-panel { width: min(100%, 560px); margin: 5px auto 0; padding: 8px 14px 10px; border: 1px solid rgba(255,128,78,.42); border-radius: 14px; text-align: center; background: radial-gradient(circle at 50% 0, #7d2c20, #171817 63%); box-shadow: 0 12px 40px rgba(0,0,0,.45); z-index: 9; }
.challenge-panel[hidden] { display: none; }
/* Nom, títol i pedres en joc en una sola línia i el més curts possible: el
   panel ocupa menys pantalla. Textos llargs (lletres majúscules amb molt
   letter-spacing) són el que més trencava la línia en mòbil. */
.challenge-header { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 3px 7px; }
.challenge-header .eyebrow { margin: 0; font-size: 9px; letter-spacing: .1em; }
.challenge-header .eyebrow:empty { display: none; }
.challenge-panel h2 { margin: 0; font: 900 clamp(15px, 4.5vw, 18px) Georgia, serif; letter-spacing: -.02em; text-shadow: 0 2px 0 #6b2119; overflow-wrap: anywhere; }
.challenge-panel p:not(.eyebrow) { color: #d9cbb9; font-size: 11px; margin: 0; }
.challenge-training-hand { margin: 9px 0 3px; padding: 11px 10px 13px; border: 1px solid rgba(245,190,76,.28); border-radius: 15px; background: rgba(3,16,15,.4); box-shadow: inset 0 1px rgba(255,255,255,.05); }
.challenge-training-hand > span { display: block; margin-bottom: 9px; color: #f8d276; font-size: 9px; font-weight: 950; letter-spacing: .08em; }
.challenge-hand-cards { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 122px; }
.challenge-hand-cards .card { flex: 1 1 0; width: min(27vw, 98px); max-width: 98px; aspect-ratio: 195 / 300; border-radius: 8px; box-shadow: 0 9px 18px rgba(0,0,0,.42), 0 0 0 1px rgba(255,244,209,.36); }
.challenge-hand-cards .card-image { transform: scale(1.045); }
.challenge-hand-cards > small { color: #9eb1ac; font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.challenge-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 6px; }
.challenge-actions button { min-height: 32px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.08); font-weight: 950; font-size: 11px; text-transform: uppercase; }
.challenge-actions .accept { background: linear-gradient(#e86a3e,#ba3827); }
.challenge-actions .raise { grid-column: 1 / -1; color: var(--gold); border-color: rgba(245,190,76,.3); }
.challenge-extra { margin-top: 10px; }
.challenge-extra:empty { margin-top: 0; }
.ask-partner { width: 100%; min-height: 42px; border-radius: 11px; border: 1px solid rgba(245,190,76,.35); background: rgba(245,190,76,.1); color: var(--gold); font-weight: 900; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.ask-partner:disabled { opacity: .5; }
.partner-advice { color: var(--gold); font-style: italic; font-size: 12px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(var(--safe-bottom) + 18px); transform: translate(-50%, 30px); max-width: calc(100% - 30px); padding: 10px 16px; border-radius: 99px; background: #f0e3c6; color: #12322f; font-size: 11px; font-weight: 900; opacity: 0; pointer-events: none; transition: .25s; box-shadow: var(--shadow); }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 720px) and (min-height: 760px) {
  .game-screen { padding-left: 24px; padding-right: 24px; }
  .table-shell { height: 46vh; }
}

@media (max-height: 690px) {
  .game-header { height: 44px; }
  .turn-strip { min-height: 28px; padding-top: 1px; padding-bottom: 1px; }
  .table-shell { height: 360px; min-height: 330px; }
  .hand { height: 98px; min-height: 98px; }
  .action-bar { min-height: 47px; }
  .action-button { height: 43px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
