:root{color-scheme:dark;--line:#44392c;--muted:#baaf9e;--gold:#e8be75;--paper:#f3eadb;font:14px/1.45 system-ui,sans-serif;color:var(--paper);background:#131210}
*{box-sizing:border-box}body{margin:0;height:100dvh;display:flex;flex-direction:column;background:radial-gradient(ellipse at 50% 20%,#29241c,transparent 68%)}header,main,footer{width:min(1016px,calc(100% - 48px));margin:0 auto}
header{text-align:center;padding:clamp(24px,5vh,52px) 0 20px}
header strong{font:600 clamp(30px,3.2vw,42px)/1 Georgia,serif;letter-spacing:-1.4px;color:#ecd9bc}
footer,small{color:var(--muted)}
main{display:flex;flex-direction:column;flex:1 0 auto;height:0;min-height:min-content;background:#1c1813;border:1px solid #826845;border-radius:6px;box-shadow:inset 0 0 0 2px #30271b,0 12px 36px #0005;padding:0 10px 10px}
.title{height:34px;display:grid;place-items:center;margin:0 -10px;border-block:1px solid #725a37;background:linear-gradient(#362d20,#292116)}
.title h1{margin:0;padding:2px 28px;font:22px/1.25 Georgia,serif;color:#eed29d;background:#2c2319;border-inline:1px solid #725a37}
.bar{display:flex;align-items:center;justify-content:space-between;padding:11px 2px;gap:12px}.bar label{display:flex;align-items:center;gap:10px;background:#110f0d;border:1px solid #564938;border-radius:4px;padding:7px 11px;color:var(--gold);max-width:100%;flex:1}.bar input{width:100%;background:none;border:0;color:var(--paper);font:inherit;outline:none}.bar label:focus-within,button:focus-visible{outline:2px solid var(--gold);outline-offset:-2px}#count{font-size:13px;color:var(--muted)}
.layout{display:grid;grid-template-columns:156px minmax(200px,.8fr) minmax(320px,1.3fr);gap:7px}nav,.book,#detail{border:1px solid var(--line);border-radius:3px;background:#171410;min-width:0}h2{margin:0}nav h2,.book h2{font:600 11px system-ui;text-transform:uppercase;letter-spacing:.13em;color:var(--muted);padding:16px}button{cursor:pointer;color:inherit;font:inherit}.entry{display:flex;align-items:center;gap:9px;width:100%;border:0;border-left:3px solid transparent;background:none;text-align:left;padding:5px 10px}.entry img{width:23px;height:23px;border-radius:3px;border:1px solid #66553e}.entry:hover,button.action:hover{background:#332c23}.entry[aria-pressed=true]{background:linear-gradient(90deg,#523b20,#33291d);border-left-color:#e2af5e;color:#ffe0a8}.book .entry{border-bottom:1px solid #332c23;min-height:32px}.book .entry small{display:block;font-size:11px}#list{max-height:clamp(300px,48vh,450px);overflow:auto;scrollbar-color:#6b5840 #211c17}#detail{padding:22px;background:linear-gradient(140deg,#26211c,#1d1915 70%)}.intro{display:flex;align-items:center;gap:12px}.intro h2{font:clamp(22px,2vw,27px)/1.12 Georgia,serif;color:#f2d8a9;margin:4px 0}.effect{margin:19px 0;color:var(--paper);font-size:18px}.metadata{font-size:13px;color:var(--muted)}h3{font:21px Georgia,serif;margin:25px 0 12px}.rule{border:0;border-top:1px solid var(--line);margin:20px 0}table{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:right;padding:9px 3px;border-bottom:1px solid var(--line)}td:first-child,th:first-child{text-align:left}th{font-size:11px;color:var(--muted);font-weight:500}.copy{border:0;background:none;padding:3px 0;text-align:left;color:#f3e2c7;text-decoration:underline dotted #87775d;text-underline-offset:4px}.cost{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin:18px 0 5px}.cost strong{color:var(--gold);font:22px Georgia,serif}.actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:24px}.action{background:#30281e;border:1px solid #776042;padding:8px 12px;border-radius:4px}.action.primary{background:#574127;color:#ffe3af}.empty{padding:12px;color:var(--muted)}footer{padding:15px 0;font-size:12px}#notice:not(:empty){position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#f2dcaf;color:#201a12;border-radius:4px;padding:8px 16px}
@media(max-width:800px){.layout{grid-template-columns:minmax(160px,.75fr) minmax(270px,1.25fr)}nav{grid-column:1/-1}nav h2{display:none}#slots{display:flex;overflow:auto;padding:6px}.entry{flex-shrink:0}#slots .entry{width:auto}.bar{padding:10px}#detail{padding:18px}}
@media(max-width:580px){header,main,footer{width:calc(100% - 16px)}header{padding:15px 3px}.layout{display:grid;grid-template-columns:minmax(0,1fr)}#list{max-height:164px}.book h2{padding:10px 15px}.bar{flex-wrap:wrap}.bar label{width:100%}#count{display:none}#detail{padding:18px 15px}.title h1{font-size:20px}table{font-size:13px}}

/* The frame follows the viewport; selecting a recipe only changes pane content. */
main {
  border: 3px double #97774d;
  background: #18130e;
}
.title {
  background: linear-gradient(#463621, #261d13 48%, #312418);
  box-shadow: inset 0 -2px #17110c;
}
.title h1 {
  min-width: 178px;
  text-align: center;
  border: 1px solid #8a6b43;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px #2a2015;
}
.layout {
  flex: 1 0 0;
  min-height: 390px;
  grid-template-columns: 180px minmax(200px, .85fr) minmax(320px, 1.15fr);
  grid-template-rows: minmax(0, 1fr);
}
.layout > * { min-height: 0; }
nav, #detail, #list {
  overflow: auto;
  scrollbar-color: #746047 #211b15;
}
.book { display: flex; flex-direction: column; }
#list { flex: 1; min-height: 0; max-height: none; }
.entry { font: 16px/1.25 Georgia, serif; }
.entry img { width: 26px; height: 26px; }
.entry[aria-pressed=true] {
  background: linear-gradient(90deg, #68451b, #3d2b18);
  border-left-color: #efbf62;
  box-shadow: inset 0 1px #856130, inset 0 -1px #76562c;
}
.effect { color: #edc77f; }
.portrait { position: relative; display: grid; place-items: center; flex: none; width: 60px; height: 60px; border-radius: 50%; filter: drop-shadow(0 2px 2px #0009); }
.portrait img { width: 83%; height: 83%; object-fit: cover; border-radius: 50%; }
.portrait::after { content: ""; position: absolute; inset: 0; background: url("art/silver-bezel.webp") center / contain no-repeat; pointer-events: none; }
@media (max-width: 800px) {
  .layout {
    grid-template-columns: minmax(160px, .75fr) minmax(270px, 1.25fr);
    grid-template-rows: 56px minmax(0, 1fr);
    min-height: 420px;
  }
  nav { overflow: hidden; }
}
@media (max-width: 580px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px 160px minmax(0, 1fr);
    min-height: 470px;
  }
}
#itemTip {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  width: max-content;
  max-width: min(285px, calc(100vw - 12px));
  padding: 9px 12px;
  border: 1px solid #ab9b81;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #40382f, 0 3px 12px #0009;
  background: #100f17f7;
  color: #e8e1d6;
  font: 13px/1.45 system-ui, sans-serif;
}
#itemTip div:first-child { color: #ffcf73; font: 600 16px/1.3 Georgia, serif; }
#itemTip div:nth-child(2) { color: #abd493; margin: 2px 0; }
.copy { display: inline-flex; align-items: center; gap: 8px; }
.reagent-icon { width: 28px; height: 28px; flex: none; border: 1px solid #8a7451; border-radius: 3px; }
.portrait, [data-tool] { cursor: help; }
.portrait:focus-visible, [data-tool]:focus-visible { outline: 2px solid var(--gold); }

#cartDialog {
  width: min(620px, calc(100vw - 20px));
  height: min(650px, 86dvh);
  padding: 0;
  background: #1e1914;
  color: var(--paper);
  border: 3px double #97774d;
  border-radius: 5px;
}
#cartDialog[open] { display: flex; flex-direction: column; }
#cartDialog::backdrop { background: #090705b8; }
.cart-header, .cart-export { padding: 12px 16px; background: #2b231a; }
.cart-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.cart-header h2 { font: 25px Georgia, serif; color: #efd1a0; }
#cartContents { flex: 1; overflow: auto; padding: 0 16px 12px; }
.cart-lines { padding: 0; margin: 0; list-style: none; }
.cart-lines li, .stepper { display: flex; align-items: center; gap: 8px; }
.cart-lines li { justify-content: space-between; border-bottom: 1px solid var(--line); padding: 7px 0; }
.stepper { flex: none; }
.stepper button { min-height: 30px; background: #30281e; border: 1px solid #68543a; border-radius: 3px; }
.stepper button[data-change] { width: 30px; }
.cart-export { display: grid; gap: 5px; border-top: 1px solid var(--line); }
.cart-export button:disabled { opacity: .5; cursor: default; }
.cart-export small:empty { display: none; }
@media (max-width: 580px) { .cart-lines li { flex-wrap: wrap; } }
.cart-guide {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  width: 100%; min-height: 42px; padding: 8px 10px; margin-top: 8px;
  text-align: left; background: #272017; border: 1px solid #615037; border-radius: 3px;
}
.cart-guide:hover { background: #34291b; }
#guideTitle, .cart-guide > :last-child { color: #edc77f; }
#guideDetail { color: var(--muted); font-size: 12px; }
.formula-note { border-left: 2px solid #a68146; background: #30271c; padding: 7px 10px; }
.formula-note summary { cursor: pointer; color: var(--gold); }
.formula-note p { font-size: 13px; margin: 8px 0 2px; }
@media(max-width:580px){
  .cart-guide { grid-template-columns: 1fr auto; row-gap: 2px; }
  #guideDetail { grid-column: 1; }
  .cart-guide > :last-child { grid-row: 1 / 3; grid-column: 2; }
}

.phone { display: none; }
@media (max-width: 580px) {
  header { padding: 10px 0 9px; }
  header strong { font-size: 28px; }
  main { padding-inline: 8px; }
  .title { margin-inline: -8px; }
  .bar { padding: 8px 0; gap: 7px; flex-wrap: nowrap; }
  .bar label { min-width: 0; }
  .bar input { font-size: 16px; min-width: 0; }
  .bar label, .action, .stepper button, .copy, #backRecipes { min-height: 44px; }
  .layout { min-height: 240px; grid-template-rows: auto minmax(0, 1fr); }
  .layout nav { grid-column: 1; }
  #slots, .layout #detail { display: none; }
  .phone.slot-picker { display: flex; align-items: center; gap: 12px; padding: 2px 10px; color: var(--muted); }
  .slot-picker { width: 100%; min-height: 46px; background: #262018; border: 0; text-align: left; }
  .slot-picker strong { flex: 1; color: var(--paper); font-weight: 500; }
  .book .entry { min-height: 46px; padding: 9px 12px; justify-content: space-between; }
  .book .entry img + span { flex: 1; }
  .book .entry::after { content: '›'; color: var(--gold); }
  .layout.reading { grid-template-rows: auto minmax(0,1fr) auto; }
  .reading nav, .reading .book, .reading #addCart { display: none; }
  .reading #detail, .reading #phoneAdd { display: block; }
  .reading #phoneNav { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
  #backRecipes { background: transparent; border: 0; color: var(--gold); padding: 6px 12px; }
  #phoneSlotName { font-size: 13px; padding-right: 6px; }
  #phoneAdd { font-weight: 600; }
  #detail { padding: 14px; }
  #detail .actions { margin-top: 12px; }
  .cart-lines li { display: grid; gap: 5px; }
  .stepper button[data-change] { width: 44px; }
  .cart-export { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #cartDialog { max-height: 96dvh; height: 92dvh; }
  #notice:not(:empty) { width: max-content; max-width: 90vw; pointer-events: none; bottom: 12px; }
  footer { padding-block: 7px; font-size: 11px; }
}

#slotDialog { width: min(380px, calc(100% - 24px)); max-height: 80dvh; padding: 0; overflow: hidden; color: var(--paper); background: #211b15; border: 2px solid #816742; border-radius: 6px; }
#slotDialog[open] { display: flex; flex-direction: column; }
#slotDialog::backdrop { background: #090705b8; }
#slotChoices { overflow-y: auto; }
#slotChoices button { min-height: 46px; }
#slotChoices button[aria-pressed=true]::after { content: '✓'; margin-left: auto; color: var(--gold); }

.wordmark { display: block; width: min(405px, 82%); height: auto; margin: 0 auto; }
.title h1 { display: grid; place-items: center; padding: 5px 20px; }
.title h1 img { display: block; width: 148px; height: auto; }

.coin { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.coin img { width: 13px; height: 13px; }
.effect { font-size: 16px; line-height: 1.5; }

header { position: relative; }
.tip-sign { display: flex; align-items: center; gap: 8px; width: fit-content; margin: 9px auto 0; color: #efd39a; text-align: left; }
.tip-sign b { font: 600 16px/1.15 Georgia, serif; }
.tip-sign small { display: block; font-size: 11px; }
.tip-sign small img { width: 12px; height: 12px; vertical-align: -2px; }
.toss { position: relative; display: block; width: 28px; height: 30px; }
.toss img { position: absolute; width: 18px; height: 18px; bottom: 0; left: 1px; }
.toss img + img { left: 9px; bottom: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .toss img + img { animation: coin-toss 1.7s ease-in-out 2; }
  .tip-sign:hover .toss img:first-child { animation: coin-toss 1s ease-out; }
}
@keyframes coin-toss {
  0%, 62%, 100% { transform: translateY(0) rotateY(0deg); }
  26% { transform: translateY(-11px) rotateY(200deg); }
  52% { transform: translateY(-1px) rotateY(360deg); }
}
@media (min-width: 860px) { .tip-sign { position: absolute; right: 8px; bottom: 20px; margin: 0; } }
@media (max-width: 580px) {
  .tip-sign { gap: 5px; margin-top: 4px; }
  .tip-sign b { font-size: 14px; }
  .tip-sign small { display: inline; margin-left: 5px; }
  .toss { transform: scale(.8); width: 23px; height: 24px; }
  .reading #detail .actions { display: none; }
}
