/* ============ токени ============ */
:root {
  --linen:      #EFE9DE;
  --linen-2:    #F8F4EC;
  --linen-3:    #E3DACB;
  --ink:        #17130F;
  --ink-2:      #3A332B;
  --ink-soft:   #6B6154;
  --line:       #D3C8B5;
  --red:        #AE2A1E;
  --red-soft:   #C9503F;
  --brass:      #94722F;
  --brass-soft: #B79A5C;
  --felt:       #221C17;
  --felt-2:     #2E2620;
  --felt-line:  #453A30;
  --on-felt:    #E9E0D2;
  --on-felt-dim:#A2947F;
  --card-face:  #FBF8F1;
  --card-edge:  #CFC3AE;
  --card-ink:   #1A1613;
  --good:       #3F6B47;
  /* Мітка мельдунка на карті. Карта світла в обох темах, тож колір один; латунь
     тут не годиться — вона вже означає «чий хід» і виділення взагалі. */
  --meld:       #7BC61A;
  --shadow:     0 1px 2px rgba(23,19,15,.10), 0 8px 24px rgba(23,19,15,.10);
  --shadow-lift:0 2px 6px rgba(23,19,15,.16), 0 18px 40px rgba(23,19,15,.20);
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px;
  --display: "Unbounded", "Trebuchet MS", sans-serif;
  --body: "Commissioner", "Segoe UI", system-ui, sans-serif;
  --serif: "PT Serif", Georgia, serif;
  --bar-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --linen:      #100D0B;
    --linen-2:    #1A1613;
    --linen-3:    #241E1A;
    --ink:        #EDE5D8;
    --ink-2:      #CDC2B1;
    --ink-soft:   #91856F;
    --line:       #332B24;
    --red:        #D6503E;
    --red-soft:   #E2705F;
    --brass:      #C3A05B;
    --brass-soft: #8E7639;
    --felt:       #17120F;
    --felt-2:     #201A16;
    --felt-line:  #352C25;
    --on-felt:    #E5DCCC;
    --on-felt-dim:#8C8070;
    --card-face:  #F1ECE1;
    --card-edge:  #8C8172;
    --card-ink:   #17130F;
    --good:       #74A17C;
    --shadow:     0 1px 2px rgba(0,0,0,.5), 0 10px 28px rgba(0,0,0,.45);
    --shadow-lift:0 2px 8px rgba(0,0,0,.55), 0 20px 44px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --linen:#100D0B; --linen-2:#1A1613; --linen-3:#241E1A;
  --ink:#EDE5D8; --ink-2:#CDC2B1; --ink-soft:#91856F; --line:#332B24;
  --red:#D6503E; --red-soft:#E2705F; --brass:#C3A05B; --brass-soft:#8E7639;
  --felt:#17120F; --felt-2:#201A16; --felt-line:#352C25;
  --on-felt:#E5DCCC; --on-felt-dim:#8C8070;
  --card-face:#F1ECE1; --card-edge:#8C8172; --card-ink:#17130F; --good:#74A17C;
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 28px rgba(0,0,0,.45);
  --shadow-lift:0 2px 8px rgba(0,0,0,.55), 0 20px 44px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--linen); color: var(--ink);
  font-family: var(--body); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
/* довге натискання (кнопка рації) не має виділяти текст інтерфейсу */
#app {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
/* але текст, який людина може захотіти скопіювати, лишається виділюваним */
input, textarea, [contenteditable], .selectable {
  -webkit-user-select: text; user-select: text;
}
/* поля вводу — рівно 16px, інакше iOS зумить сторінку при фокусі */
input, select, textarea { font-family: inherit; font-size: 16px; }
button { font: inherit; color: inherit; cursor: pointer; }
:where(button, [tabindex]):focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* вишиванковий бордюр */
.band {
  height: 7px; flex: none;
  background:
    repeating-linear-gradient(135deg, var(--red) 0 4px, transparent 4px 8px),
    repeating-linear-gradient(45deg, var(--ink-2) 0 4px, transparent 4px 8px);
  opacity: .5;
}

/* ============ каркас ============ */
#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; overflow-x: clip; position: relative; }

.topbar {
  position: relative;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--linen-2);
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 19px;
  letter-spacing: -.02em; margin: 0; color: var(--ink); white-space: nowrap;
}
.brand em { font-style: normal; color: var(--red); }
.brand-sub { font-weight: 500; font-size: 14px; color: var(--ink-soft); }

.status {
  display: flex; align-items: baseline; gap: 0; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-soft); min-width: 0; flex: 1 1 160px;
}
.status .s { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.status .s + .s::before {
  content: ""; width: 1px; height: 11px; background: var(--line);
  margin: 0 10px; display: inline-block; transform: translateY(1px);
}
.status b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.status .live b { color: var(--brass); }
/* Фан-режим не ховається у вузькому хедері: це єдине місце, де гравець бачить,
   що роздача підкручена на його користь. */
.status .fun { color: var(--brass); font-weight: 600; }

.actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; flex: none; }
.nav-meta, .nav-main { display: flex; align-items: center; gap: 6px; }
.nav-meta { gap: 8px; }
.nav-main { gap: 6px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
@media (hover: hover) {
  .btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }
}
a.btn-ghost { text-decoration: none; display: inline-block; }
.btn-ghost[aria-pressed="true"] { border-color: var(--brass); color: var(--brass); background: var(--linen-3); }
.navlink {
  background: transparent; border: 0; padding: 5px 4px; font-size: 13px;
  color: var(--ink-2); white-space: nowrap; text-decoration: none;
  border-bottom: 1px solid transparent;
}
@media (hover: hover) {
  .navlink:hover { color: var(--ink); border-bottom-color: var(--ink-soft); }
}
a.navlink { display: inline-block; }
.navsw {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; padding: 4px 2px;
  color: var(--ink-2); white-space: nowrap; font-size: 13px;
}
@media (hover: hover) {
  .navsw:hover { color: var(--ink); }
}
.navsw-l { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.sw-ico { display: inline-grid; place-items: center; width: 15px; height: 15px; color: currentColor; }
.sw-ico svg { width: 15px; height: 15px; display: block; }
.navsw[aria-checked="false"] .sw-ico { color: var(--ink-soft); }
.navsw .track { width: 34px; height: 20px; }
.navsw .knob { width: 14px; height: 14px; top: 2px; inset-inline-start: 2px; }
.navsw[aria-checked="true"] { color: var(--ink); }
.navsw[aria-checked="true"] .track { background: var(--red); border-color: var(--red); }
.navsw[aria-checked="true"] .knob { transform: translateX(14px); background: #fff; }
.navsw[disabled] { opacity: .45; cursor: not-allowed; }
.navsw[disabled] .track { background: transparent; border-color: var(--line); }
.navsw[disabled] .knob { background: var(--ink-soft); }
.iconbtn {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-2); padding: 0;
}
@media (hover: hover) {
  .iconbtn:hover { border-color: var(--ink-soft); color: var(--ink); }
}
.iconbtn.muted { color: var(--red); border-color: var(--red); }
.iconbtn svg { width: 16px; height: 16px; display: block; }
.topnav { display: flex; align-items: center; gap: 14px; flex: 1 1 220px; min-width: 0; order: 1; }
.topbtns { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; order: 2; }
.gear {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 7px; color: var(--ink-2); display: grid; place-items: center;
}
.gear svg { width: 20px; height: 20px; display: block; }
.gear[aria-expanded="true"] { border-color: var(--ink-soft); color: var(--ink); }
.settpanel {
  position: absolute; z-index: 21; top: calc(100% + 6px);
  inset-inline-end: 14px; width: min(310px, calc(100vw - 24px));
  display: grid; gap: 15px; padding: 15px 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--linen-2); box-shadow: var(--shadow-lift);
}
.settpanel:not(.open) { display: none; }
.setrow { display: grid; gap: 5px; }
.setrow-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setrow-l { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.settpanel .navsw { width: 100%; justify-content: space-between; padding: 0; }
.sethint { margin: 0; font-size: 11px; line-height: 1.4; color: var(--ink-soft); }
.burger {
  display: none; background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 8px 9px; margin-inline-start: auto;
  flex-direction: column; gap: 4px; align-items: stretch;
}
.burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink-2); transition: transform .18s ease, opacity .18s ease; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.board { display: grid; grid-template-columns: 1fr 320px; flex: 1; min-height: 0; }

/* ============ стіл ============ */
.table {
  display: flex; flex-direction: column; min-width: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--felt-2), var(--felt) 70%);
  position: relative;
}
.table::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 3px, rgba(255,255,255,.012) 3px 4px),
              repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.012) 3px 4px);
}

.seats {
  display: flex; gap: 10px; justify-content: center; align-items: stretch;
  padding: 0; flex-wrap: wrap; min-width: 0; width: 100%;
}
.seatrow {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 6px;
  padding: 14px 16px 0; z-index: 1; position: relative;
}
.seatmeta {
  display: flex; flex-direction: row; align-items: baseline;
  justify-content: space-between; gap: 8px;
  width: 100%; min-width: 0;
}
.seatmeta:not(:has(.seat:not([hidden]))) { display: none; }
.seat.matchclock {
  display: flex; flex-direction: row; align-items: baseline; gap: 8px;
  min-width: 0; flex: none;
  grid-template-columns: none;
  align-self: start;
  justify-content: flex-start;
  opacity: .5;
}
.seat.dealcount {
  align-self: end;
  justify-content: flex-end;
  margin-inline-start: auto;
}
.seat.matchclock[hidden] { display: none !important; }
.matchclock-l {
  font-size: 11.5px; color: var(--on-felt-dim); line-height: 1.3;
}
.matchclock time, .dealcount-n {
  font-variant-numeric: tabular-nums; font-weight: 600;
  font-size: 18px; letter-spacing: -.02em; color: var(--on-felt);
  white-space: nowrap; line-height: 1.2;
}
.seat {
  position: relative;
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px;
  align-items: center; min-width: 150px;
  padding: 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--felt-line); background: rgba(255,255,255,.028);
  color: var(--on-felt);
}
.seat.turn { border-color: var(--brass); background: rgba(196,160,91,.10); }
.seat.declarer .who::after { content: "•"; color: var(--brass); margin-inline-start: 6px; }
.seat.dealer { padding-inline-end: 18px; }
.seat.dealer::before {
  content: "";
  position: absolute; inset-inline-end: 7px; top: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass);
}
.seat.out { opacity: .5; }
/* Присутність: крапка тільки в того, кого немає — і в правому кінці фішки,
   окремо від імені. Червона, бо латунь у нас уже означає «чий хід»: два
   різні повідомлення одним кольором читалися б як одне. Приглушуємо фішку
   лише з offline і далі — «відійшов на хвилину» ще не привід гасити місце. */
/* Крапка «сів за стіл». Ритм не вигаданий, а знятий із самого звуку: у
   powerUp1 шість писків на 0.100, 0.254, 0.409, 0.589, 0.768 і 0.968 секунди
   від початку фрагмента — інтервал не сталий, він розтягується з 0.154 до
   0.200. Тому не «шість однакових ітерацій», а один прохід на всю довжину
   фрагмента (1.261 с) із кадрами в тих самих частках: рівний період поїхав би
   від звуку вже на третьому писку. */
.joindot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass); margin-inline-start: 8px; vertical-align: 1px;
  transform-origin: 50% 50%;
  animation: joinpulse 1.261s linear both;
}
@keyframes joinpulse {
  0%,     7.9% { transform: scale(1);   opacity: .45; }
  10.3%        { transform: scale(1.9); opacity: 1; }
  17.0%, 20.1% { transform: scale(1);   opacity: .45; }
  22.5%        { transform: scale(1.9); opacity: 1; }
  29.2%, 32.4% { transform: scale(1);   opacity: .45; }
  34.8%        { transform: scale(1.9); opacity: 1; }
  41.5%, 46.7% { transform: scale(1);   opacity: .45; }
  49.1%        { transform: scale(1.9); opacity: 1; }
  55.8%, 60.9% { transform: scale(1);   opacity: .45; }
  63.3%        { transform: scale(1.9); opacity: 1; }
  70.0%, 76.8% { transform: scale(1);   opacity: .45; }
  79.2%        { transform: scale(1.9); opacity: 1; }
  85.9%, 100%  { transform: scale(1);   opacity: .45; }
}
@media (prefers-reduced-motion: reduce) {
  .joindot { animation: none; opacity: 1; }
}

.pres {
  position: absolute; inset-inline-end: 9px; top: 50%;
  transform: translateY(-50%);
  font-size: 10px; line-height: 1; margin: 0;
  color: var(--red);
}
.seat.away, .seat.offline, .seat.gone, .seat.takeover { padding-inline-end: 24px; }
/* Гасне вміст фішки, а не сама фішка: opacity на батькові забрала б із собою
   й крапку, а вона — єдине, що має лишитись у повну силу. */
.seat.offline > :not(.pres),
.seat.gone > :not(.pres),
.seat.takeover > :not(.pres) { opacity: .55; }
.seat.gone .avatar { text-decoration: line-through; }
.hint-away {
  color: var(--ink-soft); font-size: .92em;
}
.hint-away::before { content: "· "; }
.av, .avatar {
  border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 500;
  background: var(--felt-line); color: var(--on-felt); flex: none;
}
.avatar {
  grid-row: 1 / 3; width: 34px; height: 34px; font-size: 14px;
}
.av-sm { width: 20px; height: 20px; font-size: 11px; }
.who, .seat-name {
  display: flex; align-items: baseline; min-width: 0;
  font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; line-height: 1.3;
  white-space: normal; overflow-wrap: anywhere;
}
.nm { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; max-width: 100%; flex-wrap: wrap; }
.nm-t { white-space: normal; overflow-wrap: anywhere; }
.nm-you {
  flex: none;
  font-size: 10px; line-height: 1; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brass); border: 1px solid var(--brass); border-radius: 999px;
  padding: 2px 5px 3px; opacity: .85;
}
.st-barrel { margin-inline-start: 5px; font-size: .95em; line-height: 1; }
.mutedmark {
  width: 13px; height: 13px;
  vertical-align: -2px; margin-inline-start: 6px;
  color: var(--on-felt-dim);
  opacity: .85;
  flex: none;
}
.sub, .seat-stats {
  flex: none; white-space: nowrap;
  font-size: 11.5px; color: var(--on-felt-dim); font-variant-numeric: tabular-nums;
}
.st-num { font-variant-numeric: tabular-nums; }
.st-meld { color: var(--good); font-variant-numeric: tabular-nums; }
.st-meld.off, .st-num.off {
  color: var(--on-felt-dim);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.st-cards { color: var(--on-felt-dim); }
.st-sep { color: var(--on-felt-dim); opacity: .5; margin: 0 4px; }
.backs { display: none; }
.cnt { display: none; }

/* центр столу */
.felt-center {
  flex: 1; display: grid; place-items: center; position: relative;
  padding: 8px 16px 44px; min-height: 200px; z-index: 1;
}
.trickwrap { display: flex; gap: 14px; align-items: flex-end; justify-content: center; margin-bottom: 14px; }
.trickwrap.piles { gap: 40px; }
.trickslot { display: grid; justify-items: center; gap: 6px; }
.trickslot .label {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--on-felt-dim);
}
.trickslot.lead .card { box-shadow: 0 0 0 2px var(--brass), 0 6px 16px rgba(0,0,0,.45); }
.trickslot.lead .slot-name { color: var(--brass); }
.trickslot.won .label { color: var(--brass); }

.centerpiece { text-align: center; color: var(--on-felt-dim); max-width: min(420px, 100%); }
.centerpiece .big {
  font-family: var(--display); font-size: 15px; font-weight: 500;
  color: var(--on-felt); letter-spacing: -.01em;
}
.centerpiece .small { font-size: 12.5px; margin-top: 4px; }

.trumpbadge {
  position: absolute; top: 10px; inset-inline-end: 18px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--felt-line); background: rgba(0,0,0,.22);
  color: var(--on-felt); font-size: 12.5px;
}
.trumpbadge .sym { font-size: 17px; line-height: 1; }
@keyframes trumplit {
  0%   { transform: scale(.86); opacity: 0; box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass) 60%, transparent); }
  55%  { transform: scale(1.06); opacity: 1; box-shadow: 0 0 0 6px color-mix(in srgb, var(--brass) 22%, transparent); }
  100% { transform: none; opacity: 1; box-shadow: 0 0 0 0 transparent; }
}
.trumpbadge.lit { animation: trumplit .5s ease-out both; }
.trumpbadge .sym.red { color: var(--red-soft); }
.trumpbadge .sym.blk { color: var(--on-felt); }

.lasttrick {
  position: absolute; bottom: 6px; inset-inline-start: 18px;
  display: flex; align-items: flex-end; gap: 10px; opacity: .72;
}
.lt-label {
  font-size: 10.5px; line-height: 1.3; letter-spacing: .05em; text-transform: uppercase;
  color: var(--on-felt-dim); text-align: end;
}
.lt-cards { display: flex; gap: 3px; }
.stock {
  position: absolute; bottom: 6px; inset-inline-end: 18px;
  display: flex; align-items: flex-end; gap: 10px; opacity: .72;
}
.stock .lt-label { text-align: start; }
.pilecards { display: flex; gap: 4px; }
.pilebtn {
  background: none; border: 0; padding: 4px; border-radius: var(--r-md);
  transition: transform .16s ease, background .16s ease;
}
.pilebtn:focus-visible { transform: translateY(-8px); background: rgba(196,160,91,.14); }
@media (hover: hover) {
  .pilebtn:hover { transform: translateY(-8px); background: rgba(196,160,91,.14); }
}
.trickslot.pile .label { color: var(--brass); }
.card.mini { --w: 38px; border-radius: 5px; box-shadow: none; }
.card.mini .rk { font-size: 11px; top: 2px; inset-inline-start: 4px; }
.card.mini .sm { display: none; }
.card.mini .big { font-size: 19px; padding-top: 9px; }

/* ============ карти ============ */
.card {
  --w: 102px;
  position: relative; width: var(--w); height: calc(var(--w) * 1.45);
  border: 1px solid var(--card-edge); border-radius: var(--r-md);
  background: linear-gradient(168deg, var(--card-face), color-mix(in srgb, var(--card-face) 92%, var(--linen-3)));
  color: var(--card-ink); box-shadow: var(--shadow);
  padding: 0; display: block; flex: none;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.card .rk {
  position: absolute; top: 5px; inset-inline-start: 8px;
  font-family: var(--serif); font-weight: 700; font-size: calc(var(--w) * .23); line-height: 1;
}
.card .sm {
  position: absolute; top: calc(var(--w) * .27); inset-inline-start: 8px;
  font-size: calc(var(--w) * .17); line-height: 1;
}
.card .big {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: calc(var(--w) * .52); line-height: 1; opacity: .92;
}
.card .rk, .card .sm, .card .big { font-variant-emoji: text; }
.card.red { color: var(--red); }
.card.blk { color: var(--card-ink); }
.card.static { cursor: default; }
.hand .card { cursor: pointer; }
.hand .card:focus-visible { transform: translateY(-12px); box-shadow: var(--shadow-lift); }
@media (hover: hover) {
  .hand .card:hover { transform: translateY(-12px); box-shadow: var(--shadow-lift); }
}
.hand .card.no { cursor: not-allowed; opacity: .5; filter: saturate(.55); }
@media (hover: hover) {
  .hand .card.no:hover { transform: none; box-shadow: var(--shadow); }
}
.card.dim { opacity: .38; filter: grayscale(.45); }
.card.dim .rk, .card.dim .sm, .card.dim .big { color: var(--card-ink); }
.card.pick { transform: translateY(-14px); box-shadow: var(--shadow-lift); outline: 2px solid var(--brass); }
/* Мельдунок на руці: карту не можна не помітити — суцільна салатова рамка
   по всьому периметру плюс залитий кут. */
.card.meldy {
  border-color: var(--meld);
  box-shadow: 0 0 0 3px var(--meld), var(--shadow);
}
.hand .card.meldy:focus-visible,
.hand .card.meldy.got:focus-visible {
  box-shadow: 0 0 0 3px var(--meld), var(--shadow-lift);
}
@media (hover: hover) {
  .hand .card.meldy:hover,
  .hand .card.meldy.got:hover {
    box-shadow: 0 0 0 3px var(--meld), var(--shadow-lift);
  }
}
.card.meldy::after {
  content: "";
  position: absolute; top: -1px; inset-inline-end: -1px;
  width: calc(var(--w) * .30); height: calc(var(--w) * .30);
  background: var(--meld);
  border-start-end-radius: var(--r-md);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}
/* Прикуп і мельдунок разом: рамка лишається салатовою, латунна крапка
   живе окремим елементом, щоб не красти ::after з кута. */
.card.meldy.got {
  box-shadow: 0 0 0 3px var(--meld), var(--shadow);
  animation: none;
}

.card.back {
  background:
    repeating-linear-gradient(45deg, var(--red) 0 3px, transparent 3px 7px),
    repeating-linear-gradient(-45deg, var(--red) 0 3px, transparent 3px 7px),
    linear-gradient(160deg, #3A1712, #24100C);
  border-color: #4A2018;
}

@keyframes drop { from { transform: translateY(-26px) rotate(var(--rot,0deg)); opacity: 0; } to { transform: translateY(0) rotate(var(--rot,0deg)); opacity: 1; } }
@keyframes dealin { from { transform: translateY(34px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-drop { animation: drop .22s ease-out both; }
.anim-deal { animation: dealin .3s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
  .meldshout { animation: none !important; opacity: 1; }
}

/* ============ оголошення мельдунка ============ */
.meldshout {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  pointer-events: none; padding: 16px;
  background: radial-gradient(closest-side at 50% 50%, rgba(0,0,0,.62), rgba(0,0,0,0) 75%);
  animation: msIn .26s cubic-bezier(.2,1.3,.4,1) both, msOut .45s ease-in 1.5s both;
}
.ms-card {
  text-align: center; padding: 20px 36px 22px; border-radius: var(--r-lg);
  border: 1px solid var(--brass); background: rgba(34,26,21,.97);
  box-shadow: 0 0 0 1px rgba(196,160,91,.28), 0 24px 70px rgba(0,0,0,.62); max-width: 100%;
}
.ms-eyebrow {
  font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}
.ms-value {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 8px 0 6px; font-family: var(--display); font-weight: 700; font-size: 46px;
  line-height: 1; color: #F2E9DA; letter-spacing: -.03em;
}
.ms-value .ms-sym { font-family: var(--body); font-size: 52px; line-height: 1; }
.ms-value .ms-sym.red { color: #E2705F; }
.ms-value .ms-sym.blk { color: #F2E9DA; }
.ms-who { font-size: 14px; color: #E5DCCC; }
.ms-trump { font-size: 12.5px; color: var(--brass); margin-top: 4px; }
.ms-note { font-size: 11.5px; color: #A2947F; margin-top: 6px; }
@keyframes msIn { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
@keyframes msOut { to { opacity: 0; } }
.meldshout.leftover-shout {
  animation: msIn .26s cubic-bezier(.2,1.3,.4,1) both, msOut .45s ease-in 2.1s both;
}
.ls-row { display: flex; gap: 8px; justify-content: center; margin: 8px 0 2px; }
.ls-card {
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  font-variant-emoji: text;
  background: var(--card-face); color: var(--card-ink);
  border: 1px solid var(--card-edge); border-radius: var(--r-sm);
  padding: 6px 10px; line-height: 1.1;
}
.ls-card.red { color: var(--red); }

/* ============ підказки ============ */
.hint {
  display: flex; align-items: baseline; gap: 10px; max-width: min(640px, 100%);
  padding: 9px 14px; border-radius: var(--r-md);
  border: 1px solid var(--brass-soft); background: rgba(196,160,91,.10);
  color: var(--on-felt); font-size: 13px; line-height: 1.5;
}
.hint-tag {
  flex: none; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}
.hint-text b { color: var(--brass); font-weight: 600; }
.pausebar {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  max-width: min(640px, 100%);
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--brass-soft); background: rgba(196,160,91,.10);
  color: var(--on-felt); font-size: 13.5px; line-height: 1.45;
}
.pausebar[hidden] { display: none; }
.pausebar p { margin: 0; }
.pausebar .rowbtns { margin: 0; }
.card.tip { outline: 2px solid var(--brass); outline-offset: 1px; }
.card.tip::before {
  content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 4px;
  background: var(--brass); border-radius: 0 0 5px 5px;
}

/* карта, отримана від замовника — підсвічена до першого ходу */
.card.got {
  box-shadow: 0 0 0 2px var(--brass), 0 2px 10px rgba(0,0,0,.18);
  animation: gotpulse 1.1s ease-out 2;
}
.got-dot {
  position: absolute; inset-inline-end: 5px; top: 5px;
  display: block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass);
  pointer-events: none; z-index: 1;
}
.card.meldy .got-dot {
  inset-inline-end: 4px; top: 4px;
  width: 8px; height: 8px;
  box-shadow: 0 0 0 1.5px var(--card-face);
}
@keyframes gotpulse {
  0%   { box-shadow: 0 0 0 2px var(--brass), 0 0 0 0 rgba(196,160,91,.55); }
  70%  { box-shadow: 0 0 0 2px var(--brass), 0 0 0 12px rgba(196,160,91,0); }
  100% { box-shadow: 0 0 0 2px var(--brass), 0 2px 10px rgba(0,0,0,.18); }
}
@media (prefers-reduced-motion: reduce) { .card.got { animation: none; } }

/* ============ рука і дії ============ */
.handzone {
  padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 10px;
  align-items: center; z-index: 1;
}
.hand { --w: 102px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 92px; }
.card-gap {
  width: var(--w); height: calc(var(--w) * 1.45);
  flex: none; pointer-events: none;
}
.actionbar {
  display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
  min-height: 38px;
}
.prikup-ack {
  width: 100%; max-width: 240px;
  display: flex; flex-direction: column; align-items: stretch;
}
.prikup-ack .btn { width: 100%; }
.prikup-ack .readybar {
  margin-top: 8px;
  background: rgba(255,255,255,.12);
}
.prompt { color: var(--on-felt); font-size: 13.5px; }
.prompt b { color: var(--brass); font-weight: 600; }
/* Хід повернувся до вас — рядок у латунному ореолі, як у значка козиря, і
   через секунду починає пульсувати. Секунда — щоб на швидких ходах підказка
   не блимала. */
.prompt.yours {
  padding: 6px 16px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brass) 55%, transparent);
  background: color-mix(in srgb, var(--brass) 12%, transparent);
  color: var(--brass);
  animation: yourturn 1.6s ease-in-out 1s infinite;
}
@keyframes yourturn {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass) 45%, transparent),
                0 0 10px 0 color-mix(in srgb, var(--brass) 22%, transparent);
    background: color-mix(in srgb, var(--brass) 10%, transparent);
  }
  60% {
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--brass) 0%, transparent),
                0 0 20px 3px color-mix(in srgb, var(--brass) 34%, transparent);
    background: color-mix(in srgb, var(--brass) 20%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass) 0%, transparent),
                0 0 10px 0 color-mix(in srgb, var(--brass) 22%, transparent);
    background: color-mix(in srgb, var(--brass) 10%, transparent);
  }
}
.hg {
  width: 15px; height: 15px; flex: none;
  vertical-align: -2px; margin-inline-end: 7px;
  color: var(--brass);
  transform-origin: 50% 50%;
  animation: hgflip 4.8s cubic-bezier(.75, 0, .25, 1) infinite;
}
.hg-sand {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: hgsand 4.8s ease-in infinite;
}
@keyframes hgflip {
  0%,  40% { transform: rotate(0deg); }
  50%, 90% { transform: rotate(180deg); }
  100%     { transform: rotate(360deg); }
}
@keyframes hgsand {
  0%   { transform: translateY(0)      scaleX(1); }
  40%  { transform: translateY(10.8px) scaleX(1.5); }   /* лягло на дно */
  50%  { transform: translateY(10.8px) scaleX(1); }     /* переворот: купка знову цівка */
  90%  { transform: translateY(0)      scaleX(1.5); }
  100% { transform: translateY(0)      scaleX(1); }
}
.btn {
  border: 1px solid var(--brass-soft); background: rgba(196,160,91,.12);
  color: var(--on-felt); padding: 7px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; transition: background .14s ease, transform .1s ease;
}
@media (hover: hover) {
  .btn:hover { background: rgba(196,160,91,.24); }
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #FDF6EE; }
@media (hover: hover) {
  .btn.primary:hover { background: var(--red-soft); }
}
.btn.primary.pending { background: rgba(255,255,255,.08); border-color: var(--felt-line); color: var(--on-felt-dim); }
.btn.quiet { border-color: var(--felt-line); background: rgba(255,255,255,.05); }
.btn.danger { border-color: color-mix(in srgb, var(--red-soft) 55%, transparent); background: rgba(214,80,62,.10); color: var(--red-soft); }
@media (hover: hover) {
  .btn.danger:hover { background: rgba(214,80,62,.20); }
}
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn .n { font-variant-numeric: tabular-nums; }

.bidform {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--felt-line); background: rgba(255,255,255,.05);
}
.bidform label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--on-felt-dim);
}
.bidform input {
  width: 104px; padding: 7px 10px; border-radius: var(--r-md);
  border: 1px solid var(--brass-soft); background: var(--felt-2); color: var(--on-felt);
  font-variant-numeric: tabular-nums; text-align: center;
}
.bidnote { flex-basis: 100%; text-align: center; font-size: 11.5px; color: var(--on-felt-dim); }
.bidnote.bad { color: var(--red-soft); }

/* ============ права колонка ============ */
.rail {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border-inline-start: 1px solid var(--line); background: var(--linen-2);
}
.railbody { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.railbar {
  display: none; width: 100%; align-items: center; gap: 10px; text-align: start;
  padding: 10px 16px; background: var(--linen-2); border: 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.railbar-s {
  flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.sbar-list { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 auto; }
.sbar-p { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* «ви» в смузі рахунку — той самий значок, що й біля імені за столом:
   одна мова для «це я» в усій грі */
.sbar-you {
  flex: none;
  font-size: 10px; line-height: 1; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brass); border: 1px solid var(--brass); border-radius: 999px;
  padding: 2px 5px 3px; opacity: .85;
}
.sbar-me { color: var(--ink); font-weight: 600; }
.grip {
  display: none; position: absolute; inset-inline-start: 50%; top: 6px;
  width: 36px; height: 4px; margin-inline-start: -18px; border-radius: 999px;
  background: var(--line);
}
.chev {
  flex: none; width: 9px; height: 9px; border-inline-end: 2px solid var(--ink-soft);
  border-block-end: 2px solid var(--ink-soft); transform: rotate(-135deg) translate(-3px, -3px);
  transition: transform .2s ease;
}
.rail.open .chev { transform: rotate(45deg) translate(-2px, -2px); }
.panel { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel h2 {
  font-family: var(--display); font-size: 11.5px; font-weight: 500; margin: 0 0 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
}
table.score { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.score th, table.score td { padding: 5px 4px; text-align: right; font-size: 13.5px; }
table.score th:first-child, table.score td:first-child { text-align: left; }
table.score thead th {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 500; border-bottom: 1px solid var(--line);
}
table.score td.total { font-weight: 700; font-size: 15px; }
table.score tr.me td,
.hxtable th.me, .hxtable td.me,
table.result tr.me td {
  background: rgba(148, 114, 47, 0.09);
  background: color-mix(in srgb, var(--brass) 9%, transparent);
}
table.score tr.me td:first-child { font-weight: 600; }
.barrel {
  display: inline-block; margin-inline-start: 6px; font-size: 10px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--brass);
  border: 1px solid var(--brass-soft); border-radius: 3px; padding: 0 4px;
}
.pen {
  display: inline-block; margin-inline-start: 6px; font-size: 10px; font-weight: 600;
  letter-spacing: .04em; color: var(--red); border: 1px solid currentColor;
  border-radius: 3px; padding: 0 4px;
}
.dashes {
  display: inline-block; margin-inline-start: 6px; font-size: 11px; letter-spacing: .12em;
  color: var(--red); font-weight: 700; vertical-align: 1px;
}
.bails {
  display: inline-flex; gap: 3px; margin-inline-start: 6px; vertical-align: 1px;
}
.bails i {
  font-style: normal; font-size: 9.5px; line-height: 13px; min-width: 13px; text-align: center;
  border: 1px solid var(--brass-soft); border-radius: 3px; color: var(--brass);
}
.bails i.off { opacity: .3; text-decoration: line-through; }
.mark {
  display: inline-block; min-width: 22px; font-weight: 700; color: var(--ink-soft);
}
.bar { height: 3px; background: var(--linen-3); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.bar i { display: block; height: 100%; background: var(--brass); }

.logbox { flex: 1; overflow-y: auto; padding: 12px 16px 20px; min-height: 120px; }
.railtabs {
  display: flex; gap: 4px; margin: 0 0 10px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: -12px; background: var(--linen-2);
  padding-top: 2px; margin-top: -2px; z-index: 1;
}
.railtabs button {
  background: none; border: 0; padding: 8px 12px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.railtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.railtabs button[hidden] { display: none !important; }
#tab-last { display: none; }
#panel-all { overflow-x: auto; }
.sr-h { font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin: 2px 0 10px; }
.sr-list { display: grid; gap: 6px; margin: 0 0 12px; }
.sr-row {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--linen);
}
.sr-row.sr-top { border-color: var(--brass); }
.sr-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.sr-w {
  font-family: var(--display, inherit); font-weight: 700; font-size: 18px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.sr-row.sr-zero .sr-w { color: var(--ink-soft); font-weight: 500; }
.sr-foot { color: var(--ink-soft); font-size: 12.5px; margin: 0; }
.ltp-h { font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin: 2px 0 8px; }
.ltp-sum { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); }
.ltp-sum b { color: var(--brass); font-variant-numeric: tabular-nums; }
.ltp-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ltp-one { display: grid; gap: 4px; justify-items: center; }
.ltp-who { font-size: 11.5px; color: var(--ink-soft); max-width: 84px;
  overflow-wrap: anywhere; text-align: center; }
.ltp-win { outline: 2px solid var(--brass); outline-offset: 1px; border-radius: var(--r-md); }
.logline {
  font-size: 12.5px; color: var(--ink-soft); padding: 3px 0 3px 10px;
  border-inline-start: 2px solid var(--line); margin-bottom: 1px;
}
.logline.bid { border-color: var(--brass); color: var(--ink-2); }
.logline.meld { border-color: var(--red); color: var(--ink-2); font-weight: 500; }
.logline.trick { border-color: var(--ink-soft); }

/* ============ модалки ============ */
.credit {
  position: fixed;
  inset-inline-start: max(12px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex; align-items: center; gap: 6px;
  margin: 0; font-size: 12px; line-height: 1; color: var(--on-felt);
  opacity: .5; transition: opacity .15s ease;
}
.credit:focus-within { opacity: 1; }
@media (hover: hover) {
  .credit:hover { opacity: 1; }
}
.credit img { height: 16px; width: auto; display: block; border-radius: 2px; }
.credit a { color: inherit; text-underline-offset: 2px; }

.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  /* `safe` центрує, поки аркуш уміщається, і притискає до верху, коли ні.
     Звичайне центрування в такому разі зрізає верх, і дістатись до нього не
     можна навіть прокруткою. */
  place-items: safe center;
  overflow-y: auto; overscroll-behavior: contain;
  /* Вирізи екрана додаємо до полів, а не «поглинаємо» їх: аркуш рахує свою
     максимальну висоту з тих самих величин, тож його низ не може опинитись
     під домашньою смужкою — там ховалась кнопка «Почати гру». */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  padding-top: calc(20px + var(--safe-t));
  padding-bottom: calc(20px + var(--safe-b));
  background: color-mix(in srgb, var(--felt) 72%, transparent);
  backdrop-filter: blur(3px); z-index: 50;
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--linen-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
  max-width: 620px; width: 100%; overflow: auto;
  overscroll-behavior: contain;
  /* `vh` на мобільних міряє екран **без** адресного рядка, тож 88vh буває
     вищим за видиму частину: низ аркуша ховається під хромом браузера, а сам
     аркуш при цьому «вміщається» й не гортається — саме тому кнопка «Почати
     гру» ставала недосяжною. `dvh` міряє те, що видно насправді; рядок із
     `vh` лишається для старих движків. */
  max-height: 88vh;
  max-height: min(88vh, calc(100dvh - 40px - var(--safe-t, 0px) - var(--safe-b, 0px)));
}
.sheet-in { padding: 22px 26px 26px; }
.sheet h3 {
  font-family: var(--display); font-weight: 700; font-size: 22px; margin: 0 0 4px;
  letter-spacing: -.02em;
}
.sheet .lede { color: var(--ink-soft); margin: 0 0 12px; font-size: 12px; line-height: 1.4; }
.sheet h4 {
  font-family: var(--display); font-size: 11.5px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft); margin: 20px 0 8px;
}
.sheet p, .sheet li { font-size: 13.8px; }
.sheet ul { padding-inline-start: 18px; margin: 6px 0; }

.group { margin: 0 0 16px; }
.glabel {
  display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin: 0 0 7px;
}
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.seg button {
  flex: 1 1 0; min-width: 0; background: var(--linen); border: 0;
  padding: 9px 10px; text-align: center; color: var(--ink-2);
  border-inline-start: 1px solid var(--line); transition: background .12s ease, color .12s ease;
}
.seg button:first-child { border-inline-start: 0; }
@media (hover: hover) {
  .seg button:hover { background: var(--linen-3); }
}
.seg .t { display: block; font-weight: 600; font-size: 14px; }
.seg .d { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 1px; }
.seg button[aria-checked="true"] { background: var(--red); color: #fff; }
@media (hover: hover) {
  .seg button[aria-checked="true"]:hover { background: var(--red); color: #fff; }
}
.seg button[aria-checked="true"] .d { color: rgba(255,255,255,.78); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
@media (hover: hover) {
  .seg button:disabled:hover { background: var(--linen); }
}
.seg.compact button { padding: 6px 10px; }
.seg.compact .t { font-size: 13px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .duo { grid-template-columns: 1fr; } }
.switches { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.swrow {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 11px 14px; background: var(--linen); border: 0; text-align: start;
  border-top: 1px solid var(--line);
}
.swrow:first-child, .swrow[hidden] + .swrow { border-top: 0; }
@media (hover: hover) {
  .swrow:hover { background: var(--linen-3); }
}
.swrow .txt { flex: 1; min-width: 0; }
.swrow .t { display: block; font-weight: 600; font-size: 14px; }
.swrow .d { display: block; font-size: 11.5px; color: var(--ink-soft); }
.track {
  flex: none; width: 40px; height: 23px; border-radius: 999px;
  background: var(--linen-3); border: 1px solid var(--line); position: relative;
  transition: background .16s ease, border-color .16s ease;
}
.knob {
  position: absolute; top: 2px; inset-inline-start: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--ink-soft); transition: transform .16s ease, background .16s ease;
}
.swrow[aria-checked="true"] .track { background: var(--red); border-color: var(--red); }
.swrow[aria-checked="true"] .knob { transform: translateX(17px); background: #fff; }
@media (prefers-reduced-motion: reduce) { .track, .knob, .seg button { transition: none; } }

.rowbtns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.rowbtns:has(.dailydrop) { align-items: center; }
.sheet:has(.homebrand) { max-width: 400px; }
.homebrand {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin: 4px 0 6px;
}
.homebrand-mark {
  width: 72px; height: 72px; border-radius: 16px;
  box-shadow: var(--shadow);
}
.homebrand .brand { font-size: 28px; letter-spacing: -.03em; }
.homebtns { display: flex; flex-direction: column; gap: 12px; padding: 10px 0 4px; }
.home-invite {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--linen-2, #F3EDE3) 80%, transparent);
}
.home-invite p { margin: 0; font-weight: 600; font-size: 15px; }
.home-invite .rowbtns { margin: 0; }
.home-invite .btn-solid,
.home-invite .btn-line { width: auto; padding: 8px 16px; font-size: 14px; }
.lobby-mates { display: flex; flex-direction: column; margin: 0 0 8px; }
.lobby-mate {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 0;
  border: 0; border-bottom: 1px solid var(--line);
  background: none; color: inherit; text-align: start;
  font: inherit; cursor: pointer;
}
.lobby-mate:last-child { border-bottom: 0; }
.lobby-mate:disabled { opacity: .55; cursor: default; }
.lobby-mate .lm-mark { flex: none; }
.lobby-mate .lm-name { flex: 1; min-width: 0; font-weight: 600; }
.lobby-mate .lm-ago { flex: none; color: var(--ink-soft); font-size: 12px; }
button.textlink {
  display: inline; padding: 0; margin: 0;
  border: 0; background: none; color: var(--brass);
  font: inherit; text-decoration: underline; cursor: pointer;
}
.dailyhome { padding: 14px 0 0; }
.dailyhome-head, .dailyhead {
  display: flex; align-items: center; gap: 8px;
}
.dailyhome-head { margin: 0 0 10px; }
.dailyhome-title { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; color: var(--ink); }
.dailyhead { margin: 0 0 2px; }
.dailyhead h3 { margin: 0; flex: 1; min-width: 0; }
.daily-stamp { margin: 0 0 2px; font-size: 13px; }
.daily-streak {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.hintbtn {
  flex: none; width: 28px; height: 28px; padding: 0;
  margin-inline-start: auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: transparent; color: var(--brass);
  border: 1px solid var(--brass);
  font-weight: 600; font-size: 14px; line-height: 1;
}
@media (hover: hover) {
  .hintbtn:hover { background: color-mix(in srgb, var(--brass) 14%, transparent); }
}
.hintbtn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--brass) 18%, transparent);
}
.daily-explain {
  margin: 8px 0 12px;
  font-size: 13px; color: var(--ink-soft); line-height: 1.45;
}
.daily-explain[hidden] { display: none !important; }
.daily-status { margin: 12px 0 0; }
.dailytabs { margin: 12px 0 0; }
.dailytable th:nth-child(4), .dailytable td:nth-child(4),
.dailytable th:nth-child(5), .dailytable td:nth-child(5),
.dailytable th:nth-child(6), .dailytable td:nth-child(6),
.dailytable-total th:nth-child(3), .dailytable-total td:nth-child(3),
.dailytable-total th:nth-child(4), .dailytable-total td:nth-child(4),
.dailytable-total th:nth-child(5), .dailytable-total td:nth-child(5) {
  text-align: end; font-variant-numeric: tabular-nums;
}
.dailyboard { margin-top: 28px; }
.daily-empty { color: var(--ink-soft); margin-top: 28px; }
.dailydrop {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: 14px;
  color: var(--ink);
  opacity: 0.55;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-inline-start: auto;
  align-self: center;
}
@media (hover: hover) {
  .dailydrop:hover { opacity: 0.85; }
}
.dailydrop-ask { margin-top: 16px; }
.dailydrop-ask .field { margin-top: 10px; }
.dailydrop-code {
  font-weight: 700;
  letter-spacing: .14em;
  font-variant-numeric: tabular-nums;
}
/* Кнопка з другим рядком усередині: головне слово великим, стан — дрібним
   під ним. Другий рядок не має розсувати ряд, тому кнопка лишається тієї ж
   висоти, а рядок сідає в її межі. */
.btn-two {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; line-height: 1.15;
}
.btn-two .bt-t { font-weight: 600; }
.btn-two .bt-d {
  font-size: 11.5px; font-weight: 500; opacity: .75;
  letter-spacing: .01em;
}

/* Перемикач для вібро: лишається намальованим (display:none міг би вимкнути
   системний тап), але його не видно й не спіймати пальцем. */
/* Невидимий нативний перемикач поверх карти: тільки він уміє викликати
   системний тап на iPhone. Нуль прозорості WebKit може визнати «немає»,
   тому лишаємо ледь помітний слід. */
.hapticwrap { position: relative; display: inline-block; }
.hapticwrap .hapticover {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; z-index: 2; cursor: pointer;
  opacity: .004;
}
.hapticwrap .card, .hapticwrap .btn { position: relative; z-index: 1; }

/* ============ реакції на прикуп ============ */
.reactrow {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.reactcol { display: flex; flex-direction: column; gap: 8px; flex: none; }
/* Без рамки й підкладки: емодзі самі по собі — кнопка, тож їх можна зробити
   вдвічі більшими на тому самому місці. */
.reactbtn {
  width: 46px; height: 46px; padding: 0;
  border: 0; background: none; border-radius: 999px;
  font-size: 34px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  filter: saturate(.92) drop-shadow(0 2px 4px rgba(0,0,0,.35));
  transition: transform .14s cubic-bezier(.2,.7,.3,1.4), filter .14s ease, opacity .2s ease;
}
@media (hover: hover) {
  .reactbtn:hover { transform: translateY(-3px) scale(1.12); filter: saturate(1) drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
}
.reactbtn:active { transform: scale(.88); }
.reactbtn:disabled { opacity: .3; cursor: default; transform: none; filter: grayscale(.4); }
.reactlayer {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden;
}
.reactfly {
  position: absolute; font-size: 30px; line-height: 1;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}
@media (max-width: 560px) {
  .reactbtn { width: 40px; height: 40px; font-size: 28px; }
  .reactrow { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .reactfly { display: none; }
}

/* ============ призупинені партії ============ */
.savedlist { display: grid; gap: 8px; margin: 4px 0 16px; }
.savedrow {
  display: flex; align-items: flex-start; gap: 6px; width: 100%;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--linen-3); color: var(--ink);
}
@media (hover: hover) {
  .savedrow:hover { border-color: var(--ink-soft); }
}
.savedrow-go {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  margin: 0; padding: 8px 6px;
  background: transparent; border: 0;
  text-align: start; appearance: none; -webkit-appearance: none;
}
.savedrow .sv-main { font-size: 13.5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.savedrow .sv-mark { margin-inline-end: .35em; }
.savedrow .sv-sep { color: var(--ink-soft); margin: 0 .4em; font-weight: 400; }
.savedrow .sv-s { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.savedrow .sv-s b, .savedrow .sv-main b { color: var(--ink); font-weight: 700; }
.savedrow .sv-exp {
  font-size: 11px; line-height: 1.2; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.savedrow .sv-del {
  flex: none; width: 34px; height: 34px;
  display: grid; place-items: center;
  margin: 4px 0 0; padding: 0;
  background: transparent; border: 0; border-radius: var(--r-md);
  color: var(--ink-soft); appearance: none; -webkit-appearance: none;
}
@media (hover: hover) {
  .savedrow .sv-del:hover { color: var(--ink-2); }
}
.savedrow .sv-del:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.savedrow .sv-del svg { width: 15px; height: 15px; display: block; }

.homerow {
  display: flex; gap: 10px; align-items: stretch;
  padding: 0;
}
.homerow .btn-solid {
  flex: 1; text-align: center;
  padding: 14px 18px; font-size: 15px;
}
.homerow .home-board {
  flex: none; width: 54px; padding: 0;
  display: grid; place-items: center;
}
.home-board svg { width: 22px; height: 22px; display: block; }
.homelinks { display: flex; gap: 18px; flex-wrap: wrap; }
.homelink {
  display: block;
  width: max-content;
  margin: 14px 0 0;
  text-align: start;
}
/* Особиста статистика — кутова іконка на головному екрані: одна дія, яка не
   мусить забирати рядок під назвою гри. */
.sheet:has(.homebrand) .sheet-in { position: relative; }
.homestat {
  position: absolute; top: 14px; inset-inline-end: 14px;
  width: 36px; height: 36px;
}
.homestat svg { width: 19px; height: 19px; }

/* ============ профіль ============
   Дзеркало до іконки статистики: там «як я граю», тут «хто я». */
.homeprof {
  position: absolute; top: 14px; inset-inline-start: 14px;
  width: 36px; height: 36px;
}
.homeprof svg { width: 19px; height: 19px; }
.profav-mini { font-size: 18px; line-height: 1; }

.profhead { display: flex; align-items: center; gap: 14px; margin: 2px 0 10px; }
.profhead .field { flex: 1 1 auto; min-width: 0; }
/* Шапка: значок і імʼя. Усе інше — під розділами, по одному за раз. */
.profcard {
  display: flex; align-items: center; gap: 14px;
  margin: 2px 0 14px;
}
.profwho {
  margin: 0; min-width: 0; font-family: var(--display); font-weight: 500;
  font-size: 20px; letter-spacing: -.02em; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc { border-top: 1px solid var(--line); }
.acc:last-of-type { border-bottom: 1px solid var(--line); }
.acc > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 2px;
  font-weight: 600; font-size: 14.5px; color: var(--ink);
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after {
  content: ""; flex: none; width: 9px; height: 9px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s ease;
}
.acc[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.acc > summary:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; border-radius: var(--r-sm); }
@media (hover: hover) {
  .acc > summary:hover { color: var(--red); }
  .acc > summary:hover::after { border-color: var(--red); }
}
.acc-in { padding: 2px 2px 16px; }
.acc-in > h4:first-child, .acc-in > .profsub:first-child { margin-top: 0; }
.profav {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--felt-line); color: var(--on-felt);
  font-family: var(--display); font-weight: 500; font-size: 24px;
  border: 1px solid var(--line);
}
.avgrid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  margin: 10px 0 12px;
  /* Набір той самий, що в рандомайзері, — сімдесят із гаком значків. Показуємо
     кілька рядів, решта прокручується всередині аркуша. */
  max-height: 208px; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px; scrollbar-width: thin;
}
.home-room .hr-seats {
  font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 500;
  font-size: .92em; margin-inline-start: 4px;
}
.avown { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.avown label {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
}
.avown input {
  width: 68px; text-align: center; font-size: 19px; line-height: 1;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--linen); color: var(--ink);
}
.avown .btn-line { padding: 8px 14px; font-size: 13px; }
.avpick {
  aspect-ratio: 1; display: grid; place-items: center;
  font-size: 19px; line-height: 1; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--linen-3); color: inherit; cursor: pointer;
}
.avpick.on { border-color: var(--brass); background: rgba(196,160,91,.14); }
@media (hover: hover) {
  .avpick:hover { border-color: var(--line); }
}
.avpick:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.profsub { margin: 18px 0 6px; }
.profsett .setrow { margin-bottom: 12px; }
.profsett .navsw { width: 100%; justify-content: space-between; padding: 0; }
.profcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px; letter-spacing: .08em; font-variant-numeric: tabular-nums;
  margin: 4px 0 10px; color: var(--ink);
}
.profxbtns { margin: 0 0 8px; flex-wrap: wrap; }
#profXtra .field + .profxbtns { margin-top: 12px; }
.profxbtns .btn-line, .profxbtns .btn-solid { padding: 8px 14px; font-size: 13px; }
.proflist { list-style: none; margin: 4px 0 12px; padding: 0; }
.proflist li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.proflist-l { font-weight: 600; }
.proflist-m { font-size: 12px; color: var(--ink-soft); margin-left: auto; }
.profthis {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brass); margin-left: 6px;
}
.profmini { padding: 4px 10px; font-size: 12px; }
.proferr { font-size: 13px; color: var(--red); min-height: 1.2em; margin: 4px 0 0; }
.profok { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; }
#profXtra .armed { background: var(--red); border-color: var(--red); color: #fff; }
/* Емодзі-аватар малюється шрифтом емодзі, тож дисплейний шрифт тут зайвий. */
.avatar.emoji { font-family: inherit; font-size: 18px; }
@media (max-width: 420px) {
  .avgrid { grid-template-columns: repeat(6, 1fr); }
}

/* ============ особиста статистика ============ */
.statgrid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 4px 0 16px;
}
.statbox {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--linen-3); padding: 10px 8px;
  display: grid; gap: 2px; justify-items: center; text-align: center;
}
.sb-v {
  font-family: var(--display); font-weight: 700; font-size: 20px;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.sb-l { font-size: 11px; color: var(--ink-soft); }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 0 0 14px; }
.stats-table th, .stats-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.stats-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); font-weight: 600;
}
.stats-table tbody th { text-align: start; font-weight: 600; }
.stats-table .c { text-align: end; font-variant-numeric: tabular-nums; width: 4.5em; }
.statkv { margin: 0 0 14px; }
@media (max-width: 420px) {
  .statgrid { grid-template-columns: repeat(2, 1fr); }
}
.homebtns .btn-solid,
.homebtns .btn-line {
  width: 100%;
  text-align: center;
  padding: 16px 20px;
  font-size: 16px;
}
.homebtns .home-invite .btn-solid,
.homebtns .home-invite .btn-line {
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
}
.btn-solid {
  background: var(--red); color: #FDF6EE; border: 1px solid var(--red);
  padding: 9px 20px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
@media (hover: hover) {
  .btn-solid:hover { background: var(--red-soft); }
}
.btn-solid.pending { background: var(--linen-3); color: var(--ink-2); border-color: var(--line); }
.btn-solid:disabled {
  opacity: .55;
  cursor: not-allowed;
}
@media (hover: hover) {
  .btn-solid:disabled:hover { background: var(--red); }
}
.waitnote { margin: 8px 0 0; font-size: 11px; line-height: 1.4; color: var(--ink-soft); }
.readybar {
  height: 3px; border-radius: 2px; margin: 10px 0 0;
  background: var(--linen-3); overflow: hidden;
}
.readybar i { display: block; height: 100%; background: var(--brass); width: 100%; }
.btn-line {
  background: transparent; border: 1px solid var(--line); color: var(--ink-2);
  padding: 9px 18px; border-radius: 999px; font-size: 14px;
}
@media (hover: hover) {
  .btn-line:hover { border-color: var(--ink-soft); }
}
.quitbtn { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.quitbtn.armed { background: var(--red); border-color: var(--red); color: #fff; }
.mode-join { display: block; width: 100%; margin-top: 8px; text-align: center; }

.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice button {
  border: 1px solid var(--line); background: var(--linen); border-radius: var(--r-md);
  padding: 10px 14px; text-align: left; min-width: 130px;
}
.choice button .t { display: block; font-weight: 600; font-size: 14px; }
.choice button .d { display: block; font-size: 11.5px; color: var(--ink-soft); }
.choice button[aria-pressed="true"] { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--linen)); }
.choice.off { opacity: .4; }
.choice.off button { cursor: not-allowed; }
.choice-note { font-size: 11px; line-height: 1.4; color: var(--ink-soft); margin: 8px 0 0; }
.choice-note.fun-note { color: var(--ink-2); }
.advline {
  display: flex; align-items: baseline; gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 16px;
}
.advsum {
  margin: 0; flex: 1 1 auto; min-width: 0;
  font-size: 12px; line-height: 1.4; color: var(--ink-soft);
}
.advtog {
  flex: none; background: none; border: 0; padding: 2px 0;
  font: inherit; font-size: 13px; color: var(--brass);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
@media (hover: hover) {
  .advtog:hover { color: var(--ink); }
}
.adv { margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 5px; max-width: 240px; }
.field label {
  display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin: 0 0 6px;
}
.field input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--linen); color: var(--ink);
}
.sheet .field { max-width: none; }
.namerow { display: flex; gap: 8px; align-items: stretch; }
.namerow input { flex: 1 1 auto; min-width: 0; width: auto; text-align: start; }
.name-dice {
  flex: none; width: 44px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--linen); color: var(--ink);
  font-size: 22px; line-height: 1;
}
@media (hover: hover) {
  .name-dice:hover { border-color: var(--ink-soft); }
}
.name-dice:active { background: var(--linen-3); }
.name-dice:disabled { opacity: .55; cursor: default; }
.name-spin {
  text-align: start;
  transform-origin: 0.8em center;
  animation: nameshake .1s linear infinite;
}
@keyframes nameshake {
  0%, 100% { transform: translateY(0); filter: blur(0); }
  50% { transform: translateY(-3px); filter: blur(.4px); }
}
@media (prefers-reduced-motion: reduce) {
  .name-spin { animation: none; }
}
.lobby-link { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.lobby-link input { flex: 1 1 140px; min-width: 0; font: inherit; padding: 9px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--linen); color: var(--ink); cursor: pointer; }
.lobby-link .btn-line { flex: none; }
.roomlink { display: grid; gap: 8px; }
.roomlink input { width: 100%; flex: none; }
.lobby-share {
  margin-top: 12px; display: flex; align-items: center; gap: 8px;
}
.lobby-share-url {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: 0;
  background: none; text-align: start; font: inherit; font-size: 12px;
  line-height: 1.35; color: var(--ink-soft); word-break: break-all; cursor: pointer;
}
.lobby-share .iconbtn { flex: none; }
.netbanner {
  position: sticky; top: 0; z-index: 40; padding: 8px 14px; text-align: center;
  background: var(--red); color: #FDF6EE; font-size: 13.5px; font-weight: 600;
}
.netbar {
  position: fixed; inset-inline: 0; top: 0; z-index: 80;
  padding: 7px 14px; text-align: center;
  font-size: 13px; font-weight: 600;
  background: var(--red); color: #fff;
  padding-top: calc(7px + env(safe-area-inset-top));
}
.netbar[hidden] { display: none !important; }

.tablewrap { overflow-x: auto; }
table.result { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.rowdetail { display: none; }
table.result th, table.result td { padding: 8px 6px; text-align: right; font-size: 13.5px; border-bottom: 1px solid var(--line); }
table.result th:first-child, table.result td:first-child { text-align: left; }
table.result thead th { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; }
td.delta { font-weight: 700; }
td.delta.pos { color: var(--good); }
td.delta.neg { color: var(--red); }
.note { font-size: 11.5px; color: var(--ink-soft); }
.won { font-family: var(--display); font-size: 15px; color: var(--brass); }

.rules-scroll { max-height: 60vh; overflow-y: auto; padding-inline-end: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.kv-names { grid-template-columns: minmax(8em, max-content) 1fr; align-items: start; }
.kv-names dt { min-width: 8em; }
.kv-names dt .nm-t, .kv-names dt .who, .kv-names dt .seat-name {
  overflow-wrap: break-word;
}

/* ============ адаптив ============ */
@media (max-width: 900px) {
  .lasttrick, .stock { display: none; }
  #tab-last { display: block; }
  .railtabs button { flex: 1 1 0; min-width: 0; padding-inline: 6px; text-align: center; }
  .board { grid-template-columns: 1fr; grid-template-rows: 1fr auto;
           padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  .card, .hand { --w: 78px; }
  .trumpbadge { position: static; align-self: center; margin-bottom: 6px; }
  .felt-center { flex-direction: column; padding-bottom: 12px; }

  /* шапка ховається під бургер */
  .topbar { position: relative; padding: 10px 14px; gap: 10px; align-items: center; flex-wrap: nowrap; }
  .brand { flex: none; }
  .credit {
    position: static; inset: auto; z-index: auto; bottom: auto;
    opacity: .35; color: var(--ink-soft); font-size: 11px; gap: 5px;
    white-space: nowrap; min-width: 0;
  }
  .burger { display: flex; margin-inline-start: 0; }
  .topnav .nav-main { gap: 8px; }
  .topnav .nav-main > #newBtn,
  .topnav .nav-main > #quitBtn {
    flex: 1 1 auto; width: auto; max-width: none;
    text-align: center; padding: 8px 10px; font-size: 13px;
  }
  .topnav {
    position: absolute; inset-inline: 8px; top: calc(100% + 6px); z-index: 20;
    flex-direction: column; align-items: stretch; gap: 12px; margin: 0; flex: none;
    padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg);
    background: var(--linen-2); box-shadow: var(--shadow-lift);
  }
  .topnav:not(.open) { display: none; }
  .actions {
    order: -1; margin: 0; width: 100%;
    flex-direction: column; align-items: stretch; gap: 10px;
  }
  .nav-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  }
  .nav-meta > #ibBtn {
    margin-inline-start: auto;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; font-size: 12.5px; line-height: 1.2;
  }
  .nav-meta > #ibBtn .ib-ico { flex: none; display: block; }
  .nav-main {
    display: flex; align-items: center; gap: 0; width: 100%;
  }
  .nav-main > #newBtn {
    box-sizing: border-box; text-align: center; padding: 8px 10px; font-size: 13px;
  }
  .actions .navlink { padding: 4px 0; font-size: 13px; }
  .status { flex-direction: column; gap: 2px; flex: none; }
  .status .s + .s::before { display: none; }

  /* місця гравців — один рядок; годинник компактний під ними */
  .seatrow {
    display: flex; flex-direction: column; align-items: stretch;
    padding: 10px 10px 0; gap: 4px;
  }
  .seats { flex-wrap: nowrap; gap: 6px; padding: 0; }
  .seat.matchclock {
    flex-direction: row; align-items: baseline; gap: 6px;
    align-self: start;
    flex: none;
    min-width: 0; padding: 2px 2px 0;
    border: 0; background: none;
    opacity: .5;
  }
  .matchclock-l { font-size: 10px; }
  .matchclock time, .dealcount-n { font-size: 12px; }
  .seat {
    min-width: 0; flex: 1 1 0; padding: 6px 8px; gap: 0 7px;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .avatar { width: 26px; height: 26px; font-size: 11px; }
  .who { font-size: 12px; }
  .who .nm { min-width: 0; }
  .sub, .seat-stats { font-size: 10px; }
  .seat-name, .nm-t { white-space: normal; overflow-wrap: anywhere; }
  .seat-stats { overflow: visible; text-overflow: clip; }

  /* рахунок і журнал згортаються; смуга завжди поза потоком, щоб стіл не скакав */
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--bar-h) + env(safe-area-inset-bottom));
    max-height: 85vh;
    display: flex; flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
    border-inline-start: 0; border-top: 1px solid var(--line);
    transition: height .32s cubic-bezier(.32, .72, .24, 1);
  }
  .rail.dragging, .rail.snap { transition: none; }
  .railbar {
    display: flex; touch-action: none; cursor: ns-resize;
    min-height: var(--bar-h); padding: 0 16px; align-items: center;
  }
  .sbar-list { gap: 10px; }
  .rail:not(.open) .railbody { display: none; }
  .rail.open {
    height: calc(var(--sheet-h, 320px) + env(safe-area-inset-bottom));
  }
  .rail.open .grip { display: block; }
  .rail.open .railbar { flex: none; }
  .rail.open .railbody {
    display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden;
  }
  .rail.open .logbox {
    max-height: none; flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .logbox { max-height: 200px; }
  body:has(#ptt:not([hidden])) .railbar {
    padding-inline-end: calc(var(--bar-h) + 16px);   /* 8 зазор + 8 відступ краю */
  }

  .meldshout { position: fixed; }
  .ms-card { padding: 16px 24px 18px; }
  .ms-value { font-size: 38px; }
  .ms-value .ms-sym { font-size: 42px; }
}
@media (max-width: 700px) {
  /* у підсумку лишаємо дві колонки: гравець і запис, решта — рядком під імʼям */
  table.result td.c, table.result th.c { display: none; }
  .rowdetail { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
  table.result th, table.result td { padding: 9px 4px; }
  .sheet-in { padding: 18px 16px 20px; }
  .sheet h3 { font-size: 19px; }
}
/* вирізи й домашня смужка на телефоні в режимі застосунку */
@media (max-width: 900px) {
  @supports (padding: max(0px)) {
    .topbar {
      padding-inline-start: max(14px, env(safe-area-inset-left));
      padding-inline-end: max(14px, env(safe-area-inset-right));
    }
    .seats {
      padding-inline-start: 0;
      padding-inline-end: 0;
    }
    .seatrow {
      padding-inline-start: max(8px, env(safe-area-inset-left));
      padding-inline-end: max(8px, env(safe-area-inset-right));
    }
    .handzone { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
    .rail { padding-bottom: env(safe-area-inset-bottom); }
    .topnav {
      inset-inline-start: max(8px, env(safe-area-inset-left));
      inset-inline-end: max(8px, env(safe-area-inset-right));
    }
    .settpanel { inset-inline-end: max(14px, env(safe-area-inset-right)); }
  }
}
@media (max-width: 560px) {
  .card, .hand { --w: 66px; }
  .hand { gap: 4px; }
  .brand { font-size: 17px; }
  .seat { padding: 5px 7px; grid-template-columns: minmax(0, 1fr); }
  .seat .avatar { display: none; }
  .seatrow { padding: 8px 8px 0; }
  .seats { padding: 0; }
  .seat.matchclock { padding: 2px 2px 0; }
  .hint { font-size: 12.5px; padding: 8px 11px; }
}

/* історія роздач у підсумку партії */
.hxwrap { overflow-x: auto; margin: 0 0 10px; }
.hxtable { border-collapse: collapse; width: 100%; font-size: 13px; }
.hxtable th, .hxtable td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.hxtable thead th {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; line-height: 1.25;
  overflow-wrap: anywhere;
}
.hxtable tbody th {
  text-align: start; font-weight: 600; color: var(--ink-soft);
  font-size: 12px; white-space: nowrap; padding-inline-end: 10px;
}
.hx-bid { display: block; font-size: 10.5px; font-weight: 400; color: var(--brass); }
.hxtable td { font-variant-numeric: tabular-nums; }
.hx-d { display: block; font-weight: 700; }
.hx-run { display: block; font-size: 11px; color: var(--ink-soft); }
.hx-pen { display: block; font-size: 10px; color: var(--red); }
.hx-dec { background: color-mix(in srgb, var(--brass) 12%, transparent); }
.hx-dash .hx-d { color: var(--ink-soft); }
.hx-neg .hx-d { color: var(--red); }
.hx-out { color: var(--ink-soft); }
.hx-note { font-size: 11px; line-height: 1.4; color: var(--ink-soft); margin: 0 0 4px; }
.hxfold { cursor: pointer; border-radius: var(--r-md); }
@media (hover: hover) {
  .hxfold:hover { outline: 1px solid var(--line); }
}
.sheet:has(#dailyFinish) .rules-scroll { max-height: none; overflow: visible; }
.sheet:has(#dailyFinish) .rowbtns { margin-top: 24px; }
#goFooter #dailyFinish { margin-top: 22px; }
#goFooter #dailyFinish .choice-note { margin-top: 12px; }
#goFooter #dailyFinish .rowbtns { margin-top: 16px; }
.dailytable th, .dailytable td { text-align: start; }
.dailytable th:nth-child(1), .dailytable td:nth-child(1) { width: 2em; text-align: center; color: var(--ink-soft); }
.dailytable th:nth-child(4), .dailytable td:nth-child(4),
.dailytable th:nth-child(5), .dailytable td:nth-child(5) { text-align: end; font-variant-numeric: tabular-nums; }
.dailytable tr.you th, .dailytable tr.you td { background: color-mix(in srgb, var(--brass) 12%, transparent); font-weight: 600; }
@media (max-width: 560px) {
  .hxtable { font-size: 12px; }
  .hxtable th, .hxtable td { padding: 4px 3px; }
  .hxtable tbody th { font-size: 11px; padding-inline-end: 5px; }
}

/* ─── банер встановлення ─── */
.ib {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: var(--linen-2); border-top: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  animation: ibup .28s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes ibup { from { transform: translateY(102%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .ib { animation: none; } }
.ib-in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.ib-icon {
  width: 44px; height: 44px; border-radius: 11px; flex: none;
  background: linear-gradient(160deg, var(--felt-2), var(--felt));
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.ib-icon span { font-family: var(--display); font-weight: 700; font-size: 13px; color: #EFE9DE; letter-spacing: -.03em; }
.ib-t { font-family: var(--display); font-weight: 700; font-size: 15px; margin: 0 0 2px; letter-spacing: -.01em; }
.ib-d { font-size: 12.5px; color: var(--ink-soft); margin: 0; }
.ib-x {
  background: transparent; border: 0; padding: 4px; margin: -4px -4px 0 0; color: var(--ink-soft);
  border-radius: 6px; line-height: 0;
}
@media (hover: hover) {
  .ib-x:hover { color: var(--ink); background: var(--linen-3); }
}
.ib-x svg { width: 16px; height: 16px; }
.ib-steps { grid-column: 1 / -1; margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ib-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.ib-steps .n {
  flex: none; width: 19px; height: 19px; border-radius: 50%; background: var(--linen-3);
  color: var(--ink-soft); font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.ib-steps svg { width: 15px; height: 15px; vertical-align: -3px; color: var(--brass); }
.ib-steps b { font-weight: 600; color: var(--ink); }
.ib-row { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 12px; }
.ib-go {
  background: var(--red); color: #fff; border: 1px solid var(--red); border-radius: 999px;
  padding: 9px 20px; font-weight: 600; font-size: 14px;
}
@media (hover: hover) {
  .ib-go:hover { background: var(--red-soft); border-color: var(--red-soft); }
}
.ib-later {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; font-size: 14px; color: var(--ink-2);
}
@media (hover: hover) {
  .ib-later:hover { border-color: var(--ink-soft); }
}

/* смуга згоди на кукі */
.cb {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 70;
  background: var(--linen-2); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(0,0,0,.10), 0 -18px 44px rgba(0,0,0,.14);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.cb-in {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cb-t { flex: 1 1 260px; min-width: 0; font-size: 13px; color: var(--ink-2); margin: 0; }
.cb-t a { color: var(--red); }
.cb-btns { display: flex; gap: 8px; flex: none; }
.cb-yes {
  background: var(--red); color: #fff; border: 1px solid var(--red);
  border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 14px;
}
@media (hover: hover) {
  .cb-yes:hover { background: var(--red-soft); border-color: var(--red-soft); }
}
.cb-no {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 14px; color: var(--ink-2);
}
@media (hover: hover) {
  .cb-no:hover { border-color: var(--ink-soft); }
}
@media (max-width: 520px) {
  .cb-btns { width: 100%; }
  .cb-btns button { flex: 1; }
}

.ptt {
  position: fixed;
  inset-inline-end: 8px;
  bottom: 0;
  z-index: 95; display: grid; place-items: center;
  width: var(--bar-h); height: var(--bar-h); padding: 0; border-radius: 50%;
  background: var(--card-face); color: var(--card-ink);
  border: 1px solid var(--card-edge); box-shadow: var(--shadow-lift);
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; touch-action: none;
  transform-origin: right bottom;
  transition: transform .18s ease, background .14s ease, color .14s ease, border-color .14s ease, opacity .18s ease;
}
.ptt[hidden] { display: none !important; }
.ptt svg { width: 28px; height: 28px; }
.ptt.on {
  background: var(--red); border-color: var(--red); color: #fff;
  transform: scale(2);
}
.ptt.muted {
  transform: scale(.82);
  opacity: .45;
  background: var(--linen-2);
  border-color: var(--line);
  color: var(--ink-soft);
  cursor: default;
  pointer-events: none;
  animation: none;
}
.ptt.muted.on { transform: scale(.82); }
.ptt.muted::after {
  content: "";
  position: absolute; inset-inline: 6px; top: 50%;
  height: 2px; background: var(--red); border-radius: 2px;
  transform: rotate(-14deg);
}
@media (max-width: 900px) {
  @supports (padding: max(0px)) {
    .ptt {
      bottom: env(safe-area-inset-bottom);
      inset-inline-end: max(8px, env(safe-area-inset-right));
    }
  }
}
#app:has(.rail.open) ~ .ptt { bottom: calc(12px + env(safe-area-inset-bottom)); }
body.sheet-open .ptt {
  bottom: calc(16px + env(safe-area-inset-bottom));
  inset-inline-end: 16px;
}

.seat.talking { border-color: var(--red); }
.seat.talking .avatar { position: relative; }
.seat.talking .avatar::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--red); animation: ring 1.2s ease-out infinite;
}
@keyframes ring {
  0%   { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}
.seat.talking .who::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--red); margin-inline-end: 6px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .ptt { transition: none; }
  .seat.talking .avatar::after, .seat.talking .who::before { animation: none; }
  .seat.talking .avatar::after { opacity: .8; }
  .hg, .hg-sand { animation: none !important; }
  .readybar i { transition: none !important; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(72px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 50;
  padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: var(--linen); font-size: 13px;
}
.toast[hidden] { display: none !important; }
.talkbar {
  position: fixed; inset-inline: 0; top: 0; z-index: 92;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: var(--red); color: #fff;
  font-size: 13px; font-weight: 600;
}
.talkbar[hidden] { display: none !important; }
.talkbar svg { width: 15px; height: 15px; }
.soundprompt {
  position: fixed; z-index: 95; pointer-events: auto;
  inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw;
  bottom: calc(76px + env(safe-area-inset-bottom));
  padding: 12px 22px; border-radius: 999px;
  background: var(--red); color: #fff; border: 0;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
}
.soundprompt[hidden] { display: none !important; }

/* iOS 26+ малює власний «живий» скляний градієнт поверх верхніх ~40pt вікна
   встановленого застосунку — і розмиває наш хедер. Вимкнути його не можна:
   це системна графіка над WebView, не наш backdrop-filter. Але якщо у самій
   верхівці вікна лежить пофарбований липкий шар, система бере з нього
   суцільний тон замість живого розмиття. Тож у застосунку робимо хедер
   sticky з тим самим фоном — висота й вигляд не міняються. Перевіряється
   лише на живому айфоні: ні симулятор, ні браузер цього не відтворюють. */
@media (display-mode: standalone) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: var(--linen-2);
  }
}

/* ============ журнал змін (/changelog/) ============ */
.brand a { color: inherit; text-decoration: none; }
body.log { min-height: 100vh; min-height: 100dvh; }
body.log .topbar { position: sticky; top: 0; z-index: 4; }
body.log .btn-ghost { margin-inline-start: auto; }
/* Текст для тих, хто без JS: роботи пошуковиків і ШІ читають саме його. */
.noscript-intro { max-width: 40rem; margin: 0 auto; padding: 28px 20px; color: var(--ink-2); }
.noscript-intro h1 { font-family: var(--display); font-size: 24px; margin: 0 0 12px; color: var(--ink); }
.noscript-intro p { margin: 0 0 12px; }
.noscript-intro ul { padding-inline-start: 1.2em; }
.noscript-intro li { margin: 0 0 6px; }

/* Сторінки правил і посібника користуються версткою журналу змін. */
.rules-toc { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 28px; font-size: 13.5px; }
.rules-toc a { color: var(--ink-2); }
.logpage table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 14px; }
.logpage table th, .logpage table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.logpage table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.logpage table td:last-child, .logpage table th:last-child { text-align: end; font-variant-numeric: tabular-nums; }
.logpage > section > article > ul { margin: 0 0 8px; padding-inline-start: 1.2em; color: var(--ink-2); }

.logpage { max-width: 40rem; margin: 0 auto; padding: 28px 20px 72px; }
.logpage > .credit {
  position: static; inset: auto; z-index: auto;
  color: var(--ink-soft); opacity: .55;
  margin: 0 0 18px;
}
.logpage > .credit:focus-within { opacity: 1; }
@media (hover: hover) {
  .logpage > .credit:hover { opacity: 1; }
}
.logpage > h1 {
  font-family: var(--display); font-size: 28px; font-weight: 700;
  letter-spacing: -.03em; margin: 0 0 10px; line-height: 1.15;
}
.logpage > .lede { color: var(--ink-2); margin: 0 0 28px; font-size: 12px; line-height: 1.4; }
.logpage .day { margin: 0 0 40px; }
.logpage .day h2 {
  font-family: var(--display); font-size: 12px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft);
  margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.logpage article { margin: 0 0 22px; }
.logpage article h3 {
  font-size: 17px; font-weight: 600; margin: 0 0 8px; letter-spacing: -.015em;
}
.logpage article p { margin: 0 0 8px; color: var(--ink-2); }
.logpage article p:last-child, .logpage article ul:last-child { margin-bottom: 0; }
.logpage article ul { margin: 0 0 8px; padding-inline-start: 1.2em; color: var(--ink-2); }
.logpage article li { margin: 0 0 4px; }
.logpage article li + li { margin-top: 4px; }
.logpage code {
  font-size: .92em; background: var(--linen-3); padding: 1px 5px; border-radius: 3px;
}
