/* Locle — styles */
:root {
  --bg: #0e1420;
  --bg-raised: #16203180;
  --card: #182338;
  --card-2: #1e2c47;
  --border: #2b3c5c;
  --text: #e8eef8;
  --text-dim: #93a4c0;
  --accent: #4da3ff;
  --accent-2: #7ec8ff;
  --good: #37c978;
  --bad: #ff6b6b;
  --gold: #ffd166;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1a2c4d 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #14263f 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ——— Top bar ——— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(14, 20, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  font-weight: 800;
}
.logo-accent { color: var(--accent); }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.icon-btn:hover { background: var(--card-2); transform: scale(1.06); }

/* ——— Layout ——— */
.game {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 60px;
}
.day-line, .zoom-line {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 8px 0;
}
.zoom-line { font-variant-numeric: tabular-nums; }
.dot { opacity: 0.5; }
#day-number { font-weight: 700; color: var(--accent-2); }

/* ——— Photo grid ——— */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.photo-pane {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}
.photo-pane img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(4.2);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
  user-select: none;
  -webkit-user-drag: none;
}
.photo-pane img.loaded { opacity: 1; }
.pane-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ——— Hints ——— */
.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 6px;
}
.hint-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  min-width: 96px;
  transition: border-color 0.3s, background 0.3s;
}
.hint-chip.revealed {
  border-color: var(--accent);
  background: linear-gradient(180deg, #1c3050, #182b48);
}
.hint-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.hint-value { font-size: 0.9rem; font-weight: 650; }
.hint-value.locked { opacity: 0.55; }

/* ——— Guess input ——— */
.guess-area { margin-top: 14px; }
#guess-form { display: flex; gap: 8px; }
.input-wrap { position: relative; flex: 1; }
#guess-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
#guess-input:focus { border-color: var(--accent); }
#guess-input::placeholder { color: var(--text-dim); }

.suggestions {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
  z-index: 15;
}
.suggestions li {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.suggestions li:hover, .suggestions li.active { background: var(--accent); color: #08111f; font-weight: 650; }

.btn {
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), #2f7fd6);
  border-color: transparent;
  color: #06101d;
}

/* ——— Guesses list ——— */
.guesses { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.guess-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  animation: slide-in 0.25s ease;
}
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.guess-row.wrong { border-left: 4px solid var(--bad); }
.guess-row.correct { border-left: 4px solid var(--good); background: linear-gradient(180deg, #16321f, #142b1e); }
.guess-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.guess-text { flex: 1; font-weight: 600; }
.guess-mark { flex: none; }

/* ——— Result panel ——— */
.result {
  margin-top: 18px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  text-align: center;
  box-shadow: var(--shadow);
  animation: slide-in 0.35s ease;
}
.result-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 8px; }
.result-answer { color: var(--text-dim); line-height: 1.5; }
.result-answer strong { color: var(--gold); }
.result-answer a { color: var(--accent-2); text-decoration: none; }
.result-answer a:hover { text-decoration: underline; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin: 16px 0 10px; }
.countdown { color: var(--text-dim); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
#countdown { color: var(--accent-2); font-weight: 700; }

/* ——— Modals ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 16, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  animation: modal-in 0.22s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h2 { margin: 0 0 12px; }
.modal h3 { margin: 18px 0 8px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
}
.help-list { padding-left: 20px; line-height: 1.65; }
.help-list li { margin-bottom: 6px; }
.help-fineprint { color: var(--text-dim); font-size: 0.85rem; }

/* ——— Stats ——— */
.stats-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  min-width: 78px;
  text-align: center;
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 6px;
}
.stat-val { font-size: 1.4rem; font-weight: 800; color: var(--accent-2); }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-top: 2px; }

.dist-title { font-weight: 700; margin-bottom: 8px; }
.dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dist-n { width: 14px; color: var(--text-dim); font-size: 0.85rem; text-align: right; }
.dist-bar {
  background: var(--accent);
  color: #06101d;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 5px;
  padding: 3px 8px;
  min-width: 22px;
  text-align: right;
  transition: width 0.4s ease;
}

/* ——— History table ——— */
.history-table-wrap { max-height: 300px; overflow-y: auto; border-radius: 10px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.history-table th, .history-table td { text-align: left; padding: 8px 10px; }
.history-table thead th {
  position: sticky;
  top: 0;
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.history-table tbody tr { border-top: 1px solid var(--border); }
.history-table tbody tr:hover { background: var(--card-2); }
.history-empty { color: var(--text-dim); text-align: center; padding: 14px 0; }

/* ——— Toast ——— */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--text);
  color: #0c1424;
  font-weight: 650;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: 90vw;
  text-align: center;
  white-space: pre-line;
  animation: slide-in 0.2s ease;
}

.hidden { display: none !important; }

/* ——— Small screens ——— */
@media (max-width: 480px) {
  .photo-grid { gap: 6px; }
  .hint-chip { min-width: 84px; padding: 6px 10px; }
  #guess-form { flex-direction: column; }
  .btn { width: 100%; }
}
