*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Trebuchet MS", "Segoe UI", "PT Sans", "Liberation Sans", sans-serif;
  color: var(--ink, #2a2118);
  background: var(--bg, #1b2740);
  line-height: 1.45;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
button, input { font: inherit; }
a { color: inherit; }

.snow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.flake {
  position: absolute;
  top: -8%;
  color: #fff;
  animation: fall linear infinite;
  text-shadow: 0 0 8px rgba(255,255,255,.45);
}

@keyframes fall {
  0%   { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  100% { transform: translate3d(12vw, 110vh, 0) rotate(360deg); }
}

.burst-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
}

.burst-particle {
  position: fixed;
  font-size: 18px;
  animation: burst-out .85s ease-out forwards;
  pointer-events: none;
}

@keyframes burst-out {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; }
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 8px;
}

.topbar-title {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: clamp(18px, 4.5vw, 30px);
  letter-spacing: .02em;
  line-height: 1.15;
  text-wrap: balance;
}

.topbar-title p {
  margin: 3px 0 0;
  font-size: 12px;
  opacity: .85;
}

.nav-link, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--chip, rgba(255,255,255,.16));
  border: 1px solid var(--chip-border, rgba(255,255,255,.28));
  color: var(--chip-ink, #fff);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 40px;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

.nav-link:hover, .ghost-btn:hover { filter: brightness(1.08); }

.progress-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chip, rgba(255,255,255,.14));
  color: var(--chip-ink, #fff);
  font-size: 13px;
  width: max-content;
  position: relative;
  z-index: 5;
}

.page {
  position: relative;
  z-index: 4;
  width: min(1120px, calc(100% - 20px));
  margin: 0 auto 28px;
}

.btn {
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  min-height: 48px;
  font-weight: 700;
  letter-spacing: .02em;
}

.btn-check {
  background: linear-gradient(#ffd45a, #f0a020);
  color: #3a2408;
  box-shadow: 0 4px 0 #c47a10, 0 8px 18px rgba(0,0,0,.18);
}

.btn-check:hover { filter: brightness(1.05); }
.btn-check:disabled { filter: grayscale(.2) brightness(.95); cursor: default; }

.modal-backdrop,
.finale-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 10, 20, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  opacity: 0;
  transition: opacity .2s ease;
}

.modal-backdrop.is-visible,
.finale-backdrop.is-visible { opacity: 1; }

.task-sheet,
.finale-card {
  width: min(560px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  background: var(--sheet, #fffaf0);
  color: var(--sheet-ink, #2a2118);
  border-radius: 24px 24px 16px 16px;
  padding: 20px 18px 22px;
  position: relative;
  box-shadow: 0 -8px 40px rgba(0,0,0,.3);
  transform: translateY(16px);
  transition: transform .22s ease;
}

.modal-backdrop.is-visible .task-sheet,
.finale-backdrop.is-visible .finale-card { transform: translateY(0); }

@media (min-width: 800px) {
  .modal-backdrop,
  .finale-backdrop { align-items: center; }
  .task-sheet,
  .finale-card {
    border-radius: 24px;
    padding: 28px 28px 26px;
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
  }
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.08);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

.sheet-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 36px 8px 0;
}

.sheet-day, .sheet-subject {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 10px;
}

.sheet-day { background: #ffe7a3; color: #5a3a00; }
.sheet-subject { background: #dceeff; color: #163a62; }

.sheet-title {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.2;
}

.sheet-intro, .sheet-question, .already {
  margin: 0 0 10px;
  font-size: 16px;
}

.sheet-question { font-weight: 700; font-size: 18px; }

.sheet-form { display: grid; gap: 10px; margin: 12px 0; }

.option {
  text-align: left;
  border: 2px solid #e0d2b6;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 48px;
  cursor: pointer;
  color: inherit;
}

.option.is-picked {
  border-color: #e09a12;
  background: #fff4d6;
  box-shadow: 0 0 0 3px rgba(224,154,18,.25);
}

.option:disabled { opacity: .85; cursor: default; }

.answer-input {
  width: 100%;
  border: 2px solid #e0d2b6;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 18px;
  min-height: 52px;
  background: #fff;
  color: inherit;
}

.answer-input:focus, .option:focus, .btn:focus, .nav-link:focus, .ghost-btn:focus, .sheet-close:focus {
  outline: 3px solid rgba(80, 140, 255, .55);
  outline-offset: 2px;
}

.sheet-feedback {
  min-height: 1.4em;
  font-size: 15px;
  margin: 4px 0 8px;
}
.sheet-feedback.is-ok { color: #0e6b38; font-weight: 700; }
.sheet-feedback.is-hint { color: #8a3b00; }

.sheet-reward { display: none; margin-top: 8px; }
.sheet-reward.is-shown { display: block; animation: pop-in .45s ease; }

.reward-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 2px dashed #d2b46a;
  border-radius: 16px;
  padding: 10px 12px;
}

.reward-card svg, .reward-card .emoji-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  font-size: 44px;
  line-height: 64px;
  text-align: center;
}

.reward-text { margin: 0; }
.reward-text strong { display: block; font-size: 16px; }
.reward-text p { margin: 4px 0 0; font-size: 14px; }

@keyframes pop-in {
  0% { transform: scale(.85); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.is-shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  z-index: 70;
  background: #2a2118;
  color: #fff8e8;
  padding: 12px 16px;
  border-radius: 14px;
  max-width: min(92vw, 420px);
  font-size: 14px;
  opacity: 0;
  transition: .2s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.finale-card h2 { margin: 0 0 8px; font-size: 26px; }
.finale-card p { margin: 0 0 12px; font-size: 16px; }
.finale-art {
  display: flex;
  justify-content: center;
  margin: 6px 0 14px;
  font-size: 64px;
  line-height: 1;
}

.site-footer {
  position: relative;
  z-index: 4;
  text-align: center;
  color: var(--footer-ink, rgba(255,255,255,.7));
  font-size: 12px;
  padding: 8px 16px 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

@media (max-width: 420px) {
  .topbar { padding: 10px 8px 6px; }
  .nav-link, .ghost-btn { padding: 8px 9px; font-size: 12px; }
}
