/* Abeceo: wspólny system wizualny. Opis klas i zasad: DESIGN.md, sekcja „System UI (ui.css, ui.mjs)”. */

:root {
  --c-table: #1f3b33;
  --c-table-deep: #162b25;
  --c-table-raise: #234338;
  --c-table-line: rgba(246, 241, 230, .14);
  --c-on-table: #f6f1e6;
  --c-on-table-muted: #b9c7bf;
  --c-paper: #f6f1e6;
  --c-paper-clean: #fffdf8;
  --c-paper-sunk: #efe8d8;
  --c-line: #dcd3c1;
  --c-field-line: #8f8572;
  --c-ink: #24302c;
  --c-muted: #59645f;
  --c-btn: #e4ddcc;
  --c-yellow: #f2c94c;
  --c-yellow-tint: #fbefc4;
  --c-green: #6fbf73;
  --c-blue: #5aa7e0;
  --c-red: #e5675b;
  --c-wood: #7a5a3a;
  --c-wood-hi: #8a6744;
  --c-wood-lo: #5c4229;
  --c-on-wood: #fff6ea;
  --c-blank: #fbf8f0;
  --c-danger: #b3261e;
  --c-err: #9b1c13;
  --c-err-bg: #fbe3df;
  --c-ok: #1d6b34;
  --c-ok-bg: #e3f1e1;
  --c-info: #1f5c8a;
  --c-info-bg: #e3eef8;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-md: .9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 18px;
  --sp-5: 24px;
  --sp-6: 34px;

  --r-tile-sm: 4px;
  --r-tile: 7px;
  --r-control: 10px;
  --r-panel-sm: 12px;
  --r-panel: 16px;
  --r-feature: 26px;

  --sh-inset: inset 0 -3px 0 rgba(0, 0, 0, .16);
  --sh-reading: 0 18px 50px rgba(0, 0, 0, .22);
  --sh-lift: 0 14px 40px rgba(0, 0, 0, .38);

  --focus-outer: var(--c-yellow);
 

  --top-h: 0px;
  --page-max: 1120px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--c-table); scrollbar-color: rgba(246, 241, 230, .25) var(--c-table); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-table); color: var(--c-on-table); font: 400 var(--fs-md)/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul.plain, ol.plain { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
svg { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
table { border-collapse: collapse; }

:focus { outline: none; }
::selection { background: var(--c-yellow); color: var(--c-ink); }
:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 2px; }
.panel, .paper, .dialog, .on-paper, .alert { --focus-outer: var(--c-ink); }
.on-table, .panel.is-table, .feature-art { --focus-outer: var(--c-yellow); }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 8px; top: 8px; z-index: 1000; padding: 10px 14px; border-radius: var(--r-control); background: var(--c-yellow); color: var(--c-ink); font-weight: 700; text-decoration: none; transform: translateY(-160%); }
.skip:focus-visible { transform: none; --focus-outer: var(--c-paper); }

/* Typografia */
.display { font-size: clamp(2.25rem, 6vw, 4.5rem); font-weight: 800; line-height: .95; letter-spacing: -.04em; }
.h1 { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.h2 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.h3 { font-size: var(--fs-md); font-weight: 700; line-height: 1.3; }
.label { font-size: var(--fs-xs); font-weight: 600; line-height: 1.35; letter-spacing: .06em; text-transform: uppercase; }
.muted { color: var(--c-muted); }
.on-table .muted, .panel.is-table .muted, .page-head .muted { color: var(--c-on-table-muted); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.center { text-align: center; }
.right { text-align: right; }
.link { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link:hover { text-decoration-thickness: 2px; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: var(--fs-sm); color: inherit; text-decoration: none; }
.link-more::after { content: "›"; font-size: 1.25em; line-height: 1; }
.link-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose { max-width: 68ch; font-size: 1rem; line-height: 1.6; }
.prose > * + * { margin-top: .9em; }
.prose h2 { margin-top: 1.8em; font-size: var(--fs-xl); line-height: 1.2; letter-spacing: -.015em; }
.prose h3 { margin-top: 1.4em; font-size: var(--fs-lg); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose a { font-weight: 600; text-underline-offset: 3px; }
.prose code { background: var(--c-paper-clean); border: 1px solid var(--c-line); border-radius: 4px; padding: 0 4px; font-size: .92em; }
.toc { display: grid; gap: 2px; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--c-line); background: var(--c-paper-sunk); border-radius: var(--r-control); }
.toc a { padding: 4px 0; text-decoration: none; font-weight: 600; }
.toc a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Układ */
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: var(--sp-3) var(--sp-3) var(--sp-5); display: grid; gap: var(--sp-3); align-content: start; }
.page.is-narrow { --page-max: 720px; }
.page.is-read { --page-max: 860px; }
.layout { display: grid; gap: var(--sp-3); align-items: start; }
.layout > * { min-width: 0; display: grid; gap: var(--sp-3); align-content: start; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); }
.grid-auto { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 200px)), 1fr)); }
.stack { display: grid; gap: var(--sp-3); align-content: start; }
.stack-sm { display: grid; gap: var(--sp-2); align-content: start; }
.stack-lg { display: grid; gap: var(--sp-5); align-content: start; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); }
.grow { flex: 1 1 auto; min-width: 0; }
.only-sm { display: revert; }
@media (min-width: 560px) {
  .feature-art { aspect-ratio: 16 / 9; }
  .grid-2, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .page { padding: var(--sp-5) var(--sp-5) var(--sp-6); gap: var(--sp-4); }
  .layout, .layout > * { gap: var(--sp-4); }
  .only-sm { display: none !important; }
}
@media (max-width: 767.98px) { .hide-sm { display: none !important; } }
@media (max-width: 1023.98px) { .hide-md { display: none !important; } }
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .layout.is-wide-side { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* Nagłówek strony */
.page-head { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; color: var(--c-on-table); }
.page-head-main { display: flex; align-items: center; gap: var(--sp-3); flex: 1 1 auto; min-width: 0; }
.page-head-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.page-head-sub { font-size: var(--fs-sm); color: var(--c-on-table-muted); }
.page-head-aside { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
@media (min-width: 768px) { .page-head-title { font-size: var(--fs-2xl); } }

/* Panel (karta) */
.panel { background: var(--c-paper); color: var(--c-ink); border-radius: var(--r-panel-sm); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); min-height: 52px; }
.panel-head > :is(h2, h3, .h2) { font-size: var(--fs-lg); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.panel-head .count { color: var(--c-muted); font-weight: 600; }
.panel-head + .panel-body, .panel-head + .table-wrap, .panel-head + .list { border-top: 1px solid var(--c-line); }
.panel-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-3); }
.panel-foot { display: flex; justify-content: center; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--c-line); }
.panel.is-pad { padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.panel.is-table { background: var(--c-table-deep); color: var(--c-on-table); border: 1px solid var(--c-table-line); }
.panel.is-table .panel-head + .panel-body, .panel.is-table .panel-foot { border-color: var(--c-table-line); }
.panel.is-sheet { border-radius: var(--r-panel); box-shadow: var(--sh-reading); }
.paper { background: var(--c-paper); color: var(--c-ink); }
.inset { background: var(--c-paper-clean); border: 1px solid var(--c-line); border-radius: var(--r-control); padding: var(--sp-3); }
.divider { height: 1px; background: var(--c-line); border: 0; margin: 0; }
.panel.is-table .divider { background: var(--c-table-line); }

/* Przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 10px 16px 12px; border: 0; border-radius: var(--r-control); background: var(--c-btn); color: var(--c-ink); font-weight: 700; font-size: var(--fs-md); line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; box-shadow: var(--sh-inset); transition: filter .12s, transform .12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .btn:hover:not(:disabled, [aria-disabled="true"]) { filter: brightness(1.05); } }
.btn:active:not(:disabled, [aria-disabled="true"]) { filter: brightness(.94); transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.btn > svg { width: 20px; height: 20px; }
.btn-primary { background: var(--c-yellow); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; }
@media (hover: hover) { .btn-ghost:hover:not(:disabled) { background: rgba(36, 48, 44, .07); filter: none; } }
.on-table .btn-ghost, .panel.is-table .btn-ghost, .page-head .btn-ghost { color: var(--c-on-table); }
@media (hover: hover) { :is(.on-table, .panel.is-table, .page-head) .btn-ghost:hover:not(:disabled) { background: rgba(246, 241, 230, .1); } }
.btn-quiet { background: var(--c-table-raise); color: var(--c-on-table); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.btn-sm { min-height: 36px; padding: 6px 12px 8px; font-size: var(--fs-sm); border-radius: 8px; }
.btn-sm > svg { width: 16px; height: 16px; }
.btn-lg { min-height: 56px; padding: 14px 20px 16px; font-size: var(--fs-lg); font-weight: 800; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 3px solid var(--c-ink); border-right-color: transparent; border-radius: 50%; animation: ui-spin .7s linear infinite; }
.btn-danger.is-busy::after { border-color: #fff; border-right-color: transparent; }
.btn-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
@keyframes ui-spin { to { transform: rotate(1turn); } }

/* Wybór (np. tempo) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: var(--sp-2); border: 0; padding: 0; margin: 0; min-width: 0; }
.choices > legend { padding: 0; margin-bottom: var(--sp-2); }
.choice { position: relative; display: flex; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; padding: 8px 10px; border-radius: var(--r-control); background: var(--c-btn); color: var(--c-ink); font-weight: 700; font-size: var(--fs-sm); text-align: center; box-shadow: var(--sh-inset); cursor: pointer; transition: background-color .12s; }
.choice span small { font-weight: 600; font-size: var(--fs-xs); color: var(--c-muted); }
.choice input:checked + span { background: var(--c-yellow-tint); box-shadow: inset 0 0 0 3px var(--c-ink), var(--sh-inset); }
.choice input:focus-visible + span { outline: 2px solid var(--focus-outer); outline-offset: 2px; }
.btn:has(> input:focus-visible) { outline: 2px solid var(--focus-outer); outline-offset: 2px; }
.choice input:disabled + span { opacity: .5; cursor: default; }
.panel.is-table .choice span { background: var(--c-table-raise); color: var(--c-on-table); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.panel.is-table .choice span small { color: var(--c-on-table-muted); }
.panel.is-table .choice input:checked + span { background: var(--c-table); box-shadow: inset 0 0 0 3px var(--c-yellow); color: var(--c-on-table); }

/* Formularze */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: var(--fs-sm); font-weight: 700; }
.hint { font-size: var(--fs-sm); color: var(--c-muted); }
.panel.is-table .hint { color: var(--c-on-table-muted); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--c-field-line); border-radius: var(--r-control); background: #fff; color: var(--c-ink); font-size: 1rem; line-height: 1.3; }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2324302c' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center; cursor: pointer; }
.input::placeholder { color: #7d776a; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--c-ink); box-shadow: 0 0 0 3px rgba(242, 201, 76, .6); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border: 2px solid var(--c-err); }
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.input-code::placeholder { letter-spacing: .02em; }
.input-code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .18em; text-transform: lowercase; }
.field-error { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-sm); font-weight: 600; color: var(--c-err); }
.field-error:empty { display: none; }
.field-error::before { content: "!"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--c-err); color: #fff; font-size: 12px; font-weight: 800; }
.form-row { display: flex; gap: var(--sp-2); align-items: flex-end; flex-wrap: wrap; }
.form-row > .input, .form-row > .field { flex: 1 1 120px; }
.form-row > .field-error, .form-row > .hint, .form-row > .alert { flex-basis: 100%; }
.form-row > .btn { flex: none; }
.check { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-table); flex: none; }
.switch { appearance: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 13px; background: #a39a87; cursor: pointer; flex: none; transition: background-color .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s var(--ease); }
.check .switch { width: 44px; height: 26px; }
.switch:checked { background: var(--c-table); }
.switch:checked::after { transform: translateX(18px); }

/* Komunikaty */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-control); border: 1px solid transparent; background: var(--c-info-bg); color: var(--c-info); font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; }
.alert:empty { display: none; }
.alert::before { content: "i"; flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: currentColor; color: #fff; font-weight: 800; font-size: 12px; font-style: normal; }
.alert > * { color: inherit; }
.alert-error { background: var(--c-err-bg); color: var(--c-err); border-color: #f0bfb8; }
.alert-error::before { content: "!"; background: var(--c-err); }
.alert-ok { background: var(--c-ok-bg); color: var(--c-ok); border-color: #bfdfbf; }
.alert-ok::before { content: "✓"; background: var(--c-ok); }
.alert > span { flex: 1; min-width: 0; align-self: center; }
.alert > .alert-act { flex: none; align-self: center; color: var(--c-ink); }
.alert-info::before { background: var(--c-info); }
.conn { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: 8px 12px; border-radius: var(--r-control); background: var(--c-paper); color: var(--c-ink); font-size: var(--fs-sm); font-weight: 700; line-height: 1.3; box-shadow: var(--sh-inset); }
.conn[hidden] { display: none; }
.conn svg { flex: none; }
@media (prefers-reduced-motion: no-preference) { .conn svg { animation: conn-spin 1.2s linear infinite; } }
@keyframes conn-spin { to { transform: rotate(360deg); } }
.alert-error::before, .alert-ok::before, .alert-info::before { color: #fff; }
.alert .btn { margin-left: auto; }

/* Pigułki, odznaki */
.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 9px; border-radius: 999px; background: var(--c-btn); color: var(--c-ink); font-size: var(--fs-xs); font-weight: 700; line-height: 1.2; white-space: nowrap; vertical-align: middle; }
.pill > svg { width: 14px; height: 14px; }
.pill-attn { background: var(--c-yellow); }
.pill-ok { background: var(--c-ok-bg); color: var(--c-ok); }
.pill-muted { background: transparent; color: var(--c-muted); box-shadow: inset 0 0 0 1px var(--c-line); }
.pill-table { background: var(--c-table); color: var(--c-on-table); }
.panel.is-table .pill { background: var(--c-table-raise); color: var(--c-on-table); }
.panel.is-table .pill-attn { background: var(--c-yellow); color: var(--c-ink); }
.tempo-stack { display: inline-grid; justify-items: center; gap: 2px; min-width: 44px; font-size: var(--fs-xs); font-weight: 700; color: var(--c-muted); white-space: nowrap; }
.tempo-stack svg { width: 22px; height: 22px; color: var(--c-ink); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c-yellow); color: var(--c-ink); font-size: 12px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }

/* Awatar */
.avatar { --av-size: 40px; display: inline-grid; place-items: center; flex: none; width: var(--av-size); height: var(--av-size); border-radius: calc(var(--av-size) * .22); background: var(--c-blank); color: #fff; font-weight: 800; font-size: calc(var(--av-size) * .42); line-height: 1; letter-spacing: -.02em; box-shadow: inset 0 calc(var(--av-size) * -.06) 0 rgba(0, 0, 0, .22); user-select: none; text-transform: uppercase; overflow: hidden; }
.avatar.is-guest { background: #a39a87; }
.avatar.ltile { --lt: var(--av-size); width: var(--av-size); height: var(--av-size); }
.avatar.is-photo { color: transparent; background-size: cover; background-position: center; }
.avatar.is-guest svg { width: 62%; height: 62%; }
.avatar.is-xl { --av-size: 96px; }
@media (max-width: 559.98px) { .avatar.is-xl { --av-size: 64px; } }

/* Płytki z literami */
.tiles { display: inline-flex; gap: calc(var(--lt, 28px) * .1); align-items: center; }
.ltile { --lt-c: var(--c-yellow); position: relative; display: inline-grid; place-items: center; width: var(--lt, 28px); height: var(--lt, 28px); border-radius: calc(var(--lt, 28px) * .18); background: var(--lt-c); color: #1d1d1d; font-weight: 800; font-size: calc(var(--lt, 28px) * .58); line-height: 1; box-shadow: inset 0 calc(var(--lt, 28px) * -.08) 0 rgba(0, 0, 0, .18); }
.ltile i { position: absolute; right: 8%; bottom: 2%; font-style: normal; font-size: .38em; font-weight: 600; }
.ltile.v2 { --lt-c: var(--c-green); }
.ltile.v3 { --lt-c: var(--c-blue); }
.ltile.v5 { --lt-c: var(--c-red); }
.ltile.v0 { --lt-c: var(--c-blank); }
.tiles.is-tilted .ltile:nth-child(odd) { transform: rotate(-3deg); }
.tiles.is-tilted .ltile:nth-child(3n) { transform: rotate(3deg) translateY(-1px); }

/* Kafelek */
.feature { position: relative; display: grid; grid-template-rows: auto 1fr; color: var(--c-ink); border-radius: var(--r-panel-sm); overflow: hidden; text-decoration: none; min-width: 0; }
.feature-art { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 7; max-height: 168px; color: var(--c-on-table); overflow: hidden; background: var(--c-table-deep); background-image: radial-gradient(circle at 30% 20%, rgba(246, 241, 230, .08), transparent 60%); padding: var(--sp-3); }
.feature-body { background: var(--c-paper); display: grid; gap: var(--sp-2); padding: var(--sp-3); align-content: start; }
.feature-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 700; font-size: var(--fs-md); line-height: 1.25; }
.feature-text { font-size: var(--fs-sm); color: var(--c-muted); }
.feature-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); }
.feature-body > .btn { margin-top: auto; align-self: end; }
.feature .stretch { color: inherit; text-decoration: none; }
.feature .stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.feature:has(.stretch:focus-visible) { outline: 2px solid var(--c-yellow); outline-offset: 2px; }
.feature .stretch:focus-visible { outline: none; box-shadow: none; }
@media (hover: hover) { .feature:has(.stretch):hover { box-shadow: 0 0 0 2px var(--c-yellow); } a.feature:hover { box-shadow: 0 0 0 2px var(--c-yellow); } }
a.feature:focus-visible { outline-color: var(--c-yellow); box-shadow: none; }
.feature.is-row { grid-template-rows: none; grid-template-columns: 96px minmax(0, 1fr); }
.feature.is-row .feature-art { aspect-ratio: auto; }

/* Lista */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--c-line); }
.list-item { position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) var(--sp-4); color: inherit; text-decoration: none; }
.list-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.list-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: var(--fs-sm); color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-end { flex: none; display: flex; align-items: center; gap: var(--sp-2); }
@media (max-width: 559.98px) { .list-end { flex-direction: column; align-items: flex-end; gap: 4px; } }
a.list-item:hover, .list-item.is-link:hover { background: var(--c-paper-sunk); }
a.list-item:focus-visible { outline-offset: -3px; }
.list-item.is-attn { box-shadow: inset 0 0 0 2px var(--c-yellow); }
.list .stretch::after { content: ""; position: absolute; inset: 0; }
.panel.is-table .list > li + li { border-color: var(--c-table-line); }
.panel.is-table .list-sub { color: var(--c-on-table-muted); }
.panel.is-table a.list-item:hover { background: rgba(246, 241, 230, .06); }

/* Tabela */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.table caption { text-align: left; }
.table th { padding: 10px var(--sp-3); background: var(--c-paper-sunk); color: var(--c-muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-align: left; white-space: nowrap; }
.table td { padding: 10px var(--sp-3); border-top: 1px solid var(--c-line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: var(--sp-4); }
.table th:last-child, .table td:last-child { padding-right: var(--sp-4); }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.table .center { text-align: center; }
.table .shrink { width: 1%; white-space: nowrap; }
.table tbody tr { position: relative; }
.table tbody tr:hover { background: rgba(239, 232, 216, .7); }
.table tbody tr.is-attn { box-shadow: inset 0 0 0 2px var(--c-yellow); }
.table .stretch { color: inherit; text-decoration: none; }
.table .stretch::after { content: ""; position: absolute; inset: 0; }
.table .stretch:focus-visible { outline: none; box-shadow: none; }
.table tr:has(.stretch:focus-visible) { outline: 2px solid var(--c-ink); outline-offset: -3px; }
@media (max-width: 559.98px) {
  .table th, .table td { padding-left: 6px; padding-right: 6px; }
  .table th:first-child, .table td:first-child { padding-left: 10px; }
  .table th:last-child, .table td:last-child { padding-right: 12px; }
  .tempo-stack { min-width: 36px; }
}
.table.is-compact td { padding-top: 6px; padding-bottom: 6px; }
.match { display: grid; gap: 4px; min-width: 128px; }
.match-player { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; font-weight: 600; }
.match-player .avatar { --av-size: 22px; }
.match-player .nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-player .score { margin-left: auto; padding-left: var(--sp-2); font-variant-numeric: tabular-nums; color: var(--c-muted); font-weight: 700; }
.match-player.is-me .nick { font-weight: 800; }
.match-player.is-winner .score { color: var(--c-ink); }
.outcome { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.outcome-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-size: 15px; font-weight: 800; line-height: 1; color: #fff; }
.outcome-mark svg { stroke-width: 3.5; }
.outcome.win .outcome-mark { background: #2e7d3a; }
.outcome.loss .outcome-mark { background: var(--c-danger); }
.outcome.draw .outcome-mark { background: #6f7a75; }
.outcome-text { font-size: var(--fs-sm); }

/* Zakładki */
.subnav { display: flex; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none; padding: 0 var(--sp-3); border-top: 1px solid var(--c-line); }
.subnav::-webkit-scrollbar { display: none; }
.subnav > a, .subnav > button { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 var(--sp-3); border: 0; background: none; color: var(--c-muted); font-weight: 700; font-size: var(--fs-md); text-decoration: none; cursor: pointer; }
.subnav > a:hover, .subnav > button:hover { color: var(--c-ink); }
.subnav > [aria-current="page"], .subnav > [aria-selected="true"] { color: var(--c-ink); }
.subnav > [aria-current="page"]::after, .subnav > [aria-selected="true"]::after { content: ""; position: absolute; left: var(--sp-2); right: var(--sp-2); bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--c-yellow); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }
.subnav > :focus-visible { outline-offset: -3px; }
.subnav.is-flush { border-top: 0; padding: 0; }
.tabpanel:focus-visible { outline: none; box-shadow: none; }

/* Statystyki */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); gap: var(--sp-2); margin: 0; }
.stat { display: grid; gap: 2px; padding: 10px 12px; background: var(--c-paper-clean); border: 1px solid var(--c-line); border-radius: var(--r-control); min-width: 0; }
.stat dt, .stat .stat-label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; color: var(--c-muted); }
.stat dd, .stat .stat-value { margin: 0; font-size: var(--fs-xl); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .stat-note { font-size: var(--fs-xs); color: var(--c-muted); }
.stat.is-best { background: var(--c-yellow-tint); border-color: #e8cf7a; }
.statlist { display: grid; margin: 0; }
.statlist > div { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: 6px var(--sp-4); }
.statlist > div + div { border-top: 1px solid var(--c-line); }
.statlist dt { flex: 1; display: flex; align-items: center; gap: var(--sp-3); font-weight: 600; }
.statlist dt svg { width: 22px; height: 22px; color: var(--c-muted); }
.statlist dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.big-stat { display: flex; align-items: center; gap: var(--sp-3); }
.big-stat svg { width: 36px; height: 36px; color: var(--c-ink); }
.big-stat .label { color: var(--c-muted); }
.big-stat .value { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 4px; background: var(--c-paper-sunk); overflow: hidden; box-shadow: inset 0 0 0 1px var(--c-line); }
.meter > span { display: block; height: 100%; width: var(--v, 0%); background: var(--c-table); border-radius: inherit; }

/* Seria */
.streak { display: grid; gap: var(--sp-3); }
.streak-head { display: flex; align-items: center; gap: var(--sp-3); }
.streak-flame { width: 40px; height: 40px; flex: none; color: var(--c-muted); }
.streak.is-on .streak-flame { color: #d9822b; }
.streak-title { font-size: var(--fs-lg); font-weight: 800; line-height: 1.2; }
.streak-sub { font-size: var(--fs-sm); color: var(--c-muted); }
.streak-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; list-style: none; margin: 0; padding: 0; }
.streak-day { display: grid; justify-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--c-muted); }
.streak-box { display: grid; place-items: center; width: 100%; max-width: 36px; aspect-ratio: 1; border-radius: var(--r-tile); border: 2px solid var(--c-line); background: var(--c-paper-clean); color: var(--c-ink); font-size: 16px; font-weight: 800; }
.streak-day.is-done .streak-box { background: var(--c-yellow); border-color: var(--c-yellow); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .16); }
.streak-day.is-today { color: var(--c-ink); }
.streak-day.is-today .streak-box { border-color: var(--c-ink); }
.streak-day.is-future .streak-box { border-style: dashed; background: transparent; }
.streak-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: var(--fs-lg); color: var(--c-on-table); white-space: nowrap; }
.streak-chip svg { width: 26px; height: 26px; color: var(--c-on-table-muted); }
.streak-chip.is-on svg { color: #f0a04b; }

/* Stan pusty, szkielet */
.empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4); text-align: center; color: var(--c-muted); }
.empty-text { font-size: var(--fs-md); color: var(--c-ink); }
.empty.is-block { flex-direction: column; padding: var(--sp-6) var(--sp-4); }
.empty.is-block .empty-text { max-width: 36ch; }
.empty .tiles { --lt: 30px; opacity: .9; }
.empty.is-block .tiles { --lt: 34px; margin-bottom: var(--sp-1); }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: var(--sp-1); border-radius: 50%; background: var(--c-paper-sunk); color: var(--c-muted); }
.empty-title { font-size: var(--fs-lg); font-weight: 750; line-height: 1.25; letter-spacing: -.01em; color: var(--c-ink); }
.empty.has-title { gap: var(--sp-2); }
.empty.has-title .empty-text { font-size: var(--fs-sm); color: var(--c-muted); }
.empty.has-title > .btn { margin-top: var(--sp-2); }
.skeleton { display: block; height: 1em; border-radius: 6px; background: linear-gradient(90deg, var(--c-line) 0%, var(--c-paper-sunk) 50%, var(--c-line) 100%); background-size: 200% 100%; opacity: 0; animation: ui-skel-in .2s ease-out .4s forwards, ui-shimmer 1.4s linear infinite; }
.on-table .skeleton { background-image: linear-gradient(90deg, rgba(246, 241, 230, .06) 0%, rgba(246, 241, 230, .12) 50%, rgba(246, 241, 230, .06) 100%); }
.skeleton.is-block { height: 56px; border-radius: var(--r-control); }
@keyframes ui-shimmer { to { background-position: -200% 0; } }
@keyframes ui-skel-in { to { opacity: 1; } }

/* Okno dialogowe */
.dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: var(--sp-4); border: 0; border-radius: var(--r-panel); background: var(--c-paper); color: var(--c-ink); box-shadow: var(--sh-lift); }
.dialog::backdrop { background: rgba(10, 22, 18, .62); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.dialog-head h2 { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; }
.dialog-body { display: grid; gap: var(--sp-3); padding-top: var(--sp-3); }
.or { display: flex; align-items: center; gap: var(--sp-3); color: var(--c-muted); font-size: var(--fs-sm); font-weight: 600; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--c-line); }

/* Wzorce stron: karta pojedyncza, tożsamość, wiersze akcji, linki */
.panel.is-solo { width: 100%; max-width: 440px; margin: clamp(12px, 6vh, 64px) auto 0; }
.panel.is-solo > .panel-body { gap: var(--sp-4); padding: var(--sp-4); }
.solo-head { display: flex; align-items: center; gap: var(--sp-3); }
.solo-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.solo-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-control); background: var(--c-table); color: var(--c-yellow); }
.solo-mark.is-err { background: var(--c-err-bg); color: var(--c-err); }
.identity { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.identity-main { flex: 1 1 auto; display: grid; min-width: 0; }
.identity-name { font-size: var(--fs-lg); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.identity-sub { font-size: var(--fs-sm); color: var(--c-muted); overflow-wrap: anywhere; }
.identity > .btn { flex: none; }
.page.is-settings { --page-max: 980px; }
.settings { display: grid; gap: var(--sp-3); align-items: start; }
.settings-nav { display: flex; gap: 2px; padding: var(--sp-1); overflow-x: auto; scrollbar-width: none; }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav > button { flex: none; display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-control); background: none; color: var(--c-muted); font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; }
.settings-nav > button:hover, .settings-nav > [aria-selected="true"] { color: var(--c-ink); background: var(--c-paper-sunk); }
.settings-main > * { display: grid; gap: var(--sp-3); }
.range { width: 100%; min-height: 44px; margin: 0; accent-color: var(--c-table); }
.check.is-split { justify-content: space-between; font-weight: 700; }
@media (min-width: 768px) {
  .settings { grid-template-columns: 220px minmax(0, 1fr); }
  .settings-nav { flex-direction: column; position: sticky; top: var(--sp-4); }
}
.action-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); }
.action-row + .action-row, .panel-head + .action-row { border-top: 1px solid var(--c-line); }
.action-row-text { flex: 1 1 260px; display: grid; gap: 2px; }
.action-row > .btn { flex: none; }
.panel-head.is-danger > :is(h2, h3) { display: flex; align-items: center; gap: var(--sp-2); color: var(--c-err); }
.panel-note { padding: 0 var(--sp-4) var(--sp-3); font-size: var(--fs-sm); color: var(--c-muted); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); }
.links.is-spread { justify-content: space-between; }
.links.is-center { justify-content: center; }
.page > .links, .links.on-table { color: var(--c-on-table-muted); }
.error-state { display: grid; gap: var(--sp-3); justify-items: start; }
kbd { display: inline-block; min-width: 28px; padding: 2px 7px; border-radius: 6px; background: var(--c-paper-clean); border: 1px solid var(--c-line); box-shadow: inset 0 -2px 0 var(--c-line); color: var(--c-ink); font: 700 var(--fs-xs)/1.5 var(--font); text-align: center; }
.toc-title { margin-bottom: 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.toc ol { margin: 0; padding-left: 1.4em; display: grid; gap: 2px; }
@media (max-width: 559.98px) {
  .hide-xs { display: none !important; }
  .action-row > .btn { width: 100%; }
}

/* Profil: karta nagłówka, ranking i bilans */
.profile-head { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4); }
.profile-main { flex: 1 1 auto; min-width: 0; display: grid; gap: var(--sp-2); }
.profile-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-2xl); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.profile-facts { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: 0; font-size: var(--fs-sm); }
.profile-facts > div { display: flex; gap: 6px; }
.profile-facts dt { color: var(--c-muted); }
.profile-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.profile-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-self: flex-start; }
.rating-panel { container-type: inline-size; }
.rating { display: grid; gap: var(--sp-4); align-items: center; }
.rating-note { font-size: var(--fs-sm); color: var(--c-muted); }
.record { display: grid; gap: var(--sp-2); }
.record-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--c-paper-sunk); box-shadow: inset 0 0 0 1px var(--c-line); }
.record-bar > span { width: var(--v); }
.record-bar .w { background: var(--c-ok); }
.record-bar .d { background: #a39a87; }
.record-bar .l { background: var(--c-danger); }
.record-legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.record-legend li { display: flex; align-items: center; gap: 6px; }
.record-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.record-legend b { font-variant-numeric: tabular-nums; }
.best-word { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: 4px; }
@container (min-width: 520px) { .rating { grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-5); } }
@media (max-width: 559.98px) {
  .profile-head { flex-wrap: wrap; gap: var(--sp-3); padding: var(--sp-3) var(--sp-3) var(--sp-4); }
  .profile-name { font-size: var(--fs-xl); }
  .profile-actions { width: 100%; }
}

/* Powłoka nawigacji */
html:has(> body.has-shell) { --top-h: 60px; scroll-padding-top: calc(var(--top-h) + 12px); }
body.has-shell { margin: var(--top-h) 0 0; min-height: calc(100svh - var(--top-h)); }
.shell-top, .shell-drawer { color: var(--c-on-table); --focus-outer: var(--c-yellow); }
.shell-logo { display: inline-flex; align-items: center; flex: none; padding: 6px 0; border-radius: var(--r-control); color: var(--c-on-table); text-decoration: none; }
.shell-logo .tiles { gap: 2px; }
.shell-top { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: var(--top-h); display: flex; align-items: center; gap: 28px; padding: env(safe-area-inset-top, 0px) clamp(16px, 4vw, 48px) 0; background: rgba(22, 43, 37, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--c-table-line); }
.shell-nav { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.shell-nav a { --tab-pad: 14px; position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 var(--tab-pad); border-radius: var(--r-control); color: var(--c-on-table-muted); text-decoration: none; font-weight: 650; white-space: nowrap; }
.shell-nav a:hover { color: var(--c-on-table); background: var(--c-table-raise); }
.shell-nav a[aria-current="page"] { color: var(--c-on-table); background: none; }
.shell-nav a[aria-current="page"]::after { content: ""; position: absolute; left: var(--tab-pad); right: var(--tab-pad); bottom: 3px; height: 3px; border-radius: 3px; background: var(--c-yellow); }
.shell-me { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0 4px; border-radius: var(--r-control); color: var(--c-on-table); text-decoration: none; font-weight: 650; }
.shell-me .avatar { flex: none; }
.shell-nick { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-login { margin-left: auto; white-space: nowrap; }
.shell-icon-btn { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-control); background: transparent; color: var(--c-on-table-muted); text-decoration: none; cursor: pointer; }
.shell-icon-btn:hover { background: var(--c-table-raise); color: var(--c-on-table); }
.shell-icon-btn[aria-current="page"] { color: var(--c-yellow); }
.shell-top > :is(.shell-me, .shell-login) + .shell-settings { margin-left: -16px; }
.shell-top > .shell-tabs + .shell-settings { margin-left: auto; }
.shell-menu, .shell-back { display: none; }
.shell-back { align-items: center; gap: 4px; min-height: 44px; padding: 0 10px 0 4px; border-radius: var(--r-control); color: var(--c-on-table); text-decoration: none; font-weight: 700; }
.shell-back svg { width: 22px; height: 22px; }

.shell-drawer { margin: 0; inset: 0 auto 0 0; width: min(280px, 82vw); height: 100dvh; max-width: none; max-height: none; padding: calc(var(--sp-2) + env(safe-area-inset-top, 0px)) var(--sp-3) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)); border: 0; background: var(--c-table-deep); box-shadow: 12px 0 32px rgba(0, 0, 0, .5); }
.shell-drawer[open] { animation: shell-drawer-in .2s var(--ease); }
@keyframes shell-drawer-in { from { transform: translateX(-100%); } }
.shell-drawer::backdrop { background: rgba(0, 0, 0, .55); }
.shell-drawer-pane { display: flex; flex-direction: column; gap: var(--sp-2); height: 100%; }
.shell-drawer-head { display: flex; align-items: center; gap: var(--sp-2); }
.shell-drawer .shell-nav { display: grid; gap: 2px; margin-top: var(--sp-2); }
.shell-drawer .shell-nav a { min-height: 48px; font-size: 1.1rem; color: var(--c-on-table); }
.shell-drawer .shell-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--c-yellow); }
.shell-drawer .shell-nav a[aria-current="page"]::after { content: none; }
.shell-drawer-foot { display: grid; gap: 2px; margin-top: auto; padding-top: var(--sp-2); border-top: 1px solid var(--c-table-line); }
.shell-drawer-foot :is(a, button) { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 48px; padding: 0 14px; border: 0; border-radius: var(--r-control); background: none; color: var(--c-on-table); font: inherit; font-weight: 650; text-decoration: none; text-align: left; cursor: pointer; }
.shell-drawer-foot :is(a, button):hover { background: var(--c-table-raise); }
.shell-drawer-foot a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--c-yellow); }
.shell-drawer-foot .avatar { flex: none; }

@media (max-width: 860px) {
  .shell-top { gap: 8px; }
  .shell-nav a { --tab-pad: 10px; }
  .shell-top .shell-nick { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .shell-top > :is(.shell-me, .shell-login) + .shell-settings { margin-left: 0; }
}
@media (max-width: 600px) {
  html:has(> body.has-shell) { --top-h: 52px; }
  .shell-top { gap: 8px; padding-inline: 4px 12px; }
  .shell-top .shell-tabs, .shell-top .shell-settings { display: none; }
  .shell-top .shell-logo .tiles { --lt: 20px; }
  .shell-menu { display: inline-grid; }
  .shell-top .shell-nick { position: static; width: auto; height: auto; overflow: hidden; clip-path: none; max-width: 40vw; }
  body.is-focus .shell-back { display: inline-flex; }
  body.is-focus .shell-top .shell-logo { display: none; }
}
@media (prefers-reduced-motion: reduce) { .shell-drawer[open] { animation: none; } }

/* Dashboard: stojak, trwająca gra, wiersze gier, ostatnie partie, kolumna boczna */
.tiles.is-fit { --lt: clamp(13px, calc((100cqi - (var(--n) - 1) * 2px) / var(--n)), var(--lt-max, 22px)); gap: 2px; }
.page.is-dash { --page-max: 1180px; gap: 0; }
.dash-cols + .links { margin-top: var(--sp-6); }
.stand-wrap { margin: 0 0 var(--sp-6); }
.stand { --focus-outer: var(--c-yellow); display: grid; gap: 18px; padding: 22px clamp(16px, 3vw, 28px) 18px; border-radius: 14px; background: linear-gradient(180deg, var(--c-wood-hi), var(--c-wood) 55%, var(--c-wood-lo)); box-shadow: 0 18px 30px -12px rgba(0, 0, 0, .55), inset 0 2px 0 rgba(255, 255, 255, .18); color: var(--c-on-wood); }
.stand-main { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px clamp(16px, 3vw, 32px); }
.stand-main > .stand-name { flex: 1 1 200px; max-width: 320px; }
.stand-main > .stand-new { flex: 0 1 240px; margin-left: auto; }
.stand-ledge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; padding-top: 16px; border-top: 1px solid rgba(0, 0, 0, .28); box-shadow: inset 0 1px 0 rgba(255, 246, 234, .12); }
.stand-join, .stand-friend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.stand-grp { display: grid; gap: var(--sp-2); min-width: 0; }
.stand-lbl { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--c-on-wood); white-space: nowrap; }
.stand-tempo { display: flex; gap: 6px; }
.stand-tempo button { min-height: 44px; border: 0; padding: 7px 12px; border-radius: 8px; background: rgba(0, 0, 0, .22); color: #f6efe2; font-weight: 650; font-size: .9rem; cursor: pointer; }
.stand-tempo button[aria-pressed="true"] { background: var(--c-paper-clean); color: var(--c-ink); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.stand-new { min-height: 52px; padding: 14px 28px 16px; font-size: var(--fs-lg); font-weight: 800; white-space: nowrap; }
.stand-name .input { min-height: 44px; }
.stand-name .field { gap: var(--sp-2); }
.stand-name label { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--c-on-wood); }
.stand-join-row { display: flex; gap: 10px; align-items: center; }
.stand .field-error { color: #fff0ec; }
.stand-join .field-error { flex-basis: 100%; }
.code-slots { position: relative; display: flex; gap: 6px; }
.code-slot { --s: 44px; display: grid; place-items: center; width: var(--s); height: var(--s); border-radius: 8px; background: rgba(0, 0, 0, .24); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 246, 234, .7); color: #1d1d1d; font-weight: 800; font-size: 22px; text-transform: uppercase; }
.code-slot.is-on { background: var(--c-blank); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 1px 2px rgba(0, 0, 0, .25); }
.code-slots input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: text; }
.code-slots:focus-within .code-slot.is-cur { outline: 2px solid var(--c-yellow); outline-offset: 2px; }
.code-slots:has(input[aria-invalid="true"]) .code-slot { box-shadow: inset 0 0 0 2px #ffb4a8; }
.code-slots input:focus-visible { outline: none; box-shadow: none; }
.btn-dark { background: rgba(0, 0, 0, .28); color: #fff; box-shadow: none; }
.stand-invite { white-space: nowrap; }

.live-game { display: grid; grid-template-columns: 5rem minmax(0, 1fr) 3rem 4.5rem auto; align-items: center; gap: var(--sp-3); padding: 14px 18px; border-radius: 14px; background: var(--c-paper); color: var(--c-ink); box-shadow: 0 18px 30px -12px rgba(0, 0, 0, .55), inset 0 0 0 2px var(--c-yellow); --focus-outer: var(--c-ink); }
.live-act { display: flex; justify-content: end; margin-left: var(--sp-3); }
.live-act .stand-new { min-height: 48px; padding: 12px 22px 14px; font-size: 1.05rem; }
.seat-clocks { display: grid; gap: 2px; justify-items: end; font-variant-numeric: tabular-nums; font-size: 1.05rem; line-height: 1.5; font-weight: 700; color: var(--c-muted); }
.seat-clocks span { padding: 0 6px; border-radius: 5px; }
.seat-clocks .is-on { background: var(--c-ink); color: var(--c-paper); }
.seat-clocks .is-low { color: var(--c-danger); }
.seat-clocks .is-on.is-low { background: var(--c-danger); color: #fff; }

.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-6); align-items: start; }
.dash-cols > div { min-width: 0; }
.dash-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 var(--sp-3); font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.dash-h small { color: var(--c-on-table-muted); font-weight: 500; font-size: .9rem; }
.dash-sec + .dash-sec { margin-top: var(--sp-6); }
.dash-sec .link-more { margin-top: var(--sp-3); }
.on-table .panel .muted { color: var(--c-muted); }
.dash-sec .empty { padding: var(--sp-4) 0; justify-content: flex-start; text-align: left; }
.dash-sec .empty.is-block { justify-content: center; text-align: center; padding: var(--sp-6) var(--sp-4); border: 1px dashed rgba(246, 241, 230, .2); border-radius: 14px; background: rgba(246, 241, 230, .03); }
.on-table .empty-text, .on-table .empty { color: var(--c-on-table-muted); }
.on-table .empty-text { color: var(--c-on-table); }
.on-table .empty-title { color: var(--c-on-table); }
.on-table .empty.has-title .empty-text { color: var(--c-on-table-muted); max-width: 44ch; }
.on-table .empty-icon { background: var(--c-table-raise); color: var(--c-on-table-muted); }

.game-row { display: grid; grid-template-columns: 5rem minmax(0, 1fr) 3rem 10rem 3rem; align-items: center; gap: var(--sp-3); padding: 12px 18px; border-radius: 14px; background: var(--c-paper); color: var(--c-ink); text-decoration: none; transition: background-color .15s; --c-row-muted: var(--c-muted); --c-row-ink: var(--c-ink); --focus-outer: var(--c-ink); }
.game-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.game-row.is-mine { box-shadow: 0 14px 24px -14px rgba(0, 0, 0, .7), inset 0 0 0 2px var(--c-yellow); }
.game-row.is-wait { --c-row-muted: var(--c-on-table-muted); --c-row-ink: var(--c-on-table); --focus-outer: var(--c-yellow); background: var(--c-table-raise); color: var(--c-on-table); box-shadow: inset 0 0 0 1px var(--c-table-line); }
@media (hover: hover) { .game-row:hover { background: var(--c-paper-sunk); } .game-row.is-wait:hover { background: #2a4d41; } }
.game-row:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 3px; }
.row-tempo { font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; text-align: center; color: var(--c-row-muted, var(--c-muted)); }
.row-tempo b { display: block; font-size: 1rem; font-weight: 800; color: var(--c-row-ink, var(--c-ink)); white-space: nowrap; }
.row-tempo.is-urgent b { color: var(--c-danger); }
.room-code { text-transform: uppercase; letter-spacing: .04em; }
.seat-list, .seat-scores, .row-last { display: grid; gap: 2px; min-width: 0; }
.seat-list > span { display: flex; gap: var(--sp-2); align-items: baseline; min-width: 0; white-space: nowrap; line-height: 1.5; }
.seat-list .avatar { --av-size: 22px; align-self: center; font-size: 10px; }
.seat-list b { min-width: 4ch; overflow: hidden; text-overflow: ellipsis; font-weight: 750; font-size: 1.05rem; }
.seat-scores { text-align: right; font-variant-numeric: tabular-nums; font-size: 1.05rem; line-height: 1.5; font-weight: 600; color: var(--c-row-muted, var(--c-muted)); }
.seat-scores .is-lead { color: var(--c-row-ink, var(--c-ink)); font-weight: 800; }
.row-last { gap: 4px; container-type: inline-size; }
.row-last small, .game-row small { font-size: var(--fs-sm); line-height: 1.3; color: var(--c-row-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-go { font-weight: 800; text-align: right; }

.recent-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--c-table-line); }
.recent-list li { position: relative; display: grid; grid-template-columns: 5rem minmax(0, 1fr) 3rem 4.5rem; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--c-table-line); --c-row-muted: var(--c-on-table-muted); --c-row-ink: var(--c-on-table); }
.recent-list .seat-list b { font-size: 1rem; }
.recent-list time { color: var(--c-on-table-muted); font-size: .9rem; text-align: right; white-space: nowrap; }
.recent-date { display: none; }
.recent-list a.stretch { position: static; text-decoration: none; }
.recent-list a.stretch::after { content: ""; position: absolute; inset: 0; }
.recent-list a.stretch:focus-visible { outline: none; box-shadow: none; }
.recent-list li:has(.stretch:focus-visible) { outline: 2px solid var(--c-yellow); outline-offset: -3px; border-radius: var(--r-control); }
@media (hover: hover) { .recent-list li:has(a:hover) { background: rgba(246, 241, 230, .05); } }

.dash-side { position: sticky; top: calc(var(--top-h) + 24px); display: grid; gap: 28px; }
.train-list a { display: block; padding: 12px 0; border-bottom: 1px solid var(--c-table-line); color: var(--c-on-table); text-decoration: none; }
.train-list a:first-of-type { border-top: 1px solid var(--c-table-line); }
@media (hover: hover) { .train-list a:hover small { color: var(--c-on-table); } }
.train-list small { display: block; margin-top: 4px; color: var(--c-on-table-muted); font-size: .85rem; }
.streak-txt { margin: 0 0 6px; color: var(--c-on-table-muted); font-size: .92rem; }
.streak-txt b { color: var(--c-on-table); }
.on-table .streak-day { color: var(--c-on-table-muted); }
.on-table .streak-box { max-width: 30px; border: 2px dashed rgba(246, 241, 230, .22); background: transparent; color: var(--c-ok); border-radius: 6px; }
.on-table .streak-day.is-done .streak-box { border: 0; background: var(--c-yellow); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.on-table .streak-day.is-today { color: var(--c-on-table); }
.on-table .streak-day.is-today:not(.is-done) .streak-box { border-color: var(--c-on-table-muted); }
.bot-door { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; padding: 14px; border-radius: var(--r-panel-sm); border: 1px dashed rgba(246, 241, 230, .3); color: var(--c-on-table-muted); font-size: .92rem; }
.bot-door .btn { margin-left: auto; white-space: nowrap; }
.bot-door .alert { flex-basis: 100%; }

@media (max-width: 860px) {
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
  .dash-side { position: static; }
}
@media (max-width: 600px) {
  .stand-wrap { margin-bottom: var(--sp-5); }
  .stand { gap: 18px; padding: 16px; }
  .stand-main > .stand-name { max-width: none; flex-basis: 100%; }
  .stand-main > .stand-new { flex: 1 1 100%; }
  .stand-ledge { align-items: flex-start; }
  .code-slot { --s: 36px; font-size: 18px; }
  .live-game { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "t t t" "p s c" "a a a"; gap: 10px; padding: 12px 14px; }
  .live-game .seat-list { grid-area: p; } .live-game .seat-scores { grid-area: s; } .live-game .seat-clocks { grid-area: c; }
  .live-game .row-tempo { grid-area: t; text-align: left; } .live-game .row-tempo b { display: inline; margin-right: 4px; }
  .live-act { grid-area: a; margin: 0; } .live-act .stand-new { flex: 1; }
  .game-row { grid-template-columns: 5rem minmax(0, 1fr) 3rem; grid-template-areas: "p p s" "t l l"; gap: 8px 10px; padding: 12px 14px; }
  .game-row .seat-list { grid-area: p; } .game-row .seat-scores { grid-area: s; } .game-row .row-tempo { grid-area: t; text-align: left; } .game-row .row-last { grid-area: l; }
  .game-row .row-go { display: none; }
  .recent-list li { grid-template-columns: minmax(0, 1fr) 3rem; gap: 4px 12px; padding: 10px 2px; }
  .recent-list .row-tempo { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .recent-list .row-tempo b { display: inline; }
  .recent-list time { display: none; }
  .recent-date { display: inline; }
}

/* Landing gościa: hero z planszą, pasy funkcji, zamknięcie */
.page.is-land { --page-max: 1180px; gap: 0; }
.land-mine { margin-bottom: var(--sp-6); }
.land-mine .live-game { margin-bottom: 10px; }
.land-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; padding: clamp(8px, 3vw, 36px) 0 clamp(48px, 8vw, 96px); }
.land-board { transform: rotate(-2deg); }
.land-grid { container-type: inline-size; display: grid; grid-template: repeat(9, minmax(0, 1fr)) / repeat(9, minmax(0, 1fr)); aspect-ratio: 1; padding: 6px; border-radius: 14px; background: #fff; box-shadow: var(--sh-reading), 0 0 0 6px var(--c-table-deep); }
.land-cell { position: relative; display: grid; place-items: center; border: solid #e7e2d8; border-width: 0 1px 1px 0; min-width: 0; }
.land-cell:nth-child(9n) { border-right: 0; }
.land-cell:nth-last-child(-n + 9) { border-bottom: 0; }
.land-cell[class*="sq-"] { isolation: isolate; font-size: calc(100cqi / 9 * .26); font-weight: 800; }
.land-cell.sq-W, .land-cell.sq-w { color: #7f321c; } .land-cell.sq-L, .land-cell.sq-l { color: #1d4e8f; }
.land-cell[class*="sq-"]::before { content: ""; position: absolute; inset: 14%; border-radius: 4px; background: var(--sq); z-index: -1; }
.land-cell.sq-W { --sq: #f4b49a; } .land-cell.sq-w { --sq: #f7d3c4; } .land-cell.sq-L { --sq: #a9c4f3; } .land-cell.sq-l { --sq: #d3dff8; }
.land-tile { position: relative; z-index: 1; display: grid; place-items: center; animation: land-drop .55s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 120ms); }
.land-tile .tiles { --lt: calc(100cqi / 9 - 6px) !important; }
.land-tile .ltile { box-shadow: inset 0 calc(var(--lt) * -.08) 0 rgba(0, 0, 0, .18), 0 2px 3px rgba(0, 0, 0, .18); }
@keyframes land-drop { from { opacity: 0; transform: translateY(-18px) scale(1.15) rotate(-6deg); } 55% { opacity: 1; } }
.land-pitch { display: grid; gap: var(--sp-4); min-width: 0; }
.land-title { font-size: clamp(2.2rem, 4.6vw, 3.75rem); font-weight: 800; line-height: .98; letter-spacing: -.035em; text-wrap: balance; }
.land-lead { max-width: 52ch; font-size: var(--fs-lg); line-height: 1.5; color: var(--c-on-table-muted); }
.land-pitch .stand-wrap { margin: var(--sp-2) 0 0; }
.land-pitch .stand-main > .stand-new { flex: 1 1 100%; }
.land-login { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: var(--fs-sm); color: var(--c-on-table-muted); }
.land-login:empty { display: none; }
.land-login .btn-ghost { color: var(--c-on-table); text-decoration: underline; text-underline-offset: 3px; }

.land-strips { display: grid; gap: clamp(56px, 9vw, 112px); padding: clamp(48px, 8vw, 96px) 0; border-top: 1px solid var(--c-table-line); }
.land-strip { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(28px, 6vw, 88px); align-items: center; }
.land-strip.is-flip .land-art { order: 2; }
.land-copy { display: grid; gap: var(--sp-4); justify-items: start; max-width: 46ch; }
.land-copy p { font-size: 1.0625rem; line-height: 1.6; color: var(--c-on-table-muted); }
.land-h { font-size: clamp(1.6rem, 2.8vw, 2.25rem); font-weight: 800; line-height: 1.08; letter-spacing: -.028em; text-wrap: balance; }
.land-art { display: grid; align-content: center; gap: 18px; min-height: 240px; padding: clamp(22px, 3.5vw, 40px); border-radius: var(--r-feature); background: var(--c-table-deep); border: 1px solid var(--c-table-line); }
.land-note { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--c-on-table-muted); }
.land-art-link { background: linear-gradient(180deg, var(--c-wood-hi), var(--c-wood) 55%, var(--c-wood-lo)); border: 0; box-shadow: 0 18px 30px -14px rgba(0, 0, 0, .55), inset 0 2px 0 rgba(255, 255, 255, .16); color: var(--c-on-wood); justify-items: start; }
.land-url { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 9px 16px 9px 12px; border-radius: 999px; background: rgba(0, 0, 0, .26); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.land-url b { color: #fff; font-weight: 800; }
.land-slots .code-slot { --s: 52px; font-size: 26px; }
.land-seats { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.land-seats > span { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.land-seats .land-seat-free { padding: 7px 12px; border: 1px dashed rgba(255, 246, 234, .55); border-radius: 999px; font-size: var(--fs-sm); font-weight: 600; }
.land-art-corr { gap: 10px; }
.land-art-corr .land-note { margin-top: 6px; }
.land-demo-row { grid-template-columns: 4.5rem minmax(0, 1fr) 2.5rem; grid-template-areas: "t p s" ". l l"; row-gap: 8px; cursor: default; }
.land-demo-row .row-tempo { grid-area: t; } .land-demo-row .seat-list { grid-area: p; } .land-demo-row .seat-scores { grid-area: s; } .land-demo-row .row-last { grid-area: l; }
@media (hover: hover) { .land-demo-row:hover { background: var(--c-paper); } }
.land-art-train { gap: 16px; }
.land-train { display: grid; gap: 6px; }
.land-train small { font-size: var(--fs-sm); color: var(--c-on-table-muted); }
.land-art-acct { background: var(--c-paper); color: var(--c-ink); border: 0; }
.land-art-acct .land-note { color: var(--c-muted); }

.land-close { display: grid; justify-items: center; gap: var(--sp-5); padding: clamp(56px, 9vw, 104px) 0 clamp(40px, 6vw, 72px); border-top: 1px solid var(--c-table-line); text-align: center; }
.land-close .land-h { font-size: clamp(2.2rem, 5vw, 3.5rem); }
.land-close .btn-lg { min-width: 240px; }

@media (max-width: 900px) {
  .land-hero { grid-template-columns: minmax(0, 1fr); }
  .land-board { order: 2; width: min(100%, 440px); justify-self: center; }
  .land-strip { grid-template-columns: minmax(0, 1fr); }
  .land-strip .land-art, .land-strip.is-flip .land-art { order: 2; }
}
@media (max-width: 600px) {
  .land-slots .code-slot { --s: 42px; font-size: 21px; }
  .land-close .btn-lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .skeleton { background: var(--c-line); opacity: 1; }
  .on-table .skeleton { background: rgba(246, 241, 230, .08); }
}
