:root {
  --ink: #17221f;
  --muted: #74807c;
  --line: #e2e8e3;
  --paper: #f5f7f3;
  --card: #ffffff;
  --green: #1d5445;
  --green-deep: #12392f;
  --green-soft: #e7f1eb;
  --tomato: #dc6a4e;
  --yellow: #efc961;
  --shadow: 0 16px 50px rgba(22, 53, 43, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(220, 106, 78, .32); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 76px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: inline-flex; gap: 3px; align-items: end; height: 24px; }
.brand-mark span { display: block; width: 5px; border-radius: 5px; background: var(--tomato); }
.brand-mark span:nth-child(1) { height: 13px; }.brand-mark span:nth-child(2) { height: 20px; background: var(--green); }.brand-mark span:nth-child(3) { height: 16px; background: var(--yellow); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-button, .avatar, .close-button { border: 0; background: transparent; color: var(--muted); }
.icon-button { width: 40px; height: 40px; border-radius: 50%; font-size: 21px; transform: rotate(-45deg); transition: .2s ease; }
.icon-button:hover { color: var(--green); background: var(--green-soft); transform: rotate(-45deg) translateY(-2px); }
.avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; background: var(--green); font-weight: 700; font-size: 14px; }

.main-content { max-width: 1360px; margin: 0 auto; padding: 46px 42px 80px; }
.intro-row { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 42px; }
.eyebrow { margin: 0 0 10px; color: var(--tomato); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; letter-spacing: .13em; font-weight: 500; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 14px; font-size: clamp(2rem, 4.5vw, 4.2rem); line-height: 1.1; letter-spacing: -.07em; font-weight: 800; }
h1 em { color: var(--green); font-style: normal; }
.intro-copy { margin: 0; color: var(--muted); font-size: 16px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; padding: 12px 18px; min-height: 46px; font-weight: 700; font-size: 14px; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.primary-button { border: 1px solid var(--green); color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(29, 84, 69, .16); }
.primary-button:hover { background: var(--green-deep); transform: translateY(-2px); box-shadow: 0 12px 24px rgba(29, 84, 69, .2); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.secondary-button:hover { border-color: var(--green); color: var(--green); }
.intro-add { flex: 0 0 auto; }
.intro-add span { font-size: 20px; font-weight: 400; line-height: 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 40px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 28px rgba(22, 53, 43, .04); }
.search-box { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 0 12px; color: var(--muted); }
.search-box > span { font-size: 26px; line-height: 1; transform: rotate(-20deg); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 15px; }
.search-box input::placeholder { color: #98a39e; }
kbd { padding: 3px 7px; border: 1px solid var(--line); border-radius: 5px; color: #9aa39e; background: var(--paper); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; white-space: nowrap; }
.filter-row { display: flex; gap: 5px; }
.filter-button { border: 0; padding: 9px 12px; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; white-space: nowrap; }
.filter-button span { color: #a9b0ac; font-family: 'DM Mono', monospace; font-size: 11px; }
.filter-button:hover, .filter-button.is-active { color: var(--green); background: var(--green-soft); font-weight: 700; }
.filter-button.is-active span { color: var(--green); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 32px; align-items: start; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; letter-spacing: -.06em; font-size: 26px; }
.section-heading h2 span { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 14px; letter-spacing: 0; vertical-align: middle; }
.text-button { border: 0; padding: 8px 0; color: var(--green); background: transparent; font-weight: 700; font-size: 13px; }
.text-button:hover { color: var(--tomato); }
.text-button span { margin-left: 4px; }
.recipe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.recipe-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 18px rgba(22, 53, 43, .035); transition: transform .2s ease, box-shadow .2s ease; }
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.recipe-cover { position: relative; height: 200px; overflow: hidden; background: #e6eee8; }
.recipe-cover img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .5s ease; }
.recipe-card:hover .recipe-cover img { transform: scale(1.035); }
.cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 56px; background: linear-gradient(135deg, #ebefe9, #f8d5c5); }
.favorite-button { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; color: #fff; background: rgba(26, 48, 41, .28); backdrop-filter: blur(5px); font-size: 17px; }
.favorite-button.is-favorite { color: #f7d370; background: rgba(26, 48, 41, .72); }
.recipe-body { padding: 18px 18px 16px; }
.recipe-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.recipe-tag { display: inline-flex; padding: 3px 8px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-weight: 700; }
.recipe-time { font-family: "SFMono-Regular", Consolas, monospace; }
.recipe-card h3 { overflow: hidden; margin: 0 0 7px; font-size: 20px; line-height: 1.3; letter-spacing: -.05em; text-overflow: ellipsis; white-space: nowrap; }
.recipe-description { display: -webkit-box; overflow: hidden; min-height: 48px; margin: 0 0 15px; color: var(--muted); font-size: 13px; line-height: 1.85; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.recipe-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px solid #edf0ed; }
.stars { color: var(--yellow); font-size: 13px; letter-spacing: -2px; }
.notes-badge { color: var(--tomato); font-size: 12px; font-weight: 700; }
.notes-badge::before { content: '•'; margin-right: 4px; }
.empty-state { padding: 72px 20px; border: 1px dashed #cbd7d0; border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-icon { margin: 0 auto 8px; color: var(--green); font-size: 40px; transform: rotate(-20deg); }
.empty-state h3 { margin-bottom: 6px; color: var(--ink); font-size: 18px; }
.empty-state p { margin-bottom: 18px; font-size: 14px; }

.side-column { display: grid; gap: 18px; }
.side-card { padding: 22px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.prep-card { color: #fff; background: var(--green); border-color: var(--green); }
.side-card-heading { display: flex; justify-content: space-between; gap: 16px; }
.side-card .eyebrow { color: var(--yellow); }
.side-card h3 { margin: 0 0 18px; color: inherit; font-size: 17px; letter-spacing: -.04em; }
.pulse-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 5px rgba(239, 201, 97, .12); }
.rhythm-stat { display: flex; gap: 10px; align-items: center; margin: 6px 0 22px; }
.rhythm-stat strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 42px; line-height: 1; font-weight: 400; }
.rhythm-stat span { color: #b9d0c5; font-size: 12px; line-height: 1.45; }
.rhythm-bars { display: flex; align-items: end; gap: 8px; height: 100px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.15); }
.rhythm-bars > span { position: relative; flex: 1; height: var(--height); min-height: 18px; border-radius: 5px 5px 2px 2px; background: #4e796a; }
.rhythm-bars > span.is-today { background: var(--yellow); }
.rhythm-bars small { position: absolute; top: calc(100% + 8px); left: 50%; color: #a7c3b7; font-size: 10px; transform: translateX(-50%); }
.rhythm-bars .is-today small { color: var(--yellow); font-weight: 700; }
.muted-note { margin: 18px 0 0; color: #b9d0c5; font-size: 12px; line-height: 1.7; }
.template-card { position: relative; overflow: hidden; }
.template-card::after { content: ''; position: absolute; right: -30px; bottom: -45px; width: 130px; height: 130px; border: 1px solid #e1ece3; border-radius: 50%; box-shadow: 0 0 0 18px #f8fbf7, 0 0 0 19px #e1ece3; }
.template-symbol { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 20px; border-radius: 10px; color: var(--tomato); background: #fff0e9; }
.template-card h3 { max-width: 190px; margin-bottom: 10px; color: var(--ink); font-size: 18px; }
.template-card > p:not(.eyebrow) { max-width: 215px; margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.full-button { position: relative; z-index: 1; width: 100%; }

.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(16, 33, 27, .42); backdrop-filter: blur(6px); }
.modal-backdrop[hidden] { display: none !important; }
.modal { width: min(100%, 680px); max-height: min(88vh, 780px); overflow: auto; padding: 26px; border: 1px solid rgba(255,255,255,.5); border-radius: 22px; background: var(--paper); box-shadow: 0 30px 100px rgba(12, 33, 25, .25); animation: modal-in .24s ease both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 20px; }
.modal-header h2 { margin: 0; font-size: 26px; letter-spacing: -.06em; }
.close-button { width: 34px; height: 34px; font-size: 26px; line-height: 1; }
.close-button:hover { color: var(--tomato); }
.import-hint { display: flex; gap: 9px; align-items: start; margin-bottom: 20px; padding: 12px 14px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 13px; line-height: 1.6; }
.import-hint > span:first-child { color: var(--tomato); }
.field-label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.recipe-textarea { width: 100%; min-height: 330px; resize: vertical; padding: 16px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: #fff; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; line-height: 1.75; }
.recipe-textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29, 84, 69, .1); }
.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; }
.action-group { display: flex; gap: 9px; }
.modal-lead { margin: -4px 0 18px; color: var(--muted); font-size: 14px; }
.template-preview { overflow: auto; max-height: 440px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; color: #385148; background: #fff; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.copy-status { color: var(--green); font-size: 12px; }

.detail-modal { width: min(100%, 820px); padding: 0; background: #fff; }
.detail-hero { position: relative; height: 260px; overflow: hidden; background: #e4eee7; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(12, 31, 25, .7), transparent 60%); }
.detail-close { position: absolute; z-index: 2; top: 16px; right: 16px; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; color: #fff; background: rgba(12, 31, 25, .3); font-size: 23px; }
.detail-hero-copy { position: absolute; z-index: 1; right: 24px; bottom: 22px; left: 24px; color: #fff; }
.detail-hero-copy .eyebrow { color: var(--yellow); }
.detail-hero-copy h2 { margin: 0; font-size: 31px; letter-spacing: -.07em; line-height: 1.2; }
.detail-main { padding: 25px 28px 30px; }
.detail-info-row { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 24px; }
.info-chip { padding: 7px 11px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 700; }
.detail-columns { display: grid; grid-template-columns: 1fr 1.3fr; gap: 30px; }
.detail-section + .detail-section { margin-top: 26px; }
.detail-section h3 { padding-bottom: 10px; margin-bottom: 13px; border-bottom: 1px solid var(--line); font-size: 17px; letter-spacing: -.04em; }
.ingredient-group { margin: 0 0 17px; }
.ingredient-group h4 { margin: 0 0 6px; color: var(--green); font-size: 13px; }
.ingredient-list, .step-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { position: relative; padding: 7px 0 7px 18px; border-bottom: 1px solid #eff2ef; color: #4d5a55; font-size: 13px; }
.ingredient-list li::before { content: '·'; position: absolute; left: 3px; color: var(--tomato); font-size: 18px; line-height: 1.1; }
.step-list { counter-reset: step; }
.step-list li { position: relative; padding: 0 0 19px 38px; color: #4d5a55; font-size: 14px; }
.step-list li::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; top: 0; left: 0; color: var(--tomato); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 500; }
.step-list li + li::after { content: ''; position: absolute; top: 21px; bottom: 0; left: 4px; width: 1px; background: #e9efeb; }
.tip-box { padding: 14px; border-radius: 10px; color: #596b63; background: #fff7d9; font-size: 13px; line-height: 1.7; }
.notes-box { margin-top: 20px; padding: 16px; border-radius: 12px; background: var(--paper); }
.notes-box label { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--green); font-size: 13px; font-weight: 700; }
.notes-box label span { color: var(--muted); font-weight: 400; }
.notes-textarea { width: 100%; min-height: 92px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: #fff; color: var(--ink); font-size: 13px; line-height: 1.6; }
.notes-textarea:focus { border-color: var(--green); }
.detail-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 19px; }
.delete-button { border: 0; color: #b37467; background: transparent; font-size: 12px; }
.delete-button:hover { color: #b43f2e; }

.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(360px, calc(100vw - 44px)); padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--green-deep); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .25s ease; font-size: 13px; }
.toast.is-visible { opacity: 1; transform: none; }
.mobile-nav { display: none; }

@media (max-width: 960px) {
  .topbar { padding: 0 24px; }
  .main-content { padding: 38px 24px 64px; }
  .content-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  body { padding-bottom: 70px; }
  .topbar { height: 65px; padding: 0 18px; }
  .main-content { padding: 30px 16px 44px; }
  .intro-row { display: block; margin-bottom: 26px; }
  h1 { margin-bottom: 12px; font-size: 2.15rem; }
  .intro-copy { max-width: 290px; font-size: 14px; }
  .intro-add { width: 100%; margin-top: 20px; }
  .toolbar { display: block; margin: 0 -2px 28px; padding: 8px; }
  .search-box { min-height: 43px; padding: 0 10px; }
  kbd { display: none; }
  .filter-row { overflow-x: auto; padding-top: 6px; border-top: 1px solid #f0f3f0; }
  .filter-button { flex: 0 0 auto; }
  .section-heading { margin-bottom: 15px; }
  .section-heading h2 { font-size: 23px; }
  .recipe-grid { grid-template-columns: 1fr; gap: 14px; }
  .recipe-cover { height: 190px; }
  .recipe-card h3 { font-size: 19px; }
  .side-column { grid-template-columns: 1fr; gap: 14px; }
  .side-card { padding: 19px; }
  .mobile-nav { position: fixed; z-index: 8; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-around; padding: 8px 22px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
  .mobile-nav-item { display: grid; gap: 1px; justify-items: center; min-width: 70px; border: 0; color: var(--muted); background: transparent; font-size: 20px; }
  .mobile-nav-item small { font-size: 11px; }
  .mobile-nav-item.is-active { color: var(--green); font-weight: 700; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { max-height: 92vh; padding: 21px 17px calc(20px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; }
  .detail-modal { padding: 0 0 calc(20px + env(safe-area-inset-bottom)); }
  .detail-hero { height: 220px; }
  .detail-main { padding: 21px 17px 24px; }
  .detail-columns { grid-template-columns: 1fr; gap: 22px; }
  .detail-hero-copy h2 { font-size: 26px; }
  .modal-actions { align-items: end; }
  .action-group { flex: 1; justify-content: end; }
  .action-group .secondary-button, .action-group .primary-button { padding-right: 14px; padding-left: 14px; }
}
