:root {
  color-scheme: light dark;
  --bg: #f6f5fb;
  --surface: #ffffff;
  --text: #1c1a2e;
  --muted: #5f5b76;
  --line: #e4e1ef;
  --accent: #5b45e0;
  --accent-soft: #eeebfd;
  --good: #107a43;
  --good-soft: #e2f6ea;
  --bad: #b3261e;
  --wait: #8a5300;
  --wait-soft: #fff0d6;
  --shadow: 0 1px 2px rgb(28 26 46 / 6%), 0 8px 24px rgb(28 26 46 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121120;
    --surface: #1c1a2e;
    --text: #f1effa;
    --muted: #aaa6c3;
    --line: #322f4a;
    --accent: #a394ff;
    --accent-soft: #2a2648;
    --good: #6fdc9f;
    --good-soft: #143326;
    --bad: #ff9a92;
    --wait: #ffc96b;
    --wait-soft: #3a2b10;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 "Be Vietnam Pro", system-ui, sans-serif;
}

a { color: var(--accent); }
h1 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; text-wrap: balance; }
.muted { color: var(--muted); }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}
.brand { font-weight: 800; color: var(--text); text-decoration: none; }
.progress { font-size: 14px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 4px 12px; white-space: nowrap; }

main { max-width: 1000px; margin: 0 auto; padding: 0 16px 56px; }

.hero { text-align: center; padding: 28px 0; }
.hero h1 { font-size: clamp(28px, 6vw, 42px); }
.hero p { max-width: 520px; margin: 0 auto; color: var(--muted); text-wrap: balance; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid li { display: flex; }
.card {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: start;
  gap: 4px 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card.done { border-color: var(--good); }
.card strong { grid-column: 1 / -1; font-size: 19px; margin-top: 6px; }
.card > .muted, .card .kind { grid-column: 1 / -1; font-size: 14px; }
.card .kind { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-weight: 500; }
.card-number { font-size: 13px; font-weight: 600; color: var(--muted); }

.status { font-size: 12px; font-weight: 600; border-radius: 99px; padding: 2px 10px; }
.status.ready { background: var(--accent-soft); color: var(--accent); }
.status.waiting { background: var(--wait-soft); color: var(--wait); }
.status.opened { background: var(--good-soft); color: var(--good); }

.crumbs { display: flex; justify-content: space-between; gap: 12px; max-width: 620px; margin: 0 auto 12px; font-size: 14px; color: var(--muted); }
.box { max-width: 620px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: clamp(18px, 5vw, 32px); }
.box h1 { font-size: clamp(24px, 5vw, 30px); }

.riddle { margin: 22px 0; padding: 16px 18px; background: var(--accent-soft); border-radius: 14px; }
.riddle h2 { margin: 0 0 4px; font-size: 13px; color: var(--accent); }
.riddle p { margin: 0; font-size: 18px; font-weight: 500; }

.lock { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 12px; border: 2px dashed var(--line); border-radius: 14px; text-align: center; }
.widget { display: flex; justify-content: center; width: 100%; min-height: 65px; align-items: center; }
.widget > div:not(.frc-captcha):not(.mtcaptcha) { max-width: 100%; }
.widget .frc-captcha { width: min(316px, 100%); }
.lock .note { margin: 0; font-weight: 500; min-height: 1.6em; }
.note:empty { display: none; }
.note.good { color: var(--good); }
.note.bad { color: var(--bad); }
.empty p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
code { font-size: .85em; background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }

.button { font: 600 15px/1.2 inherit; font-family: inherit; display: inline-block; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: var(--surface); cursor: pointer; text-decoration: none; }
.button.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.reward { margin-top: 20px; text-align: center; padding: 24px 16px; border-radius: 16px; background: var(--good-soft); animation: pop .5s cubic-bezier(.2, 1.5, .4, 1); }
.reward p { margin: 0; }
.reward-art svg { width: 190px; max-width: 100%; height: auto; }
.reward-label { margin-top: 8px !important; font-size: 13px; font-weight: 600; color: var(--good); }
.reward-answer { font-size: 30px; font-weight: 800; line-height: 1.25; margin-bottom: 6px !important; }

.detail { margin-top: 18px; font-size: 14px; }
.detail summary { cursor: pointer; font-weight: 600; }
.detail pre { overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12.5px; }

.pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; max-width: 620px; margin: 16px auto 0; }

.confetti { position: fixed; top: -12px; width: 9px; height: 15px; border-radius: 2px; pointer-events: none; z-index: 10; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(720deg); opacity: .6; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.widget altcha-widget { --altcha-max-width: 100%; width: min(320px, 100%); text-align: left; }
