:root {
  --bg: #0f1419;
  --surface: #1a222d;
  --surface2: #121820;
  --text: #e8eef5;
  --muted: #9aa7b8;
  --accent: #5b8def;
  --accent2: #3dd68c;
  --border: #2a3544;
  --danger: #e85d5d;
  --dice-face: #f4f7fb;
  --dice-pip: #1d2430;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header h1 { margin: 0; font-size: 1.35rem; }
.site-header p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; }
.daily-motivation {
  width: min(1100px, 94%);
  margin: 0 auto 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent2);
  border-radius: 12px;
  text-align: center;
}
.daily-motivation[hidden] { display: none !important; }
.daily-motivation-label {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.daily-motivation-quote {
  margin: 0;
  padding: 0;
  border: none;
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  font-style: italic;
}
.site-main {
  width: min(1100px, 94%);
  margin: 1.25rem auto 2.5rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  color: var(--accent);
}
.hint { font-size: 0.82rem; color: var(--muted); margin: 0.35rem 0 0; }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.65rem;
}
input[type="text"],
input[type="number"],
select {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}
button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
}
.btn-primary { background: var(--accent); color: #0b1020; }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled, button:disabled { opacity: 0.45; cursor: not-allowed; }
.status { margin-top: 0.5rem; font-size: 0.88rem; min-height: 1.2em; }
.status.ok { color: var(--accent2); }
.status.err { color: var(--danger); }
.hidden { display: none !important; }
.game-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .game-grid { grid-template-columns: 1fr 320px; }
}
.dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin: 0.75rem 0;
  padding: 0.35rem 0;
}
.die {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 12px;
  background: var(--dice-face);
  border: 2px solid #b8c5d6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 0.35rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    border-width 0.15s,
    box-shadow 0.15s,
    transform 0.15s,
    background 0.15s;
}
.die:hover:not(:disabled) {
  border-color: #7a94b8;
}
.die.held {
  border: 5px solid var(--accent);
  background: #fff;
  box-shadow:
    0 0 0 3px rgba(91, 141, 239, 0.45),
    0 8px 18px rgba(91, 141, 239, 0.28);
  transform: translateY(-6px) scale(1.05);
  z-index: 1;
}
.die.held:hover:not(:disabled) {
  border-color: #7eb0ff;
}
.die .pip {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--dice-pip);
  align-self: center;
  justify-self: center;
}
.die .pip.off { visibility: hidden; }
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.score-table th,
.score-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  text-align: center;
}
.score-table th { background: var(--surface2); color: var(--muted); font-weight: 600; }
.score-table td.name { text-align: left; color: var(--text); }
.score-table tr.active-player td { background: rgba(91, 141, 239, 0.12); }
.score-table button.pick {
  width: 100%;
  padding: 0.2rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--accent);
  border-radius: 4px;
}
.score-table button.pick:hover:not(:disabled) { background: rgba(91, 141, 239, 0.15); }
.score-table .filled { color: var(--text); font-weight: 600; }
.score-table .preview { color: var(--muted); font-style: italic; }
.player-list { list-style: none; padding: 0; margin: 0; }
.player-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.player-list li:last-child { border-bottom: none; }
.badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
}
.badge.turn { background: var(--accent); color: #0b1020; }
.badge.you { background: var(--accent2); color: #0b1020; }
.game-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.game-card h3 { margin: 0; color: var(--text); }
.game-card p { margin: 0; color: var(--muted); font-size: 0.9rem; flex: 1; }
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 1.5rem 0 2rem;
  padding: 0 1rem;
}
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: min(360px, 100%);
  margin: 1rem auto;
}
.ttt-cell {
  aspect-ratio: 1;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.ttt-cell:not(:disabled):hover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.08);
}
.ttt-cell.filled {
  color: var(--text);
  cursor: default;
}
.ttt-cell.win {
  border-color: var(--accent2);
  background: rgba(61, 214, 140, 0.15);
}
.ttt-cell:disabled:not(.filled) {
  opacity: 0.85;
}
.ttt-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin: 0.5rem 0;
  font-size: 0.95rem;
}
.ttt-board-wrap {
  overflow: auto;
  max-height: min(88vh, 960px);
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  background: var(--surface2);
}
.ttt-board-30 {
  --ttt-cell: 20px;
  display: grid;
  grid-template-columns: repeat(30, var(--ttt-cell));
  gap: 2px;
  width: calc(30 * var(--ttt-cell) + 29 * 2px);
  max-width: 100%;
  margin: 0 auto;
}
@media (min-width: 600px) {
  .ttt-board-30 { --ttt-cell: 24px; }
}
@media (min-width: 900px) {
  .ttt-board-30 { --ttt-cell: 28px; }
}
@media (min-width: 1200px) {
  .ttt-board-30 { --ttt-cell: 32px; }
}
.ttt-cell-sm {
  width: var(--ttt-cell);
  height: var(--ttt-cell);
  min-width: var(--ttt-cell);
  min-height: var(--ttt-cell);
  box-sizing: border-box;
  font-size: clamp(0.65rem, calc(var(--ttt-cell) * 0.55), 1.25rem);
  font-weight: 700;
  padding: 0;
  border-radius: 3px;
  border-width: 1px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ttt-board-30 .ttt-cell-sm:not(:disabled):hover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.12);
}
.c4-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: center;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.c4-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.c4-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  display: inline-block;
}
.c4-play-area {
  max-width: min(560px, 100%);
  margin: 0 auto;
}
.c4-columns {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.c4-col-btn {
  padding: 0.45rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
}
.c4-col-btn:not(:disabled):hover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.12);
}
.c4-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 10px;
  background: #1a4a9e;
  border-radius: 12px;
  border: 3px solid #0f3270;
}
.c4-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  min-width: 0;
}
.c4-hole {
  background: var(--surface2);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}
.c4-disc {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.c4-disc.c4-p0,
.c4-swatch.c4-p0 {
  background: #e63946;
}
.c4-disc.c4-p1,
.c4-swatch.c4-p1 {
  background: #f4d35e;
}
.c4-cell.win {
  outline: 3px solid var(--accent2);
  outline-offset: 2px;
}
@media (min-width: 600px) {
  .c4-play-area {
    max-width: min(640px, 100%);
  }
  .c4-board,
  .c4-columns {
    gap: 8px;
  }
}
