html { min-height: 100%; background: #fff4f8; }
body { font-family: 'Quicksand', sans-serif; margin: 0; min-height: 100vh; color: #2b2b3a;
  background: radial-gradient(circle, #ffffffb0 0.18rem, transparent 0.22rem) 0 0 / 2.2rem 2.2rem fixed, linear-gradient(#ffe3ee, #fff4f8 60%, #fffdf3) fixed; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
header { position: sticky; top: 0.6rem; z-index: 10; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.8rem 1.5rem; padding: 0.6rem 1.4rem; margin-bottom: 1.2rem; background: #ffffffe6; border: 3px solid #fff; border-radius: 1.4rem; box-shadow: 0 0 0 3px #ff9fc2, 0 6px 16px #0002; }
.logo { height: 5rem; width: auto; justify-self: start; }
h1 { margin: 0; text-align: center; font-size: clamp(1.4rem, 4vw, 2.2rem); color: #ffee00; -webkit-text-stroke: 1px #1a1a9a; paint-order: stroke fill; text-shadow: 2px 2px 0 #1a1a9a; }
.tools { display: flex; align-items: center; justify-content: flex-end; gap: 0.8rem; flex-wrap: nowrap; font-weight: 700; }
.counter { display: flex; flex-direction: column; align-items: center; padding: 0.3rem 0.9rem; line-height: 1.2; background: #fff0f6; border: 2px solid #ff9fc2; border-radius: 0.9rem; color: #a3305f; }
.counter span { font-size: 0.75rem; }
.counter b { font-size: 1.2rem; }
select, .tools button, #settings button, #help button { padding: 0.45rem 0.8rem; font-weight: 700; color: #1d4e6b; background: #fff; border: 2px solid #5fb8de; border-radius: 0.8rem; cursor: pointer; }
.tools button:hover, #settings button:hover, #help button:hover { background: #e6f7ff; }
button, select, input { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
#cookbooks { padding: 1.4rem 1.2rem; background: #fffffff0; border: 3px solid #fff; border-radius: 1.4rem; box-shadow: 0 6px 16px #0002; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.2rem 1rem; align-items: start; }
.book { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: center; }
.cover { position: relative; aspect-ratio: 1.15; display: flex; align-items: center; justify-content: center; }
.cover-img { max-width: 100%; max-height: 100%; display: block; transition: transform .15s; filter: drop-shadow(0 2px 3px #0005); }
.cover-pan { position: absolute; filter: none; pointer-events: none; }
.cover-pan[hidden] { display: none; }
.cover-icon { position: absolute; left: 50%; top: 66%; width: 30%; transform: translate(-50%, -50%); transition: transform .15s; }
.book:hover .cover-img, .book:focus-visible .cover-img { transform: scale(1.05); }
.book:hover .cover-icon, .book:focus-visible .cover-icon { transform: translate(-50%, -50%) scale(1.05); }
.book-name { display: block; margin-top: 0.4rem; font-weight: bold; }
.book small { display: block; color: #7a1f1f; font-size: 0.75em; }
dialog { container-type: inline-size; width: min(1200px, 96vw, 100vh); max-height: 96vh; border: 0; border-radius: 16px; padding: 0; background: #5fd4f2 url(../img/ui/bg-tile.jpg) left bottom / auto 100% repeat-x; box-shadow: 0 8px 30px #0006; overflow: auto; }
dialog::backdrop { background: #0008; }
.modal-inner { padding: 1.5cqw 2cqw 2cqw; }
#close { position: absolute; top: 1cqw; left: 1cqw; z-index: 3; width: 6cqw; height: 6cqw; min-width: 2.6rem; min-height: 2.6rem; padding: 0; border: 0; font-size: 0; background: url(../img/ui/close.png) center / contain no-repeat; cursor: pointer; transition: transform .1s; }
#close:hover { transform: scale(1.08); }
h2 { margin: 0 auto 1cqw; width: 70%; box-sizing: border-box; padding: 0.2cqw 1cqw; text-align: center; font-size: 3.2cqw; color: #ffee00; -webkit-text-stroke: 1px #1a1a9a; paint-order: stroke fill; text-shadow: 2px 2px 0 #1a1a9a;
  border: 2.7cqw solid transparent; border-image: url(../img/ui/title.png) 72 fill / 2.7cqw round; filter: drop-shadow(0 2px 3px #0004); }
h2 small { display: block; font-size: 0.45em; color: #7a1f1f; -webkit-text-stroke: 0; text-shadow: none; }
.open-book { --u: 1cqw; container-type: inline-size; position: relative; padding: 3cqw 2cqw 3.5cqw; border: 0.6cqw solid #fff; border-radius: 2.4cqw; box-shadow: 0 0 0 0.4cqw #5fb8de, 0 4px 8px #0003;
  background: radial-gradient(circle, #ffffff66 0.25cqw, transparent 0.3cqw) 0 0 / 2.4cqw 2.4cqw, linear-gradient(#d6f8d4, #bdeec3); }
.page { display: grid; grid-template-columns: 1fr 1fr; gap: calc(3.5 * var(--u)) calc(2 * var(--u)); grid-auto-flow: column; grid-template-rows: 1fr 1fr; }
.recipe { width: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: calc(3.4 * var(--u)) calc(1.6 * var(--u)) calc(1.6 * var(--u)); background: #ffffffb3; border: calc(0.3 * var(--u)) solid #fff; border-radius: calc(2 * var(--u)); box-shadow: 0 calc(0.3 * var(--u)) calc(1 * var(--u)) #2f7a4a40; }
.photo-card { position: relative; width: calc(30 * var(--u)); background: #fff; padding: calc(1.2 * var(--u)); box-shadow: 0 1px 4px #0005; }
.photo.blur { filter: blur(calc(1.2 * var(--u))); clip-path: inset(0); }
.photo { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.tape { position: absolute; width: calc(5 * var(--u)); left: calc(-2 * var(--u)); bottom: calc(-1.7 * var(--u)); transform: rotate(180deg); }
.star { position: absolute; left: calc(-2.4 * var(--u)); top: calc(-3 * var(--u)); width: calc(6.4 * var(--u)); height: calc(6.4 * var(--u)); padding: 0; border: 0; background: center / contain no-repeat; cursor: pointer; transition: transform .1s; z-index: 2; }
.star:hover { transform: scale(1.12); }
.alt-mark { position: absolute; right: calc(-2.4 * var(--u)); top: calc(-2.6 * var(--u)); width: calc(5.6 * var(--u)); height: calc(5.6 * var(--u)); padding: 0; border: 0; background: url(../img/ui/exclamation.png) center / contain no-repeat; cursor: pointer; z-index: 2; filter: drop-shadow(0 1px 2px #0006); transition: transform .1s; }
.alt-mark:hover { transform: scale(1.1); }
.alt-mark[aria-pressed="true"] { filter: drop-shadow(0 0 3px #ffd400) drop-shadow(0 1px 2px #0006); transform: scale(1.1); }
.ribbon { align-self: stretch; margin: calc(-0.6 * var(--u)) 0 0; padding: 0 calc(3 * var(--u)); height: calc(4.6 * var(--u)); line-height: calc(4.6 * var(--u)); background-repeat: no-repeat, no-repeat, round no-repeat; background-size: auto 100%; background-position: left, right, left; background-origin: padding-box, padding-box, content-box; background-clip: padding-box, padding-box, content-box; font-weight: 700; font-size: calc(2.5 * var(--u)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffee00; -webkit-text-stroke: calc(0.3 * var(--u)) #1a1a9a; paint-order: stroke fill; z-index: 1; }
.ribbon { text-align: center; }
.ingredients { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 calc(0.2 * var(--u)); margin-top: calc(0.4 * var(--u)); }
.chip { display: flex; flex-direction: column; align-items: center; width: calc(8.4 * var(--u)); text-align: center; font-size: calc(1.5 * var(--u)); font-weight: 600; line-height: 1.1; color: #333; }
.chip > span { display: block; width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.ing-icon { width: calc(8.4 * var(--u)); height: calc(8.4 * var(--u)); object-fit: contain; }

#settings, #help { width: min(26rem, 92vw); padding: 1.2rem 1.4rem; border: 3px solid #fff; border-radius: 1.2rem; background: #f1fbff; box-shadow: 0 0 0 3px #5fb8de, 0 8px 30px #0006; color: #2b2b3a; }
#settings::backdrop, #help::backdrop { background: #0008; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1rem; font-weight: 700; }
#settings h3, #settings h4, #help h3 { margin: 0 0 0.6rem; }
#settings h4 { margin-top: 1.2rem; }
.opt { display: flex; gap: 0.7rem; align-items: flex-start; font-weight: 700; cursor: pointer; }
.opt input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; }
.opt small { font-weight: 500; color: #555; }
#settings .row, #help .row { display: flex; gap: 0.6rem; }
#settings .end, #help .end { justify-content: flex-end; margin-top: 0.8rem; }
#status { min-height: 1.3em; margin: 0.6rem 0 0; font-size: 0.9rem; color: #1d6b3a; }

/* Animations */
dialog, dialog::backdrop { transition: opacity .25s ease, transform .25s cubic-bezier(.2, .9, .3, 1.2), overlay .25s allow-discrete, display .25s allow-discrete; }
dialog:not([open]), dialog:not([open])::backdrop { opacity: 0; }
dialog:not([open]) { transform: translateY(1.5rem) scale(.92); }
dialog[open] { opacity: 1; transform: none; }
dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog[open], dialog[open]::backdrop { opacity: 0; } dialog[open] { transform: translateY(1.5rem) scale(.92); } }
.book { transition: transform .15s ease; animation: pop .45s backwards; animation-delay: calc(var(--i, 0) * 25ms); }
.book:hover { transform: translateY(-4px); }
.book:active { transform: scale(.95); }
.recipe { animation: pop .4s backwards; }
.recipe:nth-child(2) { animation-delay: .05s; } .recipe:nth-child(3) { animation-delay: .1s; } .recipe:nth-child(4) { animation-delay: .15s; }
header { animation: drop .5s cubic-bezier(.2, .9, .3, 1.2) backwards; }
select, .tools button, #settings button, .counter { transition: transform .12s ease, background-color .15s, box-shadow .15s; }
.tools button:hover, #settings button:hover, select:hover { transform: translateY(-1px); box-shadow: 0 3px 6px #0002; }
.tools button:active, #settings button:active { transform: scale(.94); }
.counter b { display: inline-block; }
.counter.bump b { animation: bump .35s ease; }
.photo { transition: filter .35s ease; }
.star:active, .alt-mark:active { transform: scale(.85); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.94); } }
@keyframes drop { from { opacity: 0; transform: translateY(-1.5rem); } }
@keyframes bump { 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 700px) {
  #cookbooks { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 1rem 0.7rem; gap: 1rem 0.6rem; }
  header { grid-template-columns: 1fr; justify-items: center; padding: 0.8rem; }
  .logo { justify-self: center; height: 4rem; }
  .tools { justify-content: center; flex-wrap: wrap; }
  #modal { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; }
  .modal-inner { padding: 3.5rem 0.6rem 1rem; }
  #close { top: 0.5rem; left: 0.5rem; width: 2.8rem; height: 2.8rem; }
  h2 { width: 100%; margin-bottom: 0.6rem; font-size: 1.15rem; border-width: 14px; border-image-width: 14px; }
  .open-book { --u: 2.6cqw; padding: 4cqw 2cqw 5cqw; border-width: 4px; border-radius: 18px; box-shadow: 0 0 0 3px #5fb8de; }
  .page { display: flex; flex-direction: column; gap: 7cqw; }
  .recipe { padding: 4cqw 3cqw 3cqw; }
  .photo-card { width: 72cqw; }
  .chip { width: 19cqw; font-size: 3.4cqw; }
  .ing-icon { width: 19cqw; height: 19cqw; }
}

footer { max-width: 900px; margin: 0 auto; padding: 0 1rem 2rem; text-align: center; font-size: .8rem; color: #6b5b6e; }
footer p { margin: .25rem 0; }
footer a { color: inherit; font-weight: 700; }

/* Changelog page */
.cl { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .6rem 1.4rem; margin-bottom: 1.6rem; background: #ffffffe6; border: 3px solid #fff; border-radius: 1.4rem; box-shadow: 0 6px 16px #0002; }
.cl-head .logo { height: 4rem; }
.cl-head h1 { flex: 1; min-width: 10rem; }
.back { display: inline-block; padding: .45rem .9rem; font-weight: 700; text-decoration: none; color: #1d4e6b; background: #fff; border: 2px solid #5fb8de; border-radius: .8rem; transition: background .2s, transform .15s; }
.back:hover { background: #e6f7ff; transform: translateY(-2px); }
.timeline { position: relative; margin: 0; padding: 0 0 0 1.8rem; list-style: none; }
.timeline::before { content: ''; position: absolute; left: .55rem; top: .6rem; bottom: .6rem; width: 4px; border-radius: 2px; background: repeating-linear-gradient(#ff9fc2 0 8px, transparent 8px 14px); }
.release { position: relative; margin-bottom: 1.4rem; padding: 1.1rem 1.3rem; background: #ffffffee; border: 3px solid #fff; border-radius: 1.2rem; box-shadow: 0 4px 12px #0002; animation: pop .4s both; }
.release::before { content: ''; position: absolute; left: -1.75rem; top: 1.5rem; width: 1rem; height: 1rem; background: #ffee00; border: 3px solid #ff6fa3; border-radius: 50%; }
.release header { position: static; display: flex; align-items: center; gap: .7rem; padding: 0; margin: 0 0 .6rem; background: none; border: 0; box-shadow: none; animation: none; }
.release h2 { all: unset; font-size: 1.5rem; font-weight: 700; color: #a3305f; }
.badge { padding: .1rem .6rem; font-size: .75rem; font-weight: 700; color: #fff; background: #ff6fa3; border-radius: 1rem; }
.release time { margin-left: auto; font-size: .85rem; font-weight: 600; color: #6b5b6e; }
.release ul { margin: 0; padding-left: 1.2rem; line-height: 1.6; list-style: disc; }
.release li::marker { color: #ff6fa3; }
@media (max-width: 700px) { .cl-head { justify-content: center; text-align: center; } .release time { margin-left: 0; width: 100%; } }

/* How to use dialog */
#help { width: min(34rem, 94vw); max-height: 92vh; overflow-y: auto; }
#help h3 { font-size: 1.4rem; text-align: center; color: #a3305f; }
.step { position: relative; margin: 0 0 1rem; padding: 1rem 1rem .8rem 3.2rem; background: #fff; border: 2px solid #cfeaf6; border-radius: 1rem; }
.step .num { position: absolute; left: .8rem; top: .9rem; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; font-weight: 700; color: #fff; background: #ff6fa3; border-radius: 50%; box-shadow: 0 2px 0 #c94a7c; }
.step h4 { margin: 0 0 .3rem; font-size: 1.1rem; color: #1d4e6b; }
.step p { margin: 0 0 .6rem; line-height: 1.5; }
.step .art { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .6rem; margin: 0 0 .7rem; padding: .6rem; background: #fff4f8 radial-gradient(circle, #fff 0.12rem, transparent .16rem) 0 0 / 1rem 1rem; border-radius: .8rem; }
.step .art img { height: 4.2rem; width: auto; filter: drop-shadow(0 2px 3px #0004); }
.step .art img.s { height: 3rem; }
.arrow { font-size: 1.4rem; color: #ff6fa3; font-weight: 700; }
.file { font-size: 2.2rem; }
.fake-btn { padding: .4rem .9rem; font-weight: 700; color: #1d4e6b; background: #fff; border: 2px solid #5fb8de; border-radius: .8rem; }
.mini-counter { padding: .3rem .8rem; font-weight: 600; color: #a3305f; background: #fff0f6; border: 2px solid #ff9fc2; border-radius: .9rem; }
@media (max-width: 700px) { #help-btn { order: -1; } .step { padding-left: 2.8rem; } }
.tools button { white-space: nowrap; }
.tools { gap: .5rem; }
.tools .icon-btn { width: 3rem; height: 3rem; padding: 0; font-size: 1.8rem; line-height: 1; display: grid; place-items: center; }
