/* Daily Hue — daily-hue design system, light & dark schemes. */

:root {
  --ink: #1d2440;
  --muted: #8b93b2;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --card: #ffffff;
  --bg: #f4f6fb;
  --border: #e7e9f4;
  --pill-bg: #f3f4fb;
  --icon-bg: #fafbff;
  --overlay-bg: rgba(255, 255, 255, 0.82);
  --shadow: 0 24px 70px rgba(58, 68, 130, 0.14), 0 2px 8px rgba(58, 68, 130, 0.06);
  --tile-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.06), 0 2px 6px rgba(30, 36, 80, 0.08);
  --tile-hover: 0 6px 16px rgba(30, 36, 80, 0.14);
  --radius: 22px;
  --ring: var(--accent);
  color-scheme: light;
}

[data-theme="dark"] {
  --ink: #eef0ff;
  --muted: #a3aac8;
  --accent: #818cf8;
  --accent-2: #22d3ee;
  --card: #23263b;
  --bg: #141627;
  --border: #323652;
  --pill-bg: #2a2e47;
  --icon-bg: #2a2e47;
  --overlay-bg: rgba(20, 22, 39, 0.86);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  --tile-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.4);
  --tile-hover: 0 6px 16px rgba(0, 0, 0, 0.5);
  --ring: #a5b4fc;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1100px 520px at 12% -8%, #eef2ff 0%, transparent 60%),
    radial-gradient(900px 480px at 108% 12%, #ecfeff 0%, transparent 55%),
    radial-gradient(700px 500px at 50% 115%, #fdf4ff 0%, transparent 55%),
    linear-gradient(180deg, #fafbff, var(--bg));
}

[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(99, 102, 241, 0.22) 0%, transparent 60%),
    radial-gradient(900px 480px at 108% 12%, rgba(34, 211, 238, 0.14) 0%, transparent 55%),
    radial-gradient(700px 500px at 50% 115%, rgba(168, 85, 247, 0.14) 0%, transparent 55%),
    linear-gradient(180deg, #191b30, var(--bg));
}

.game {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 28px;
  padding: 26px 26px 24px;
  box-shadow: var(--shadow);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-block;
}
.sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 18px; }
.actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--icon-bg); color: var(--muted); cursor: pointer; font-size: 16px;
  display: grid; place-items: center; transition: all .18s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.pill {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: var(--pill-bg); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 999px;
  display: flex; align-items: center; gap: 6px;
}
.pill b { font-weight: 800; }
.pill .flame { font-size: 13px; }

.grid-wrap { position: relative; }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.tile {
  aspect-ratio: 1 / 1; border: none; border-radius: 15px; cursor: pointer;
  box-shadow: var(--tile-shadow);
  transition: transform .16s ease, box-shadow .16s ease, opacity .35s ease;
  animation: pop-in .45s cubic-bezier(.2,.9,.3,1.4) both;
  animation-delay: calc(var(--i) * 16ms);
  opacity: 0;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.6) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tile:hover { transform: translateY(-2px) scale(1.04); box-shadow: var(--tile-hover); }
.tile:active { transform: scale(.95); }
.tile:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.tile.miss { opacity: .16; cursor: default; box-shadow: none; animation: none; transform: scale(.92); }
.tile.hit {
  cursor: default; animation: hit-pulse .6s ease both;
  box-shadow: 0 0 0 4px var(--card), 0 0 0 7px var(--accent), 0 8px 24px rgba(99,102,241,.35);
}
@keyframes hit-pulse {
  0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1.06); }
}

.overlay {
  position: absolute; inset: 0; z-index: 5; border-radius: inherit;
  background: var(--overlay-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 28px;
  animation: fade-in .35s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.overlay.hidden { display: none; }
.overlay .emoji { font-size: 44px; animation: bounce .6s ease both; }
@keyframes bounce { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.overlay h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.overlay p { color: var(--muted); font-size: 13.5px; max-width: 320px; line-height: 1.6; }
.overlay .btn-row { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }

.btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13.5px;
  padding: 11px 18px; border-radius: 14px; transition: all .18s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(99,102,241,.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(99,102,241,.42); }
.btn-ghost { background: var(--pill-bg); color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

footer {
  margin-top: 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.note { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.link {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600; color: var(--accent); padding: 4px 2px;
}
.link:hover { text-decoration: underline; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

@media (max-width: 460px) {
  .game { padding: 20px 16px; border-radius: 22px; }
  .grid { gap: 7px; }
  .tile { border-radius: 11px; }
  .sub { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
