@font-face {
  font-family: "Baloo 2";
  src: url("fonts/baloo-2-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --night: #1d2756;
  --night-2: #2c3b7a;
  --gold: #ffc94a;
  --gold-deep: #f2a91c;
  --coral: #ff7a6b;
  --mint: #4fbf9f;
  --lilac: #b69cff;
  --cream: #fff8ec;
  --ink: #1f2547;
  --muted: #5d6385;
  --line: #ece6fb;
  --wood: #cf9561;
  --wood-dark: #93602f;
  --round: "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.icon { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon--star { fill: var(--gold); stroke: var(--gold-deep); stroke-width: 1.5; }

/* Demo bar */
.demo-bar { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 14px; padding: 2px 14px; background: #141b42; color: var(--cream); font-size: 14px; }
.demo-bar__note { margin: 0; display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.demo-bar__note strong { padding: 0 10px; border-radius: 999px; background: var(--gold); color: var(--ink); font-family: var(--round); font-weight: 800; }
.demo-bar__actions { display: flex; gap: 4px; margin-left: auto; }
.demo-bar__reset, .demo-bar__made { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--cream); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.demo-bar__made { color: var(--gold); }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 30px 20px 70px; color: #fff; background: radial-gradient(120% 90% at 20% 0%, var(--night-2) 0%, var(--night) 60%, #141b42 100%); }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; fill: #fff; }
.moon { position: absolute; top: 22px; right: 22px; width: 74px; height: 74px; fill: var(--gold); filter: drop-shadow(0 0 18px rgb(255 201 74 / 0.6)); }
.hero__inner { position: relative; max-width: 1120px; margin: 0 auto; }
.hero__kicker { margin: 0; font-family: var(--round); font-weight: 700; color: var(--gold); font-size: 18px; }
.hero h1 { margin: 0; font-family: var(--round); font-weight: 800; font-size: clamp(52px, 14vw, 104px); line-height: 0.95; letter-spacing: -0.01em; }
.hero__stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; }
.hero__stats li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgb(255 255 255 / 0.12); font-size: 15px; }
.hero__stats strong { font-family: var(--round); font-size: 20px; line-height: 1; }
.hero__stats .icon { color: var(--gold); }

.shell { position: relative; max-width: 1120px; margin: -48px auto 0; padding: 0 14px 48px; }
.layout { display: grid; gap: 16px; }
.col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.card { min-width: 0; padding: 18px; border-radius: 28px; background: #fff; box-shadow: 0 5px 0 var(--line), 0 26px 40px -34px rgb(29 39 86 / 0.6); }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 12px; }
.card__head h2 { margin: 0; font-family: var(--round); font-weight: 800; font-size: 26px; line-height: 1.1; }
.card__head p { margin: 0; color: var(--muted); font-size: 15px; }
.label { margin: 0; font-family: var(--round); font-weight: 800; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--coral); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; font-family: var(--round); font-weight: 800; font-size: 18px; box-shadow: 0 4px 0 var(--ink); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn--sun { background: var(--gold); }
.btn--small { min-height: 44px; padding: 0 14px; font-size: 15px; box-shadow: 0 3px 0 var(--ink); }

/* Book covers */
.cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 104px;
  height: 148px;
  flex: none;
  padding: 12px 10px 10px 16px;
  border-radius: 6px 12px 12px 6px;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.18) 0 6px, transparent 6px), linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  color: #fff;
  box-shadow: 4px 6px 0 rgb(29 39 86 / 0.18);
  overflow: hidden;
}
.cover--big { width: 128px; height: 182px; }
.cover__title { font-family: var(--round); font-weight: 800; font-size: 17px; line-height: 1.05; }
.cover--big .cover__title { font-size: 20px; }
.cover__author { font-size: 11px; font-weight: 700; opacity: 0.9; }
.cover__stars { position: absolute; right: -10px; bottom: 26px; width: 60px; height: 60px; fill: rgb(255 255 255 / 0.18); }

/* Reading now */
.now { display: flex; gap: 18px; align-items: center; }
.now__text { min-width: 0; flex: 1; }
.now h2 { margin: 2px 0 0; font-family: var(--round); font-weight: 800; font-size: 28px; line-height: 1.05; }
.now__author { margin: 2px 0 10px; color: var(--muted); }
.now__progress { height: 16px; border: 3px solid var(--ink); border-radius: 999px; background: #f4f1ff; overflow: hidden; }
.now__progress span { display: block; height: 100%; background: var(--mint); }
.now__pages { margin: 6px 0 12px; font-size: 15px; color: var(--muted); }
.now__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Chart */
.chart { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; height: 170px; padding-top: 18px; }
.chart__goal { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--lilac); pointer-events: none; }
.chart__goal span { position: absolute; right: 0; top: -22px; font-size: 12px; font-weight: 700; color: #7b62e6; }
.chart__col { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 6px; min-height: 0; }
.chart__bar { position: relative; align-self: end; width: 100%; max-width: 36px; min-height: 4px; border-radius: 10px 10px 4px 4px; background: var(--coral); }
.chart__bar small { position: absolute; left: 50%; top: -20px; transform: translateX(-50%); font-weight: 700; font-size: 12px; color: var(--muted); }
.chart__col--today .chart__bar { background: var(--gold); }
.chart__col--later .chart__bar { background: #eee9fb; }
.chart__day { font-family: var(--round); font-weight: 800; color: var(--muted); }
.chart__col--today .chart__day { color: var(--ink); }

/* Badges */
.badges__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: 20px; background: #f7f5ff; text-align: center; }
.badge strong { font-family: var(--round); font-weight: 800; line-height: 1.1; font-size: 15px; }
.badge small { font-size: 12px; line-height: 1.25; color: var(--muted); }
.badge__medal { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 4px; border: 3px dashed #c9c1ea; border-radius: 50%; color: #a69ccc; }
.badge--got { background: #fff6dd; }
.badge--got .badge__medal { border: 3px solid var(--ink); background: radial-gradient(circle at 35% 30%, #ffe08a, var(--gold)); color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.badge--got small { color: #9a6b00; font-weight: 700; }

/* Shelf */
.shelf__rows { display: grid; gap: 4px; }
.shelf__row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-height: 168px;
  padding: 0 10px;
  border-bottom: 16px solid var(--wood);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 6px 0 var(--wood-dark);
  background: linear-gradient(#f7f1e6, #efe4d1);
}
.spine {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: calc(150px * var(--h));
  padding: 6px 0;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.12), transparent 30%, rgb(255 255 255 / 0.18) 50%, transparent 70%), var(--c);
  color: #fff;
  overflow: hidden;
  transition: transform 0.15s ease;
}
.spine::before, .spine::after { content: ""; position: absolute; left: 0; right: 0; height: 4px; background: rgb(255 255 255 / 0.45); }
.spine::before { top: 12px; }
.spine::after { bottom: 12px; }
.spine:hover { transform: translateY(-6px); }
.spine span { writing-mode: vertical-rl; transform: rotate(180deg); max-height: calc(150px * var(--h) - 34px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--round); font-weight: 800; font-size: 12px; text-shadow: 0 1px 1px rgb(0 0 0 / 0.25); }

/* Pile */
.pile__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pile__list li { display: flex; align-items: center; gap: 12px; }
.pile__book { width: 54px; height: 22px; flex: none; border-radius: 4px; background: var(--c); box-shadow: inset 0 -5px 0 rgb(0 0 0 / 0.12), 2px 2px 0 rgb(29 39 86 / 0.15); }
.pile__text { display: grid; min-width: 0; }
.pile__text strong { font-family: var(--round); font-weight: 800; font-size: 18px; line-height: 1.15; }
.pile__text small { color: var(--muted); }

/* Make your own */
.own { margin-top: 30px; padding: 22px; border: 3px dashed #c9c1ea; border-radius: 28px; background: #fff; }
.own__label { margin: 0; font-family: var(--round); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--coral); }
.own__words { margin: 8px 0; font-family: var(--round); font-weight: 700; font-size: 22px; line-height: 1.3; }
.own__note { margin: 0; font-size: 14px; color: var(--muted); }

/* Dialog */
.dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 3px solid var(--ink); border-radius: 28px; background: #fff; color: var(--ink); box-shadow: 0 6px 0 var(--ink); }
.dialog::backdrop { background: rgb(20 27 66 / 0.6); }
.dialog__body { padding: 20px 20px 22px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dialog__title { margin: 0; font-family: var(--round); font-weight: 800; font-size: 26px; line-height: 1.1; }
.dialog__close { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 2px solid var(--line); border-radius: 50%; background: #fff; }
.dialog__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field__label { padding: 0; font-family: var(--round); font-weight: 800; font-size: 17px; }
.field input, .field textarea { width: 100%; min-height: 50px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; font-size: 17px; }
.field textarea { resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input, .rate__star input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; font-family: var(--round); font-weight: 800; }
.chip input:checked + span { background: var(--mint); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 2px; }
.rate { display: flex; gap: 6px; }
.rate__star { position: relative; display: grid; place-items: center; width: 52px; height: 52px; }
.rate__star input { z-index: 1; }
.rate__star svg { width: 46px; height: 46px; fill: #eee9fb; stroke: #c9c1ea; stroke-width: 1.5; stroke-linejoin: round; pointer-events: none; transition: transform 0.15s ease; }
.rate__star--on svg { fill: var(--gold); stroke: var(--gold-deep); }
.rate__star:hover svg { transform: scale(1.1); }
.form__problem { margin: 0; padding: 10px 14px; border-radius: 14px; background: #ffe6e2; color: #b13a2c; font-weight: 700; }
.form__actions { display: flex; justify-content: flex-end; }
.book { display: flex; gap: 16px; align-items: flex-start; }
.book__author { margin: 0; color: var(--muted); }
.book__rating { display: flex; gap: 2px; margin: 6px 0; }
.book__rating svg { width: 24px; height: 24px; fill: #eee9fb; stroke: #c9c1ea; stroke-width: 1.5; }
.book__rating svg.on { fill: var(--gold); stroke: var(--gold-deep); }
.book__best { margin: 6px 0; }
.book__date { margin: 0; font-size: 14px; color: var(--muted); }

.toast-region { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 20; display: grid; justify-items: center; pointer-events: none; }
.toast { margin: 0 16px; padding: 12px 18px; border: 3px solid var(--ink); border-radius: 18px; background: var(--gold); color: var(--ink); font-family: var(--round); font-weight: 800; font-size: 18px; box-shadow: 0 4px 0 var(--ink); animation: toast-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes toast-in { from { transform: translateY(16px) scale(0.9); opacity: 0; } }

@media (max-width: 520px) {
  .now { align-items: flex-start; gap: 14px; }
  .now .cover--big { width: 92px; height: 132px; padding: 10px 8px 8px 14px; }
  .now .cover--big .cover__title { font-size: 15px; }
  .now h2 { font-size: 24px; }
  .now__actions .btn { width: 100%; }
}

@media (min-width: 900px) {
  .hero { padding: 46px 32px 96px; }
  .moon { top: 34px; right: max(32px, calc(50% - 540px)); width: 110px; height: 110px; }
  .shell { margin-top: -64px; padding: 0 28px 64px; }
  .layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
