/* Schwimmen (31) – styles. Mobile-first, no external fonts/images. */
:root {
  --felt: #166534; --felt-dark: #14532d; --ink: #1f2937; --paper: #fafaf9;
  --accent: #f59e0b; --red: #c81e1e; --black: #111827; --muted: #6b7280;
  --cw: clamp(62px, 19vw, 92px);          /* card width */
  --ch: calc(var(--cw) * 1.4);            /* card height */
  --mw: clamp(22px, 6vw, 30px);           /* mini card width */
  --radius: 10px; --gap: clamp(8px, 2.5vw, 14px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: #f3f4f1; }
a { color: #166534; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.site-header { display: flex; align-items: baseline; gap: 10px; padding: 8px 14px; background: var(--felt-dark); color: #fff; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.brand-sub { font-size: .8rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { max-width: 980px; margin: 0 auto; padding: 0 10px 24px; }
h1 { font-size: clamp(1.05rem, 4.2vw, 1.6rem); line-height: 1.25; margin: 10px 2px 8px; }

/* ---------------------------------------------------------------- table --- */
.game {
  position: relative; background: radial-gradient(ellipse at center, #1d7a42 0%, var(--felt) 55%, var(--felt-dark) 100%);
  color: #fff; border-radius: 16px; padding: 10px var(--gap) 12px; box-shadow: 0 4px 18px rgba(0,0,0,.18);
  min-height: 560px; /* reserved so the JS render never shifts the layout */
}
.toolbar { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
@media (max-width: 420px) { .toolbar button { font-size: .78rem; padding: 5px 7px; } }
.toolbar button, .dlg-actions button:not(.act) {
  font: inherit; font-size: .85rem; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.18); color: #fff; cursor: pointer; min-height: 36px;
}
.toolbar button[aria-pressed="true"] { background: var(--accent); color: #111; border-color: var(--accent); }
.round { margin-left: auto; font-size: .8rem; opacity: .75; }

.opponents { display: flex; justify-content: center; gap: var(--gap); margin: 10px 0 4px; min-height: 86px; flex-wrap: nowrap; }
.opp { flex: 1 1 0; max-width: 200px; min-width: 0; text-align: center; padding: 6px 4px; border-radius: 10px; background: rgba(0,0,0,.14); border: 2px solid transparent; transition: border-color .2s; }
.opp.is-turn, .player.is-turn { border-color: var(--accent); }
.opp.is-out { opacity: .45; }
.opp-head { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-cards { display: flex; justify-content: center; gap: 3px; margin-top: 4px; min-height: calc(var(--mw) * 1.4); }
.lives { font-size: .85rem; color: #fecaca; letter-spacing: 1px; min-height: 1.3em; }
.badge { display: inline-block; font-size: .65rem; font-weight: 700; text-transform: uppercase; background: rgba(255,255,255,.2); border-radius: 6px; padding: 0 5px; margin-left: 4px; vertical-align: middle; }
.badge.knock { background: var(--accent); color: #111; }

.table-area { text-align: center; margin-top: 6px; }
.row-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin-bottom: 4px; }
.cards { display: flex; justify-content: center; gap: var(--gap); min-height: var(--ch); }

.status { min-height: 3.2em; margin: 8px 0; text-align: center; font-size: .92rem; line-height: 1.4; background: rgba(0,0,0,.2); border-radius: 8px; padding: 6px 8px; }

.player { border: 2px solid transparent; border-radius: 12px; padding: 6px 4px 8px; background: rgba(0,0,0,.1); }
.player-head { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; margin-bottom: 6px; min-height: 1.6em; }
.score { font-weight: 700; background: #fff; color: var(--felt-dark); border-radius: 999px; padding: 0 10px; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.act { font: inherit; font-weight: 700; font-size: .95rem; min-height: 46px; border: 0; border-radius: 10px; background: #fff; color: var(--felt-dark); cursor: pointer; padding: 6px 8px; }
.act-knock { background: var(--accent); color: #111; }
.act:disabled, .toolbar button:disabled { opacity: .45; cursor: not-allowed; }
.keys { font-size: .75rem; opacity: .7; text-align: center; margin: 8px 0 0; }
@media (hover: none) { .keys { display: none; } }
button:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }

/* ---------------------------------------------------------------- cards --- */
.card {
  position: relative; display: inline-block; width: var(--cw); height: calc(var(--cw) * 1.4); flex: 0 0 auto;
  border-radius: var(--radius); background: var(--paper); color: var(--black); border: 1px solid #d6d3d1;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); padding: 0; font: inherit; cursor: default;
  transition: transform .18s ease, box-shadow .18s ease;
}
button.card { cursor: pointer; }
button.card:disabled { cursor: default; opacity: 1; }
.card.red { color: var(--red); }
.c-corner { position: absolute; top: 5%; left: 8%; font-weight: 700; font-size: calc(var(--cw) * .24); line-height: 1; text-align: center; }
.c-pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--cw) * .55); padding-top: 12%; }
.card.selected { transform: translateY(-10px); box-shadow: 0 0 0 4px var(--accent), 0 8px 14px rgba(0,0,0,.3); }
.card.flash { animation: flash 1s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 5px #fde047; } 100% { box-shadow: 0 2px 6px rgba(0,0,0,.25); } }
.card.back { background: repeating-linear-gradient(45deg, #1e3a8a 0 4px, #1d4ed8 4px 8px); border: 2px solid #fff; }
.card.mini { --cw: var(--mw); border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.card.mini .c-corner { font-size: calc(var(--mw) * .36); top: 4%; left: 6%; }
.card.mini .c-pip { font-size: calc(var(--mw) * .5); padding-top: 30%; }
.card.mini.back { border-width: 1px; }

/* ----------------------------------------------------------- dialogs ----- */
dialog { border: 0; border-radius: 14px; padding: 18px; max-width: min(460px, 94vw); width: 100%; color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 8px; font-size: 1.2rem; }
dialog label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0; }
dialog label.check { justify-content: flex-start; }
dialog select { font: inherit; padding: 4px 8px; min-height: 36px; }
dialog input[type="checkbox"] { width: 22px; height: 22px; }
dialog fieldset { border: 1px solid #e5e7eb; border-radius: 8px; margin: 10px 0; }
dialog .act { background: var(--felt); color: #fff; padding: 8px 16px; }
.dlg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.dlg-actions button:not(.act) { color: var(--ink); background: #f3f4f6; border-color: #d1d5db; }
.round-list { list-style: none; padding: 0; margin: 10px 0; }
.round-list li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name cards" "score score"; gap: 2px 8px; padding: 6px 8px; border-radius: 8px; }
.round-list li.lost { background: #fee2e2; }
.res-name { grid-area: name; font-weight: 700; }
.res-cards { grid-area: cards; display: flex; gap: 3px; --mw: 26px; }
.res-score { grid-area: score; font-size: .9rem; }
.round-final { font-weight: 700; font-size: 1.05rem; }
.stats-list { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.stats-list dd { margin: 0; font-weight: 700; text-align: right; }

/* ------------------------------------------------------------- ad slots --- */
/* Fixed reserved heights → CLS stays 0 whether or not an ad fills the slot. */
.ad-slot { display: block; width: 100%; margin: 16px auto; background: #ebebe6; border-radius: 8px; contain: strict; }
.ad-slot--game { height: 280px; max-width: 728px; }
.ad-slot--content { height: 280px; max-width: 336px; }
@media (min-width: 768px) { .ad-slot--game { height: 90px; } }

/* -------------------------------------------------------------- content --- */
.content { background: #fff; border-radius: 14px; padding: 14px 18px; margin-top: 4px; }
.content h2 { font-size: 1.3rem; margin: 22px 0 8px; color: var(--felt-dark); }
.content h3 { font-size: 1.05rem; margin: 16px 0 4px; }
.content li { margin: 6px 0; }
.lead { font-size: 1.02rem; }
.values { border-collapse: collapse; margin: 8px 0; min-width: 260px; }
.values caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.values th, .values td { border: 1px solid #e5e7eb; padding: 5px 10px; text-align: left; }
.site-footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 10px 10px 30px; }

/* -------------------------------------------------------------- desktop --- */
@media (min-width: 768px) {
  .game { padding: 14px 24px 16px; min-height: 600px; }
  .opponents { margin-top: 14px; }
  .actions { max-width: 520px; margin-left: auto; margin-right: auto; }
}
@media (orientation: landscape) and (max-height: 500px) {
  :root { --cw: clamp(48px, 11vh, 70px); }
  .game { min-height: 0; }
  h1 { font-size: 1rem; margin: 4px; }
}

/* ------------------------------------------------- senior / large cards --- */
body.senior { font-size: 19px; }
body.senior { --cw: clamp(84px, 27vw, 130px); --mw: clamp(28px, 8vw, 38px); }
body.senior .card { border: 2px solid #000; }
body.senior .card.red { color: #b00000; }
body.senior .card.back { border-color: #fff; }
body.senior .game { background: #0b3d1f; }
body.senior .status { font-size: 1.05rem; background: #000; }
body.senior .act { min-height: 56px; font-size: 1.1rem; }
body.senior .lives { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------- language switch --- */
.site-header { display: flex; align-items: center; }
.site-header .brand-sub { flex: 1 1 auto; min-width: 0; }
.site-header .lang-switch { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.site-header .lang-switch a,
.site-header .lang-switch a:link,
.site-header .lang-switch a:visited {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  min-width: 52px; min-height: 44px; padding: 0 14px; border: 2px solid #ffffff; border-radius: 999px;
  background: transparent; color: #ffffff; font: 700 17px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: .04em; text-decoration: none;
}
.site-header .lang-switch a:hover { background: rgba(255,255,255,.18); color: #ffffff; text-decoration: none; }
.site-header .lang-switch a[aria-current="page"],
.site-header .lang-switch a[aria-current="page"]:link,
.site-header .lang-switch a[aria-current="page"]:visited,
.site-header .lang-switch a[aria-current="page"]:hover { background: #ffffff; color: #14532d; border-color: #ffffff; }
.site-header .lang-switch a:focus-visible { outline: 3px solid #fde047; outline-offset: 3px; }
@media (max-width: 400px) { .site-header .brand-sub { display: none; } }
