/* Solitär – 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: #fdfdfb; --accent: #f59e0b; --red: #c81e1e; --black: #111827; --muted: #6b7280;
  --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 { background: radial-gradient(ellipse at center, #1d7a42 0%, var(--felt) 55%, var(--felt-dark) 100%); color: #fff;
  border-radius: 16px; padding: 8px 8px 10px; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.toolbar { display: flex; flex-wrap: wrap; gap: 5px; }
.toolbar button { font: inherit; font-size: .86rem; min-height: 38px; padding: 5px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.18); color: #fff; cursor: pointer; }
.toolbar button.main { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; }
.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: .8rem; padding: 4px 8px; } }
.info { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; margin: 6px 2px; font-size: .9rem; height: 1.5em; white-space: nowrap; overflow: hidden; }
.info .stat b { font-variant-numeric: tabular-nums; font-size: 1.05em; display: inline-block; text-align: right; min-width: 3ch; }
#time { min-width: 4.4ch !important; } #score { min-width: 5ch !important; }
#game-no { opacity: .85; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.info .stats { display: flex; gap: 12px; flex: 0 0 auto; }

/* The board has a fixed aspect ratio, so nothing below it moves when the cards are laid out (CLS = 0). */
.board { position: relative; width: 100%; aspect-ratio: 1 / 1.25; margin: 0 auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overflow: hidden; }
@media (min-width: 600px) { .board { max-width: 700px; aspect-ratio: 1 / .92; } }
@media (min-width: 600px) and (max-height: 760px) { .board { max-width: 600px; } }
@media (orientation: landscape) and (max-height: 520px) { .board { max-width: 480px; } }
.slot { position: absolute; left: 0; top: 0; width: var(--cw, 13%); height: var(--ch, 18%); border-radius: 7px; border: 2px dashed rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.35); font-size: calc(var(--cw, 40px) * .5); touch-action: none; }
.slot-f::after { content: attr(data-suit); }
/* slots stay invisible until game.js has laid them out (appearing ≠ shifting → CLS stays 0) */
.board:not(.ready) .slot { visibility: hidden; }
#slot-s { cursor: pointer; border-style: solid; }
#slot-s.recycle::after { content: "↻"; color: rgba(255,255,255,.75); font-size: calc(var(--cw, 40px) * .7); }
#slot-s.empty::after { content: "✕"; }
.slot.hint { border-color: #fde047; color: #fde047; box-shadow: 0 0 0 3px #fde047; }

.card { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); border-radius: 7px; background: var(--paper); color: var(--black);
  border: 1px solid #c9c7c2; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s ease; will-change: transform; cursor: pointer; touch-action: none; overflow: hidden; }
.card.red { color: var(--red); }
.c-idx { position: absolute; top: 2%; left: 6%; font-weight: 800; font-size: calc(var(--cw) * .31); line-height: 1; letter-spacing: -.03em; white-space: nowrap; }
.c-idx b { font-weight: 400; margin-left: 1px; }
.c-big { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-size: calc(var(--cw) * .58); line-height: 1; }
.card.down { background: repeating-linear-gradient(45deg, #1e40af 0 5px, #1d4ed8 5px 10px); border: 2px solid #fff; cursor: default; }
.card.down > * { display: none; }
.board.no-anim .card { transition: none; }
.card.dragging { transition: none; box-shadow: 0 10px 22px rgba(0,0,0,.45); cursor: grabbing; }
.card.hint { box-shadow: 0 0 0 3px #fde047, 0 4px 10px rgba(0,0,0,.35); }
.card.shake { animation: shake .35s ease; }
@keyframes shake { 0%, 100% { margin-left: 0; } 25% { margin-left: -5px; } 75% { margin-left: 5px; } }
#win-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 900; pointer-events: none; }
.status { height: 2.9em; margin: 6px 0 0; text-align: center; font-size: .9rem; line-height: 1.4; background: rgba(0,0,0,.2); border-radius: 8px; padding: 3px 8px; overflow: hidden; }

/* -------------------------------------------------------------- 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 10px; font-size: 1.25rem; }
dialog label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0; }
dialog label.check { justify-content: flex-start; }
dialog select { font: inherit; padding: 4px 8px; min-height: 42px; }
dialog input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; }
.act { font: inherit; font-weight: 700; min-height: 46px; border: 0; border-radius: 10px; background: var(--felt); color: #fff; cursor: pointer; padding: 8px 16px; }
.dlg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.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; }
.win-table, .stats-table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.win-table th, .win-table td, .stats-table th, .stats-table td { border-bottom: 1px solid #e5e7eb; padding: 5px 6px; text-align: right; }
.win-table th, .stats-table th[scope="row"] { text-align: left; font-weight: 400; }
.win-table tr.total td, .win-table tr.total th { font-size: 1.15rem; font-weight: 700; }
.record { color: #b45309; font-weight: 700; font-size: 1.1rem; margin: 10px 0 0; }
.stats-wrap { overflow-x: auto; }

/* ------------------------------------------------------------- ad slots --- */
.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; }
.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; }
.site-footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 10px 10px 30px; }

/* ------------------------------------------------- senior / large cards --- */
body.senior { font-size: 19px; }
body.senior .c-idx { font-size: calc(var(--cw) * .42); top: 1%; left: 4%; letter-spacing: -.06em; }
body.senior .c-idx b { margin-left: 0; }
body.senior .c-big { font-size: calc(var(--cw) * .5); }
body.senior .card { border: 2px solid #000; }
body.senior .card.red { color: #b00000; }
body.senior .card.down { border-color: #fff; }
body.senior .game { background: #0b3d1f; }
body.senior .status { background: #000; font-size: 1rem; }
body.senior .info { font-size: 1rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
button:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }
@media (max-width: 420px) { .info { font-size: .8rem; gap: 8px; } .info .stats { gap: 8px; } }

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