/* Sound Connections — styles */

:root {
  --bg: #0e0e12;
  --bg-raised: #17171f;
  --tile: #1f1f2a;
  --tile-hover: #262634;
  --tile-selected: #3a3a4d;
  --text: #f2f2f5;
  --text-dim: #9a9aa8;
  --accent: #ff6b35;
  --border: #2c2c3a;
  --d0: #e9c46a; /* yellow — easiest */
  --d1: #7fb069; /* green */
  --d2: #5b9bd5; /* blue */
  --d3: #a97fd1; /* purple — hardest */
  --radius: 10px;
}

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

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo-accent { color: var(--accent); }

.header-nav { display: flex; gap: 0.4rem; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover { background: var(--tile-hover); }

/* ---------- ad slots ---------- */

.ad-slot {
  max-width: 640px;
  width: 100%;
  margin: 0.75rem auto;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.75rem;
}

.ad-slot:empty::after,
.ad-slot:not(:has(ins))::after { content: "advertisement"; }

/* ---------- game ---------- */

.game-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0.5rem 0.75rem 1.5rem;
  flex: 1;
}

.puzzle-meta {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

#puzzle-label { color: var(--accent); font-weight: 700; }

.archive-badge {
  background: var(--accent);
  color: #14100c;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.prompt { margin: 0.5rem 0 0.9rem; font-size: 0.95rem; color: var(--text); }

.solved-groups { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.solved-group {
  border-radius: var(--radius);
  padding: 0.7rem 0.5rem;
  text-align: center;
  color: #17130b;
  animation: pop-in 0.35s ease;
}

.solved-group h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.solved-group p { font-size: 0.82rem; margin-top: 2px; }

.solved-group.d0 { background: var(--d0); }
.solved-group.d1 { background: var(--d1); }
.solved-group.d2 { background: var(--d2); }
.solved-group.d3 { background: var(--d3); }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tile {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 700;
  font-family: inherit;
  min-height: 76px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  transition: background 0.12s ease, transform 0.12s ease;
  font-size: 0.85rem;
}

.tile.len-m { font-size: 0.72rem; }
.tile.len-l { font-size: 0.62rem; }

.tile:hover { background: var(--tile-hover); }

.tile.selected {
  background: var(--tile-selected);
  border-color: var(--accent);
  transform: scale(0.97);
}

.tile.shake { animation: shake 0.35s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes pop-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.mistakes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0 0.9rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.dots { display: inline-flex; gap: 6px; }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.dot.spent { background: var(--border); }

.controls { display: flex; justify-content: center; gap: 0.6rem; }

.pill-btn {
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.pill-btn:hover:not(:disabled) { background: var(--tile-hover); }

.pill-btn:disabled { opacity: 0.35; cursor: default; }

.pill-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #17100b;
}

.pill-btn.primary:hover:not(:disabled) { background: #ff824f; }

.pill-btn.wide { width: 100%; margin-top: 0.8rem; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.site-footer a { color: var(--accent); }

.fine-print { font-size: 0.72rem; margin-top: 0.5rem; color: var(--text-dim); }

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 420px;
  width: 100%;
  padding: 1.4rem;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 0.8rem; font-size: 1.2rem; }
.modal p, .modal li { font-size: 0.92rem; line-height: 1.5; color: var(--text); }
.modal ul { margin: 0.6rem 0 0.6rem 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
}

.chip {
  display: inline-block;
  min-width: 2.4em;
  padding: 0.05em 0.45em;
  border-radius: 5px;
  color: #17130b;
  font-size: 0.78em;
  font-weight: 700;
  text-align: center;
}

.chip.d0 { background: var(--d0); }
.chip.d1 { background: var(--d1); }
.chip.d2 { background: var(--d2); }
.chip.d3 { background: var(--d3); }

.results-grid {
  font-size: 1.4rem;
  line-height: 1.35;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.8rem;
  margin: 0.6rem 0;
  font-family: inherit;
}

.next-puzzle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  align-items: baseline;
  margin-top: 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.countdown { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.archive-link {
  display: block;
  text-align: center;
  margin-top: 0.9rem;
  color: var(--accent);
  font-size: 0.9rem;
}

.stats-row { display: flex; justify-content: space-between; gap: 0.5rem; margin: 1rem 0; }

.stat { display: flex; flex-direction: column; align-items: center; flex: 1; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  z-index: 60;
  pointer-events: none;
}

.hidden { display: none !important; }

/* ---------- archive page ---------- */

.archive-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 0.75rem 2rem;
  flex: 1;
}

.archive-wrap h1 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.archive-sub { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1rem; }

.archive-list { display: flex; flex-direction: column; gap: 8px; }

.archive-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.archive-card:hover { background: var(--tile-hover); }

.archive-card .num { font-weight: 800; color: var(--accent); margin-right: 0.8rem; }
.archive-card .date { color: var(--text-dim); font-size: 0.85rem; flex: 1; }
.archive-card .status { font-size: 1rem; }

/* ---------- hints page ---------- */

.archive-wrap p { font-size: 0.92rem; line-height: 1.55; margin: 0.6rem 0; }
.archive-wrap a { color: var(--accent); }

.hints-h2 { font-size: 1.05rem; margin: 1.4rem 0 0.6rem; }

.hint-block {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.6rem 0;
  padding: 0.75rem 1rem;
}

.hint-block summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
}

.hint-block[open] summary { margin-bottom: 0.6rem; color: var(--accent); }

.hint-block ul { margin: 0 0 0.2rem 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }
.hint-block li { font-size: 0.9rem; line-height: 1.5; }

.hint-block .answers, #hints-yesterday .answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- small screens ---------- */

@media (max-width: 420px) {
  .tile { min-height: 68px; font-size: 0.78rem; }
  .tile.len-m { font-size: 0.66rem; }
  .tile.len-l { font-size: 0.58rem; }
  .pill-btn { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
}
