@import url(fonts/fonts.css);

/* The same palette on every page. Host and guest each keep one colour everywhere: on the board, on names, on the score. */
:root {
  --bg: #131118;
  --bg-2: #1b1822;
  --panel: #211d29;
  --panel-2: #2a2534;
  --line: #3a3446;
  --text: #f6f1e9;
  --muted: #a69db3;
  --faint: #6f6780;
  --host: #ff8a3d;
  --host-soft: rgba(255, 138, 61, 0.16);
  --guest: #44c7f4;
  --guest-soft: rgba(68, 199, 244, 0.16);
  --gold: #ffd166;
  --red: #ff5c7a;
  --green: #5ee0a0;
  --twitch: #9146ff;
  --radius: 18px;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

.host-c {
  color: var(--host);
}

.guest-c {
  color: var(--guest);
}

.num {
  font-family: var(--ui);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.display {
  font-family: var(--display);
  letter-spacing: -0.01em;
}

/* ---- boards, shared by the phone, the host page and the stream ------------------------------------------- */

.board {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  touch-action: manipulation;
}

.board .grid {
  stroke: var(--line);
  stroke-width: 6;
  stroke-linecap: round;
}

.board .hit {
  fill: transparent;
}

.board .hit.can {
  cursor: pointer;
}

.board .hit.can:hover {
  fill: rgba(255, 255, 255, 0.05);
}

.board .mark-host {
  stroke: var(--host);
  fill: none;
}

.board .mark-guest {
  stroke: var(--guest);
  fill: none;
}

.board .disc-host {
  fill: var(--host);
}

.board .disc-guest {
  fill: var(--guest);
}

.board .win-line {
  stroke: var(--gold);
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 0.6s 0.15s ease-out forwards;
}

.board .fresh {
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.28s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.board .dim {
  opacity: 0.35;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes pop {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
}

@keyframes drop {
  from {
    transform: translateY(var(--from));
  }
  70% {
    transform: translateY(0);
  }
  85% {
    transform: translateY(calc(var(--from) * -0.06));
  }
}

@media (prefers-reduced-motion: reduce) {
  .board .fresh,
  .board .win-line,
  .board .drop,
  .banner,
  .confetti i {
    animation: none !important;
    stroke-dashoffset: 0;
  }
}

/* ---- reversi ----------------------------------------------------------------------------------------------- */

.board .grid.thin {
  stroke-width: 3;
}

.board .hint-guest {
  fill: var(--guest);
  opacity: 0.45;
}

.board .hint-host {
  fill: var(--host);
  opacity: 0.45;
}

.board .flip {
  transform-box: fill-box;
  transform-origin: center;
  animation: flip 0.45s ease-in-out;
}

@keyframes flip {
  50% {
    transform: scaleX(0.05);
  }
}

/* ---- dots and boxes ---------------------------------------------------------------------------------------- */

.board .dot {
  fill: var(--text);
}

.board .edge {
  stroke-width: 12;
  stroke-linecap: round;
}

.board .edge-host {
  stroke: var(--host);
}

.board .edge-guest {
  stroke: var(--guest);
}

.board .edge-free {
  stroke: var(--line);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 2 14;
}

.board .fresh-edge {
  animation: glow 1.2s ease-out;
}

@keyframes glow {
  from {
    stroke: var(--gold);
  }
}

.board .box-host {
  fill: var(--host);
  opacity: 0.32;
}

.board .box-guest {
  fill: var(--guest);
  opacity: 0.32;
}

.board .strip:hover {
  fill: rgba(255, 255, 255, 0.08);
}

/* ---- sea battle -------------------------------------------------------------------------------------------- */

.sea {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sea-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.sea-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sea-own {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 62%;
  margin: 6px auto 0;
  font-size: 0.85em;
}

.sea-own .sea-title {
  white-space: nowrap;
}

.sea-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sea-title span {
  color: var(--muted);
  font-size: 0.85em;
}

.sea-side.guest .sea-title b {
  color: var(--guest);
}

.sea-side.host .sea-title b {
  color: var(--host);
}

.board .sea-bg {
  fill: var(--bg-2);
}

.board .sea-grid {
  stroke: var(--line);
  stroke-width: 1.5;
}

.board .sea-label {
  fill: var(--muted);
  font-family: var(--ui);
  font-size: 17px;
  font-weight: 700;
}

.board .ship-host {
  fill: var(--host);
}

.board .ship-guest {
  fill: var(--guest);
}

.board .ship.sunk {
  opacity: 0.4;
}

.board .miss {
  fill: var(--muted);
}

.board .hit-mark {
  stroke: var(--gold);
  stroke-width: 6;
  stroke-linecap: round;
  fill: none;
}

.board .last-shot {
  fill: none;
  stroke: var(--text);
  stroke-width: 2.5;
}

.sea-actions {
  display: flex;
  gap: 10px;
}

.sea-actions .btn {
  flex: 1;
}

/* ---- bulls and cows ---------------------------------------------------------------------------------------- */

.bulls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bulls .cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bulls .bulls-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
}

.bulls .head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bulls .bulls-col.guest .head b {
  color: var(--guest);
}

.bulls .bulls-col.host .head b {
  color: var(--host);
}

.bulls .secret {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8em;
}

.bulls .digits {
  display: inline-flex;
  gap: 3px;
  font-family: var(--ui);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bulls .digits i {
  display: inline-grid;
  place-items: center;
  width: 1.45em;
  height: 1.7em;
  border-radius: 6px;
  background: var(--bg-2);
  font-style: normal;
}

.bulls .digits.hidden i {
  color: var(--faint);
}

.bulls .tries {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bulls .tries li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulls .tries .n {
  width: 1.4em;
  color: var(--faint);
  font-size: 0.8em;
  text-align: right;
}

.bulls .tries li.solved .digits i {
  background: rgba(255, 209, 102, 0.25);
  color: var(--gold);
}

.bulls .tries li.pending {
  opacity: 0.6;
}

.bulls .wait {
  color: var(--muted);
  font-size: 0.8em;
}

.bulls .bc {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.bulls .bull,
.bulls .cow {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 4px;
  border-radius: 999px;
  font-family: var(--ui);
  font-weight: 800;
  font-size: 0.85em;
}

.bulls .bull {
  background: var(--gold);
  color: #2a1d00;
}

.bulls .cow {
  box-shadow: inset 0 0 0 2px var(--guest);
  color: var(--guest);
}

.bulls .legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8em;
}

.bulls .legend {
  column-gap: 16px;
}

.bulls .legend .pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.bulls .entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.bulls .ask {
  margin: 0;
  color: var(--muted);
}

.bulls .slots {
  display: flex;
  gap: 8px;
}

.bulls .slots i {
  display: grid;
  place-items: center;
  width: 54px;
  height: 64px;
  border-radius: 14px;
  background: var(--panel);
  font-family: var(--ui);
  font-size: 32px;
  font-style: normal;
  font-weight: 800;
}

.bulls .slots i.cur {
  box-shadow: inset 0 0 0 2px var(--guest);
}

.bulls .pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.bulls .pad button {
  min-height: 52px;
  border-radius: 12px;
  background: var(--panel-2);
  font-family: var(--ui);
  font-size: 22px;
  font-weight: 800;
}

.bulls .pad button.go {
  grid-column: span 4;
  background: var(--guest);
  color: #06222d;
  font-size: 17px;
}

.btn.go {
  background: var(--guest);
  color: #06222d;
}

/* ---- chapaev ----------------------------------------------------------------------------------------------- */

.board.chapaev {
  touch-action: none;
}

.board .ch-frame {
  fill: var(--line);
}

.board .ch-light {
  fill: #2c2737;
}

.board .ch-dark {
  fill: #1d1925;
}

.board .disc-guest .ch-body {
  fill: var(--guest);
}

.board .disc-host .ch-body {
  fill: var(--host);
}

.board .ch-ring {
  fill: none;
  stroke: rgba(0, 0, 0, 0.28);
  stroke-width: 0.05;
}

.board .ch-dot {
  fill: rgba(255, 255, 255, 0.3);
}

.board .ch-disc.can {
  cursor: grab;
}

.board .ch-disc.can .ch-body {
  stroke: var(--text);
  stroke-width: 0.05;
}

.board .ch-disc.picked .ch-body {
  stroke: var(--gold);
  stroke-width: 0.08;
}

.board .aim-pull {
  stroke: var(--muted);
  stroke-width: 0.05;
  stroke-dasharray: 0.12 0.12;
}

.board .aim-line {
  stroke: var(--gold);
  stroke-width: 0.13;
  stroke-linecap: round;
}

.board .aim-head {
  fill: var(--gold);
}

/* ---- balda ------------------------------------------------------------------------------------------------- */

.balda {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bl-grid {
  display: grid;
  gap: 6px;
}

.bl-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--bg-2);
  font-family: var(--ui);
  font-size: 1.6em;
  font-weight: 800;
  opacity: 1 !important;
}

.bl-cell.start {
  background: var(--panel-2);
}

.bl-cell.by-guest {
  background: var(--guest-soft);
  color: var(--guest);
}

.bl-cell.by-host {
  background: var(--host-soft);
  color: var(--host);
}

.bl-cell.open {
  box-shadow: inset 0 0 0 2px var(--line);
}

.bl-cell.new {
  box-shadow: inset 0 0 0 3px var(--gold);
}

.bl-cell.in-word {
  background: var(--gold);
  color: #1a1400;
}

.bl-cell.last {
  box-shadow: inset 0 0 0 3px var(--gold);
}

.bl-cell i {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.45em;
  font-style: normal;
  opacity: 0.7;
}

.bl-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.bl-ask {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.bl-word {
  color: var(--gold);
  letter-spacing: 0.08em;
}

.bl-keys {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.bl-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.bl-row button {
  flex: 1;
  max-width: 44px;
  min-height: 46px;
  padding: 0;
  border-radius: 9px;
  background: var(--panel-2);
  font-family: var(--ui);
  font-size: 18px;
  font-weight: 800;
}

.bl-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.bl-words {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bl-list {
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
}

.bl-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 1.05em;
}

.bl-list.guest .bl-head b {
  color: var(--guest);
}

.bl-list.host .bl-head b {
  color: var(--host);
}

.bl-list ol {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.bl-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bl-list li span {
  color: var(--muted);
}

.btn.small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
