﻿:root {
  --bg: #0b111c;
  --card: #121a29;
  --ink: #ecf4ff;
  --muted: #9fb2cf;
  --brand: #5bc0ff;
  --brand-soft: #1d2d47;
  --danger: #ff6b9d;
  --line: #283a57;
  --tile: #fff6a3;
  --tile-ink: #17213a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at 8% 8%, #16253e, #0b111c 45%, #070b12 100%);
  color: var(--ink);
}

.app-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.card {
  width: min(980px, 100%);
  background: linear-gradient(160deg, #142037 0%, var(--card) 55%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.45);
}

.hidden { display: none; }
h1, h2, h3 { margin: 0.2rem 0; }
.muted { color: var(--muted); }

.grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-grid {
  margin: 0.8rem 0;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.95rem;
}

input, button {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
  font: inherit;
}

input { background: #101a2b; color: var(--ink); }

button {
  background: var(--brand);
  border: none;
  color: #03253b;
  cursor: pointer;
  font-weight: 700;
}

button.ghost { background: var(--brand-soft); color: #c8deff; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.controls { margin-top: 0.65rem; }
.error { color: var(--danger); min-height: 1rem; }

.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.timer {
  font-size: 1.7rem;
  font-weight: 800;
  background: #d7f4ff;
  color: #00243e;
  min-width: 80px;
  text-align: center;
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
}

.invite-wrap {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
}

#inviteLink { background: #0f1b2f; }

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 0.8rem 0;
}

#qrImage {
  width: min(180px, 50vw);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.board-wrap {
  position: relative;
  margin: 0.8rem 0;
}

.path-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.75rem;
  background: #0f1829;
  border: 1px solid #314a73;
  border-radius: 14px;
}

.tile {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: clamp(1rem, 2.3vw, 1.5rem);
  font-weight: 800;
  color: var(--tile-ink);
  background: linear-gradient(180deg, #fff9b8 0%, var(--tile) 100%);
  border: 1px solid #ffe76a;
  user-select: none;
}

.tile.selected {
  background: linear-gradient(180deg, #d2fff4 0%, #7ff5d2 100%);
  border-color: #2dd4b8;
}

#wordInput { flex: 1; }

.boards {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

ul {
  margin: 0.2rem 0;
  list-style: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
  background: #0f1829;
}

li {
  border-bottom: 1px solid #223454;
  padding: 0.55rem 0.7rem;
}

li:last-child { border-bottom: none; }

#mechanicsDialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #15233a;
  color: var(--ink);
  width: min(560px, 94vw);
}

#mechanicsDialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.owner-label,
.version-label {
  position: fixed;
  right: 10px;
  color: #9cb6d8;
  font-size: 0.75rem;
  opacity: 0.8;
}

.owner-label { bottom: 10px; }
.version-label { bottom: 26px; }

@media (max-width: 1100px) {
  .config-grid,
  .boards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .grid,
  .boards,
  .invite-wrap,
  .config-grid { grid-template-columns: 1fr; }

  .topline { align-items: flex-start; }
  .timer { font-size: 1.4rem; }
}

