/* Skat – styles. Mobile-first, no external fonts/images. Same look as the other games of the portal. */
:root {
  --felt: #166534; --felt-dark: #14532d; --ink: #1f2937; --paper: #fafaf9;
  --accent: #f59e0b; --red: #c81e1e; --black: #111827; --muted: #6b7280;
  --gap: 10px; --radius: 8px;
  --hcols: 5;                                                     /* hand: cards per row on phones */
  --cw5: calc((min(100vw, 980px) - 20px - 2 * var(--gap) - 4 * 6px) / 5);
  --cw: var(--cw5);
  --tw: clamp(46px, 14vw, 72px);                                  /* card width in the trick */
  --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: 8px var(--gap) 10px; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.toolbar { display: flex; flex-wrap: wrap; gap: 5px; }
.toolbar button, .actions button { font: inherit; font-size: .86rem; min-height: 36px; padding: 5px 9px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.18); color: #fff; cursor: pointer; }
.toolbar button[aria-pressed="true"] { background: var(--accent); color: #111; border-color: var(--accent); }
.toolbar button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 420px) { .toolbar button { font-size: .78rem; padding: 4px 7px; } }
.info { display: flex; justify-content: space-between; gap: 8px; margin: 6px 2px 4px; font-size: .85rem; height: 1.45em; }
.info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#contract-info { font-weight: 700; flex: 0 1 auto; }
#my-role { flex: 0 1 auto; text-align: right; }

.table { display: grid; grid-template-columns: 82px 1fr 82px; gap: 6px; }
.p { background: rgba(0,0,0,.18); border: 2px solid transparent; border-radius: 10px; padding: 4px 6px; font-size: .8rem; line-height: 1.3; min-width: 0; }
.p.is-turn { border-color: var(--accent); }
.p-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-role { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; min-height: 1.35em; padding: 0 5px; border-radius: 6px; font-weight: 700; font-size: .74rem; }
.p-role:empty { padding: 0; }
.p-role.bid { background: #fde047; color: #111; }
.p-role.bid.passed { background: rgba(255,255,255,.25); color: #fff; }
.p-role.decl { background: #fde047; color: #111; }
.p-role.def { background: #93c5fd; color: #111; }
.p-info { opacity: .85; font-size: .74rem; }
#seat-1, #seat-2 { align-self: start; min-height: 96px; }
#seat-1 .p-name, #seat-2 .p-name { white-space: normal; }
.trick { position: relative; height: calc(var(--tw) * 1.4 * 2 + 50px); min-height: 200px; border-radius: 12px; background: rgba(0,0,0,.12); cursor: default; }
.trick.pending { cursor: pointer; }
.band { position: absolute; left: 4px; right: 4px; top: 4px; height: calc(var(--tw) * .55 * 1.4); display: flex; justify-content: center; gap: 2px; pointer-events: none; }
.band.skat { gap: 6px; }
.band .card.tiny { --cw: calc(var(--tw) * .55); margin-left: calc(var(--tw) * -.16); }
.band .card.tiny:first-child { margin-left: 0; }
.slot { position: absolute; width: var(--tw); height: calc(var(--tw) * 1.4); }
.slot-0 { left: 50%; bottom: 4px; transform: translateX(-50%); }
.slot-1 { left: 6px; top: calc(var(--tw) * .55 * 1.4 + 10px); }
.slot-2 { right: 6px; top: calc(var(--tw) * .55 * 1.4 + 10px); }
.slot.winner .card { box-shadow: 0 0 0 4px var(--accent), 0 6px 14px rgba(0,0,0,.35); }
.me { display: flex; align-items: center; gap: 8px; margin-top: 6px; height: 46px; }
#seat-0 { flex: 1 1 auto; display: flex; gap: 8px; align-items: center; overflow: hidden; height: 44px; }
#seat-0 .p-name { flex: 0 0 auto; overflow: visible; }
#seat-0 .p-info { white-space: nowrap; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.actions { display: flex; gap: 6px; flex: 0 0 auto; }
.actions button { font-weight: 700; background: var(--accent); color: #111; border-color: var(--accent); min-height: 44px; }
.actions button:disabled { opacity: .5; }
.actions .invisible { display: none; }
.invisible { visibility: hidden; }
.status { height: 3em; overflow: hidden; margin: 6px 0; text-align: center; font-size: .9rem; line-height: 1.4; background: rgba(0,0,0,.2); border-radius: 8px; padding: 3px 8px; }
.p.is-dealer .p-name::after { content: " · " attr(data-d); font-weight: 400; font-size: .85em; opacity: .85; }

/* ---------------------------------------------------------------- hand --- */
.hand { display: grid; grid-template-columns: repeat(var(--hcols), var(--cw)); gap: 6px; justify-content: center;
  height: calc(var(--cw5) * 1.4 * 2 + 16px); padding-top: 4px; align-content: start; }
.hand.many { --hcols: 6; --cw: calc((min(100vw, 980px) - 20px - 2 * var(--gap) - 5 * 6px) / 6); }
.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; text-align: left; cursor: default;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s; }
.card.small { --cw: var(--tw); }
.card.back { background: repeating-linear-gradient(45deg, #1e3a8a 0 4px, #1d4ed8 4px 8px); border: 2px solid #fff; }
button.card { cursor: pointer; }
.card.s2, .card.s3 { color: var(--red); }
body.deck-four .card.s1 { color: #15803d; }
body.deck-four .card.s3 { color: #b45309; }
.c-corner { position: absolute; top: 4%; left: 8%; font-weight: 800; font-size: calc(var(--cw) * .27); line-height: .95; text-align: center; display: flex; flex-direction: column; align-items: center; }
.c-pip { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(var(--cw) * .5); padding-top: 22%; line-height: 1; }
.c-pip b { font-size: .62em; margin-bottom: 2px; }
.c-sym svg { display: block; width: .95em; height: .95em; }
.c-corner .c-sym svg { width: .9em; height: .9em; margin-top: 1px; }
body.deck-german .card { color: #1f2937; }
body.deck-german .card.s0 .c-corner, body.deck-german .card.s0 .c-pip b { color: #5b3a1a; }
body.deck-german .card.s1 .c-corner, body.deck-german .card.s1 .c-pip b { color: #166534; }
body.deck-german .card.s2 .c-corner, body.deck-german .card.s2 .c-pip b { color: #b91c1c; }
body.deck-german .card.s3 .c-corner, body.deck-german .card.s3 .c-pip b { color: #92400e; }
.card.tiny .c-pip { display: none; }
.card.tiny .c-corner { font-size: calc(var(--cw) * .36); left: 6%; }
.card.trump::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 5%; height: 5px; border-radius: 3px; background: #d97706; }
.card.legal { transform: translateY(-3px); box-shadow: 0 0 0 3px #86efac, 0 6px 12px rgba(0,0,0,.3); }
.card.illegal { opacity: .45; filter: grayscale(.35); }
.card.selected { transform: translateY(-6px); box-shadow: 0 0 0 4px var(--accent), 0 8px 14px rgba(0,0,0,.3); }
.card.flash { animation: flash .9s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 5px #fde047; } 100% { box-shadow: 0 0 0 3px #86efac; } }
button:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }

/* -------------------------------------------------------------- dialogs --- */
dialog { border: 0; border-radius: 14px; padding: 18px; max-width: min(520px, 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: 40px; max-width: 62%; }
dialog input[type="checkbox"], dialog input[type="radio"] { width: 22px; height: 22px; flex: 0 0 auto; margin: 0; }
dialog fieldset { border: 1px solid #e5e7eb; border-radius: 8px; margin: 10px 0; }
.act { font: inherit; font-weight: 700; min-height: 46px; border: 0; border-radius: 10px; background: var(--felt); color: #fff; cursor: pointer; padding: 8px 16px; }
.act:disabled { opacity: .5; cursor: not-allowed; }
.dlg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dlg-actions button:not(.act) { font: inherit; min-height: 46px; padding: 8px 14px; border-radius: 10px; color: var(--ink); background: #f3f4f6; border: 1px solid #d1d5db; cursor: pointer; }
.muted { color: var(--muted); font-size: .9rem; }
.warn { color: #b91c1c; font-weight: 700; font-size: .9rem; min-height: 0; margin: 6px 0 0; }
.warn:empty { display: none; }
/* bidding / skat / announcement: non-modal, sits over the table so the hand stays visible below */
#dlg-bid, #dlg-skat, #dlg-declare { position: absolute; z-index: 5; top: 96px; left: 8px; right: 8px; width: auto; margin: 0 auto; max-width: 480px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
#dlg-bid h2, #dlg-skat h2, #dlg-declare h2 { font-size: 1.1rem; }
#dlg-bid p, #dlg-skat p { margin: 4px 0; }
#dlg-declare { top: 56px; max-height: calc(100vh - 70px); overflow: auto; }
.decl-games { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.decl-games label { margin: 5px 0; justify-content: flex-start; gap: 8px; }
.decl-games label .v { color: var(--muted); font-size: .85rem; margin-left: auto; }
.decl-games input:disabled + span { opacity: .45; }
#decl-ann label { margin: 6px 0; }
.res-contract { font-weight: 700; margin: 0 0 6px; }
.res-calc { margin: 6px 0; font-size: .95rem; }
.res-items { list-style: none; padding: 0; margin: 8px 0; }
.res-items li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #eee; padding: 3px 0; }
.res-points, .score, .stats-table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.res-points th, .res-points td, .score th, .score td, .stats-table th, .stats-table td { border-bottom: 1px solid #e5e7eb; padding: 4px 5px; text-align: right; vertical-align: top; }
.res-points td small, .score td small { display: block; color: var(--muted); font-size: .75rem; font-weight: 400; }
td.pos { color: #15803d; font-weight: 700; }
td.neg { color: #b91c1c; font-weight: 700; }
.score .g-type, .score th:nth-child(2), .res-points th:first-child { text-align: left; }
.score-wrap { max-height: 60vh; overflow: auto; }
.stats-table th:first-child { text-align: left; }
.last-row { display: flex; gap: 10px; flex-wrap: wrap; }
.last-card { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .85rem; --tw: 56px; }
.last-card.winner .card { box-shadow: 0 0 0 4px var(--accent); }

/* -------------------------------------------------------------- content --- */
.content { background: #fff; border-radius: 14px; padding: 14px 18px; margin-top: 16px; }
.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; }
.content table { border-collapse: collapse; width: 100%; font-size: .95rem; margin: 8px 0; }
.content th, .content td { border: 1px solid #e5e7eb; padding: 5px 8px; text-align: left; vertical-align: top; }
.content thead th { background: #f0fdf4; }
.table-wrap { overflow-x: auto; }
.lead { font-size: 1.02rem; }
.example { background: #f0fdf4; border-left: 4px solid var(--felt); padding: 8px 12px; border-radius: 6px; }
.site-footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 10px 10px 30px; }
/* nothing jumps while the scripts start: the board is filled before it is shown */
.game:not(.ready) .table, .game:not(.ready) .hand, .game:not(.ready) .me { visibility: hidden; }

/* --------------------------------------------------------------- desktop --- */
@media (min-width: 900px) {
  :root { --hcols: 12; --cw5: 72px; --cw: 72px; --tw: 72px; }
  .hand.many { --hcols: 12; --cw: 72px; }
  .hand { height: calc(72px * 1.4 + 14px); }
  .table { grid-template-columns: 160px 1fr 160px; }
  #seat-1, #seat-2 { min-height: 110px; font-size: .9rem; }
  .trick { height: 270px; }
  .status { font-size: 1rem; }
  #dlg-bid, #dlg-skat { top: 120px; }
}

/* ------------------------------------------------- senior / large cards --- */
body.senior { font-size: 19px; --tw: clamp(50px, 15vw, 80px); }
/* phones: cards already fill the width (5 per row), so senior mode enlarges the indices */
body.senior .c-corner { font-size: calc(var(--cw) * .38); left: 7%; }
body.senior .c-pip { font-size: calc(var(--cw) * .58); padding-top: 42%; }
body.senior .c-pip b { display: none; }
body.senior .card { border: 2px solid #000; }
body.senior .card.back { border-color: #fff; }
body.senior .card.s2, body.senior .card.s3 { color: #b00000; }
body.senior.deck-four .card.s3 { color: #9a3412; }
body.senior.deck-four .card.s1 { color: #166534; }
body.senior .game { background: #0b3d1f; }
body.senior .status { font-size: 1.02rem; background: #000; }
body.senior .p { font-size: .88rem; }
@media (min-width: 900px) {
  body.senior { --hcols: 6; --cw5: 96px; --cw: 96px; --tw: 86px; }
  body.senior .hand.many { --hcols: 6; --cw: 96px; }
  body.senior .hand { height: calc(96px * 1.4 * 2 + 16px); }
  body.senior .trick { height: 300px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.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; } }

/* ---------------------------------------------------------- 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; } }
