/* Človeče, nehnevaj sa! – štýly */

:root {
  --bg-1: #16304f;
  --bg-2: #24527a;
  --ink: #1f2633;
  --ink-soft: #5d6677;
  --card: #fffdf8;
  --card-edge: rgba(31, 38, 51, 0.08);
  --primary: #ef6a32;
  --primary-dark: #c74e1c;
  --accent: #f4c430;
  --ok: #1f9d55;
  --warn: #d98a00;
  --danger: #d63645;
  --wood: #f3e6c8;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(8, 22, 40, 0.28), 0 2px 6px rgba(8, 22, 40, 0.18);
  --red: #e63946; --blue: #2f6fe4; --green: #20a35a; --yellow: #f4c430; --orange: #f3841c; --purple: #8d4bd8;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.10), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(244, 196, 48, 0.10), transparent 40%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}
[hidden] { display: none !important; }
a { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
.muted { color: var(--ink-soft); }

/* ------------------------------------------------------------ tlačidlá */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 48px; padding: 0.7em 1.3em;
  border: 0; border-radius: 999px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .swatch input:focus-visible + .swatch-body { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8752, var(--primary) 55%, var(--primary-dark));
  box-shadow: 0 4px 0 #a63e12, 0 8px 18px rgba(199, 78, 28, 0.35);
}
.btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 #a63e12, 0 4px 10px rgba(199, 78, 28, 0.35); }
.btn-secondary {
  color: var(--ink); background: #fff;
  box-shadow: inset 0 0 0 2px rgba(31, 38, 51, 0.14), 0 3px 8px rgba(8, 22, 40, 0.10);
}
.btn-ghost { color: var(--ink-soft); background: transparent; box-shadow: inset 0 0 0 2px rgba(31, 38, 51, 0.10); }
.btn-whatsapp { color: #fff; background: #25d366; box-shadow: 0 3px 8px rgba(37, 211, 102, 0.35); }
.btn-xl { min-height: 64px; font-size: 1.15rem; padding: 0.9em 2em; width: 100%; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: inline-grid; place-items: center;
  font-size: 1.25rem; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.25); }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon { width: 1.35rem; height: 1.35rem; display: block; fill: currentColor; }
.sound-toggle[aria-pressed="true"] .sound-off,
.sound-toggle[aria-pressed="false"] .sound-on { display: none; }

/* ------------------------------------------------------------ karty a formuláre */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-edge);
}
.panel { padding: 1.5rem; width: 100%; max-width: 560px; margin: 0 auto; animation: rise 0.3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.field { display: block; margin: 0 0 1.1rem; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-weight: 650; margin-bottom: 0.4rem; padding: 0; }
input[type=text], select {
  width: 100%; min-height: 50px;
  padding: 0.6em 0.9em;
  font: inherit; font-size: 1.05rem; color: var(--ink);
  border: 2px solid #d9d2c3; border-radius: 12px; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=text]:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(239, 106, 50, 0.18); }
.code-input { font-size: 1.6rem !important; letter-spacing: 0.3em; text-align: center; font-weight: 700; text-transform: uppercase; }
.form-error { color: #fff; background: var(--danger); border-radius: 10px; padding: 0.6em 0.9em; font-weight: 600; }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1rem; }

.board-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.board-option input { position: absolute; opacity: 0; pointer-events: none; }
.board-option-body {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem; text-align: center;
  padding: 0.9rem 0.5rem; border-radius: 14px; cursor: pointer;
  border: 2px solid #e2dccd; background: #fff; transition: all 0.15s;
}
.board-option input:checked + .board-option-body { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(239, 106, 50, 0.15); background: #fff7f2; }
.board-option small { color: var(--ink-soft); }
.board-icon { width: 54px; height: 54px; margin-bottom: 0.3rem; background: var(--wood); border-radius: 10px; position: relative; }
.board-icon-4 {
  background:
    linear-gradient(var(--wood), var(--wood)) padding-box,
    conic-gradient(var(--red) 0 25%, var(--blue) 0 50%, var(--green) 0 75%, var(--yellow) 0) border-box;
  border: 6px solid transparent; border-radius: 12px;
}
.board-icon-6 {
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
  background: conic-gradient(var(--red) 0 16.6%, var(--orange) 0 33.3%, var(--yellow) 0 50%, var(--green) 0 66.6%, var(--blue) 0 83.3%, var(--purple) 0);
}

.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-body {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  min-width: 84px; min-height: 76px; padding: 0.55rem 0.6rem; cursor: pointer;
  border-radius: 14px; border: 2px solid #e2dccd; background: #fff;
  font-size: 0.9rem; font-weight: 600; transition: all 0.15s;
}
.swatch input:checked + .swatch-body { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent); transform: translateY(-2px); }
.swatch.is-taken .swatch-body { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.7); }
.swatch small { font-weight: 500; color: var(--ink-soft); font-size: 0.75rem; }
.glyph-svg { flex: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }

/* ------------------------------------------------------------ úvodná stránka */
.home { max-width: 640px; margin: 0 auto; padding: 1.25rem 16px 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.hero { text-align: center; color: #fff; padding-top: 2rem; }
.hero-small { padding-top: 0.5rem; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.2rem); font-weight: 800; letter-spacing: -0.025em; text-shadow: 0 2px 8px rgba(8, 22, 40, 0.32); margin-bottom: 0.3em; }
.hero-small h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.subtitle { font-size: 1.15rem; opacity: 0.9; margin: 0 auto; max-width: 30em; }
.hero-logo { display: flex; justify-content: center; gap: 0.6rem; margin-bottom: 1rem; }
.pawn {
  width: 34px; height: 46px; position: relative; display: inline-block;
  animation: bob 2.4s ease-in-out infinite;
}
.pawn::before, .pawn::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0, var(--pc) 35%, color-mix(in srgb, var(--pc) 55%, #000) 100%); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); }
.pawn::before { width: 20px; height: 20px; top: 0; z-index: 1; }
.pawn::after { width: 34px; height: 30px; bottom: 0; border-radius: 50% 50% 40% 40%; }
.pawn-red { --pc: var(--red); }
.pawn-blue { --pc: var(--blue); animation-delay: 0.2s; }
.pawn-green { --pc: var(--green); animation-delay: 0.4s; }
.pawn-yellow { --pc: var(--yellow); animation-delay: 0.6s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.choice { display: grid; gap: 0.8rem; max-width: 420px; width: 100%; margin: 0.5rem auto 0; }
.home-foot { text-align: center; }
.home-foot a { color: rgba(255, 255, 255, 0.85); }
.join-players { margin: 1rem 0 1.25rem; }
.join-players h3 { font-size: 1rem; }
.player-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.player-chips li { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem 0.3rem 0.35rem; background: #f3eee3; border-radius: 999px; font-weight: 600; }
.room-code-inline { letter-spacing: 0.12em; }

/* ------------------------------------------------------------ hlavička hry */
.page-game { overflow-x: hidden; }
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.4rem 16px; padding-top: max(0.4rem, env(safe-area-inset-top));
  color: #fff; position: relative; z-index: 20;
}
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 0.45rem; }
.brand-icon { color: var(--accent); width: 1.45rem; height: 1.45rem; flex: none; }
.topbar-actions { display: flex; align-items: center; gap: 0.4rem; position: relative; }
.room-badge { background: rgba(255, 255, 255, 0.14); padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.9rem; white-space: nowrap; }
.room-badge strong { letter-spacing: 0.1em; }
.app.offline .topbar::after { content: "Obnovujem spojenie…"; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); background: var(--warn); color: #fff; padding: 0.2rem 0.8rem; border-radius: 0 0 10px 10px; font-size: 0.85rem; font-weight: 600; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 0.4rem; z-index: 30;
  display: flex; flex-direction: column;
}
.menu button, .menu a {
  text-align: left; border: 0; background: none; font: inherit; color: var(--ink);
  padding: 0.8rem 0.9rem; border-radius: 10px; cursor: pointer; text-decoration: none; min-height: 44px;
}
.menu button:hover, .menu a:hover { background: #f3eee3; }
.menu .danger { color: var(--danger); }

.loading { flex: 1; display: grid; place-content: center; justify-items: center; color: #fff; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ čakáreň */
.lobby { padding: 0.5rem 16px 2rem; display: flex; justify-content: center; }
.lobby-card { width: 100%; max-width: 680px; padding: 1.5rem; }
.lobby-title { font-size: 1.6rem; }
.invite { display: grid; gap: 1rem; grid-template-columns: auto 1fr; align-items: center; padding: 1rem; background: #f6f0e3; border-radius: 14px; margin-bottom: 1.4rem; }
.invite-code { display: flex; flex-direction: column; align-items: center; padding: 0 0.5rem; }
.invite-code strong { font-size: 2rem; letter-spacing: 0.15em; font-weight: 800; }
.invite-link { display: grid; gap: 0.6rem; min-width: 0; }
.invite-link input { font-size: 0.9rem; min-height: 44px; }
.invite-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.invite-buttons .btn { min-height: 44px; padding: 0.5em 1em; flex: 1 1 auto; }
.lobby-sub { font-size: 1.2rem; }
.lobby-sub .muted { font-size: 0.95rem; font-weight: 500; }
.lobby-players { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; gap: 0.5rem; }
.lobby-players li { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.8rem; background: #fff; border: 1px solid #ebe4d5; border-radius: 14px; }
.lobby-players li.empty { background: transparent; border-style: dashed; }
.lobby-players li.is-offline { opacity: 0.6; }
.empty-slot { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed #cfc6b3; }
.lp-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lp-name small { color: var(--ink-soft); }
.tag { font-size: 0.8rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px; background: #eee7d8; color: var(--ink-soft); white-space: nowrap; }
.tag-ready { background: #d8f3e3; color: #13693a; }
.tag-host { background: #fde7c2; color: #8a5300; }
.lobby-color h3 { font-size: 1rem; }
.lobby-hint { margin: 1.2rem 0 0; padding: 0.8rem 1rem; background: #eef4fb; border-radius: 12px; color: #1d4370; }

/* ------------------------------------------------------------ hra */
.game {
  flex: 1; display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr) 340px;
  padding: 0 16px 16px; align-items: start;
  max-width: 1400px; width: 100%; margin: 0 auto;
}
.board-area { position: relative; display: flex; justify-content: center; }
.board-wrap {
  width: min(100%, calc(100dvh - 90px));
  aspect-ratio: 1; overflow: hidden; border-radius: 22px;
  touch-action: manipulation;
}
.board-wrap.zoomed { overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.board-zoom { width: 100%; }
.board { display: block; width: 100%; height: auto; aspect-ratio: 1; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.board-announcer {
  --notice-accent: #2f6fe4;
  position: absolute; z-index: 12; left: 50%; top: 50%;
  width: max-content; max-width: min(82%, 430px); min-height: 58px;
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 1rem 0.65rem 0.7rem;
  color: #fff; background: rgba(17, 31, 50, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 17px;
  box-shadow: 0 14px 38px rgba(8, 22, 40, 0.34), inset 4px 0 var(--notice-accent);
  pointer-events: none; transform: translate(-50%, -50%); opacity: 0;
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
.board-announcer[hidden] { display: none; }
.board-announcer.is-visible { animation: board-notice-in 0.28s cubic-bezier(.2,.85,.25,1.25) forwards; }
.board-announcer.is-leaving { animation: board-notice-out 0.24s ease forwards; }
.board-announcer-symbol {
  display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px;
  border-radius: 50%; color: #fff; background: var(--notice-accent);
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.16);
}
.board-announcer-symbol .ui-icon { width: 24px; height: 24px; }
.board-announcer-text { font-weight: 800; line-height: 1.25; text-wrap: balance; }
.board-announcer.notice-capture { --notice-accent: #d63645; }
.board-announcer.notice-goal { --notice-accent: #15945d; }
.board-announcer.notice-six { --notice-accent: #e39a18; }
.board-announcer.notice-win { --notice-accent: #9b62dc; }
@keyframes board-notice-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes board-notice-out {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, calc(-50% - 10px)) scale(0.97); }
}
.zoom-controls { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom-controls .icon-btn { background: rgba(22, 48, 79, 0.75); font-weight: 700; }
.app:not(.board6) .zoom-controls { display: none; }

.board-plate { fill: var(--wood); stroke: #b99c69; stroke-width: 0.1; }
.track-line { fill: none; stroke: #c5ab7c; stroke-width: 0.14; stroke-linejoin: round; }
.goal-line { stroke-width: 0.14; stroke-opacity: 0.45; stroke-linecap: round; }
.yard-fill { fill-opacity: 0.22; transition: fill-opacity 0.35s ease; }
.yard-line { fill: none; stroke-width: 0.06; stroke-opacity: 0.6; transition: stroke-width 0.35s ease, stroke-opacity 0.35s ease; }
.yard.current .yard-fill { fill-opacity: 1; }
.yard.current .yard-line { stroke: var(--yard-dark); stroke-width: 0.1; stroke-opacity: 1; }
.field-start.current { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { stroke: #fff; stroke-width: 0.13; } }
.start-arrow { pointer-events: none; }
.fields { pointer-events: none; }

.piece { cursor: default; outline: none; pointer-events: none; }
.piece-ring { fill: none; stroke: transparent; stroke-width: 0.08; }
.piece.movable { cursor: pointer; }
.piece.movable .piece-hit { pointer-events: all; }
.piece.movable .piece-ring { stroke: #fff; animation: ring 1s ease-in-out infinite; }
.piece.movable .piece-inner { animation: lift 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
/* neaktívne figúrky: odfarbené, takmer nepriehľadné – čitateľné aj v plne farebnom domčeku hráča na ťahu
   (prehliadač bez podpory filter na SVG použije aspoň priehľadnosť) */
.piece.inactive { opacity: 0.72; filter: saturate(0.25) brightness(1.08); transition: opacity 0.2s, filter 0.2s; }
.piece.captured .piece-inner { animation: shake 0.26s linear; transform-box: fill-box; transform-origin: center; }
@keyframes ring { 0%, 100% { stroke-opacity: 1; stroke-width: 0.08; } 50% { stroke-opacity: 0.5; stroke-width: 0.15; } }
@keyframes lift { 50% { transform: translateY(-0.06px) scale(1.08); } }
@keyframes shake { 25% { transform: translateX(-0.1px) rotate(-10deg); } 75% { transform: translateX(0.1px) rotate(10deg); } }
.target { fill: #fff6debf; stroke: #164739; stroke-width: 0.09; stroke-dasharray: 0.18 0.1; cursor: pointer; animation: dash 1.2s linear infinite; }
.target.hl { fill: #ffd27e; stroke-width: 0.11; stroke-dasharray: none; }
@keyframes dash { to { stroke-dashoffset: -0.56; } }
.spark { pointer-events: none; animation: spark 0.7s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.goal-ring { fill: none; stroke-width: 0.1; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: goalring 0.9s ease-out forwards; }
@keyframes goalring { to { transform: scale(3); opacity: 0; } }

/* ------------------------------------------------------------ bočný panel */
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.turn-card {
  --turn-color: #999;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0.9rem 1rem; border-left: 8px solid var(--turn-color);
  transition: border-color 0.3s;
}
.turn-card.is-me { background: linear-gradient(90deg, color-mix(in srgb, var(--turn-color) 16%, #fff), #fff); }
.turn-who { display: flex; align-items: center; gap: 0.6rem; font-weight: 750; font-size: 1.15rem; }
.turn-who .glyph { display: inline-flex; }
.turn-hint { color: var(--ink-soft); min-height: 1.4em; margin-top: 0.2rem; }

.dice-area {
  display: flex; align-items: center; gap: 1rem; justify-content: center;
  padding: 0.75rem 1rem; background: var(--card); border: 1px solid var(--card-edge);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.mobile-turn-line { display: none; min-width: 0; }
.mobile-turn-line span, .mobile-turn-line small { overflow-wrap: anywhere; }
.dice-scene {
  --dice-accent: #888;
  width: 88px; height: 88px; perspective: 520px; position: relative; flex: none;
  display: grid; place-items: center;
}
.dice-scene.clickable { cursor: pointer; }
.dice-scene.shake { animation: diceShake 0.3s; }
@keyframes diceShake { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.dice { width: 62px; height: 62px; position: relative; transform-style: preserve-3d; will-change: transform; }
.dice-shadow { position: absolute; bottom: 2px; left: 50%; width: 56px; height: 12px; transform: translateX(-50%); background: radial-gradient(rgba(0, 0, 0, 0.4), transparent 70%); z-index: -1; }
.face {
  position: absolute; inset: 0; border-radius: 12px;
  background: radial-gradient(circle at 30% 25%, #fff, #f1ede4 70%, #ddd5c5);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06), inset 0 0 10px rgba(0, 0, 0, 0.08);
  border: 3px solid var(--dice-accent);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face i { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #555, #111); place-self: center; }
.f1 { transform: rotateY(0deg) translateZ(31px); }
.f6 { transform: rotateY(180deg) translateZ(31px); }
.f3 { transform: rotateY(90deg) translateZ(31px); }
.f4 { transform: rotateY(-90deg) translateZ(31px); }
.f5 { transform: rotateX(90deg) translateZ(31px); }
.f2 { transform: rotateX(-90deg) translateZ(31px); }
.f1 i { grid-area: 2 / 2; background: radial-gradient(circle at 35% 35%, #ff6b6b, #b3121f); width: 14px; height: 14px; }
.f2 i:nth-child(1) { grid-area: 1 / 1; } .f2 i:nth-child(2) { grid-area: 3 / 3; }
.f3 i:nth-child(1) { grid-area: 1 / 1; } .f3 i:nth-child(2) { grid-area: 2 / 2; } .f3 i:nth-child(3) { grid-area: 3 / 3; }
.f4 i:nth-child(1) { grid-area: 1 / 1; } .f4 i:nth-child(2) { grid-area: 1 / 3; } .f4 i:nth-child(3) { grid-area: 3 / 1; } .f4 i:nth-child(4) { grid-area: 3 / 3; }
.f5 i:nth-child(1) { grid-area: 1 / 1; } .f5 i:nth-child(2) { grid-area: 1 / 3; } .f5 i:nth-child(3) { grid-area: 2 / 2; } .f5 i:nth-child(4) { grid-area: 3 / 1; } .f5 i:nth-child(5) { grid-area: 3 / 3; }
.f6 i:nth-child(1) { grid-area: 1 / 1; } .f6 i:nth-child(2) { grid-area: 2 / 1; } .f6 i:nth-child(3) { grid-area: 3 / 1; }
.f6 i:nth-child(4) { grid-area: 1 / 3; } .f6 i:nth-child(5) { grid-area: 2 / 3; } .f6 i:nth-child(6) { grid-area: 3 / 3; }
.dice-scene.idle .dice { opacity: 0.85; }
.dice-scene.six::after { content: "6!"; position: absolute; top: -14px; right: -18px; background: var(--accent); color: #5a3d00; font-weight: 900; border-radius: 999px; padding: 0.1rem 0.5rem; animation: pop 0.9s ease forwards; }
@keyframes pop { 0% { transform: scale(0); } 20% { transform: scale(1.2); } 80% { transform: scale(1); opacity: 1; } 100% { opacity: 0; } }

.btn-roll { min-height: 64px; font-size: 1.15rem; padding: 0.8em 1.6em; flex: 1; max-width: 240px; }
.btn-roll:disabled { opacity: 1; color: #6a6f79; background: linear-gradient(180deg, #ece9e2, #d9d4ca); box-shadow: inset 0 0 0 2px rgba(31, 38, 51, 0.08); }
.btn-roll.pulse { animation: roll-ready 1.4s ease-in-out infinite; }
@keyframes roll-ready {
  50% { box-shadow: 0 3px #c89a4e, 0 0 0 6px #ffd27e66; }
}

.game :is(.turn-card, .dice-area, .side-card),
#view-finished .modal {
  --card: #fffaf0;
  --card-edge: #eadbc1;
}

.game .turn-card.is-me {
  background: linear-gradient(90deg, color-mix(in srgb, var(--turn-color) 16%, var(--card)), var(--card));
}

.game .side-card h2, #view-finished h2 { color: #14382e; }

.game .btn-roll:not(:disabled),
#btn-rematch, #btn-fin-open {
  background: #ffd27e;
  color: #30230d;
  box-shadow: 0 3px #c89a4e;
}

.side-card { padding: 0.9rem 1rem; }
.side-card h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 0.5rem; }
.side-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.side-card-head h2 { margin-bottom: 0.5rem; }
.history-toggle { display: none; border: 0; background: transparent; color: var(--primary-dark); font: 700 0.82rem/1 system-ui, sans-serif; padding: 0.4rem; cursor: pointer; }
.game-players { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.game-players li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 12px; border: 2px solid transparent; transition: background 0.2s, border-color 0.2s; }
.game-players li.is-current { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 10%, #fff); }
.game-players li.is-offline { opacity: 0.6; }
.game-players li.is-winner { background: #fff4cf; }
.gp-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.gp-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-name small { font-size: 0.78rem; color: var(--ink-soft); }
.gp-name .on { color: var(--ok); }
.gp-name .off { color: var(--danger); }
.gp-stats { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; white-space: nowrap; }
.gp-stats small { font-weight: 500; color: var(--ink-soft); font-size: 0.75rem; }

.history { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; display: grid; gap: 0.15rem; font-size: 0.92rem; }
.history li { padding: 0.3rem 0.5rem; border-radius: 8px; }
.history li:first-child { background: #f6f0e3; }
.history .h-turn { color: var(--ink-soft); font-size: 0.82rem; border-top: 1px dashed #e4dccb; border-radius: 0; }
.history .h-capture .cap { display: block; color: var(--danger); }
.history .h-goal { color: var(--ok); }
.history .h-win { font-weight: 700; }
.history .pip { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 5px; background: #fff; border: 1px solid #cfc6b3; font-weight: 800; }

/* ------------------------------------------------------------ koniec partie */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 22, 40, 0.55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; padding: 1.6rem; text-align: center; animation: rise 0.3s ease; }
.trophy { font-size: 3.5rem; line-height: 1; animation: bob 2s ease-in-out infinite; }
.trophy .ui-icon { width: 3.5rem; height: 3.5rem; color: #d99a00; }
.fin-winner { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 1.4rem; flex-wrap: wrap; }
.fin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1rem 0; }
.fin-stats div { background: #f6f0e3; border-radius: 12px; padding: 0.6rem 0.3rem; }
.fin-stats dt { font-size: 0.78rem; color: var(--ink-soft); }
.fin-stats dd { margin: 0; font-weight: 800; font-size: 1.15rem; }
.modal .form-actions { justify-content: center; }
.fin-reopen { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

/* ------------------------------------------------------------ oznámenia */
.toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.5rem; align-items: center; z-index: 70; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #1f2633; color: #fff; padding: 0.7rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; opacity: 0; transform: translateY(10px); transition: all 0.3s ease; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast-warn { background: #8a5300; }
.toast-error { background: var(--danger); }

/* ------------------------------------------------------------ chat */
.chat-fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: grab; z-index: 55;
  display: grid; place-items: center; color: #fff; touch-action: none; user-select: none;
  background: linear-gradient(180deg, #397cf0, #1d4fb0);
  box-shadow: 0 4px 0 #163d88, 0 10px 22px rgba(8, 22, 40, 0.4);
  -webkit-tap-highlight-color: transparent; transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.chat-fab:active { transform: translateY(2px); }
.chat-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.chat-fab:hover { background: linear-gradient(180deg, #4d8cff, #245ac1); }
.chat-fab.is-open { background: linear-gradient(180deg, #52627a, #2b3547); box-shadow: 0 4px 0 #1b2230, 0 10px 22px rgba(8, 22, 40, 0.4); }
.chat-fab.dragging { cursor: grabbing; transition: none; transform: scale(1.06); }
.chat-fab.has-unread { box-shadow: 0 4px 0 #163d88, 0 0 0 5px rgba(214, 54, 69, 0.35), 0 12px 28px rgba(8, 22, 40, 0.48); }
.chat-fab.notify { animation: chat-attention 0.62s ease-in-out 3; }
@keyframes chat-attention {
  0%, 100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-8deg) scale(1.1); }
  55% { transform: rotate(7deg) scale(1.1); }
}
.app[data-view="loading"] .chat-fab, .app[data-view="loading"] .chat-panel { display: none; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 12px; background: var(--danger); color: #fff; font: 700 0.8rem/24px system-ui, sans-serif;
  border: 2px solid #fff; animation: pop 0.3s ease;
}
.chat-fab-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: none; gap: 3px; }
.chat-fab-dots i { width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: chat-dot 1s infinite ease-in-out; }
.chat-fab-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-fab-dots i:nth-child(3) { animation-delay: 0.3s; }
.chat-fab.someone-typing .chat-fab-dots { display: flex; }
.chat-fab.someone-typing .chat-fab-icon { transform: translateY(-5px) scale(0.82); }
.chat-fab-icon { width: 1.65rem; height: 1.65rem; transition: transform 0.2s ease; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes pop { from { transform: scale(0.4); } 70% { transform: scale(1.15); } to { transform: scale(1); } }

.chat-peek {
  position: fixed; right: max(16px, env(safe-area-inset-right)); top: calc(max(0px, env(safe-area-inset-top)) + 62px);
  max-width: min(320px, calc(100vw - 110px)); z-index: 55; cursor: pointer;
  display: flex; align-items: flex-start; gap: 0.45rem; text-align: left;
  padding: 0.6rem 0.85rem; border: 0; border-left: 4px solid var(--mc); border-radius: 14px 14px 4px 14px;
  background: #fff; color: var(--ink); font: inherit; font-size: 0.92rem; box-shadow: var(--shadow);
}
.chat-peek span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.chat-peek svg { flex: none; margin-top: 2px; }
.chat-peek.show { animation: peek-in 0.3s ease; }
@keyframes peek-in { from { opacity: 0; transform: translateX(16px) scale(0.95); } to { opacity: 1; transform: none; } }

.chat-panel {
  position: fixed; right: max(16px, env(safe-area-inset-right)); top: calc(max(0px, env(safe-area-inset-top)) + 62px);
  width: 370px; height: min(540px, calc(100dvh - 120px)); z-index: 56;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: chat-in 0.22s ease;
}
@keyframes chat-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.chat-head { display: flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.6rem 0.55rem 1rem; background: var(--bg-1); color: #fff; }
.chat-head h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.chat-empty { margin: auto 1rem; text-align: center; }
.chat-list { list-style: none; margin: 0; padding: 0.7rem 0.75rem 0.3rem; flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; }
.chat-empty:not([hidden]) + .chat-list { flex: 0; padding: 0; }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; margin-top: 8px; }
.chat-msg.grouped { margin-top: 0; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-meta { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--ink-soft); margin: 0 0.3rem 2px; }
.chat-meta b { color: var(--ink); }
.chat-meta time { font-variant-numeric: tabular-nums; }
.chat-bubble {
  padding: 0.45rem 0.75rem; border-radius: 4px 16px 16px 16px; line-height: 1.35;
  background: #fff; border: 1px solid var(--card-edge); border-left: 3px solid var(--mc);
  overflow-wrap: anywhere; white-space: pre-wrap; animation: bubble-in 0.2s ease;
}
.chat-msg.grouped .chat-bubble { border-radius: 4px 16px 16px 4px; }
.chat-msg.mine .chat-bubble { background: #dbe8ff; border: 0; border-right: 3px solid var(--mc); border-radius: 16px 4px 16px 16px; }
.chat-msg.mine.grouped .chat-bubble { border-radius: 16px 4px 4px 16px; }
.chat-bubble.big { font-size: 1.9rem; line-height: 1.15; background: transparent !important; border: 0 !important; padding: 0 0.2rem; }
.chat-msg.pending .chat-bubble { opacity: 0.55; }
.chat-msg.failed { cursor: pointer; }
.chat-msg.failed .chat-bubble { background: #fde3e5; border-right-color: var(--danger); }
.chat-fail { font-size: 0.75rem; color: var(--danger); margin: 2px 0.3rem 0; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chat-typing { min-height: 1.3rem; padding: 0 1rem; font-size: 0.8rem; font-style: italic; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-quick { display: flex; gap: 0.3rem; padding: 0.2rem 0.6rem 0.4rem; overflow-x: auto; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-q {
  flex: none; min-width: 40px; height: 34px; padding: 0 0.5rem; border-radius: 17px; cursor: pointer;
  border: 1px solid var(--card-edge); background: #fff; font: 700 1.05rem/1 system-ui, sans-serif; color: var(--ink);
}
.chat-q:hover { background: #f1ece0; }
.chat-q:active { transform: scale(0.94); }
.chat-form { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.6rem 0.6rem; border-top: 1px solid var(--card-edge); position: relative; }
.chat-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 0.9rem; border-radius: 22px;
  border: 2px solid #d8d2c4; background: #fff; font: inherit; font-size: 16px; color: var(--ink);
}
.chat-form input:focus { outline: none; border-color: #2f6fe4; }
.chat-counter { position: absolute; right: 64px; top: 50%; transform: translateY(-50%); font-size: 0.75rem; pointer-events: none; }
.chat-send { min-height: 44px; width: 44px; padding: 0; flex: none; font-size: 1.1rem; }

/* ------------------------------------------------------------ pravidlá */
.rules { max-width: 760px; margin: 0 auto; padding: 1.5rem; }
.rules h2 { margin-top: 1.2em; }
.rules li { margin-bottom: 0.35em; }

/* ------------------------------------------------------------ responzívne */
/* Tablet: doska a ovládanie ostávajú vedľa seba, aby sa pri každom ťahu nemuselo rolovať. */
@media (min-width: 761px) and (max-width: 1100px) {
  .game { grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; padding-inline: 10px; }
  .board-wrap { width: min(100%, calc(100dvh - 82px)); }
  .dice-area { gap: 0.55rem; padding-inline: 0.65rem; }
  .dice-scene { transform: scale(0.88); margin-inline: -5px; }
  .btn-roll { padding-inline: 1rem; }
}
@media (max-width: 760px) {
  .game { grid-template-columns: 1fr; gap: 12px; padding: 0 8px 16px; }
  .board-wrap { width: min(100%, 720px); border-radius: 16px; }
  .side { max-width: 720px; width: 100%; margin: 0 auto; }
  .side > .turn-card { display: none; }
  .page-game { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .dice-area {
    position: fixed; z-index: 45; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom));
    min-height: 84px; padding: 0.5rem 0.65rem; gap: 0.6rem; border-radius: 18px;
  }
  .mobile-turn-line { display: flex; flex: 1; flex-direction: column; gap: 0.15rem; line-height: 1.2; }
  .mobile-turn-line span { font-weight: 800; font-size: 0.95rem; }
  .mobile-turn-line small { color: var(--ink-soft); font-size: 0.76rem; }
  .dice-scene { width: 62px; height: 62px; transform: scale(0.72); margin: -9px; }
  .btn-roll { flex: 0 0 auto; min-height: 54px; max-width: 38%; font-size: 0.95rem; line-height: 1.15; padding-inline: 0.65rem; }
  .chat-fab { right: 12px; bottom: calc(104px + env(safe-area-inset-bottom)); width: 54px; height: 54px; }
  .history-toggle { display: block; }
  .history-card:not(.is-expanded) .history li:nth-child(n+3) { display: none; }
  .history-card:not(.is-expanded) .history { overflow: hidden; }
}
@media (max-width: 560px) {
  .home { padding-top: 0.65rem; gap: 0.9rem; }
  .hero { padding-top: 0.35rem; }
  .hero-logo { margin-bottom: 0.55rem; transform: scale(0.86); transform-origin: bottom center; }
  .hero h1 { font-size: clamp(1.8rem, 9vw, 2.35rem); margin-bottom: 0.2em; }
  .subtitle { font-size: 1rem; line-height: 1.4; max-width: 24em; }
  .choice { margin-top: 0.2rem; }
  .brand span { display: none; }
  .brand { flex: none; }
  .brand-icon { width: 1.65rem; height: 1.65rem; }
  .room-badge { font-size: 0.8rem; padding: 0.3rem 0.55rem; }
  .room-badge > span { display: none; }
  .topbar { padding-inline: 10px; }
  .topbar-actions { gap: 0.25rem; }
  .invite { grid-template-columns: 1fr; text-align: center; }
  .lobby-card, .panel { padding: 1.1rem; }
  .swatch-body { min-width: 72px; }
  .board-options { grid-template-columns: 1fr 1fr; }
  .fin-stats { grid-template-columns: 1fr 1fr 1fr; }
  .history { max-height: 200px; }
  .board-announcer { max-width: 88%; min-height: 50px; padding: 0.5rem 0.75rem 0.5rem 0.55rem; border-radius: 14px; }
  .board-announcer-symbol { flex-basis: 36px; width: 36px; height: 36px; }
  .board-announcer-symbol .ui-icon { width: 21px; height: 21px; }
  .board-announcer-text { font-size: 0.9rem; }
  /* chat ako spodný panel cez celú šírku; pri otvorenej klávesnici sa zmenší na viditeľnú časť */
  .chat-peek { top: calc(max(0px, env(safe-area-inset-top)) + 58px); right: 10px; }
  .chat-panel {
    left: 0; right: 0; bottom: auto; width: auto;
    top: calc(var(--vvtop, 0px) + var(--vvh, 100dvh) - min(78dvh, var(--vvh, 100dvh)));
    height: min(78dvh, var(--vvh, 100dvh));
    border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom);
  }
}
/* mobil na šírku: doska vľavo, ovládanie vpravo */
@media (max-height: 560px) and (orientation: landscape) {
  .topbar { padding-block: 0.2rem; }
  .game { grid-template-columns: auto minmax(260px, 1fr); padding: 0 8px 8px; }
  .board-wrap { width: calc(100dvh - 64px); }
  .side { max-height: calc(100dvh - 64px); overflow-y: auto; }
  .side > .turn-card { display: block; }
  .dice-area { position: static; min-height: auto; box-shadow: var(--shadow); }
  .mobile-turn-line { display: none; }
  .page-game { padding-bottom: 0; }
  .btn-roll { min-height: 54px; }
  .chat-fab { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .chat-panel { top: 8px; bottom: 8px; right: max(10px, env(safe-area-inset-right)); height: auto; width: min(380px, 55vw); }
  .chat-quick { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
