/* Czcionka Atkinson Hyperlegible (SIL Open Font License 1.1), hostowana lokalnie */
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/atkinson-italic-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/atkinson-italic-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/atkinson-italic-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/atkinson-italic-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/atkinson-normal-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/atkinson-normal-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/atkinson-normal-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/atkinson-normal-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f5efe3;
  --paper-2: #ebe2d0;
  --ink: #2b2118;
  --ink-soft: #6b5d4f;
  --line: #d8ccb6;
  --board: #1f4a45;
  --cell: #2a5c56;
  --tw: #c4553b;
  --dw: #e39a86;
  --tl: #2f6f9f;
  --dl: #8fc0d6;
  --tile: #f3e3c3;
  --tile-edge: #c9a56d;
  --tile-new: #ffe9a8;
  --accent: #c4553b;
  --accent-ink: #fff;
  --ok: #2e7d4f;
  --bad: #b3261e;
  --radius: 10px;
  --serif: 'Atkinson Hyperlegible', sans-serif;
  --sans: 'Atkinson Hyperlegible', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0 0 .6em; }
h2 { font-size: 1.1rem; }
a { color: var(--tl); }
.muted { color: var(--ink-soft); }
.small { font-size: .85em; }
[hidden] { display: none !important; }

button, .button {
  font: 600 14px var(--sans);
  padding: .6em 1em;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform .08s, background .15s;
}
button:hover:not(:disabled) { background: #fff; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { background: #ad4630; }
button.danger { color: var(--bad); border-color: #e2b3ae; background: transparent; }
button.armed { background: var(--bad); border-color: var(--bad); color: #fff; }

input, textarea {
  font: 15px var(--sans);
  padding: .6em .75em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--tl); outline-offset: 1px; }
label { display: block; font-weight: 500; margin-bottom: .8em; }
label input, label textarea { margin-top: .3em; }
textarea { resize: vertical; display: block; min-height: 10em; }
.inline { display: flex; gap: .5em; }
.inline input { flex: 1; min-width: 0; }
.error { color: var(--bad); min-height: 1.2em; margin: .5em 0 0; }
.capacity { font-size: .875rem; margin: .25em 0 0; }

/* ---------- Płytki ---------- */
.tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f8ecd2, var(--tile));
  color: var(--ink);
  border-radius: 12%;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.35);
  font-family: var(--serif);
  font-weight: 700;
  user-select: none;
  line-height: 1;
}
.tile sub {
  position: absolute;
  right: 9%;
  bottom: 7%;
  font: 600 .38em var(--sans);
}
.tile.blank { color: #8a5a1c; }
.tile.blank::after {
  content: '';
  position: absolute;
  inset: 12%;
  border: 1px dashed rgba(138,90,28,.45);
  border-radius: 10%;
  pointer-events: none;
}

/* ---------- Strona główna ---------- */
.home-wrap { max-width: 480px; margin: 0 auto; padding: 48px 16px 64px; }
.logo { display: flex; gap: 6px; justify-content: center; margin-bottom: .4em; flex-wrap: wrap; }
.tile.big { width: 52px; height: 52px; font-size: 32px; }
.tile.big:nth-child(odd) { transform: rotate(-3deg); }
.tile.big:nth-child(even) { transform: rotate(2deg) translateY(2px); }
.tagline { text-align: center; color: var(--ink-soft); margin: 0 0 28px; }
.card {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.card button[type=submit] { width: 100%; }
.card .inline button { width: auto; }
#code-form input { text-transform: uppercase; letter-spacing: .15em; font-family: ui-monospace, monospace; }
#my-games-list, #public-games-list { margin: 0; padding-left: 1.2em; }
#my-games-list li, #public-games-list li { margin: .3em 0; }
#public-games-list:empty { display: none; }
label.check { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4em; font-weight: 500; }
label.check input { width: auto; margin: 0; }
.badge { font-size: .75rem; font-weight: 600; padding: .1em .5em; border-radius: 999px; background: rgba(138,90,28,.15); vertical-align: middle; }
.contact summary { cursor: pointer; font-weight: 600; }
.contact[open] summary { margin-bottom: 1em; }
.channel { display: flex; gap: 8px; align-items: baseline; margin: 0 0 .75em; color: var(--ink-soft); }
.channel .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.channel.up .dot { background: var(--good, #16a34a); }
.channel.down .dot { background: var(--warn, #d97706); }
.contact .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Gra ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.brand { font: 700 20px var(--serif); color: var(--ink); text-decoration: none; }
.game-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code { font-family: ui-monospace, monospace; color: var(--ink-soft); font-size: .85em; letter-spacing: .08em; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; }
.conn.on { background: var(--ok); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
.play { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.status {
  font: 600 16px var(--serif);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--paper-2);
}
.status.mine { background: var(--accent); color: #fff; animation: pulse 1.6s ease-in-out 2; }
.status.done { background: var(--board); color: #fff; }
.deadline { font-size: 14px; color: var(--ink-soft); margin-top: -6px; font-variant-numeric: tabular-nums; }
.deadline.urgent { color: var(--bad); font-weight: 600; }
@keyframes pulse { 50% { transform: scale(1.06); } }

.board-wrap { width: 100%; display: flex; justify-content: center; }
.board {
  --bw: min(100%, 640px, calc(100vh - 250px));
  width: var(--bw);
  min-width: 300px;
  aspect-ratio: 1;
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 0.35cqi;
  padding: 0.8cqi;
  background: var(--board);
  border-radius: 1.6cqi;
  box-shadow: 0 6px 18px rgba(31,74,69,.28);
}
.cell {
  position: relative;
  background: var(--cell);
  border-radius: 0.8cqi;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.cell.p-TW { background: var(--tw); }
.cell.p-DW { background: var(--dw); }
.cell.p-TL { background: var(--tl); }
.cell.p-DL { background: var(--dl); }
.cell .label {
  font: 600 1.8cqi var(--sans);
  color: rgba(255,255,255,.88);
  letter-spacing: -.02em;
  pointer-events: none;
}
.cell.p-DW .label, .cell.p-DL .label { color: rgba(43,33,24,.7); }
.cell .label.star { font-size: 3.6cqi; color: rgba(43,33,24,.65); }
.cell.target { cursor: pointer; box-shadow: inset 0 0 0 0.35cqi rgba(255,233,168,.75); }
.cell.target:hover { background: #3d7a72; }
.cell .tile { width: 100%; height: 100%; font-size: 3.7cqi; }
.cell .tile.pending { background: var(--tile-new); box-shadow: 0 0 0 0.35cqi #f2b32b, 0 1px 3px rgba(0,0,0,.4); cursor: pointer; z-index: 1; }
.cell .tile.last { box-shadow: inset 0 -2px 0 rgba(0,0,0,.12), 0 0 0 0.3cqi rgba(255,255,255,.75); }

.rack-area { width: 100%; max-width: 640px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.preview { min-height: 1.4em; font-weight: 500; color: var(--ink-soft); text-align: center; }
.preview.ok { color: var(--ok); }
.preview.bad { color: var(--bad); }
.rack {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: linear-gradient(#a57a45, #8a6236);
  border-radius: 10px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), 0 3px 8px rgba(0,0,0,.2);
  min-height: 72px;
}
.rack .tile, .rack .slot { width: 50px; height: 50px; font-size: 28px; flex: none; }
.rack .tile { cursor: pointer; transition: transform .1s; }
.rack .tile:hover { transform: translateY(-2px); }
.rack .tile.selected { transform: translateY(-8px); box-shadow: 0 0 0 3px #f2b32b, 0 6px 10px rgba(0,0,0,.35); }
.rack .tile.marked { background: #f6c9bd; box-shadow: 0 0 0 3px var(--accent); }
.rack .slot { border-radius: 6px; background: rgba(0,0,0,.12); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.panel.subtle { background: transparent; border: none; padding: 0 4px; }
.panel p { margin: 0 0 .7em; }
.bag { font: 500 13px var(--sans); color: var(--ink-soft); }
.share { display: flex; gap: 6px; margin-bottom: 12px; }
.share input { font-size: 13px; }
#join-form { margin-bottom: 8px; }
#btn-start { width: 100%; }

.players { list-style: none; margin: 0; padding: 0; }
.player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.player.turn { background: #fbe3c9; }
.player.me .name { font-weight: 600; }
.player .host { color: var(--ink-soft); font-size: .8em; font-weight: 400; }
.player .score { font: 700 18px var(--serif); }
.player .left { grid-column: 2 / 4; font-size: .85em; color: var(--ink-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c9bda8; }
.dot.on { background: var(--ok); }

.voice-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-panel p { margin-bottom: .6em; }
.player .mic { margin-left: 6px; font-size: .85em; opacity: .55; display: inline-block; transition: transform .12s, opacity .12s; }
.player .mic.speaking { opacity: 1; transform: scale(1.25); filter: drop-shadow(0 0 3px var(--ok)); }

.log-panel { display: flex; flex-direction: column; }
.log {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  font-size: 14px;
}
.log li { padding: 5px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.log li:last-child { border-bottom: none; }
.log .pts { color: var(--ok); font-weight: 600; }
.log-join, .log-start, .log-pass, .log-exchange { color: var(--ink-soft); }
.log-chat { color: var(--tl); }
.log-end { font-weight: 600; }

dialog {
  border: none;
  border-radius: 14px;
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
  max-width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(20,15,10,.45); }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; margin-bottom: 14px; }
.tile.pick { width: 100%; aspect-ratio: 1; font-size: 22px; border: none; padding: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px);
  text-align: center;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); }

.fatal-msg { font: 600 18px var(--serif); margin: 40px 0 16px; }
body.fatal .layout { display: block; text-align: center; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 10px 8px; }
  .board { --bw: 100%; min-width: 0; }
  .rack { gap: 4px; padding: 8px; }
  .rack .tile, .rack .slot { width: min(44px, calc((100vw - 60px) / 7)); height: min(44px, calc((100vw - 60px) / 7)); font-size: 24px; }
  .controls { gap: 6px; }
  .controls button { padding: .5em .7em; font-size: 13px; }
}

/* ---------- Strona projektu: regulamin i polityka prywatności ---------- */
.consent { margin: .7em 0 0; }
#create-form .consent { margin: 0 0 .8em; }
.voice-note { margin: .7em 0 0 !important; }
.site-footer { text-align: center; color: var(--ink-soft); margin-top: 28px; }
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.doc h1 { font-size: 2rem; }
.doc h2 { font-size: 1.35rem; margin-top: 1.6em; }
.doc h3 { font-size: 1.2rem; margin-top: 2em; padding-top: .8em; border-top: 1px solid var(--line); }
.doc h4 { font: 600 1rem var(--sans); margin: 1.6em 0 .5em; }
.doc p, .doc li { line-height: 1.6; }
.doc ol { padding-left: 1.4em; margin: 0 0 1em; }
.doc li { margin-bottom: .4em; }
.doc :target { scroll-margin-top: 16px; }
.doc h4:target, .doc h3:target, .doc h2:target { color: var(--accent); }
.toc { display: flex; flex-direction: column; gap: 4px; margin: 0 0 1em; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.doc table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .92em; background: #fffaf0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--paper-2); font-weight: 600; }
.doc .back { margin-top: 2.4em; }

