:root {
  --bg1: #2a0a1f;
  --bg2: #4a0e2e;
  --bg3: #1a0712;
  --pink: #ff5d8f;
  --pink-soft: #ff8fb3;
  --gold: #ffd479;
  --blue: #5db0ff;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.14);
  --text: #fff4f8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(255,93,143,0.25), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(120,40,200,0.25), transparent 45%),
    linear-gradient(135deg, var(--bg1), var(--bg3) 60%, var(--bg2));
  background-attachment: fixed;
  overflow: hidden;                 /* ekran trzymany u góry — bez przewijania strony */
  overscroll-behavior: none;
}

.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.hidden { display: none !important; }

/* --- LOBBY --- */
.lobby-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  border-radius: 28px;
  padding: 40px 34px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
}
.logo {
  font-family: 'Dancing Script', cursive;
  font-size: 52px;
  line-height: 1.05;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.tagline { color: var(--pink-soft); font-size: 15px; margin-bottom: 28px; }
.field { display: block; text-align: left; margin-bottom: 22px; }
.field span { display: block; font-size: 13px; opacity: 0.8; margin-bottom: 6px; }

input[type=text] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type=text]:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255,93,143,0.25); }

.btn {
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  padding: 14px 22px;
  border-radius: 14px;
  transition: transform .12s, box-shadow .2s, background .2s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.14); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(90deg, var(--pink), #ff7aa2);
  border: none;
  box-shadow: 0 10px 30px rgba(255,93,143,0.4);
  color: #2a0512;
}
.btn-primary:hover { box-shadow: 0 14px 38px rgba(255,93,143,0.55); }

.lobby-actions { display: flex; flex-direction: column; gap: 14px; }
.or { font-size: 13px; opacity: 0.6; }
.join-row { display: flex; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 600; }
.join-row .btn { white-space: nowrap; }
.hint { margin-top: 22px; font-size: 13px; opacity: 0.7; }
.error { color: #ff9a9a; min-height: 20px; margin-top: 12px; font-size: 14px; }

/* --- WAITING --- */
.room-code {
  font-size: 56px; font-weight: 800; letter-spacing: 10px;
  background: linear-gradient(90deg, var(--gold), var(--pink));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin: 18px 0;
}
.spinner {
  width: 44px; height: 44px; margin: 24px auto 8px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- GRA LAYOUT --- */
.screen#game {
  display: flex; flex-direction: column;
  align-items: stretch; justify-content: flex-start;
  padding: 0; min-height: 100vh; height: 100vh;
}

/* pasek górny */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  flex: 0 0 auto;
}
.brand {
  font-family: 'Dancing Script', cursive; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.brand span {
  background: linear-gradient(90deg, var(--pink), var(--gold));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.turn-chip {
  font-size: 16px; font-weight: 600;
  padding: 8px 18px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--card-border);
  text-align: center; min-width: 0;
}
.turn-chip.my-turn { background: linear-gradient(90deg, var(--pink), #ff7aa2); color:#2a0512; box-shadow: 0 0 22px rgba(255,93,143,0.5); }
.turn-chip .you { font-weight: 800; }
.room-pill { font-size: 14px; opacity: 0.85; white-space: nowrap; }
.room-pill b { letter-spacing: 3px; color: var(--gold); font-size: 16px; }

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  padding: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; }

/* --- PANEL: kostka (lewo) + kasa (prawo) --- */
.panel-row { display: flex; gap: 14px; align-items: stretch; }
.panel-row .dice-area { flex: 0 0 auto; }
.cash-box { flex: 1 1 auto; min-width: 0; text-align: left; }
.cash-title {
  font-family: 'Bebas Neue', 'Poppins', sans-serif; letter-spacing: 2px;
  font-size: 22px; margin-bottom: 8px; color: var(--gold);
}
.cash-row {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 10px; margin-bottom: 6px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--card-border);
}
.cash-row.current { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,212,121,0.35); }
.cash-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cash-val { font-family: 'Bebas Neue','Poppins',sans-serif; letter-spacing: 1px; font-size: 20px; color: var(--gold); white-space: nowrap; }
.cash-val.neg { color: #ff8a8a; }

.card-stakes { font-size: 14px; color: var(--pink-soft); margin-bottom: 18px; }
.card-stakes b { color: var(--gold); }

/* --- PŁYWAJĄCE OKNO WIDEO --- */
.video-window {
  position: fixed;
  top: 78px; left: 22px;
  width: 300px; height: 290px;
  z-index: 60;
  display: flex; flex-direction: column;
  background: #120307;
  border: 1px solid var(--card-border);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.6);
  touch-action: none;
  cursor: move;
}
.video-window.fullscreen { cursor: default; }

.video-wrap {
  position: relative; overflow: hidden;
  background: #120307; flex: 1 1 auto; min-height: 0;
}
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
#remoteVideo { background: #120307; }
#localVideo { transform: scaleX(-1); }

/* małe okienko "Ty" w rogu obrazu partnera */
.pip {
  position: absolute; top: 8px; right: 8px;
  width: 38%; max-width: 170px; aspect-ratio: 4/3;
  border-radius: 10px; overflow: hidden;
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  background: #1a0712; z-index: 3;
}
/* uchwyt skalowania w prawym dolnym rogu */
.vid-resize {
  position: absolute; right: 0; bottom: 0;
  width: 26px; height: 26px;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 2px 4px; font-size: 15px; line-height: 1;
  color: #fff; cursor: nwse-resize; z-index: 5;
  background: linear-gradient(135deg, transparent 50%, rgba(255,93,143,0.85) 50%);
  user-select: none; touch-action: none;
}
.video-label { display: none; }
.video-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--pink-soft); font-size: 14px; background: rgba(20,3,7,0.85);
}
.video-bottom {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  z-index: 4; pointer-events: none;
}
.video-bottom > * { pointer-events: auto; }
.video-name {
  font-size: 10px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,0.5); padding: 3px 8px; border-radius: 999px;
  max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-name:empty { display: none; }
.media-controls { display: flex; gap: 6px; }
.icon-btn {
  cursor: pointer; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.5); border-radius: 50%;
  width: 30px; height: 30px; font-size: 14px; transition: background .2s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(0,0,0,0.7); transform: scale(1.08); }
.icon-btn.off { background: rgba(255,80,80,0.65); }

/* panel tury */
.turn-panel {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 22px; padding: 20px; text-align: center; backdrop-filter: blur(12px);
}
.dice-area { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.dice {
  width: 92px; height: 92px; border-radius: 20px;
  background: linear-gradient(145deg, #fff, #ffe3ec);
  color: #c0235a; font-size: 52px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4), inset 0 -6px 12px rgba(192,35,90,0.15);
}
.dice.rollable {
  cursor: pointer;
  animation: pulse-dice 1.3s ease-in-out infinite;
}
.dice.rollable:hover { filter: brightness(1.05); }
@keyframes pulse-dice {
  0%, 100% { transform: scale(1);    box-shadow: 0 12px 30px rgba(0,0,0,0.4), 0 0 0 0 rgba(255,93,143,0.55); }
  50%      { transform: scale(1.08); box-shadow: 0 14px 36px rgba(0,0,0,0.45), 0 0 0 12px rgba(255,93,143,0); }
}
.dice.rolling { animation: roll 0.7s ease; }
.dice-hint { display: none; }
.dice.hidden-turn { visibility: hidden; }

/* Kostka 3D podczas rzutu (u obu graczy) */
.dice-roll {
  position: fixed; inset: 0; z-index: 93;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  pointer-events: none; background: rgba(8,2,5,0.55); backdrop-filter: blur(3px);
  transition: opacity .35s ease; opacity: 1;
}
.dice-roll.fade-out { opacity: 0; }
.dice-scene { width: 130px; height: 130px; display: flex; align-items: center; justify-content: center; }
.cube {
  position: relative;
  width: 132px; height: 132px;
  background: radial-gradient(125% 125% at 30% 22%, #ffffff 0%, #fff4f8 55%, #ffe1ec 100%);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow:
    0 22px 44px rgba(120,10,50,0.5),
    inset 0 3px 7px rgba(255,255,255,0.95),
    inset 0 -12px 22px rgba(192,35,90,0.2);
}
.cube::after {            /* delikatny połysk */
  content: ''; position: absolute; inset: 0; border-radius: 28px; pointer-events: none;
  background: linear-gradient(155deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 42%);
}
.cube.shake { animation: dice-shake .42s ease-in-out infinite; }
@keyframes dice-shake {
  0%   { transform: translateY(0)     rotate(0deg)  scale(1); }
  25%  { transform: translateY(-8px)  rotate(-5deg) scale(1.05); }
  50%  { transform: translateY(0)     rotate(4deg)  scale(0.98); }
  75%  { transform: translateY(-5px)  rotate(-3deg) scale(1.03); }
  100% { transform: translateY(0)     rotate(0deg)  scale(1); }
}
.cube .pip {
  position: absolute;
  width: 17%; height: 17%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ef6b93 0%, #c0235a 60%, #8d1640 100%);
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,0.45),
    inset 0 -3px 5px rgba(0,0,0,0.4),
    0 1px 2px rgba(0,0,0,0.3);
  z-index: 1;
}
.dice-roll-caption {
  font-size: clamp(18px, 3vw, 26px); font-weight: 800; color: #fff;
  text-shadow: 0 3px 12px rgba(0,0,0,0.7);
}

/* Napis "Twoja kolej" na środku ekranu, znikający (alpha) */
.turn-announce {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; padding: 20px; text-align: center;
}
.turn-announce span {
  display: inline-block; text-align: center;
  font-family: 'Bebas Neue', 'Poppins', sans-serif;
  font-size: clamp(32px, 6vw, 64px); font-weight: 400; letter-spacing: 2px; line-height: 1.12;
  color: #fff;
  padding: 16px 30px; border-radius: 24px;
  background: linear-gradient(160deg, rgba(40,8,24,0.82), rgba(90,16,52,0.82));
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 24px 70px rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  text-shadow: 0 3px 14px rgba(0,0,0,0.7);
}
.tile-toast {
  position: fixed; left: 50%; top: 30%; transform: translateX(-50%);
  z-index: 94; pointer-events: none; opacity: 0; white-space: nowrap;
  font-family: 'Bebas Neue', 'Poppins', sans-serif;
  font-size: clamp(24px, 4.4vw, 46px); font-weight: 400; letter-spacing: 2px; color: #fff;
  padding: 12px 28px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(40,8,24,0.82), rgba(90,16,52,0.82));
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 22px 60px rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  text-shadow: 0 3px 14px rgba(0,0,0,0.7);
}
.tile-toast.show { animation: toast-fade 2.6s ease forwards; }
@keyframes toast-fade {
  0%   { opacity: 0; transform: translateX(-50%) scale(.8); }
  18%  { opacity: 1; transform: translateX(-50%) scale(1.06); }
  70%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}
/* Komunikat wejścia na nowy poziom */
.level-toast {
  position: fixed; inset: 0; z-index: 96; padding: 20px; text-align: center;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0;
}
.level-toast span {
  display: inline-block;
  font-family: 'Bebas Neue', 'Poppins', sans-serif;
  font-size: clamp(40px, 9vw, 96px); font-weight: 400; letter-spacing: 3px; line-height: 1.05; color: #fff;
  padding: 26px 50px; border-radius: 28px;
  border: 3px solid rgba(255,255,255,0.4);
  box-shadow: 0 24px 70px rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  text-shadow: 0 3px 14px rgba(0,0,0,0.75);
}
.level-toast.lvl-1 span { background: linear-gradient(160deg, rgba(31,120,92,0.92), rgba(18,80,60,0.92)); }
.level-toast.lvl-2 span { background: linear-gradient(160deg, rgba(190,105,28,0.93), rgba(140,75,15,0.93)); }
.level-toast.lvl-3 span { background: linear-gradient(160deg, rgba(200,49,80,0.93), rgba(110,15,45,0.93)); }
.level-toast.show { animation: level-pop 3s ease forwards; }
@keyframes level-pop {
  0%   { opacity: 0; transform: scale(0.7); }
  12%  { opacity: 1; transform: scale(1.08); }
  75%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

.turn-announce.show { animation: turn-fade 2.4s ease forwards; }
@keyframes turn-fade {
  0%   { opacity: 0; transform: scale(0.82); }
  10%  { opacity: 1; transform: scale(1.06); }
  72%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes roll {
  0%   { transform: rotate(0)     scale(1); }
  25%  { transform: rotate(-18deg) scale(1.12); }
  50%  { transform: rotate(20deg)  scale(0.95); }
  75%  { transform: rotate(-10deg) scale(1.08); }
  100% { transform: rotate(0)     scale(1); }
}
.turn-info {
  font-size: 17px; font-weight: 600; margin-bottom: 16px; min-height: 24px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--card-border);
}
.turn-info.my-turn {
  background: linear-gradient(90deg, var(--pink), #ff7aa2); color: #2a0512;
  box-shadow: 0 0 22px rgba(255,93,143,0.5);
}
.turn-info .you { font-weight: 800; }
.status-msg { display: none; }

/* --- PLANSZA --- */
.board-area {
  display: flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 0; height: 100%;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 26px; padding: 20px; backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
.board {
  position: relative;
  display: grid;
  gap: clamp(2px, 0.35vw, 5px);
  aspect-ratio: 1 / 1;
  width: 100%;
  height: 100%;
  max-width: calc(100vh - 110px);
  max-height: 100%;
  margin: auto;
}
.tile {
  position: relative;
  border-radius: clamp(4px, 0.6vw, 9px);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; text-align: center;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform .15s, box-shadow .2s;
  overflow: hidden;
}
.tile .tile-emoji { font-size: clamp(11px, 1.7vw, 24px); line-height: 1; }
.tile .tile-num { position: absolute; top: 1px; left: 3px; font-size: clamp(6px,0.75vw,10px); opacity: 0.55; font-weight: 700; }
/* kolor wg POZIOMU (spirala dzieli się na 3 strefy) */
.tile.lvl-1 { background: linear-gradient(145deg, #2f9e7d, #1f6f57); }   /* amatorski */
.tile.lvl-2 { background: linear-gradient(145deg, #e0892b, #b5641a); }   /* średni */
.tile.lvl-3 { background: linear-gradient(145deg, #c0314f, #7e1233); }   /* hard */
.tile.t-start  { background: linear-gradient(145deg, #3aa0ff, #1f6fd0); }
.tile.t-finish { background: linear-gradient(145deg, #ffd23f, #ff9f1c); color:#3a1500; }
.tile.active { box-shadow: 0 0 0 3px var(--gold), 0 0 18px var(--gold); transform: scale(1.12); z-index: 3; }

/* pionki */
.pawn {
  position: absolute;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
  transition: left .22s ease, top .22s ease;
  z-index: 5;
  pointer-events: none;
}

/* --- OVERLAYE --- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,2,6,0.78); backdrop-filter: blur(6px);
  padding: 20px; animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card-modal {
  width: 100%; max-width: 460px; text-align: center;
  background: linear-gradient(160deg, #3a0e26, #5a163a);
  border: 1px solid var(--card-border);
  border-radius: 26px; padding: 38px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: pop .35s cubic-bezier(.5,1.5,.5,1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card-type {
  display: inline-block; font-size: 13px; letter-spacing: 3px; font-weight: 800;
  padding: 6px 16px; border-radius: 20px; margin-bottom: 22px;
  background: rgba(255,255,255,0.12);
}
.card-type.task { background: linear-gradient(90deg, var(--pink), #ff7aa2); color:#2a0512; }
.card-type.question { background: linear-gradient(90deg, #8a6bff, #6a4bc0); }
.card-text { font-size: 22px; line-height: 1.45; font-weight: 600; margin-bottom: 28px; }
.card-wait { color: var(--pink-soft); font-size: 15px; }
.card-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-ghost {
  background: rgba(255,255,255,0.08); border: 1px solid var(--card-border); color: var(--text);
}
.btn-ghost:hover { background: rgba(255,80,80,0.25); }

/* tryb pełnoekranowej kamery podczas wykonywania zadania */
.video-window.fullscreen {
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  border-radius: 0; z-index: 80;
}
.video-window.fullscreen .vid-drag,
.video-window.fullscreen .vid-resize { display: none; }
.video-window.fullscreen .pip {
  width: 26%; max-width: 240px; top: 16px; right: 16px;
}

/* pasek oceny zadania na dole ekranu */
.task-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 90; max-width: 92vw;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 16px 22px; border-radius: 20px;
  background: rgba(20,3,7,0.82); border: 1px solid var(--card-border);
  backdrop-filter: blur(10px); box-shadow: 0 16px 40px rgba(0,0,0,0.55);
  text-align: center;
}
.task-bar-text { font-size: 17px; font-weight: 600; }
.task-bar-text b { color: var(--pink-soft); }
.task-bar-btns { display: flex; gap: 12px; }

.win .confetti { font-size: 64px; margin-bottom: 10px; animation: bounce 1s infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-14px);} }
.win-text { font-size: 26px; font-weight: 800; margin-bottom: 26px; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .screen#game { height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .layout {
    display: flex; flex-direction: column;
    overflow: visible; gap: 12px;
  }
  .board-area { order: 1; height: auto; }
  .sidebar-left { order: 2; }
  .sidebar-right { order: 3; }
  .sidebar { overflow: visible; }
  .board { max-width: min(100%, 70vh); max-height: none; }
  .brand span { display: none; }
  .topbar { padding: 10px 14px; }
  .video-window { width: 200px; height: 195px; top: 64px; left: 10px; }
}
