:root {
  --bg: #0c1820;
  --card: #132630;
  --card-2: #0f1f28;
  --line: #24404e;
  --ink: #eef3f6;
  --muted: #8aa3b1;
  --accent: #f5822b;
  --accent-soft: rgba(245, 130, 43, 0.14);
  --ok: #6fd39a;
  --ok-bg: rgba(111, 211, 154, 0.12);
  --bad: #ff8a80;
  --bad-bg: rgba(255, 138, 128, 0.12);
  --radius: 14px;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.hook { width: 18px; height: 24px; color: var(--accent); }

.meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.meta strong { color: var(--ink); font-weight: 600; }
.meta .count { color: var(--accent); }

main {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 8px;
  display: grid;
  gap: 14px;
  flex: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.clue {
  margin: 0 0 18px;
  font-size: clamp(20px, 5.2vw, 26px);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.answer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.box {
  width: 46px;
  height: 56px;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--card-2);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0;
  outline: none;
  caret-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}
.box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.box:disabled { opacity: 1; }
.box.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.box.bad { border-color: var(--bad); background: var(--bad-bg); }

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

.msg {
  min-height: 1.5em;
  margin: 0 0 14px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}
.msg.ok { color: var(--ok); font-weight: 600; }
.msg.bad { color: var(--bad); font-weight: 600; }

.actions { display: flex; gap: 10px; }
.actions .btn { flex: 1; }

.btn {
  font: inherit;
  font-weight: 700;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: var(--card-2); }

.section-title {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover:not(:disabled) { border-color: var(--muted); }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.chip.revealed { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.chip .n { color: var(--muted); margin-right: 4px; }

.hint-out {
  min-height: 0;
  margin-top: 10px;
  font-size: 15px;
}
.hint-out:empty { display: none; }
.hint-out .hint-line {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--card-2);
  border-radius: 8px;
}
.hint-out .hint-line + .hint-line { margin-top: 8px; }
.hint-out .hint-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.solution { border-color: var(--ok); background: #13302a; }
.solution[hidden] { display: none; }
.parts { margin: 0 0 10px; display: grid; gap: 8px; }
.parts div { display: grid; grid-template-columns: 140px 1fr; gap: 10px; }
.parts dt { color: var(--muted); font-size: 13px; }
.parts dd { margin: 0; font-size: 15px; }
.parts .answer-word { font-weight: 700; color: var(--ok); letter-spacing: 0.04em; }
.tomorrow { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.how { padding: 0; }
.how summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.how summary::-webkit-details-marker { display: none; }
.how summary::before {
  content: "▶";
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.how[open] summary::before { transform: rotate(90deg); }
.how-body { padding: 0 18px 18px; font-size: 15px; color: #c6d3da; }
.how-body p { margin: 0 0 10px; }
.how-body strong { color: var(--ink); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px 16px 28px;
}

[hidden] { display: none !important; }

@media (min-width: 640px) {
  main { padding-top: 28px; }
  .box { width: 52px; height: 64px; font-size: 30px; }
}

@media (max-width: 360px) {
  .box { width: 38px; height: 48px; font-size: 20px; }
  .answer { gap: 4px; }
  .parts div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .answer.shake { animation: none; }
}
