@font-face { font-family: "Baloo"; src: url("../fonts/Baloo2-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/Poppins-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/Poppins-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/Poppins-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Gentium"; src: url("../fonts/GentiumBookPlus-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gentium"; src: url("../fonts/GentiumBookPlus-Italic.ttf") format("truetype"); font-style: italic; font-display: swap; }
@font-face { font-family: "Gentium"; src: url("../fonts/GentiumBookPlus-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --night: #1f2f55; --night2: #2c4377; --cream: #f8f3e8; --card: #fffdf8; --red: #b3262e; --gold: #c99a2e; --green: #2f5d3a;
  --ink: #2b2118; --muted: #6f6556; --line: #e6dccb; --teal: #3a7d9a;
  --head: "Baloo", "Poppins", system-ui, sans-serif; --body: "Poppins", system-ui, sans-serif; --book: "Gentium", Georgia, serif;
  --radius: 22px; --shadow: 0 6px 22px rgba(31, 47, 85, .14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1.05rem/1.55 var(--body); color: var(--ink); background: var(--cream); min-height: 100vh; overflow-x: hidden; }
img { max-width: 100%; height: auto; }
a { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }

/* falling snow behind the header */
.snow { position: absolute; inset: 0 0 auto 0; height: 110px; pointer-events: none; z-index: 0;
  background: linear-gradient(var(--night), var(--night2) 60%, rgba(44, 67, 119, 0));
}
.snow::before, .snow::after { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(3px 3px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 90px 80px, #fff, transparent),
    radial-gradient(3px 3px at 160px 40px, #fff, transparent), radial-gradient(2px 2px at 230px 110px, #fff, transparent),
    radial-gradient(2px 2px at 300px 60px, #fff, transparent);
  background-size: 320px 140px; opacity: .8; animation: fall 14s linear infinite; }
.snow::after { background-size: 260px 120px; opacity: .5; animation-duration: 22s; }
@keyframes fall { from { background-position: 0 0; } to { background-position: 40px 280px; } }
@media (prefers-reduced-motion: reduce) { .snow::before, .snow::after { animation: none; } }

.top { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px;
  padding: 12px max(16px, env(safe-area-inset-left)); max-width: 1120px; margin: 0 auto; color: #fff; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 800 1.35rem/1 var(--head); }
.logo img { border-radius: 50%; border: 3px solid var(--gold); }
.logo em { font-style: normal; color: #f3d27a; }
#nav { display: flex; flex-wrap: wrap; gap: 6px; }
#nav[hidden] { display: none; }
#nav a { color: #fff; text-decoration: none; font-weight: 600; padding: 10px 14px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center; }
#nav a:hover, #nav a[aria-current] { background: rgba(255, 255, 255, .16); }
main { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 8px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: .9rem; padding: 20px 16px 40px; }
.foot a { color: var(--muted); }
.loading { text-align: center; padding: 60px 0; color: var(--muted); }
/* night-sky banner for every page title (and the welcome / home hero) */
.banner, .welcome, .hero { position: relative; overflow: hidden; background: radial-gradient(120% 140% at 80% 0%, var(--night2), var(--night) 70%);
  border-radius: 28px; padding: 22px 26px; margin: 10px 0 18px; color: #fff; box-shadow: var(--shadow); }
.banner::after, .welcome::after, .hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image: radial-gradient(2px 2px at 30px 20px, #fff, transparent), radial-gradient(2px 2px at 140px 70px, #fff, transparent),
    radial-gradient(3px 3px at 260px 30px, #fff, transparent), radial-gradient(2px 2px at 380px 90px, #fff, transparent);
  background-size: 420px 120px; }
.banner > *, .welcome > *, .hero > * { position: relative; z-index: 1; }
.banner .title, .banner .lead, .banner p { color: #fff; margin-left: 0; margin-right: 0; }
.banner .title { margin: 0 0 .2em; } .banner p:last-child { margin-bottom: 0; }
.banner .muted { color: #d8deeb; }

h1, h2, h3 { font-family: var(--head); font-weight: 800; line-height: 1.15; color: var(--night); }
.title { font-size: clamp(1.9rem, 5vw, 2.9rem); margin: .3em 0 .4em; }
.small-title { font-size: 1.6rem; }
.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.3rem; margin: 1rem 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.row.center { justify-content: center; }
.screen.narrow { max-width: 760px; margin: 0 auto; }
.list { padding-left: 1.2em; } .list li { margin: .4em 0; }
.q li { font-family: var(--book); font-style: italic; font-size: 1.15rem; color: var(--night); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 54px; padding: .6rem 1.3rem;
  border-radius: 999px; border: 3px solid var(--night); background: #fff; color: var(--night); font: 700 1.02rem var(--body);
  text-decoration: none; cursor: pointer; touch-action: manipulation; }
.btn:hover { background: #eef1f8; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #9a1f26; }
.btn.big { font-size: 1.15rem; min-height: 64px; width: 100%; }
.btn.ghost { background: #fff; }
.btn.mini { min-height: 46px; min-width: 46px; padding: .3rem .9rem; }
.btn[disabled] { opacity: .4; cursor: default; }
.label { display: block; font-weight: 700; margin-bottom: 6px; }
.big-input { width: 100%; min-height: 60px; font: 700 1.4rem var(--body); letter-spacing: .1em; padding: 8px 16px; border: 3px solid var(--night);
  border-radius: 16px; background: #fff; color: var(--ink); }
#nm.big-input { text-transform: none; letter-spacing: 0; flex: 1 1 220px; }
#code { text-transform: uppercase; margin-bottom: 8px; }
.code-msg { font-weight: 600; min-height: 1.5em; color: var(--red); margin: 10px 0 0; }
.code-msg.show { background: #fdeaea; border-radius: 12px; padding: 8px 12px; }

/* welcome */
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding-top: 10px; }
.welcome .title { color: #fff; }
.welcome .lead { color: #fff; }
.welcome-cover { border-radius: 18px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); transform: rotate(-2deg); margin: 10px; }
.code-card { color: var(--ink); }
@media (max-width: 760px) { .welcome { grid-template-columns: 1fr; padding: 16px; } .welcome-cover { max-width: 260px; margin: 0 auto; } }

/* home */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; }
.hero .title, .hero .lead { color: #fff; }
.hero img { border-radius: 50%; border: 6px solid #fff; box-shadow: var(--shadow); max-width: 320px; justify-self: center; }
.bell-btn { background: var(--gold); border-color: var(--gold); color: #fff; font-size: 1.1rem; }
.bell-btn:hover { background: #b0861f; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding: 16px; } .hero img { max-width: 200px; grid-row: 1; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 22px; }
.tiles.two { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tile { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; text-decoration: none; color: var(--ink); border-left: 10px solid var(--c); min-height: 120px; transition: transform .15s; }
.tile:hover { transform: translateY(-3px); }
.tile img { width: 96px; height: 96px; object-fit: cover; border-radius: 16px; flex: none; background: #fff; }
.tile strong { display: block; font: 800 1.3rem/1.15 var(--head); color: var(--c); }
.tile small { display: block; font-size: .95rem; color: var(--muted); margin-top: 4px; }

/* story */
.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: center; padding-top: 10px; }
.story-img { margin: 0; } .story-img img { border-radius: 18px; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); display: block; }
.story-text { font: 400 1.45rem/1.6 var(--book); text-align: center; padding: 1.6rem; }
.story-text p { margin: 0 0 .8em; }
.page-no { font-family: var(--body); margin-top: 1em; }
.story-bar { grid-column: 1 / -1; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.end-img { max-width: 360px; border-radius: 18px; box-shadow: var(--shadow); }
@media (max-width: 760px) { .story { grid-template-columns: 1fr; } .story-text { font-size: 1.25rem; padding: 1.1rem; } }

/* coloring */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pick { padding: 8px; display: block; } .pick img { display: block; border-radius: 12px; }
.color-wrap { max-width: 640px; margin: 0 auto; }
#cv { width: 100%; height: auto; display: block; background: #fff; border-radius: 16px; box-shadow: var(--shadow); touch-action: manipulation; cursor: crosshair; }
.palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; margin: 14px auto; }
.sw { width: 48px; height: 48px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #cfc5b3; cursor: pointer; }
.sw[aria-checked="true"] { box-shadow: 0 0 0 4px var(--night); transform: scale(1.12); }

/* memory */
.mem { display: grid; gap: 10px; max-width: 760px; margin: 0 auto; grid-template-columns: repeat(4, 1fr); }
.mem-6 { grid-template-columns: repeat(4, 1fr); } .mem-8 { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 700px) { .mem-6 { grid-template-columns: repeat(6, 1fr); } }
.mcard { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 14px; cursor: pointer; background: var(--night); box-shadow: var(--shadow); overflow: hidden; }
.mcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.mcard .back { color: #fff; font-size: 2rem; }
.mcard.up img { opacity: 1; }
.mcard.done { box-shadow: 0 0 0 4px var(--gold); }

/* maze */
.maze { width: 100%; max-width: 560px; height: auto; display: block; margin: 0 auto; border-radius: 16px; box-shadow: var(--shadow); touch-action: none; background: var(--cream); }
.pad { display: grid; justify-items: center; gap: 6px; margin: 14px auto; } .pad div { display: flex; gap: 60px; }
.pad .btn { width: 64px; height: 64px; padding: 0; font-size: 1.3rem; }

/* countdown */
.doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-width: 900px; margin: 0 auto; }
.door { aspect-ratio: 1; border-radius: 16px; border: 3px solid var(--gold); background: linear-gradient(160deg, var(--red), #8d1c23);
  color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--head); }
.door:nth-child(3n) { background: linear-gradient(160deg, var(--green), #1f4229); }
.door:nth-child(4n) { background: linear-gradient(160deg, var(--night2), var(--night)); }
.door .dn { font-size: 2rem; line-height: 1; } .door .dt { font: 600 .8rem var(--body); min-height: 1.2em; }
.door.open { background: #fff; color: var(--night); }
.door[disabled] { opacity: .5; cursor: default; }
.door-card { max-width: 640px; margin: 20px auto; text-align: center; }
.chip { display: inline-block; background: var(--gold); color: #fff; font-weight: 700; border-radius: 999px; padding: 4px 14px; margin: 0; }
.door-text { font: 400 1.4rem/1.45 var(--book); color: var(--night); }

/* certificate and letter (screen and print) */
.cert { background: #fff; border: 10px solid var(--gold); border-radius: 18px; padding: 10px; margin: 18px auto; max-width: 720px; text-align: center; }
.cert-in { border: 3px solid var(--red); border-radius: 10px; padding: 26px 20px; font-family: var(--book); font-size: 1.2rem; }
.cert-top { font: 800 1rem var(--head); letter-spacing: .2em; text-transform: uppercase; color: var(--green); margin: 0; }
.cert-title { font-size: 2.2rem; color: var(--red); margin: .2em 0 .4em; }
.cert-name { font: 800 2.4rem var(--head); color: var(--night); border-bottom: 3px dotted var(--gold); display: inline-block; min-width: 60%; margin: .2em 0 .5em; }
.cert-img { width: 180px; border-radius: 50%; border: 5px solid var(--gold); margin: 10px auto; display: block; }
.cert-sign { display: flex; justify-content: space-around; font: italic 1.3rem var(--book); color: var(--night); margin-top: 10px; }
.cert-sign span { border-top: 2px solid var(--ink); padding: 4px 30px 0; }
.cert-date { color: var(--muted); margin-bottom: 0; }
.letter { background: #fff; border-radius: 18px; padding: 28px; max-width: 720px; margin: 16px auto; box-shadow: var(--shadow); font-family: var(--book); font-size: 1.25rem; position: relative; border: 3px dashed var(--red); }
.letter-img { position: absolute; right: 20px; top: 20px; width: 110px; border-radius: 50%; border: 4px solid var(--gold); }
.letter-title { color: var(--red); font-size: 2rem; margin: 0 0 18px; }
.lline { margin: 14px 0; display: flex; gap: 8px; align-items: flex-end; }
.blank { flex: 1; border-bottom: 2px solid #999; min-height: 1.4em; } .blank.short { flex: 0 0 70px; } .blank.full { flex: 1 1 100%; }
.letter-draw { margin-top: 20px; border: 2px dashed var(--muted); border-radius: 14px; height: 220px; display: flex; align-items: flex-end; justify-content: center; padding: 8px; color: var(--muted); font-family: var(--body); font-size: .9rem; }

/* private area */
.pv-login .btn { width: 100%; margin-top: 8px; }
.pv-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pv-nav h2 { margin: 0; flex: 1; text-align: center; }
.pv-totals { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 14px 0; }
.pv-chart { width: 100%; height: auto; display: block; }
.pv-bar { fill: var(--red); }
.pv-grid { stroke: var(--line); stroke-width: 1.5; }
.pv-axis { fill: var(--muted); font-family: var(--body); font-size: 13px; }
.pv-year { border-top: 2px solid var(--line); padding: 6px 0; }
.pv-year summary { display: flex; justify-content: space-between; cursor: pointer; font-family: var(--head); font-size: 1.1rem; padding: 6px 0; min-height: 44px; align-items: center; }
.pv-year ul { list-style: none; margin: 4px 0 0; padding: 0; }
.pv-month { display: flex; justify-content: space-between; width: 100%; min-height: 48px; background: none; border: 0; border-radius: 12px; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer; }
.pv-month:hover, .pv-month.is-sel { background: #f3ead8; }

/* printing: only the print area */
#print-area { display: none; }
@media print {
  @page { margin: 12mm; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  .print-full { width: 100%; max-height: 260mm; object-fit: contain; display: block; margin: 0 auto; }
  .cert, .letter { box-shadow: none; margin: 0 auto; max-width: none; }
  body { background: #fff; }
}
h1[tabindex="-1"]:focus { outline: none; }
@media (max-width: 600px) {
  .snow { height: 150px; }
  .top { padding: 10px 12px 4px; }
  .logo { font-size: 1.12rem; }
  #nav { width: 100%; justify-content: space-between; gap: 2px; }
  #nav a { padding: 8px 10px; font-size: .95rem; min-height: 40px; }
}
