:root {
  --paper: #dde2e4;
  --paper-2: #e9ecee;
  --ink: #1b2430;
  --ink-2: #4a5663;
  --rule: #b6bfc5;
  --sq-light: #d6ddd3;
  --sq-dark: #6a887e;
  --signal: #f1c232;
  --signal-ink: #3b2c00;
  --alert: #b8412c;
  --ok: #3f7a52;
  --wide: "Archivo", system-ui, sans-serif;
  --pieces: "Noto Sans Symbols 2", "Segoe UI Symbol", "DejaVu Sans", serif;
  --r: 4px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--wide);
  font-variation-settings: "wdth" 100;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

h1, h2 {
  font-variation-settings: "wdth" 125;
  line-height: 1.05;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 700; }

/* ---- Barra superior ---- */
.bar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: var(--ink); color: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--paper); stroke-width: 2; }
.brand svg .fill { fill: var(--paper); stroke: none; }
.brand span { font-variation-settings: "wdth" 112; font-weight: 500; }
.brand b { font-weight: 800; }
.games { display: flex; gap: 4px; }
.games a {
  text-decoration: none; padding: 4px 10px; border-radius: var(--r);
  color: #aab4bd;
}
.games a[aria-current] { color: var(--ink); background: var(--signal); font-weight: 600; }
.me {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid #3d4957; color: var(--paper);
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.me:hover { border-color: var(--paper); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #7d8791; }
.dot.on { background: #6cc287; }
.dot.off { background: var(--alert); }

/* ---- Botones ---- */
.primary {
  display: inline-block; text-decoration: none;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: var(--r);
  padding: 11px 20px; font-weight: 700; cursor: pointer;
}
.primary:hover { background: #2c3949; }
.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; color: var(--ink-2);
}
.link:hover { color: var(--ink); }

/* ---- Lobby ---- */
.lobby {
  display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: 56px; max-width: 1180px; margin: 0 auto; padding: 48px 24px 64px;
}
.lede { max-width: 42ch; color: var(--ink-2); margin: 14px 0 36px; font-size: 1.05rem; }
.block { padding: 22px 0; border-top: 2px solid var(--ink); }
.block + .block { margin-top: 8px; }
.hint { color: var(--ink-2); margin: 4px 0 14px; font-size: .92rem; }

.tc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tc-grid button {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 10px 12px; cursor: pointer;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r);
  text-align: left;
}
.tc-grid b { font-size: 1.3rem; font-variation-settings: "wdth" 115; font-variant-numeric: tabular-nums; }
.tc-grid span { font-size: .8rem; color: var(--ink-2); }
.tc-grid button:hover { border-color: var(--ink); }
.tc-grid button.active { background: var(--signal); border-color: var(--signal-ink); }
.tc-grid button.active span { color: var(--signal-ink); }

.searching { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field { margin: 16px 0; border: 0; padding: 0; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
select, .copy-row input, #chat-input, #name-input {
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 9px 10px; width: 100%;
}
select { max-width: 260px; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors legend { width: 100%; }
.colors label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px 7px 8px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--paper-2);
}
.colors input { position: absolute; opacity: 0; pointer-events: none; }
.colors label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.colors label:has(input:focus-visible) { outline: 3px solid var(--signal); }
.swatch { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--ink); }
.swatch.w { background: #fbfbf8; }
.swatch.b { background: var(--ink); }
.swatch.r { background: linear-gradient(135deg, #fbfbf8 50%, var(--ink) 50%); }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 20px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

.tables-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.tables h2 { font-size: 1.6rem; }
.online { color: var(--ink-2); font-size: .9rem; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-weight: 500; font-size: .85rem; color: var(--ink-2);
  padding: 10px 8px 6px; border-bottom: 1px solid var(--rule);
}
tbody td { padding: 12px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tbody tr:hover { background: var(--paper-2); }
td.seat-empty { color: var(--ink-2); font-style: italic; }
td.tc { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
td.go { text-align: right; white-space: nowrap; }
td.go a {
  text-decoration: none; font-weight: 700; padding: 6px 14px; border-radius: var(--r);
  background: var(--ink); color: var(--paper);
}
td.go a.watch { background: transparent; color: var(--ink); border: 1px solid var(--ink); padding: 5px 13px; font-weight: 600; }
.moves-n { display: block; font-size: .8rem; color: var(--ink-2); font-weight: 400; }
.empty { color: var(--ink-2); padding: 24px 8px; max-width: 40ch; }

/* Menú inicial: crear o unirse */
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 36px; }
.menu-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 18px;
  text-align: left; cursor: pointer; padding: 18px 18px 20px;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: var(--r);
}
.menu-opt:hover { background: #fff; }
.menu-opt:active { transform: translateY(1px); }
#go-create { background: var(--ink); color: var(--paper); }
#go-create:hover { background: #2c3949; }
.menu-icon { font-family: var(--pieces); font-size: 2.6rem; line-height: 1; }
.menu-text { display: flex; flex-direction: column; gap: 4px; }
.menu-text b { font-size: 1.35rem; font-variation-settings: "wdth" 120; font-weight: 800; }
.menu-text span { font-size: .9rem; opacity: .8; }

.panel { padding: 18px 0 28px; border-top: 2px solid var(--ink); margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel-head h2 { font-size: 1.5rem; }
.field-label { display: block; font-weight: 600; font-size: .92rem; margin: 18px 0 6px; }
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-input {
  width: 7.2em; padding: 6px 12px;
  font-size: 2.2rem; font-weight: 800; font-variation-settings: "wdth" 125;
  letter-spacing: .28em; text-transform: uppercase;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: var(--r);
}
.code-input::placeholder { color: var(--rule); }
.code-input[aria-invalid="true"] { border-color: var(--alert); }
.hint.error { color: var(--alert); font-weight: 600; }
.quick-block { margin-top: 8px; }

.room-code {
  font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: .14em;
  font-variation-settings: "wdth" 125; margin: 2px 0 12px;
  user-select: all;
}
td.code { font-weight: 700; letter-spacing: .1em; font-variation-settings: "wdth" 120; }

/* ---- Partida ---- */
.game {
  display: grid; grid-template-columns: auto minmax(280px, 360px);
  gap: 28px; justify-content: center; align-items: start;
  padding: 20px 16px 40px;
  --size: min(calc(100dvh - 240px), calc(100vw - 440px), 760px);
}
.board-col { display: flex; flex-direction: column; gap: 8px; width: var(--size); }
.board-wrap { position: relative; }
.board {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: var(--size); height: var(--size);
  border: 6px solid var(--ink); border-radius: 3px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.sq { position: relative; background: var(--sq-light); }
.sq.d { background: var(--sq-dark); }
.sq.last { background: #c9cf86; }
.sq.d.last { background: #8f9c55; }
.sq.sel { background: var(--signal) !important; }
.sq.incheck { background: radial-gradient(circle, #e2563d 0%, #e2563d55 45%, transparent 75%), var(--sq-light); }
.sq.d.incheck { background: radial-gradient(circle, #e2563d 0%, #e2563d55 45%, transparent 75%), var(--sq-dark); }
.sq.target::after {
  content: ""; position: absolute; inset: 37%; border-radius: 50%; background: #1b243055;
}
.sq.target.cap::after { inset: 4%; background: none; border: 5px solid #1b243055; }
.coord {
  position: absolute; font-size: clamp(9px, calc(var(--size) / 55), 13px); font-weight: 700;
  pointer-events: none; color: var(--sq-dark);
}
.sq.d .coord { color: var(--sq-light); }
.coord.f { right: 3px; bottom: 1px; }
.coord.r { left: 3px; top: 1px; }

.pc {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--pieces); line-height: 1;
  font-size: calc(var(--size) / 8 * 0.84);
  cursor: grab; z-index: 1;
}
.pc span { grid-area: 1 / 1; }
.pc.b .fill { color: var(--ink); }
.pc.b .line { display: none; }
.pc.w .fill { color: #fbfbf8; }
.pc.w .line { color: var(--ink); }
.pc.drag { z-index: 10; pointer-events: none; cursor: grabbing; transition: none; }
.board.locked .pc { cursor: default; }

.promo {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #1b2430aa; z-index: 20;
}
.promo div { display: flex; gap: 6px; background: var(--paper); padding: 10px; border-radius: var(--r); }
.promo button {
  width: calc(var(--size) / 8); height: calc(var(--size) / 8); position: relative;
  background: var(--sq-light); border: 0; border-radius: 3px; cursor: pointer;
}
.promo button:hover { background: var(--signal); }

/* Jugadores y reloj */
.player { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.player .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.player .name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .sub { font-size: .82rem; color: var(--ink-2); }
.player .sub.warn { color: var(--alert); font-weight: 600; }
.clock {
  font-variation-settings: "wdth" 110; font-weight: 700;
  font-size: 1.9rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  padding: 4px 14px; min-width: 132px; text-align: right;
  background: var(--paper-2); color: var(--ink-2);
  border: 2px solid var(--rule); border-radius: var(--r);
  position: relative;
}
.clock::before {
  /* el pulsador del reloj: sube en el lado que está jugando */
  content: ""; position: absolute; left: 14px; right: 14px; height: 5px; border-radius: 2px;
  background: var(--rule); top: -8px; transition: transform .15s;
}
.player.bottom .clock::before { top: auto; bottom: -8px; }
.clock.run { background: var(--signal); color: var(--signal-ink); border-color: var(--signal-ink); }
.clock.run::before { background: var(--signal-ink); transform: scaleX(.6); }
.clock.low { background: var(--alert); color: #fff; border-color: #6e1f12; }
.clock.none { display: none; }

/* Columna lateral */
.side {
  display: flex; flex-direction: column; gap: 14px;
  height: calc(var(--size) + 120px); max-height: calc(100dvh - 80px); min-height: 420px;
}
.status { border-top: 2px solid var(--ink); padding-top: 12px; }
.status h2 { font-size: 1.35rem; }
.status p { margin: 4px 0 0; color: var(--ink-2); }
.invite { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; }
.invite > p:first-child { margin: 0 0 4px; font-weight: 600; }
.invite .hint { margin: 0 0 8px; }
.copy-row { display: flex; gap: 6px; margin-bottom: 10px; }
.copy-row button, #chat-form button {
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  border-radius: var(--r); padding: 0 14px; cursor: pointer; font-weight: 600;
}

.moves {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 2.6em 1fr 1fr; align-content: start;
  max-height: 220px; overflow-y: auto;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.moves li { display: contents; }
.moves .n { color: var(--ink-2); padding: 3px 6px; background: var(--paper-2); font-size: .85rem; }
.moves .m { padding: 3px 8px; font-weight: 500; }
.moves .m.cur { background: var(--signal); font-weight: 700; }
.moves:empty { display: none; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button {
  padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-weight: 600;
  background: transparent; border: 1px solid var(--ink);
}
.actions button:hover { background: var(--paper-2); }
.actions button.primary { background: var(--ink); color: var(--paper); }
.actions button.danger { border-color: var(--alert); color: var(--alert); }
.actions .confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chat { display: flex; flex-direction: column; flex: 1; min-height: 160px; border-top: 1px solid var(--rule); }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 0; font-size: .93rem; }
.chat-log p { margin: 0 0 4px; overflow-wrap: anywhere; }
.chat-log b { margin-right: 6px; }
.chat-log .sys { color: var(--ink-2); font-style: italic; }
#chat-form { display: flex; gap: 6px; }

/* Mesa inexistente */
.missing { max-width: 640px; margin: 0 auto; padding: 72px 24px; }
.missing p { color: var(--ink-2); margin: 16px 0 28px; }

/* Diálogo y avisos */
dialog {
  border: 0; border-radius: 6px; padding: 24px; width: min(420px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: #1b2430b0; }
dialog p { color: var(--ink-2); margin: 6px 0 14px; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 18px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: var(--r);
  z-index: 50; max-width: calc(100vw - 32px);
}

/* ---- Móvil ---- */
@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; gap: 32px; padding: 28px 16px 48px; }
  .game {
    grid-template-columns: 1fr; padding: 10px 0 32px; gap: 16px;
    --size: min(100vw, calc(100dvh - 200px));
  }
  .board-col { margin: 0 auto; }
  .player { padding: 0 10px; }
  .board { border-width: 0; border-radius: 0; }
  .side { height: auto; max-height: none; padding: 0 16px; }
  .moves { display: flex; flex-wrap: nowrap; overflow-x: auto; max-height: none; white-space: nowrap; }
  .moves li { display: flex; }
  .chat { min-height: 220px; }
  .clock { font-size: 1.6rem; min-width: 112px; }
}
@media (max-width: 520px) {
  .bar { gap: 12px; }
  .brand span { display: none; }
  .tc-grid { grid-template-columns: repeat(2, 1fr); }
  thead { display: none; }
  .menu { grid-template-columns: 1fr; }
  .menu-opt { flex-direction: row; align-items: center; }
  tbody tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "w code" "b go" "tc go"; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  tbody td { border: 0; padding: 1px 8px; }
  tbody td:nth-child(1) { grid-area: w; }
  tbody td:nth-child(2) { grid-area: b; }
  tbody td:nth-child(3) { grid-area: tc; }
  tbody td:nth-child(4) { grid-area: code; text-align: right; }
  tbody td:nth-child(5) { grid-area: go; align-self: center; }
  tbody td:nth-child(1)::before { content: "♔ "; font-family: var(--pieces); }
  tbody td:nth-child(2)::before { content: "♚ "; font-family: var(--pieces); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0s !important; transition: none !important; }
  .spinner { border-top-color: var(--ink); }
}

/* ======================================================================
   Menú principal al estilo de una consola de salón: canales y barra.
   ====================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* El cursor de mano en toda la web (los campos de texto mantienen el suyo). */
html { cursor: url(/cursor.svg) 17 2, auto; }
*, *::before, *::after { cursor: inherit !important; }
:where(input:not([type=radio]):not([type=checkbox]), textarea) { cursor: text !important; }

body.home { background: #ececec; overflow: hidden; }
body.home .bar, body.booting .bar { display: none; }
body.booting { background: #ececec; }
/* El logo: pentágono con el triángulo de jugar */
svg.logo path { stroke-linejoin: round; }

.wii {
  --wii-blue: #34bdef;
  --wii-grey: #a3a3a3;
  --s: 1;
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  font-family: "Rounded", var(--wide);
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, #ffffff66 3px 4px),
    linear-gradient(#f6f6f6, #e4e4e4);
  color: #5a5a5a;
  user-select: none; -webkit-user-select: none;
}

.wii-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); align-content: center;
  gap: clamp(10px, 2vw, 22px);
  width: min(1180px, 100%, calc((100dvh - 250px) * 2.3 + 140px)); margin: 0 auto;
  padding: 24px clamp(16px, 5vw, 64px) calc(170px * var(--s) + 16px);
}
.wii-grid .channel { aspect-ratio: 16 / 10; }

.channel {
  position: relative; overflow: hidden;
  border-radius: 16px;
  border: 3px solid #cfcfcf;
  background: linear-gradient(#ffffff, #eaeaea);
  box-shadow: inset 0 0 0 2px #ffffffcc, 0 2px 4px #00000014;
  transition: transform .14s ease-out, border-color .14s, box-shadow .14s;
  padding: 0; font: inherit; color: inherit;
}
.channel.empty {
  background:
    repeating-linear-gradient(to bottom, #e9e9e9 0 2px, #dedede 2px 4px);
  border-color: #d6d6d6;
}
.channel:not(.empty):hover, .channel:not(.empty):focus-visible {
  transform: scale(1.045);
  border-color: var(--wii-blue);
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 4px #34bdef55, 0 6px 16px #34bdef40;
  outline: none; z-index: 2;
}

/* Banner del canal de ajedrez */
.chess-banner {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #dff3fb 55%, #bfe6f6 100%);
  overflow: hidden;
}
.mini-board {
  position: absolute; left: 50%; bottom: -18%;
  width: 92%; aspect-ratio: 1;
  transform: translateX(-50%) perspective(400px) rotateX(58deg);
  transform-origin: 50% 100%;
  background: conic-gradient(var(--sq-dark) 25%, var(--sq-light) 0 50%, var(--sq-dark) 0 75%, var(--sq-light) 0) 0 0 / 25% 25%;
  border-radius: 6px;
  box-shadow: 0 0 0 4px #1b2430;
}
.ch-piece {
  position: absolute; left: 50%; top: 14%;
  transform: translateX(-50%);
  font-family: var(--pieces); font-size: clamp(34px, 5.4vw, 64px); line-height: 1;
  color: #1b2430;
  filter: drop-shadow(0 4px 2px #00000030);
  animation: hop 2.6s ease-in-out infinite;
}
@keyframes hop {
  0%, 60%, 100% { transform: translate(-50%, 0); }
  70% { transform: translate(-50%, -18%); }
  80% { transform: translate(-50%, 0); }
}
.ch-title {
  position: absolute; left: 0; right: 0; bottom: 8%;
  font-weight: 800; font-size: clamp(14px, 1.6vw, 22px); color: #1b2430;
  text-shadow: 0 1px 0 #fff, 0 0 8px #fff;
}
.ch-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--wii-blue); color: #fff; font-weight: 800; font-size: 12px;
  padding: 2px 8px; border-radius: 999px;
}

/* Barra inferior */
.wii-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(160px * var(--s));
  display: flex; align-items: flex-end;
  pointer-events: none;
}
.wing { height: 100%; flex: none; width: calc(260px * var(--s)); }
.wing svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wing-fill { fill: #e7e7e7; }
.wing-line { fill: none; stroke: var(--wii-blue); stroke-width: 3; }
.bar-mid {
  /* la línea de las alas está en y=50 de 160 y mide 3 de grueso: aquí cuadra igual */
  flex: 1; height: calc(111.5px * var(--s));
  background: #e7e7e7;
  border-top: calc(3px * var(--s)) solid var(--wii-blue);
  margin: 0 -0.5px;
  display: flex; justify-content: center;
}
.wii-bar::after {
  /* el degradado común por encima de alas y centro, para que no se note la unión */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 30%, #00000010 100%);
}
.wii-clock {
  display: flex; flex-direction: column; align-items: center;
  margin-top: calc(14px * var(--s));
  line-height: 1;
}
#wii-time {
  font-weight: 800; font-size: calc(62px * var(--s)); letter-spacing: .02em;
  color: var(--wii-grey); font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #fff;
}
#wii-date { font-weight: 500; font-size: calc(19px * var(--s)); color: #8a8a8a; margin-top: calc(8px * var(--s)); }

.round-btn {
  pointer-events: auto;
  position: absolute; bottom: calc(18px * var(--s));
  width: calc(116px * var(--s)); height: calc(116px * var(--s));
  border-radius: 50%;
  border: 3px solid #c9c9c9;
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #f1f1f1 60%, #dcdcdc 100%);
  box-shadow: 0 3px 6px #00000022, inset 0 -3px 6px #00000010;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #6b6b6b; font: inherit;
  transition: transform .12s, border-color .12s;
}
.round-btn.left { left: calc(52px * var(--s)); }
.round-btn.right { right: calc(52px * var(--s)); }
.round-btn:hover, .round-btn:focus-visible { border-color: var(--wii-blue); transform: scale(1.06); outline: none; }
.round-btn svg { width: 44%; height: auto; fill: none; stroke: #6b6b6b; stroke-width: 2.2; stroke-linejoin: round; }
.round-btn svg .fill { fill: #6b6b6b; stroke: none; }
.round-label { font-size: calc(13px * var(--s)); font-weight: 800; max-width: 86%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-badge {
  position: absolute; top: 4%; right: 4%;
  min-width: 26px; height: 26px; border-radius: 13px; padding: 0 7px;
  background: var(--wii-blue); color: #fff; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #34bdef33; } }

/* Pantalla de un canal: banner grande con Menú / Comenzar */
.channel-screen {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  font-family: "Rounded", var(--wide);
  background: #ececec;
  animation: zoom-in .26s ease-out;
}
@keyframes zoom-in { from { transform: scale(.35); opacity: 0; } to { transform: none; opacity: 1; } }
.cs-banner { position: relative; flex: 1; }
.cs-banner.big .mini-board { width: min(80vh, 88vw); bottom: -8%; transform: translateX(-50%) perspective(1100px) rotateX(62deg); box-shadow: 0 0 0 8px #1b2430; }
.cs-banner.big .ch-piece { font-size: min(24vh, 28vw); top: auto; bottom: 20%; }
.cs-title {
  position: absolute; left: 0; right: 0; top: 4%;
  text-align: center; font-weight: 800; font-size: clamp(40px, 8vw, 88px); color: #1b2430;
  text-shadow: 0 3px 0 #fff;
}
.cs-sub {
  position: absolute; left: 50%; top: calc(4% + clamp(40px, 8vw, 88px) + 34px); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  text-align: center; font-weight: 500; font-size: clamp(15px, 2vw, 22px); color: #3d4a57;
}
.cs-bottom {
  flex: none; height: clamp(110px, 18vh, 160px);
  display: flex; justify-content: center; align-items: center; gap: clamp(16px, 8vw, 120px);
  background: linear-gradient(#f3f3f3, #dcdcdc);
  border-top: 3px solid #34bdef;
}
.pill {
  min-width: clamp(140px, 22vw, 260px); padding: clamp(14px, 2.4vh, 22px) 24px;
  border-radius: 999px; border: 3px solid #c9c9c9;
  background: linear-gradient(#ffffff, #e3e3e3);
  box-shadow: 0 3px 6px #00000020;
  font: 800 clamp(18px, 2.4vw, 26px) "Rounded", var(--wide); color: #5a5a5a;
  transition: transform .12s, border-color .12s;
}
.pill:hover, .pill:focus-visible { border-color: #34bdef; transform: scale(1.05); outline: none; color: #1b2430; }

@media (max-width: 760px) {
  .wii { --s: .5; }
  .wii-grid { grid-template-columns: repeat(2, 1fr); align-content: start; width: 100%; }
  .wii-grid .channel:nth-child(n+9) { display: none; }
  #wii-time { font-size: 32px; }
  #wii-date { font-size: 12px; margin-top: 3px; }
  .round-label { display: none; }
  .ch-piece { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .ch-piece, .mail-badge, .channel-screen { animation: none; }
}

/* ---- Pantallas superpuestas al estilo del menú (entrar, amigos, cuenta) ---- */
.wii-overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 16px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, #ffffff55 3px 4px),
    linear-gradient(#f6f6f6, #e1e1e1);
  font-family: "Rounded", var(--wide);
  animation: zoom-in .22s ease-out;
}
.wii-sheet, .wii-dialog {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px); overflow-y: auto;
  background: linear-gradient(#ffffff, #f1f1f1);
  border: 3px solid #cfcfcf; border-radius: 22px;
  box-shadow: 0 0 0 4px #34bdef33, 0 12px 30px #00000022;
  padding: 26px 28px 24px;
  color: #4a4a4a;
  font-family: "Rounded", var(--wide);
}
.wii-sheet.friends { width: min(640px, 100%); }
.wii-dialog { margin: auto; }
.wii-dialog::backdrop { background: #e8e8e8cc; }
.wii-sheet h2, .wii-dialog h2 {
  font-family: "Rounded", var(--wide); font-variation-settings: normal;
  font-size: 1.8rem; font-weight: 800; color: #1b2430; margin: 0 0 6px;
}
.wii-sheet h3 { font-size: 1rem; font-weight: 800; color: #6b6b6b; margin: 22px 0 8px; }
.sheet-lede { margin: 0 0 18px; color: #6b6b6b; line-height: 1.45; }
.sheet-hint { font-size: .88rem; color: #7a7a7a; margin: 6px 0 0; line-height: 1.4; }
.sheet-error { color: var(--alert); font-weight: 800; min-height: 1.2em; margin: 8px 0 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.auth-buttons { display: grid; gap: 12px; }
.auth-buttons .pill { width: 100%; }

.wii-field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; color: #5a5a5a; margin-top: 14px; }
.wii-field input, .friend-add input {
  font: 500 1.1rem "Rounded", var(--wide);
  padding: 12px 16px; border-radius: 14px;
  border: 3px solid #d2d2d2; background: #fff; color: #1b2430;
}
.wii-field input:focus, .friend-add input:focus { outline: none; border-color: #34bdef; box-shadow: 0 0 0 4px #34bdef33; }

.pill.small { min-width: 0; padding: 10px 22px; font-size: 1.05rem; }
.pill.tiny { min-width: 0; padding: 6px 14px; font-size: .9rem; border-width: 2px; }
.pill.blue { background: linear-gradient(#5fd0f7, #2aa8dc); border-color: #1f8fc0; color: #fff; }
.pill.blue:hover, .pill.blue:focus-visible { color: #fff; border-color: #0f6f9a; }
.pill.ghost { background: transparent; box-shadow: none; }
.pill.danger { color: var(--alert); border-color: #e2b4aa; }
.pill.danger:hover { border-color: var(--alert); color: var(--alert); }
.pill:disabled { opacity: .6; }
.wii-dialog .link { display: block; margin: 18px auto 0; font-family: inherit; }
.acc-area:empty { display: none; }
.acc-form { margin-top: 8px; border-top: 2px dashed #dcdcdc; padding-top: 6px; }

.friend-add { display: flex; gap: 8px; }
.friend-add input { flex: 1; min-width: 0; }
.friend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.friend-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 2px solid #e1e1e1; border-radius: 16px; padding: 10px 14px;
}
.fname { font-weight: 800; color: #1b2430; }
.fstatus { color: #8a8a8a; font-size: .9rem; margin-right: auto; }
.fdot { width: 12px; height: 12px; border-radius: 50%; background: #c4c4c4; flex: none; }
.fdot.online { background: #4cc46e; box-shadow: 0 0 0 3px #4cc46e33; }
.fdot.playing { background: #f1c232; box-shadow: 0 0 0 3px #f1c23233; }
.friends-locked { text-align: center; padding: 10px 0; }
.friends-locked .sheet-actions { justify-content: center; }

.lock {
  position: absolute; top: 6%; right: 6%; width: 28%; height: auto;
  fill: #fff; stroke: #8a8a8a; stroke-width: 1.8;
}

.invite-card {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 60;
  width: min(460px, calc(100vw - 32px));
  background: linear-gradient(#ffffff, #eef9fe); border: 3px solid #34bdef; border-radius: 20px;
  box-shadow: 0 10px 28px #00000030; padding: 14px 18px;
  font-family: "Rounded", var(--wide); color: #1b2430;
  animation: drop .3s ease-out;
}
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }
.invite-card p { margin: 0 0 10px; font-weight: 800; }
.invite-card div { display: flex; gap: 8px; justify-content: flex-end; }

#invite-friends { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
#invite-friends .hint { width: 100%; margin: 0; }
.friend-chip {
  border: 1px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 4px 12px; font-weight: 600;
}
.friend-chip:hover { background: var(--signal); }
