:root {
  --ink: #17181c;
  --paper: #f6f7f9;
  --surface: #ffffff;
  --muted: #70737c;
  --line: #e4e6ea;
  --accent: #ffb947;
  --accent-ink: #30200a;
  --radius: 22px;
  --shadow: 0 18px 60px rgba(23, 24, 28, .12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell { width: min(1180px, 100%); margin: 0 auto; min-height: 100dvh; padding: 0 clamp(18px, 4vw, 42px) 110px; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.18rem; font-weight: 760; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--ink); color: white; border-radius: 12px 12px 12px 4px; font-size: .95rem; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; }
.icon-button:hover { background: rgba(23,24,28,.06); }
.icon-button svg { width: 23px; height: 23px; stroke: currentColor; stroke-width: 1.8; fill: currentColor; stroke-linecap: round; }
.icon-button svg path { fill: none; }

.intro { padding: clamp(28px, 6vw, 72px) 0 34px; }
.eyebrow { margin: 0 0 10px; color: #9a640e; font-size: .72rem; font-weight: 760; letter-spacing: .17em; }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
h1 { margin: 0; font-size: clamp(2.25rem, 6vw, 4.8rem); line-height: .98; letter-spacing: -.07em; font-weight: 790; }
.intro-row p { margin: 16px 0 0; color: var(--muted); font-size: 1rem; }
.primary-button, .save-button { border: 0; background: var(--ink); color: white; min-height: 48px; padding: 0 20px; border-radius: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 10px 25px rgba(23,24,28,.14); }
.primary-button span { font-size: 1.25rem; margin-right: 5px; }

.workspace { position: relative; }
.search-box { height: 54px; max-width: 620px; display: flex; align-items: center; gap: 12px; padding: 0 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 4px 18px rgba(23,24,28,.035); }
.search-box:focus-within { border-color: #8c8f96; box-shadow: 0 0 0 4px rgba(23,24,28,.06); }
.search-box svg { width: 21px; fill: none; stroke: #777a82; stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; }
.search-box input::placeholder { color: #a0a2a8; }

.category-strip { display: flex; gap: 9px; overflow-x: auto; scrollbar-width: none; padding: 22px 0 8px; margin-right: calc(-1 * clamp(18px, 4vw, 42px)); }
.category-strip::-webkit-scrollbar { display: none; }
.category-chip { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 9px 15px; color: #62656d; font-size: .88rem; font-weight: 650; cursor: pointer; }
.category-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: white; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 16px; }
.section-title-row h2 { margin: 0; font-size: 1.1rem; letter-spacing: -.025em; }
.text-button { border: 0; background: none; color: var(--muted); font-size: .84rem; cursor: pointer; padding: 8px 0 8px 12px; }

.drink-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.drink-card { position: relative; overflow: hidden; border: 0; min-height: 290px; padding: 0; text-align: left; background: var(--surface); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(23,24,28,.045); cursor: pointer; transition: transform .22s ease, box-shadow .22s ease; }
.drink-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(23,24,28,.09); }
.card-visual { position: relative; height: 176px; display: grid; place-items: center; overflow: hidden; background: var(--card-bg, #e9ddd0); }
.card-visual img { width: 100%; height: 100%; object-fit: cover; }
.drink-emoji { font-size: 4rem; transform: translateY(2px); filter: drop-shadow(0 12px 10px rgba(23,24,28,.12)); }
.category-label { position: absolute; left: 14px; top: 14px; z-index: 2; border-radius: 999px; background: rgba(255,255,255,.83); backdrop-filter: blur(8px); padding: 6px 10px; font-size: .7rem; font-weight: 760; letter-spacing: .04em; }
.card-copy { padding: 18px 18px 20px; }
.card-copy h3 { margin: 0; font-size: 1.14rem; line-height: 1.28; letter-spacing: -.025em; }
.card-copy p { margin: 8px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: 14px; display: flex; gap: 12px; color: #8a8d94; font-size: .75rem; }

.empty-state { text-align: center; padding: 70px 20px; }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: auto; border: 1px dashed #a7a9af; border-radius: 50%; color: #898c93; font-size: 2rem; }
.empty-state h3 { margin: 20px 0 6px; }
.empty-state p { color: var(--muted); margin: 0 0 22px; }
.floating-add { position: fixed; right: max(20px, calc((100vw - 1180px)/2 + 28px)); bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 10; display: none; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 20px; background: var(--ink); color: white; font-size: 1.8rem; box-shadow: 0 12px 30px rgba(23,24,28,.3); cursor: pointer; }

dialog { border: 0; padding: 0; max-width: none; color: var(--ink); }
dialog::backdrop { background: rgba(12,13,15,.46); backdrop-filter: blur(5px); }
.sheet-dialog { width: min(680px, 100%); height: min(92dvh, 900px); margin: auto; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.sheet-card { height: 100%; display: flex; flex-direction: column; }
.sheet-header { flex: 0 0 70px; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 8px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.sheet-header h2 { margin: 0; text-align: center; font-size: 1.05rem; }
.save-button { min-height: 42px; padding: 0 16px; border-radius: 13px; box-shadow: none; }
.sheet-body { overflow-y: auto; padding: 24px 26px 40px; }
.photo-picker { display: block; width: 100%; height: 190px; margin-bottom: 24px; background: #eef0f3; border-radius: 20px; overflow: hidden; cursor: pointer; }
.photo-picker input { position: absolute; opacity: 0; pointer-events: none; }
.photo-preview { height: 100%; display: grid; place-content: center; justify-items: center; color: #777a82; background-size: cover; background-position: center; }
.photo-preview.has-photo { color: transparent; }
.photo-preview b { font-size: 1.6rem; line-height: 1; }
.photo-preview small { margin-top: 7px; font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.field { display: grid; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: .82rem; font-weight: 690; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fafbfc; color: var(--ink); outline: none; padding: 13px 14px; font-size: .95rem; line-height: 1.5; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #777a82; box-shadow: 0 0 0 3px rgba(23,24,28,.05); background: white; }
.field small { color: #989aa0; font-size: .72rem; }
.danger-button { width: 100%; margin-top: 26px; min-height: 48px; border: 1px solid #f1c6c1; border-radius: 14px; background: #fff8f7; color: #b6362b; font-weight: 700; cursor: pointer; }

.detail-dialog { width: min(720px, calc(100% - 28px)); max-height: 90dvh; margin: auto; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.detail-card { overflow-y: auto; max-height: 90dvh; }
.detail-hero { position: relative; height: min(42vw, 300px); min-height: 220px; display: grid; place-items: center; background: var(--detail-bg, #e9ddd0); overflow: hidden; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero .drink-emoji { font-size: 5.5rem; }
.detail-actions { position: absolute; left: 16px; right: 16px; top: 16px; display: flex; justify-content: space-between; }
.detail-actions .icon-button { background: rgba(255,255,255,.86); backdrop-filter: blur(8px); }
.detail-actions-right { display: flex; gap: 8px; }
.detail-copy { padding: 26px clamp(22px, 5vw, 44px) 44px; }
.detail-copy .eyebrow { color: var(--muted); margin-bottom: 8px; }
.detail-copy h2 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -.055em; }
.detail-description { margin: 10px 0 24px; color: var(--muted); line-height: 1.6; }
.detail-meta { display: flex; gap: 20px; padding: 14px 0 20px; border-bottom: 1px solid var(--line); color: #676a72; font-size: .84rem; }
.recipe-section { margin-top: 28px; }
.recipe-section h3 { margin: 0 0 14px; font-size: .93rem; }
.ingredient-list { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.ingredient-list li { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e3e4e7; font-size: .94rem; }
.ingredient-list li::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); }
.step-list { counter-reset: steps; display: grid; gap: 18px; list-style: none; padding: 0; margin: 0; }
.step-list li { counter-increment: steps; display: grid; grid-template-columns: 30px 1fr; gap: 12px; line-height: 1.62; font-size: .94rem; }
.step-list li::before { content: counter(steps); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--ink); color: white; font-size: .75rem; font-weight: 750; }
.notes-box { padding: 16px; border-radius: 15px; background: #f3f4f6; color: #5f6269; line-height: 1.6; white-space: pre-wrap; font-size: .88rem; }

.menu-dialog { width: min(500px, calc(100% - 28px)); margin: auto; border-radius: 26px; background: white; box-shadow: var(--shadow); }
.menu-card { padding: 24px; }
.menu-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 14px; }
.menu-header h2 { margin: 0; letter-spacing: -.04em; }
.menu-item { width: 100%; display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; border: 0; border-top: 1px solid var(--line); padding: 17px 4px; background: white; text-align: left; cursor: pointer; }
.menu-item-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #f0f1f3; font-size: 1.2rem; }
.menu-item b, .menu-item small { display: block; }
.menu-item b { font-size: .94rem; margin-bottom: 4px; }
.menu-item small { color: var(--muted); line-height: 1.4; font-size: .76rem; }
.file-menu { position: relative; }
.file-menu input { position: absolute; opacity: 0; pointer-events: none; }
.offline-note { display: flex; gap: 11px; align-items: start; margin-top: 6px; padding: 14px; border-radius: 15px; background: #fff7e8; }
.offline-note > span { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: #e7a12c; }
.offline-note p { margin: 0; }
.offline-note b, .offline-note small { display: block; }
.offline-note b { font-size: .82rem; }
.offline-note small { color: #7d6b4b; margin-top: 3px; font-size: .72rem; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); min-width: 180px; max-width: calc(100% - 40px); padding: 12px 17px; border-radius: 999px; background: #17181cec; color: white; text-align: center; font-size: .84rem; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .drink-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .app-shell { padding-inline: 18px; }
  .topbar { height: 66px; }
  .intro { padding: 24px 0 26px; }
  h1 { font-size: 2.6rem; }
  .desktop-add { display: none; }
  .floating-add { display: grid; }
  .search-box { max-width: none; }
  .category-strip { margin-right: -18px; }
  .drink-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .drink-card { min-height: 232px; border-radius: 18px; }
  .card-visual { height: 132px; }
  .drink-emoji { font-size: 3.15rem; }
  .category-label { left: 10px; top: 10px; font-size: .62rem; padding: 5px 8px; }
  .card-copy { padding: 14px; }
  .card-copy h3 { font-size: 1rem; }
  .card-copy p { font-size: .78rem; -webkit-line-clamp: 1; }
  .card-meta { margin-top: 10px; font-size: .68rem; }
  .sheet-dialog { width: 100%; height: 94dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .sheet-body { padding: 20px 18px calc(36px + env(safe-area-inset-bottom)); }
  .photo-picker { height: 160px; }
  .detail-dialog { width: 100%; max-height: 94dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .detail-card { max-height: 94dvh; }
  .detail-hero { height: 250px; }
  .menu-dialog { width: 100%; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .menu-card { padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .drink-grid { grid-template-columns: 1fr; }
  .drink-card { display: grid; grid-template-columns: 40% 1fr; min-height: 150px; }
  .card-visual { height: 100%; }
  .card-copy { align-self: center; }
  .card-copy p { -webkit-line-clamp: 2; }
}

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