/* ============ base — Milk & Cookies theme ============ */
:root {
  --bg: #ffffff;
  --dough: #fdf3e7;
  --card: #ffffff;
  --card-2: #fdf3e7;
  --border: #5b3a1e;
  --border-soft: #e8d5bf;
  --text: #4a2c17;
  --muted: #9b7a5c;
  --accent: #6b3f1d;
  --accent-ink: #ffffff;
  --milk: #7eb8e8;
  --milk-soft: #eaf4fd;
  --milk-ink: #2f6ea5;
  --wrong: #d64545;
  --skip: #d2b193;
  --radius: 22px;
}

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

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ============ top bar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--milk-soft);
  border-bottom: 3px solid var(--border);
}

.logo {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark { font-size: 1.3rem; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 800;
  box-shadow: 0 3px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s;
}
.icon-btn:hover { transform: translateY(1px); box-shadow: 0 2px 0 var(--border); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--border); }

/* ============ layout ============ */
.shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  flex: 1;
}

.view[hidden] { display: none; }

/* ============ intro ============ */
.intro-card, .results-card {
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 6px 0 var(--border);
  animation: rise 0.35s ease both;
}

.intro-day {
  display: inline-block;
  background: var(--milk-soft);
  border: 2px solid var(--milk);
  color: var(--milk-ink);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 18px;
}

.intro-tagline {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}

.intro-sub { color: var(--muted); font-size: 0.94rem; line-height: 1.55; margin-bottom: 26px; }

.intro-category { color: var(--muted); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; line-height: 2.3; margin-bottom: 26px; }

.chip {
  display: inline-block;
  background: var(--dough);
  border: 2.5px solid var(--border);
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text);
  box-shadow: 0 3px 0 var(--border);
}

.btn-primary {
  font-family: "Baloo 2", "Nunito", sans-serif;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 1.05rem;
  border: 3px solid var(--border);
  border-radius: 999px;
  padding: 11px 40px;
  box-shadow: 0 5px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--border); }
.btn-primary:disabled { opacity: 0.45; cursor: default; box-shadow: 0 5px 0 var(--border); transform: none; }

.btn-ghost {
  display: block;
  margin: 16px auto 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 999px;
  transition: color 0.15s;
}
.btn-ghost:hover { color: var(--text); }

/* ============ game ============ */
.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.timer {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.dots {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin-bottom: 20px;
}

/* progress dots drawn as little cookies */
.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--dough) url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3E%3Ccircle cx="10" cy="10" r="8.5" fill="%23fdf3e7" stroke="%23d2b193" stroke-width="1.6" stroke-dasharray="3 3"/%3E%3C/svg%3E') center/contain no-repeat;
  border: none;
  transition: background 0.2s;
}
.dot.current {
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3E%3Ccircle cx="10" cy="10" r="8.5" fill="%23fdf3e7" stroke="%235b3a1e" stroke-width="1.8"/%3E%3Ccircle cx="7" cy="8" r="1.4" fill="%23d2b193"/%3E%3Ccircle cx="13" cy="12" r="1.4" fill="%23d2b193"/%3E%3Ccircle cx="12" cy="7" r="1.1" fill="%23d2b193"/%3E%3C/svg%3E') center/contain no-repeat;
  animation: pulse 1.4s ease-in-out infinite;
}
.dot.win {
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3E%3Ccircle cx="10" cy="10" r="8.5" fill="%23d29b5c" stroke="%235b3a1e" stroke-width="1.8"/%3E%3Ccircle cx="7" cy="8" r="1.5" fill="%234a2c17"/%3E%3Ccircle cx="13" cy="12" r="1.5" fill="%234a2c17"/%3E%3Ccircle cx="12" cy="7" r="1.2" fill="%234a2c17"/%3E%3Ccircle cx="8.5" cy="13" r="1.1" fill="%234a2c17"/%3E%3C/svg%3E') center/contain no-repeat;
}
.dot.wrong {
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3E%3Cpath d="M10 1.5a8.5 8.5 0 1 0 8.1 11C14 11.8 11.2 8 12.6 3.2A8.5 8.5 0 0 0 10 1.5z" fill="%23d64545" stroke="%235b3a1e" stroke-width="1.8"/%3E%3Ccircle cx="7" cy="9" r="1.4" fill="%234a2c17"/%3E%3Ccircle cx="10.5" cy="13.5" r="1.2" fill="%234a2c17"/%3E%3C/svg%3E') center/contain no-repeat;
}
.dot.skip {
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3E%3Ccircle cx="10" cy="10" r="8.5" fill="%23d2b193" stroke="%239b7a5c" stroke-width="1.6"/%3E%3Ccircle cx="7" cy="8" r="1.4" fill="%239b7a5c"/%3E%3Ccircle cx="13" cy="12" r="1.4" fill="%239b7a5c"/%3E%3C/svg%3E') center/contain no-repeat;
}

.clues {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
  min-height: 120px;
}

.clue {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 2.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 4px 0 var(--border);
  animation: rise 0.3s ease both;
}

.clue-num {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--dough);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
}

.clue-word { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.02em; }

.clue.latest { background: var(--milk-soft); border-color: var(--milk); box-shadow: 0 4px 0 var(--milk); }
.clue.latest .clue-num { background: var(--milk); border-color: var(--milk-ink); color: #fff; }

#guess-form {
  display: flex;
  gap: 10px;
}

#guess-input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 2.5px solid var(--border);
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 2px 0 rgba(91, 58, 30, 0.12);
  transition: border-color 0.15s;
}
#guess-input:focus { border-color: var(--milk); }
#guess-input::placeholder { color: var(--muted); font-weight: 600; }

#guess-form .btn-primary { padding: 11px 26px; }

#guess-form.shake { animation: shake 0.4s ease; }

.guesses {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.guess-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--dough);
  border: 2px solid var(--border-soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  animation: rise 0.25s ease both;
}

.guess-chip .warmth { font-size: 0.9rem; }

/* ============ results ============ */
.res-verdict {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 20px;
}

.res-word-label { color: var(--muted); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }

.res-word {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 4px 0 16px;
}

.res-line { color: var(--muted); font-size: 0.95rem; margin-bottom: 10px; }

.res-marks { font-size: 1.25rem; letter-spacing: 2px; margin-bottom: 20px; }

.res-clues { margin-bottom: 24px; text-align: left; }
.res-clues summary {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: center;
  padding: 6px;
}
.res-clues ol {
  margin-top: 10px;
  padding-left: 30px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.9;
}
.res-clues li::marker { color: var(--skip); font-weight: 700; }

.share-label { color: var(--muted); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 12px; }

.share-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--dough);
  border: 2.5px solid var(--border);
  border-radius: 16px;
  padding: 12px 4px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text);
  box-shadow: 0 3px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s;
}
.share-btn:hover { transform: translateY(1px); box-shadow: 0 2px 0 var(--border); }
.share-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--border); }

.countdown { color: var(--muted); font-size: 0.88rem; font-weight: 700; }
.countdown span { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text); }

/* ============ modals ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(74, 44, 23, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fade 0.2s ease both;
}
.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  background: var(--card);
  border: 3px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 460px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  animation: rise 0.25s ease both;
}

@media (min-width: 520px) {
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: var(--radius); border-bottom: 3px solid var(--border); box-shadow: 0 6px 0 var(--border); }
}

.modal-close { position: absolute; top: 14px; right: 14px; font-size: 1.1rem; width: 32px; height: 32px; box-shadow: 0 2px 0 var(--border); }

.modal-card h2 { font-family: "Baloo 2", "Nunito", sans-serif; font-size: 1.2rem; font-weight: 800; margin-bottom: 16px; letter-spacing: 0.02em; }
.modal-card h3 { font-size: 0.8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin: 22px 0 10px; }

.help-list { list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 0.94rem; line-height: 1.55; color: var(--muted); }
.help-list strong { color: var(--text); }
.help-legend { margin-top: 18px; font-size: 0.88rem; color: var(--muted); }

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

.stat {
  background: var(--dough);
  border: 2.5px solid var(--border);
  border-radius: 16px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 3px 0 var(--border);
}
.stat-num { font-family: "Baloo 2", "Nunito", sans-serif; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.64rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.dist { display: flex; flex-direction: column; gap: 5px; }

.dist-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.dist-row .n { width: 18px; text-align: right; color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.dist-row .bar {
  height: 20px;
  min-width: 26px;
  background: var(--dough);
  border: 1.5px solid var(--border-soft);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}
.dist-row .bar.filled { background: var(--accent); border-color: var(--border); color: var(--accent-ink); }

.history { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--dough);
  border: 2px solid var(--border-soft);
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 0.85rem;
}
.history .h-date { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.history .h-word { font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.history .h-result { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.history .h-result.won { color: var(--milk-ink); }
.history-empty { color: var(--muted); font-size: 0.88rem; justify-content: center; }

/* ============ toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.88rem;
  font-weight: 800;
  border: 2.5px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--border);
  z-index: 60;
  animation: rise 0.25s ease both;
  pointer-events: none;
}

/* ============ animations ============ */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ============ ABOUT (static SEO section) ============ */
.about {
  background: var(--dough);
  border-top: 3px solid var(--border-soft);
  padding: 40px 16px 56px;
}

.about-inner {
  max-width: 460px;
  margin: 0 auto;
}

.about h2 {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 10px;
}

.about h3 {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.15rem;
  color: var(--accent);
  margin: 24px 0 8px;
}

.about p,
.about li,
.about dd {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
}

.about ul {
  list-style: none;
  display: grid;
  gap: 8px;
}

.about ul li {
  padding-left: 22px;
  position: relative;
}

.about ul li::before {
  content: "🍪";
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 0.8rem;
}

.about-faq dt {
  font-weight: 800;
  margin-top: 14px;
}

.about-faq dd {
  margin-top: 2px;
  color: var(--muted);
}
