:root {
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #241f18;
  background: #d8d5ce;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html,
body,
#root {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body { margin: 0; min-width: 320px; min-height: 100dvh; background: #d8d5ce; }
button, input, textarea { font: inherit; }
button { color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { width: 100%; min-height: 100dvh; max-width: 520px; margin: 0 auto; background: #f7f4ed; overflow-x: hidden; overflow-y: visible; }
.eyebrow { color: #9c3d2d; font: 700 10px/1.2 Georgia, serif; letter-spacing: .16em; text-transform: uppercase; }

.home-shell { height: 100dvh; display: flex; flex-direction: column; }
.home-header { flex: 0 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px 14px; background: #f7f4ed; border-bottom: 1px solid #ded8cd; }
.brand-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.brand-row h1 { margin: 3px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 28px; letter-spacing: .02em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.global-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.global-icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #ded7cd;
  border-radius: 11px;
  color: #4b4138;
  background: rgba(255, 253, 248, .94);
  box-shadow: 0 2px 9px rgba(45, 36, 27, .04);
  font-size: 18px;
  line-height: 1;
}
.global-icon-button:active { transform: scale(.96); background: #f2ede6; }
.recipe-count { display: flex; align-items: baseline; gap: 5px; color: #766d61; font-size: 12px; }
.recipe-count strong { color: #9c3d2d; font-family: Georgia, serif; font-size: 22px; }
.top-add-button { height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 2px; border: 1px solid #9c3d2d; border-radius: 4px; color: #9c3d2d; background: transparent; font-size: 14px; font-weight: 800; white-space: nowrap; }
.top-add-button svg { width: 17px; height: 17px; }
.search-box { height: 48px; padding: 0 13px; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #d9d2c5; border-radius: 6px; box-shadow: 0 2px 10px rgba(54, 40, 21, .04); }
.search-box svg { color: #9c3d2d; flex: 0 0 auto; }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: #2d2822; font-size: 17px; }
.search-box input::placeholder { color: #aaa297; }
.search-box button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; padding: 0; }
.search-box button.hidden { display: none; }

.home-body { min-height: 0; flex: 1; display: grid; grid-template-columns: 78px minmax(0, 1fr); }
.category-nav { overflow-y: auto; background: #ede7db; border-right: 1px solid #d9d1c2; padding: 9px 0 calc(20px + env(safe-area-inset-bottom)); scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }
.category-nav button { position: relative; width: 100%; height: 60px; border: 0; background: transparent; color: #665e54; font-size: 16px; font-weight: 600; }
.category-nav button.active { background: #f7f4ed; color: #8f3326; font-weight: 800; }
.category-nav button.active::before { content: ""; position: absolute; left: 0; top: 15px; bottom: 15px; width: 4px; background: #9c3d2d; border-radius: 0 4px 4px 0; }
.category-nav button i { position: absolute; left: 50%; bottom: 9px; width: 18px; height: 1px; background: #a9493a; transform: translateX(-50%); }

.recipe-panel { min-width: 0; overflow-y: auto; padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); scroll-behavior: smooth; }
.list-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 11px; }
.list-heading h2 { overflow: hidden; margin: 0; font: 700 20px/1.3 Georgia, "Songti SC", serif; text-overflow: ellipsis; white-space: nowrap; }
.list-heading span { color: #8d8478; font-size: 12px; white-space: nowrap; }
.recipe-list { display: grid; gap: 14px; }
.recipe-card { overflow: hidden; position: relative; background: #fff; border: 1px solid #ddd6ca; border-radius: 5px; box-shadow: 0 5px 18px rgba(54, 42, 27, .06); cursor: pointer; }
.recipe-card::after { content: ""; position: absolute; top: 0; right: 0; width: 25px; height: 25px; background: linear-gradient(225deg, #9c3d2d 0 49%, transparent 50%); opacity: .9; }
.image-area { position: relative; width: 100%; aspect-ratio: var(--ratio-recipe-card); display: flex; flex-direction: column; justify-content: center; align-items: center; border: 0; padding: 0; }
.image-upload-status { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 12px; color: #fff; background: rgba(36, 31, 26, .46); font-size: 14px; font-weight: 500; letter-spacing: .02em; pointer-events: none; }
.image-area.placeholder .image-upload-status { color: var(--color-text); background: rgba(255, 255, 255, .78); }
:root[data-theme="dark"] .image-area.placeholder .image-upload-status { color: var(--color-text); background: rgba(32, 29, 26, .78); }
.image-area:disabled { cursor: wait; }
.image-area.placeholder { gap: 6px; background: #dedbd5; color: #777169; cursor: pointer; }
.image-area.placeholder.compact { gap: 4px; }
.image-area.placeholder strong { font-size: 16px; letter-spacing: .03em; }
.image-area.placeholder small { font-size: 12px; color: #918b83; }
.camera-ring { width: 48px; height: 48px; display: grid; place-items: center; border: 1px dashed #99928a; border-radius: 50%; }
.compact .camera-ring { width: 42px; height: 42px; }
.image-area.has-image { cursor: pointer; }
.image-area img { width: 100%; height: 100%; object-fit: cover; }
.card-content { position: relative; padding: 11px 12px 12px; }
.card-content h3 { margin: 0 55px 8px 0; font-size: 18px; line-height: 1.25; }
.empty-state { padding: 80px 16px; text-align: center; color: #8d867d; }
.empty-state svg { color: #aaa298; }
.empty-state h3 { margin: 15px 0 5px; color: #4c463f; font-size: 18px; }
.empty-state p { margin: 0; font-size: 14px; }

.detail-shell { min-height: 100dvh; }
.detail-header { position: sticky; z-index: 5; top: 0; height: calc(62px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 13px 0; display: flex; align-items: center; justify-content: space-between; background: rgba(247, 244, 237, .96); border-bottom: 1px solid #ded8cd; backdrop-filter: blur(8px); }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; }
.detail-header-title { font-size: 17px; font-weight: 800; }
.header-edit { min-width: 82px; height: 40px; margin-right: 3px; border: 1px solid #9c3d2d; border-radius: 4px; color: #9c3d2d; background: #fff; font-size: 15px; font-weight: 800; }
.detail-content { padding: 22px 18px calc(45px + env(safe-area-inset-bottom)); }
.detail-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.detail-title-row h1 { margin: 6px 0 0; font: 700 28px/1.25 Georgia, "Songti SC", serif; }
.title-mark { color: #b8afa3; transform: rotate(90deg); }
.detail-content > .image-area { overflow: hidden; border-radius: 5px; border: 1px solid #d4cec4; }
.hidden-input { display: none; }
.detail-section { padding: 26px 1px 4px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; padding-bottom: 9px; border-bottom: 1px solid #d9d1c4; }
.section-title span { color: #9c3d2d; font: italic 15px Georgia, serif; }
.section-title h2 { margin: 0; font: 700 21px Georgia, "Songti SC", serif; }
.ingredient-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid #ddd6cb; border-radius: 3px; background: #ddd6cb; }
.ingredient-list div { padding: 12px; background: #fff; font-size: 15px; }
.steps { display: grid; gap: 17px; list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: 10px; }
.steps li > span { width: 30px; height: 30px; display: grid; place-items: center; color: white; background: #9c3d2d; border-radius: 50%; font: 700 14px Georgia, serif; }
.steps p, .body-copy { margin: 3px 0 0; font-size: 17px; line-height: 1.75; }
.note-list { border-left: 2px solid #c8bfb2; }
.note { position: relative; padding: 0 0 22px 18px; }
.note::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; background: #9c3d2d; border: 2px solid #f7f4ed; border-radius: 50%; }
.note time { color: #8e4033; font: 700 13px Georgia, serif; letter-spacing: .04em; }
.note p { margin: 7px 0 0; font-size: 17px; }
.notes-title { align-items: center; }
.notes-title h2 { flex: 1; }
.notes-title > button { height: 40px; padding: 0 12px; border: 1px solid #9c3d2d; border-radius: 4px; color: #9c3d2d; background: #fff; font-size: 15px; font-weight: 800; white-space: nowrap; }
.note-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-actions { display: flex; gap: 4px; }
.note-actions button { min-width: 48px; height: 36px; border: 0; border-radius: 3px; color: #6f665c; background: #eee9df; font-size: 14px; font-weight: 700; }
.note-actions button.danger-text { color: #ad3b2b; background: #f7e8e4; }
.note-editor { min-width: 0; margin: 0 0 20px; padding: 15px; display: grid; gap: 13px; border: 1px solid #d5c5b8; border-left: 4px solid #9c3d2d; border-radius: 4px; background: #fff; box-shadow: 0 4px 18px rgba(54, 42, 27, .06); }
.note-editor label { min-width: 0; display: grid; gap: 7px; color: #4d463f; font-size: 15px; font-weight: 800; }
.note-editor input, .note-editor textarea { width: 100%; padding: 11px 12px; border: 1px solid #d4ccbf; border-radius: 4px; outline: 0; color: #2d2822; background: #fbfaf7; font-size: 17px; }
.note-editor input[type="date"] { display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
.note-editor input { min-height: 50px; }
.note-editor textarea { min-height: 128px; resize: vertical; line-height: 1.6; }
.note-editor input:focus, .note-editor textarea:focus { border-color: #9c3d2d; box-shadow: 0 0 0 3px rgba(156, 61, 45, .1); }
.note-editor textarea.invalid { border-color: #bd3828; background: #fff7f5; }
.note-editor-actions { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; }
.note-editor-actions .secondary-button, .note-editor-actions .primary-button { height: 50px; }
.empty-copy { color: #948d83; font-size: 15px; }

.sheet-backdrop { position: fixed; z-index: 20; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(30, 26, 22, .42); }
.action-sheet { width: 100%; max-width: 520px; padding: 9px 16px calc(14px + env(safe-area-inset-bottom)); background: #f7f4ed; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .16); }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 12px; background: #c9c2b9; border-radius: 4px; }
.action-sheet h2 { margin: 0 0 9px; text-align: center; font-size: 18px; }
.action-sheet button { width: 100%; height: 52px; border: 0; border-top: 1px solid #ddd6ca; background: transparent; font-size: 17px; font-weight: 700; }
.action-sheet button.danger { color: #b33a2a; }
.action-sheet button.cancel { margin-top: 7px; border: 0; border-radius: 5px; background: #e9e3d8; }
.image-lightbox { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 56px 12px 24px; background: rgba(16, 14, 12, .94); }
.image-lightbox > button { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, calc((100vw - 520px) / 2 + 12px)); width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .14); }
.image-lightbox img { max-width: min(100%, 720px); max-height: 84dvh; object-fit: contain; border-radius: 4px; }

.form-shell { min-height: 100dvh; background: #f7f4ed; }
.header-save { min-width: 58px; height: 38px; border: 0; color: #9c3d2d; background: transparent; font-size: 16px; font-weight: 800; }
.recipe-form { padding: 16px 17px calc(34px + env(safe-area-inset-bottom)); }
.form-section { margin-bottom: 14px; padding: 16px; background: #fff; border: 1px solid #ddd6ca; border-radius: 6px; box-shadow: 0 3px 12px rgba(54, 42, 27, .035); }
.form-label { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; color: #8a8176; font-size: 13px; font-style: normal; }
.form-label strong { color: #2d2822; font-size: 17px; }
.form-label em { color: #a23d2d; font-style: normal; font-weight: 700; }
.form-control { width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid #d7d0c4; border-radius: 4px; outline: 0; color: #2d2822; background: #fbfaf7; font-size: 16px; line-height: 1.55; }
.form-control:focus { border-color: #a54939; box-shadow: 0 0 0 3px rgba(156, 61, 45, .1); }
.form-control.invalid { border-color: #bd3828; background: #fff7f5; }
textarea.form-control { min-height: 94px; resize: vertical; }
textarea.form-control.tall { min-height: 130px; }
.form-photo { overflow: hidden; position: relative; width: 100%; aspect-ratio: var(--ratio-form-photo); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #aaa298; border-radius: 5px; background: #dedbd5; color: #746e66; }
.form-photo small { color: #8d867e; }
.form-photo.has-image { display: block; padding: 0; border: 0; }
.form-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; border-radius: inherit; }
.form-photo.has-image span { position: absolute; right: 10px; bottom: 10px; padding: 7px 11px; border-radius: 4px; color: #fff; background: rgba(32, 28, 24, .72); font-size: 13px; font-weight: 700; }
.remove-form-photo { width: 100%; height: 46px; margin-top: 8px; border: 1px solid #e1c4be; border-radius: 4px; color: #aa3b2c; background: #fff6f3; font-size: 15px; font-weight: 800; }
.category-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.category-picker button { min-width: 0; height: 42px; border: 1px solid #d6cec1; border-radius: 4px; background: #f8f5ef; font-size: 15px; font-weight: 700; }
.category-picker button.selected { border-color: #9c3d2d; color: #fff; background: #9c3d2d; }
.form-bottom-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; padding-top: 5px; }
.secondary-button, .primary-button { height: 54px; border-radius: 5px; font-size: 17px; font-weight: 800; }
.secondary-button { border: 1px solid #cfc7ba; color: #5d554c; background: #eee9df; }
.primary-button { border: 1px solid #9c3d2d; color: #fff; background: #9c3d2d; }
.delete-recipe-button { width: 100%; height: 52px; margin-top: 18px; border: 1px solid #e4b9b2; border-radius: 8px; color: #b03428; background: #fff5f3; font-size: 16px; font-weight: 750; }
.delete-recipe-button:active { background: #fbe5e1; }
.delete-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.confirm-delete-button { height: 54px; border: 1px solid #b9362a; border-radius: 8px; color: #fff; background: #b9362a; font-size: 16px; font-weight: 800; }
.delete-dialog p { color: #8e3c33; }

@media (min-width: 700px) {
  .app-shell { box-shadow: 0 0 70px rgba(42, 36, 29, .2); }
}

@media (max-width: 360px) {
  .home-body { grid-template-columns: 70px minmax(0, 1fr); }
  .category-nav button { font-size: 15px; }
  .home-header { padding-left: 14px; padding-right: 14px; }
  .recipe-panel { padding-left: 10px; padding-right: 10px; }
  .detail-title-row h1 { font-size: 25px; }
  .recipe-count { display: none; }
  .category-picker { grid-template-columns: repeat(3, 1fr); }
}

/* Private access screen */
.auth-screen {
  min-height: 100dvh;
  padding: max(42px, env(safe-area-inset-top)) 22px max(30px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 12%, #fffaf1 0, #f6f1e9 48%, #eee7dc 100%);
}

.auth-card {
  width: min(100%, 390px);
  padding: 34px 25px 28px;
  border: 1px solid rgba(132, 89, 65, .11);
  border-radius: 26px;
  background: rgba(255, 253, 249, .94);
  box-shadow: 0 18px 45px rgba(74, 49, 34, .1);
  text-align: center;
}

.auth-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff8ec;
  background: #9c493b;
  box-shadow: 0 8px 20px rgba(156, 73, 59, .24);
  font: 700 30px/1 Georgia, "Songti SC", serif;
}

.auth-card h1 { margin: 5px 0 3px; color: #28221d; font-size: 30px; }
.auth-card > p { margin: 0 0 27px; color: #85796f; font-size: 15px; }
.auth-card form { text-align: left; }
.login-form { display: grid; gap: 8px; }
.login-form h2 { margin: 0 0 4px; color: #2b251f; font-size: 18px; }
.admin-login-panel { margin-top: 16px; text-align: left; }
.admin-login-panel summary { color: #8f473b; font-size: 14px; font-weight: 750; cursor: pointer; }
.admin-login-panel .login-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eee7dc; }
.auth-card label { display: block; margin: 0 0 8px 2px; color: #4a413a; font-size: 14px; font-weight: 700; }
.auth-card input { width: 100%; height: 52px; padding: 0 15px; border: 1px solid #d9d1c7; border-radius: 14px; outline: none; color: #28231f; background: #fff; font-size: 18px; }
.auth-card input:focus { border-color: #a25244; box-shadow: 0 0 0 3px rgba(162, 82, 68, .12); }
.auth-card button { width: 100%; height: 52px; border: 0; border-radius: 14px; color: #fff; background: #99483b; font-size: 17px; font-weight: 750; }
.auth-card button:disabled { opacity: .65; }
.auth-error { min-height: 30px; padding: 7px 2px 5px; color: #b13e32; font-size: 13px; }
.auth-card > small { display: block; margin-top: 18px; color: #948a82; font-size: 12px; }
.auth-loading > p { margin: 0; }
.logout-button { height: 34px; padding: 0 7px; border: 0; color: #82776e; background: transparent; font-size: 13px; font-weight: 650; }
.logout-button:active { color: #99483b; }
.header-spacer { min-width: 82px; }
.recipe-author-line { margin: -8px 0 14px; color: #95897e; font-size: 13px; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: -1px 0 9px; }
.home-stats button,
.home-stats > span { min-width: 0; padding: 7px 6px; border: 1px solid transparent; border-radius: 10px; color: #7f756a; background: rgba(255,255,255,.66); text-align: center; font-size: 11px; }
.home-stats button { appearance: none; cursor: pointer; }
.home-stats button:active { transform: scale(.98); }
.home-stats button.active { border-color: rgba(156, 73, 59, .38); color: #7c362d; background: #f2e3dc; box-shadow: inset 0 0 0 1px rgba(156, 73, 59, .08); }
.home-stats .disabled { opacity: .72; }
.home-stats strong { display: block; color: #9c493b; font-family: Georgia, serif; font-size: 18px; line-height: 1; }
.home-stats span span,
.home-stats button span { display: block; margin-top: 2px; }
.detail-quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0 0 12px; }
.detail-quick-actions button { height: 42px; border: 0; border-radius: 12px; color: #7e3c31; background: #f4e9e3; font-weight: 800; }
.share-status-card { margin: 0 0 12px; padding: 13px 13px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-radius: 16px; background: #fff; box-shadow: 0 3px 14px rgba(52, 43, 32, .045); }
.share-status-card.shared { background: #fff7ec; }
.share-status-card.private { background: #f7f5f0; }
.share-status-card strong { display: block; color: #2f2923; font-size: 16px; line-height: 1.3; }
.share-status-card small { display: block; margin-top: 4px; color: #877b70; font-size: 12px; line-height: 1.45; }
.share-switch { display: flex; align-items: center; gap: 8px; color: #6d6258; font-size: 13px; font-weight: 800; white-space: nowrap; }
.share-switch input { position: absolute; opacity: 0; pointer-events: none; }
.share-switch i { position: relative; width: 48px; height: 28px; border-radius: 999px; background: #ded8cf; transition: background-color .18s ease; }
.share-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(33, 27, 20, .22); transition: transform .18s ease; }
.share-switch input:checked + i { background: #9c493b; }
.share-switch input:checked + i::after { transform: translateX(20px); }
.share-switch.disabled { opacity: .58; }
.share-toggle { display: flex; gap: 12px; align-items: flex-start; }
.share-toggle input { width: 22px; height: 22px; margin-top: 2px; accent-color: #9c3d2d; }
.share-toggle span { display: grid; gap: 4px; }
.share-toggle strong { color: #2d2822; font-size: 17px; }
.share-toggle small { color: #82776e; font-size: 13px; line-height: 1.5; }
.member-field { margin-top: 10px; }
.member-create-button { width: 100%; margin-top: 12px; }
.member-list { display: grid; gap: 10px; }
.member-card { padding: 13px; border: 1px solid #ece5da; border-radius: 12px; background: #fbfaf7; }
.member-card > div:first-child { display: grid; gap: 4px; }
.member-card strong { color: #28231f; font-size: 17px; }
.member-card span { color: #887d72; font-size: 13px; }
.member-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.member-actions button { min-height: 38px; padding: 0 10px; border: 0; border-radius: 9px; color: #5f564d; background: #eee9df; font-size: 14px; font-weight: 750; }
.member-actions button.danger-text { color: #ad3b2b; background: #f7e8e4; }
.cook-editor select { width: 100%; min-height: 50px; padding: 0 12px; border: 1px solid #d4ccbf; border-radius: 4px; color: #2d2822; background: #fbfaf7; font-size: 17px; }
.record-photo { overflow: hidden; width: 100%; aspect-ratio: var(--ratio-record-photo); display: grid; place-items: center; border: 1px dashed #c8bfb4; border-radius: 14px; background: #f3f1ed; color: #777169; }
.record-photo.has-image { position: relative; display: block; border: 0; }
.record-photo img { width: 100%; height: 100%; object-fit: cover; }
.record-photo span:not(.placeholder-plus) { position: absolute; right: 10px; bottom: 10px; padding: 7px 10px; border-radius: 999px; color: #fff; background: rgba(32,28,24,.68); font-size: 13px; font-weight: 800; }
.growth-strip { display: flex; gap: 8px; margin: 0 0 16px; overflow-x: auto; }
.growth-strip img { flex: 0 0 96px; width: 96px; aspect-ratio: var(--ratio-record-photo); object-fit: var(--image-fit-cover); border-radius: 12px; }
.cook-record-list { display: grid; gap: 10px; }
.cook-record { padding: 12px; border-radius: 14px; background: #fff; box-shadow: 0 3px 13px rgba(49,40,30,.04); }
.cook-record > div { display: flex; justify-content: space-between; gap: 8px; color: #9a766e; font-size: 13px; font-weight: 800; }
.cook-record-head { align-items: center; flex-wrap: wrap; }
.cook-record-head .note-actions { margin-left: auto; }
.cook-record img { width: 100%; margin-top: 10px; aspect-ratio: var(--ratio-record-photo); object-fit: var(--image-fit-cover); border-radius: 12px; }
.cook-record p { margin: 9px 0 0; font-size: 16px; line-height: 1.55; }

/* First visual refinement */
:root { color: #25221e; background: #e8e6e1; }
body { background: #e8e6e1; -webkit-tap-highlight-color: transparent; }
.app-shell { background: #f8f7f3; }

:root[data-theme="dark"] { color: #f2eee6; background: #171411; }
:root[data-theme="dark"] body { background: #171411; color: #f2eee6; }
:root[data-theme="dark"] .app-shell,
:root[data-theme="dark"] .home-header,
:root[data-theme="dark"] .detail-header,
:root[data-theme="dark"] .form-bottom-actions { background: rgba(31, 27, 23, .96); border-color: #3d352e; color: #f2eee6; }
:root[data-theme="dark"] .settings-popover,
:root[data-theme="dark"] .recipe-card,
:root[data-theme="dark"] .form-section,
:root[data-theme="dark"] .detail-accordion,
:root[data-theme="dark"] .note-editor,
:root[data-theme="dark"] .cook-record,
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .app-info-panel { background: #29241f; border-color: #40372f; color: #f2eee6; }
:root[data-theme="dark"] .global-icon-button,
:root[data-theme="dark"] .settings-button,
:root[data-theme="dark"] .secondary-mini-button,
:root[data-theme="dark"] .settings-popover button { background: #332d27; border-color: #4a4037; color: #f2eee6; }
:root[data-theme="dark"] .account-subtitle,
:root[data-theme="dark"] .recipe-count,
:root[data-theme="dark"] .app-info-row span,
:root[data-theme="dark"] .body-copy,
:root[data-theme="dark"] .recipe-author-line { color: #c8bdb1; }
:root[data-theme="dark"] .card-content h3,
:root[data-theme="dark"] .list-heading h2,
:root[data-theme="dark"] .detail-title-row h1,
:root[data-theme="dark"] .app-info-row strong { color: #fff8ef; }
:root[data-theme="dark"] .category-nav { background: #211d19; border-color: #3b332c; }
:root[data-theme="dark"] .category-nav button { color: #d4c8bb; }
:root[data-theme="dark"] .category-nav button.active { color: #ffd7c8; background: #332a24; }
:root[data-theme="dark"] .image-area.placeholder,
:root[data-theme="dark"] .form-photo.placeholder { background: #302b26; color: #c8bdb1; }
.home-header { padding: max(14px, env(safe-area-inset-top)) 14px 12px; background: rgba(248, 247, 243, .96); border-color: #e8e4dc; }
.brand-row { margin-bottom: 12px; }
.brand-row h1 { font-size: 27px; letter-spacing: -.02em; }
.recipe-count { color: #938a80; }
.search-box { height: 46px; border-color: #e4dfd7; border-radius: 12px; box-shadow: 0 2px 12px rgba(45, 38, 29, .035); }
.search-box input { font-size: 16px; }

.home-body { grid-template-columns: 58px minmax(0, 1fr); }
.category-nav { padding-top: 8px; background: #eeece6; border-color: #e0dcd4; }
.category-nav button { height: 54px; font-size: 14px; font-weight: 650; transition: color .18s ease, background-color .18s ease, transform .12s ease; }
.category-nav button:active { transform: scale(.96); }
.category-nav button.active { color: #923e31; background: #f8f7f3; }
.category-nav button.active::before { top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.category-nav button i { display: none; }

.recipe-panel { padding: 13px 10px calc(92px + env(safe-area-inset-bottom)); }
.list-heading { margin: 0 3px 10px; }
.list-heading h2 { font-size: 19px; }
.recipe-list { gap: 12px; }
.recipe-card { border-color: rgba(50, 42, 33, .07); border-radius: 15px; box-shadow: 0 5px 18px rgba(53, 43, 31, .045); transition: box-shadow .18s ease; }
.recipe-card::after { display: none; }
.recipe-card:active { box-shadow: 0 2px 8px rgba(53, 43, 31, .04); }
.recipe-card .image-area { width: 84%; margin: 11px auto 0; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 11px; }
.recipe-card .camera-ring { width: 38px; height: 38px; }
.recipe-card .image-area.placeholder strong { font-size: 14px; }
.card-content { padding: 12px 14px 14px; }
.card-content h3 { margin: 0 0 10px; color: #211e1a; font-size: 20px; font-weight: 800; line-height: 1.3; letter-spacing: -.015em; }

.detail-header { border-color: #e8e4dc; background: rgba(248, 247, 243, .94); }
.detail-content { padding: 20px 16px calc(44px + env(safe-area-inset-bottom)); }
.detail-title-row { margin-bottom: 16px; }
.detail-title-row h1 { margin-top: 7px; font-size: 30px; letter-spacing: -.025em; }
.title-mark { display: none; }
.detail-content > .image-area { border: 0; border-radius: 16px; box-shadow: 0 4px 20px rgba(43, 35, 26, .08); }

.detail-accordion { margin: 13px 0; overflow: hidden; border: 1px solid #e6e1d9; border-radius: 14px; background: #fff; box-shadow: 0 3px 14px rgba(52, 43, 32, .035); }
.detail-accordion summary { min-height: 64px; padding: 0 16px; display: grid; grid-template-columns: 28px minmax(0, 1fr) 20px; align-items: center; gap: 7px; list-style: none; cursor: pointer; user-select: none; }
.detail-accordion summary::-webkit-details-marker { display: none; }
.detail-accordion summary > span { color: #a15447; font: italic 13px Georgia, serif; }
.detail-accordion summary h2 { margin: 0; font: 750 20px/1.2 Georgia, "Songti SC", serif; }
.detail-accordion summary i { width: 9px; height: 9px; justify-self: end; border-right: 1.5px solid #958b80; border-bottom: 1.5px solid #958b80; transform: rotate(45deg); transition: transform .2s ease; }
.detail-accordion[open] summary i { transform: rotate(225deg); }
.accordion-body { padding: 16px; border-top: 1px solid #eeeae3; animation: accordion-reveal .18s ease-out; }
@keyframes accordion-reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.ingredient-list { border: 0; border-radius: 10px; background: #ece8e1; }
.ingredient-list div { padding: 13px; font-size: 16px; }
.steps { gap: 20px; }
.steps li { grid-template-columns: 34px 1fr; }
.steps li > span { width: 32px; height: 32px; background: #9b4538; }
.steps p, .body-copy { font-size: 17px; line-height: 1.8; }

.notes-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.notes-toolbar button { height: 42px; padding: 0 14px; border: 1px solid #a24a3c; border-radius: 10px; color: #963e31; background: #fff; font-size: 15px; font-weight: 800; }
.note-list { margin-top: 6px; border-left: 1px solid #d8d1c7; }
.note { padding: 0 0 25px 18px; }
.note::before { left: -6px; width: 11px; height: 11px; background: #9e483a; }
.note time { color: #9a766e; font-size: 12px; letter-spacing: .03em; }
.note p { margin-top: 9px; color: #2a2621; font-size: 18px; line-height: 1.65; }
.note-actions button { min-width: 46px; height: 34px; border-radius: 8px; background: #f3f0ea; font-size: 13px; }
.note-actions button.danger-text { background: #fbefec; }

.image-lightbox { display: flex; flex-direction: column; padding: max(62px, calc(env(safe-area-inset-top) + 50px)) 0 max(18px, env(safe-area-inset-bottom)); background: rgba(9, 9, 9, .98); }
.image-stage { min-height: 0; width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.image-lightbox img { max-width: 100%; max-height: 100%; border-radius: 0; object-fit: contain; transform-origin: center; transition: transform .2s ease; user-select: none; -webkit-user-drag: none; touch-action: none; }
.image-lightbox img.zoomed { transition: none; }
.image-lightbox > p { margin: 12px 0 0; color: rgba(255, 255, 255, .58); text-align: center; font-size: 13px; }

@media (max-width: 360px) {
  .home-body { grid-template-columns: 54px minmax(0, 1fr); }
  .category-nav button { font-size: 13px; }
  .recipe-card .image-area { width: 86%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Persistent form actions */
.recipe-form { padding-bottom: calc(106px + env(safe-area-inset-bottom)); }
.form-bottom-actions { position: fixed; z-index: 12; left: 50%; bottom: 0; width: min(100%, 520px); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; grid-template-columns: 1fr 1.55fr; gap: 11px; background: rgba(248, 247, 243, .96); border-top: 1px solid #e4dfd7; box-shadow: 0 -7px 24px rgba(48, 39, 29, .07); backdrop-filter: blur(14px); }
.form-bottom-actions .secondary-button, .form-bottom-actions .primary-button { height: 56px; margin: 0; border-radius: 12px; }
.form-bottom-actions .primary-button { box-shadow: 0 5px 16px rgba(122, 49, 38, .22); font-size: 18px; }
.confirm-backdrop { position: fixed; z-index: 40; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: rgba(24, 21, 18, .45); backdrop-filter: blur(3px); }
.confirm-dialog { width: min(100%, 440px); padding: 22px 18px 18px; border-radius: 18px; background: #fff; box-shadow: 0 18px 60px rgba(18, 15, 12, .22); }
.confirm-dialog h2 { margin: 0; color: #24201c; text-align: center; font-size: 21px; }
.confirm-dialog p { margin: 9px 0 19px; color: #82796f; text-align: center; font-size: 15px; }
.confirm-actions { display: grid; gap: 9px; }
.confirm-actions button { width: 100%; height: 52px; border-radius: 11px; font-size: 16px; font-weight: 800; }
.confirm-actions .discard { border: 0; color: #ad3c2d; background: #fbefec; }
.confirm-actions .continue { border: 1px solid #d9d2c8; color: #554e47; background: #f5f2ed; }
.confirm-actions .save { border: 1px solid #9c3d2d; color: #fff; background: #9c3d2d; }

/* Mobile recipe browsing layout */
.home-header { position: relative; z-index: 6; padding-bottom: 0; box-shadow: 0 5px 16px rgba(52, 43, 32, .035); }
.home-body { display: block; min-height: 0; }
.category-nav { margin: 10px -14px 0; padding: 8px 14px 10px; display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden; border: 0; border-top: 1px solid #ebe7df; background: rgba(248, 247, 243, .98); scrollbar-width: none; scroll-snap-type: x proximity; }
.category-nav::-webkit-scrollbar { display: none; }
.category-nav button { flex: 0 0 auto; width: auto; height: 36px; padding: 0 14px; border: 0; border-radius: 18px; color: #756c63; background: transparent; font-size: 14px; font-weight: 700; scroll-snap-align: center; }
.category-nav button.active { color: #fff; background: #39332d; }
.category-nav button.active::before, .category-nav button i { display: none; }
.recipe-panel { height: 100%; padding: 12px 12px calc(90px + env(safe-area-inset-bottom)); }
.pull-refresh-indicator {
  height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  color: #8a8278;
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  transform: translateY(0);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}
.pull-refresh-indicator.visible {
  height: 28px;
  margin-top: -4px;
  margin-bottom: 6px;
  opacity: 1;
}
.list-heading { margin: 0 2px 10px; }
.list-heading h2 { font-size: 18px; }
.recipe-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
.recipe-card { min-width: 0; padding: 6px; border: 0; border-radius: 16px; background: #fff; box-shadow: 0 4px 15px rgba(50, 40, 30, .055); }
.recipe-card .image-area { width: 100%; margin: 0; aspect-ratio: 4 / 3; border-radius: 12px; }
.recipe-card .camera-ring { width: 34px; height: 34px; }
.recipe-card .camera-ring svg { width: 20px; height: 20px; }
.recipe-card .image-area.placeholder strong { font-size: 12px; }
.card-content { padding: 10px 4px 7px; }
.card-content h3 { min-height: 42px; margin: 0 0 8px; display: -webkit-box; overflow: hidden; color: #25211d; font-size: 17px; font-weight: 850; line-height: 1.3; letter-spacing: -.02em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.empty-state { grid-column: 1 / -1; }

.detail-content { padding-left: 18px; padding-right: 18px; }
.detail-content > .image-area { border-radius: 18px; }
.recipe-section { padding: 28px 2px; border-top: 1px solid #e5e0d8; }
/* The hidden file input sits between the hero image and the first section. */
.detail-content > .image-area + .hidden-input + .recipe-section { margin-top: 24px; border-top: 0; }
.recipe-section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 17px; }
.recipe-section-title > span { color: #a05245; font: italic 13px Georgia, serif; }
.recipe-section-title h2 { margin: 0; color: #24201c; font: var(--font-weight-bold) var(--font-size-section-title)/1.2 var(--font-family-display); letter-spacing: -.02em; }
.recipe-section-body { color: #39342e; }
.simple-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.simple-list li { position: relative; padding-left: 19px; font-size: 17px; line-height: 1.55; }
.simple-list li::before { content: ""; position: absolute; left: 1px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: #a04d40; }
.steps { gap: 12px; }
.steps li { padding: 14px 14px 14px 12px; grid-template-columns: 34px minmax(0, 1fr); align-items: start; border-radius: 14px; background: #fff; box-shadow: 0 3px 13px rgba(49, 40, 30, .045); }
.steps li > span { width: 32px; height: 32px; margin-top: 1px; background: #99483b; font-size: 15px; }
.steps p { margin-top: 1px; color: #28241f; font-size: var(--font-size-step); font-weight: 560; line-height: 1.7; }
.recipe-section .body-copy { margin: 0; font-size: 17px; line-height: 1.8; }
.notes-section { padding-bottom: 8px; }
.notes-toolbar { margin-top: -52px; margin-bottom: 22px; }

@media (max-width: 360px) {
  .home-body { display: block; }
  .category-nav button { font-size: 13px; }
  .recipe-card .image-area { width: 100%; }
  .recipe-list { gap: 12px 8px; }
  .card-content h3 { font-size: 16px; }
}

/* Compact category strip and strict cover sizing */
.category-nav { margin-top: 8px; padding: 6px 10px 8px; gap: 2px; scroll-padding-inline: 10px; }
.category-nav button { min-width: 0; height: 32px; padding: 0 6px; border-radius: 16px; font-size: 12px; line-height: 32px; letter-spacing: 0; }
.recipe-card .image-area { position: relative; width: 100%; height: auto !important; min-height: 0; max-height: none; margin: 0; overflow: hidden; aspect-ratio: 4 / 3 !important; border-radius: 12px; }
.recipe-card .image-area.has-image { display: block; }
.recipe-card .image-area.has-image img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.recipe-card .image-area.placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3 !important; }
.recipe-list { align-items: stretch; }
.recipe-card { height: 100%; }
.recipe-panel { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.card-content { padding-bottom: 5px; }
.card-content h3 { margin-bottom: 0; }

/* Full-bleed compact recipe cards */
.recipe-card { padding: 0; overflow: hidden; }
.recipe-card .image-area { border-radius: 0; }
.card-content { padding: 11px 12px 12px; }
.card-content h3 { min-height: 0; margin: 0; display: block; overflow: hidden; font-size: 17px; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; -webkit-line-clamp: unset; }

@media (max-width: 360px) {
  .category-nav { padding-left: 8px; padding-right: 8px; gap: 1px; }
  .category-nav button { padding: 0 5px; font-size: 11.5px; }
}

/* Final home density pass */
.home-header {
  padding-top: max(10px, env(safe-area-inset-top));
}

.brand-row {
  margin-bottom: 8px;
}

.brand-row h1 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-brand);
}

.account-subtitle {
  margin: 3px 0 0;
  color: #7f766c;
  font-size: 14px;
  font-weight: 700;
}

.home-action-row {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -2px 0 8px;
}

.settings-button,
.secondary-mini-button {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 750;
}

.settings-button {
  border: 1px solid #ded7cd;
  color: #5f574e;
  background: #fff;
}

.secondary-mini-button {
  border: 1px solid #d5ccc0;
  color: #7b493f;
  background: #f3eee7;
}

.settings-layer {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: rgba(22, 18, 14, .24);
  pointer-events: auto;
}

.settings-popover {
  position: fixed;
  z-index: 61;
  top: calc(max(10px, env(safe-area-inset-top)) + 78px);
  right: 14px;
  width: min(330px, calc(100vw - 28px));
  max-height: calc(100dvh - max(10px, env(safe-area-inset-top)) - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(69, 54, 38, .1);
  border-radius: 16px;
  background: rgba(255, 253, 248, .98);
  box-shadow: 0 14px 38px rgba(40, 31, 22, .14);
  backdrop-filter: blur(14px);
}

.settings-popover button {
  height: 44px;
  border: 0;
  border-radius: 11px;
  color: #332d27;
  background: transparent;
  text-align: left;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 750;
}

.detail-header .global-actions { flex: 0 0 auto; }
.detail-header-title { min-width: 0; flex: 1; text-align: center; }

.settings-popover button:active {
  background: #f2ede6;
}

.settings-popover .muted {
  color: #8a8177;
}

html.menu-open,
body.menu-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.app-info-panel {
  margin: 4px 0;
  padding: 12px;
  border-radius: 14px;
  background: #f6f1ea;
  border: 1px solid #ebe4da;
}

.app-info-title {
  margin-bottom: 9px;
  color: #9a4639;
  font-size: 13px;
  font-weight: 850;
}

.app-info-row {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.app-info-row.compact {
  margin: 10px 0 0;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.app-info-row span {
  color: #85796e;
  font-size: 12px;
  font-weight: 750;
}

.app-info-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #2f2923;
  font-size: 14px;
  line-height: 1.35;
}

.app-info-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-popover .app-info-actions button {
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  color: #924033;
  font-size: 14px;
}

.eyebrow {
  margin-bottom: 1px;
  font-size: 9px;
}

.search-box {
  height: 41px;
}

.category-nav {
  margin-top: 5px;
  padding: 6px 10px 7px;
  gap: 1.6px;
}

.category-nav button {
  height: 36px;
  padding: 0 5px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 36px;
}

.recipe-card {
  border-radius: 11px;
}

.card-content {
  padding: 8px 10px 9px;
}

.card-content h3 {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-card-title);
  line-height: 1.3;
}

.recipe-card .image-area.placeholder {
  flex-direction: column;
  gap: 7px;
  color: #74747b;
  background: var(--color-surface-subtle);
}

.recipe-card .image-area.placeholder strong {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.placeholder-plus {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #68686f;
  background: rgba(118, 118, 128, .11);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
}

.image-area img,
.form-photo img,
.record-photo img,
.cook-record img,
.growth-strip img {
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  transition: none;
  backface-visibility: hidden;
}

@media (max-width: 360px) {
  .category-nav {
    padding-left: 8px;
    padding-right: 8px;
    gap: 1px;
  }

  .category-nav button {
    padding: 0 4px;
    font-size: 13px;
  }
}

body {
  background: var(--bg);
  color: var(--text);
}

.app-shell,
.home-header,
.detail-header,
.form-bottom-actions {
  background: var(--bg);
  color: var(--text);
}

.settings-popover,
.recipe-card,
.form-section,
.detail-accordion,
.cook-record,
.comment-item,
.comment-form,
.confirm-dialog,
.app-info-panel,
.share-status-card {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.home-header,
.detail-header,
.search-box,
.form-control,
.settings-popover,
.form-section,
.detail-accordion,
.recipe-card,
.cook-record,
.comment-item,
.confirm-dialog,
.app-info-panel,
.share-status-card,
.ingredient-list,
.steps li {
  border-color: var(--border);
}

.home-header,
.detail-header,
.settings-popover,
.search-box,
.form-control,
.note-editor textarea,
.comment-form input,
.comment-form textarea,
.confirm-dialog,
.app-info-panel,
.detail-accordion,
.form-section {
  color: var(--text);
}

.form-section .form-label,
.form-section .form-label strong,
.form-section .share-toggle strong,
.form-section .share-toggle span {
  color: var(--text);
}

.form-section .form-label span,
.form-section .form-label em,
.form-section .share-toggle small,
.form-section .form-photo small,
.form-section .remove-form-photo {
  color: var(--text-muted);
}

.form-control::placeholder,
.note-editor textarea::placeholder,
.comment-form input::placeholder,
.comment-form textarea::placeholder {
  color: var(--placeholder);
}

.account-subtitle,
.recipe-count,
.empty-copy,
.app-info-row span,
.settings-popover .muted,
.note time,
.pull-refresh-indicator,
.recipe-author-line,
.share-status-card small,
.comment-meta time {
  color: var(--text-muted);
}

.brand-row h1,
.list-heading h2,
.detail-title-row h1,
.recipe-section-title h2,
.card-content h3,
.detail-accordion summary h2,
.app-info-row strong {
  color: var(--text);
}

.global-icon-button,
.settings-button,
.secondary-mini-button,
.settings-popover button,
.secondary-button,
.confirm-actions .continue {
  border-color: var(--border);
  color: var(--text);
  background: var(--card);
}

.global-icon-button {
  box-shadow: 0 2px 10px rgba(28, 20, 13, .06);
}

.primary-button,
.confirm-actions .save,
.form-bottom-actions .primary-button,
.notes-toolbar button,
.guest-login-button {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.recipe-card .image-area.placeholder,
.form-photo.placeholder {
  background: color-mix(in srgb, var(--card) 92%, var(--bg));
  color: var(--text-muted);
}

.placeholder-plus {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 15%, transparent);
}

.search-box,
.form-control,
.note-editor textarea,
.comment-form input,
.comment-form textarea {
  background: var(--input-bg);
}

.search-box input {
  color: var(--input-text);
  caret-color: var(--caret-color);
  -webkit-text-fill-color: var(--input-text);
}

.search-box input::placeholder {
  color: var(--placeholder);
  -webkit-text-fill-color: var(--placeholder);
}

.detail-accordion summary i {
  border-right-color: var(--text-muted);
  border-bottom-color: var(--text-muted);
}

.ingredient-list,
.steps li,
.note,
.comment-item,
.cook-record {
  background: var(--card);
}

.steps li > span,
.note::before {
  background: var(--primary);
  color: var(--primary-text);
}

.comment-list,
.note-list,
.cook-record-list {
  color: var(--text);
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  padding: 12px 13px 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 3px 14px rgba(30, 22, 14, .04);
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.comment-meta strong {
  font-size: 14px;
}

.comment-item p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
}

.comment-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.comment-form label {
  display: grid;
  gap: 6px;
}

.comment-form label span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.comment-form-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 8px;
}

.guest-login-button {
  width: 100%;
  height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 800;
}

/* Dark theme polish for structural surfaces */
:root[data-theme="dark"] .home-header,
:root[data-theme="dark"] .detail-header,
:root[data-theme="dark"] .form-bottom-actions {
  background: color-mix(in srgb, var(--bg) 88%, black);
  border-color: var(--border);
}

:root[data-theme="dark"] .settings-popover,
:root[data-theme="dark"] .recipe-card,
:root[data-theme="dark"] .form-section,
:root[data-theme="dark"] .detail-accordion,
:root[data-theme="dark"] .cook-record,
:root[data-theme="dark"] .comment-item,
:root[data-theme="dark"] .comment-form,
:root[data-theme="dark"] .confirm-dialog,
:root[data-theme="dark"] .app-info-panel,
:root[data-theme="dark"] .share-status-card {
  background: var(--card);
  border-color: var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
}

:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .note-editor input,
:root[data-theme="dark"] .note-editor textarea,
:root[data-theme="dark"] .comment-form input,
:root[data-theme="dark"] .comment-form textarea {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}

:root[data-theme="dark"] .note-editor {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
}

:root[data-theme="dark"] .note-editor label {
  color: var(--text);
}

:root[data-theme="dark"] .note-editor input,
:root[data-theme="dark"] .note-editor textarea {
  background: var(--input-bg);
  color: var(--input-text);
  border-color: var(--border);
  caret-color: var(--caret-color);
  -webkit-text-fill-color: var(--input-text);
  color-scheme: dark;
}

:root[data-theme="dark"] .note-editor input[type="date"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

:root[data-theme="dark"] .search-box input,
:root[data-theme="dark"] .search-box input:focus {
  color: var(--input-text);
  caret-color: var(--caret-color);
  -webkit-text-fill-color: var(--input-text);
}

:root[data-theme="dark"] .share-status-card strong,
:root[data-theme="dark"] .share-status-card .share-switch,
:root[data-theme="dark"] .share-status-card .share-switch span {
  color: var(--text);
}

:root[data-theme="dark"] .share-status-card small {
  color: var(--text-muted);
}

:root[data-theme="dark"] .home-stats button,
:root[data-theme="dark"] .home-stats > span {
  color: var(--text-muted);
  background: var(--card);
  border-color: var(--border);
}

:root[data-theme="dark"] .home-stats button.active {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 28%, var(--card));
  border-color: var(--primary);
}

:root[data-theme="dark"] .home-stats strong {
  color: var(--primary-text);
}

:root[data-theme="dark"] .form-section .form-label,
:root[data-theme="dark"] .form-section .form-label strong,
:root[data-theme="dark"] .form-section .share-toggle strong,
:root[data-theme="dark"] .form-section .share-toggle span,
:root[data-theme="dark"] .recipe-form .form-label,
:root[data-theme="dark"] .recipe-form .form-label strong {
  color: var(--text);
}

:root[data-theme="dark"] .form-section .form-label span,
:root[data-theme="dark"] .form-section .form-label em,
:root[data-theme="dark"] .form-section .share-toggle small,
:root[data-theme="dark"] .form-section .form-photo small,
:root[data-theme="dark"] .form-section .remove-form-photo,
:root[data-theme="dark"] .recipe-form .muted,
:root[data-theme="dark"] .recipe-form small,
:root[data-theme="dark"] .recipe-form .help-text {
  color: var(--text-muted);
}

:root[data-theme="dark"] .form-control::placeholder,
:root[data-theme="dark"] .note-editor textarea::placeholder,
:root[data-theme="dark"] .comment-form input::placeholder,
:root[data-theme="dark"] .comment-form textarea::placeholder {
  color: var(--placeholder);
}

:root[data-theme="dark"] .category-picker button {
  background: var(--color-surface-subtle);
  border-color: #5a5048;
  color: #e9e2d9;
}

:root[data-theme="dark"] .recipe-form .category-picker button {
  background: var(--color-surface-subtle);
  border-color: #5a5048;
  color: #e9e2d9;
}

:root[data-theme="dark"] .category-picker button.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--color-on-brand);
}

:root[data-theme="dark"] .recipe-form .category-picker button.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--color-on-brand);
}

:root[data-theme="dark"] .share-toggle {
  color: var(--text);
}

:root[data-theme="dark"] .recipe-form .share-toggle {
  color: var(--text);
}

:root[data-theme="dark"] .share-toggle input + i {
  background: var(--color-switch-off);
}

:root[data-theme="dark"] .share-toggle input:checked + i {
  background: var(--primary);
}

:root[data-theme="dark"] .share-toggle input + i::after {
  background: #f7f2eb;
}

:root[data-theme="dark"] .form-photo.placeholder,
:root[data-theme="dark"] .recipe-card .image-area.placeholder,
:root[data-theme="dark"] .record-photo.placeholder {
  background: var(--color-surface-subtle);
  color: #e9e2d9;
  border-color: #5a5048;
}

:root[data-theme="dark"] .form-photo.has-image span {
  background: rgba(12, 11, 10, .7);
  color: #fff;
}

:root[data-theme="dark"] .form-section .remove-form-photo {
  border-color: var(--color-danger-border);
  color: var(--color-danger);
  background: var(--color-surface-subtle);
}

:root[data-theme="dark"] .form-section .remove-form-photo:active {
  background: #3a2b27;
}

:root[data-theme="dark"] .secondary-button {
  background: #2f2924;
  color: #f3eee7;
  border-color: #5a5048;
}

:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .confirm-actions .save,
:root[data-theme="dark"] .form-bottom-actions .primary-button,
:root[data-theme="dark"] .notes-toolbar button,
:root[data-theme="dark"] .guest-login-button {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

:root[data-theme="dark"] .delete-recipe-button {
  background: #352722;
  border-color: #8a4339;
  color: #ffcbc5;
}

:root[data-theme="dark"] .recipe-section,
:root[data-theme="dark"] .recipe-section-title,
:root[data-theme="dark"] .recipe-section-body,
:root[data-theme="dark"] .steps p,
:root[data-theme="dark"] .body-copy,
:root[data-theme="dark"] .simple-list li,
:root[data-theme="dark"] .note p,
:root[data-theme="dark"] .comment-item p,
:root[data-theme="dark"] .cook-record p {
  color: var(--text);
}

:root[data-theme="dark"] .empty-copy,
:root[data-theme="dark"] .account-subtitle,
:root[data-theme="dark"] .recipe-count,
:root[data-theme="dark"] .app-info-row span,
:root[data-theme="dark"] .settings-popover .muted,
:root[data-theme="dark"] .pull-refresh-indicator,
:root[data-theme="dark"] .recipe-author-line,
:root[data-theme="dark"] .share-status-card small,
:root[data-theme="dark"] .comment-meta time,
:root[data-theme="dark"] .note time {
  color: var(--text-muted);
}

:root[data-theme="dark"] .global-icon-button,
:root[data-theme="dark"] .settings-button,
:root[data-theme="dark"] .secondary-mini-button,
:root[data-theme="dark"] .settings-popover button,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .confirm-actions .continue {
  background: color-mix(in srgb, var(--card) 92%, var(--bg));
  border-color: var(--border);
  color: var(--text);
}

:root[data-theme="dark"] .settings-popover button:active {
  background: color-mix(in srgb, var(--card) 84%, var(--bg));
}

/* Phase 3 adapters: existing business selectors share the root control behavior. */
.top-add-button,
.header-save,
.header-edit,
.global-icon-button,
.secondary-mini-button,
.primary-button,
.secondary-button,
.delete-recipe-button,
.confirm-delete-button,
.guest-login-button,
.settings-button,
.notes-toolbar button,
.note-actions button,
.member-actions button,
.detail-quick-actions button,
.logout-button {
  font-family: var(--font-family-sans);
  -webkit-tap-highlight-color: transparent;
}

.search-box input,
.form-control,
.note-editor input,
.note-editor textarea,
.cook-editor select,
.auth-card input,
.comment-form input,
.comment-form textarea {
  font-family: var(--font-family-sans);
  caret-color: var(--caret-color);
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.share-switch i {
  background: var(--color-switch-off);
}

.share-switch input:checked + i {
  background: var(--color-brand);
}

/* Phase 4 adapters: preserve business layout while sharing visual primitives. */
.recipe-card {
  border-color: var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.settings-popover,
.share-status-card {
  border-color: var(--color-border);
  border-radius: var(--radius-card);
}

.detail-accordion,
.comment-item,
.app-info-panel,
.cook-record {
  border-color: var(--color-border);
  border-radius: var(--radius-panel);
}

.member-card { border-color: var(--color-border); border-radius: var(--radius-control); }
.note-editor { border-color: var(--color-border); border-radius: var(--radius-sm); }

.confirm-dialog {
  border-color: var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
}

.form-bottom-actions { box-shadow: var(--shadow-bottom-bar); }

/* Phase 6 image adapters: one display contract, without touching image data or events. */
.image-area,
.form-photo,
.record-photo,
.cook-record img {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.image-area img,
.form-photo img,
.record-photo img,
.cook-record img,
.growth-strip img {
  display: block;
  max-width: 100%;
  object-fit: var(--image-fit-cover);
  object-position: var(--image-position-center);
}

.image-area.has-image,
.form-photo.has-image,
.record-photo.has-image {
  overflow: hidden;
}

.image-area.placeholder,
.form-photo.placeholder,
.record-photo.placeholder {
  background: var(--color-surface-muted);
}

/* Phase 5 responsive adapters: constrain existing layouts without changing structure. */
html,
body,
#app,
.app-shell,
.home-header,
.detail-header,
.detail-content,
.form-shell {
  max-width: 100%;
  box-sizing: border-box;
}

.home-header,
.detail-content,
.form-shell,
.recipe-list,
.form-section,
.note-editor,
.cook-record,
.comment-form {
  min-width: 0;
}

.recipe-list,
.category-nav,
.settings-popover,
.confirm-dialog,
.action-sheet,
.form-bottom-actions {
  max-width: 100%;
  box-sizing: border-box;
}

.category-nav {
  min-width: 0;
  /* The nav intentionally bleeds through the header's horizontal padding. */
  width: calc(100% + 28px);
  max-width: none;
  margin-left: -14px;
  margin-right: -14px;
  overscroll-behavior-inline: contain;
}

.recipe-list > *,
.form-bottom-actions > *,
.comment-form-actions > * {
  min-width: 0;
}

.detail-header-title,
.detail-title-row,
.recipe-author-line,
.share-status-card,
.form-label,
.share-toggle,
.cook-record-head {
  min-width: 0;
  max-width: 100%;
}

.detail-header-title,
.detail-title-row h1,
.recipe-author-line,
.member-card strong,
.share-status-card strong {
  overflow-wrap: anywhere;
}

.note-editor input[type="date"],
.cook-editor input[type="date"],
.comment-form input[type="date"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 360px) {
  .category-nav { gap: 1px; padding-left: 8px; padding-right: 8px; }
  .category-nav button { padding-left: 5px; padding-right: 5px; font-size: 11.5px; }
  .recipe-list { column-gap: 8px; row-gap: 12px; }
}

@media (min-width: 420px) {
  .home-header,
  .detail-content { padding-left: var(--page-padding-inline-fluid); padding-right: var(--page-padding-inline-fluid); }

  .category-nav {
    width: calc(100% + var(--page-padding-inline-fluid) + var(--page-padding-inline-fluid));
    margin-left: calc(-1 * var(--page-padding-inline-fluid));
    margin-right: calc(-1 * var(--page-padding-inline-fluid));
  }
}

/* Phase 7: image-first family table home. Business selectors retain their existing behavior. */
.home-shell {
  height: auto;
  min-height: 100dvh;
  display: block;
  background: var(--color-bg);
}

.home-shell .home-header {
  position: static;
  z-index: auto;
  padding: max(12px, env(safe-area-inset-top)) var(--page-padding-inline-fluid) var(--space-3);
  border: 0;
  box-shadow: none;
  background: var(--color-bg);
}

.home-shell .brand-row {
  align-items: flex-start;
  margin: 0 0 var(--space-2);
}

.home-shell .eyebrow {
  margin-bottom: 2px;
  color: var(--color-brand-strong);
  font-size: 9px;
}

.home-shell .brand-row h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: clamp(23px, 6.4vw, 27px);
  line-height: 1.08;
}

.home-shell .account-subtitle {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.home-shell .global-actions { gap: 0; }

.home-shell .global-icon-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-control);
  border-color: var(--color-border);
  color: var(--color-text-primary);
  background: var(--color-surface-raised);
  box-shadow: none;
  font-size: 21px;
}

.home-shell .home-action-row {
  margin: 0 0 var(--space-2);
  justify-content: flex-start;
}

.home-shell .home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 var(--space-2);
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}

.home-shell .home-stats button,
.home-shell .home-stats > span {
  min-width: 0;
  min-height: 34px;
  padding: 6px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  background: transparent;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.1;
  white-space: nowrap;
}

.home-shell .home-stats button.active {
  color: var(--color-brand-strong);
  background: var(--color-accent-soft);
  box-shadow: none;
}

.home-shell .home-stats strong,
.home-shell .home-stats span span,
.home-shell .home-stats button span {
  display: inline;
  margin: 0;
}

.home-shell .home-stats strong {
  color: currentColor;
  font-family: var(--font-family-sans);
  font-size: 1em;
  font-weight: var(--font-weight-bold);
}

.home-shell .guest-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.home-scope-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--space-2);
}

.home-scope-controls .home-stats {
  min-width: 0;
  margin: 0;
}

.home-search-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(84px, 30fr) minmax(0, 70fr);
  align-items: stretch;
  gap: 7px;
}

.home-search-row .search-box {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 9px;
  gap: 5px;
  border-radius: var(--radius-control);
  border-color: var(--color-border);
  background: var(--color-surface-input);
  box-shadow: none;
}

.home-search-row .search-box svg {
  width: 18px;
  height: 18px;
  color: var(--color-brand);
}

.home-search-row .search-box input {
  min-width: 0;
  font-size: 16px;
}

.home-search-row .clear-search {
  flex: 0 0 24px;
}

.home-search-row .category-nav {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 4px;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-muted);
  scroll-padding-inline: 4px;
  scroll-snap-type: none;
  scrollbar-width: none;
  justify-content: flex-start;
}

.home-search-row .category-nav button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  background: transparent;
  font-size: clamp(11px, 2.9vw, 13px);
  font-weight: var(--font-weight-semibold);
  line-height: 32px;
  white-space: nowrap;
}

.home-search-row .category-nav button.active {
  color: var(--primary-text);
  background: var(--color-brand);
}

.home-shell .home-body,
.home-shell .recipe-panel {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.home-shell .recipe-panel {
  padding: var(--space-1) var(--page-padding-inline-fluid) calc(var(--space-7) + env(safe-area-inset-bottom));
}

.home-shell .recipe-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 10px;
}

.home-shell .recipe-card {
  border-radius: var(--radius-card);
  border-color: var(--color-border);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-card);
}

.home-shell .recipe-card .image-area {
  width: 100%;
  margin: 0;
  border-radius: 0;
  background: var(--color-surface-muted);
}

.home-shell .card-content {
  padding: 7px 10px 8px;
}

.home-shell .card-content h3 {
  min-height: 0;
  margin: 0;
  display: block;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: var(--font-size-card-title);
  line-height: 1.3;
  white-space: nowrap;
  text-align: left;
  text-overflow: ellipsis;
}

.home-leaderboard,
.home-show-more,
.home-shell .empty-state {
  grid-column: 1 / -1;
}

.home-leaderboard {
  margin-top: 2px;
  padding: 12px 14px;
  display: grid;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface-raised);
}

.home-leaderboard-kicker {
  display: block;
  color: var(--color-brand-strong);
  font-family: var(--font-family-display);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  letter-spacing: .12em;
}

.home-leaderboard h2 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-section);
}

.home-leaderboard-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.home-leaderboard-heading > span {
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
}

.home-ranking-row {
  position: relative;
  min-width: 0;
  min-height: 42px;
  padding: 7px 0 6px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  border: 0;
  color: var(--color-text-primary);
  background: transparent;
  text-align: left;
}

.home-ranking-position {
  position: absolute;
  left: 0;
  top: 8px;
  color: var(--color-brand-strong);
  font-weight: var(--font-weight-bold);
}

.home-ranking-name {
  min-width: 0;
  overflow: hidden;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-ranking-count {
  color: var(--color-text-secondary);
  font-size: var(--font-size-caption);
  white-space: nowrap;
}

.home-ranking-bar {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
}

.home-ranking-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-brand), var(--color-accent-warm));
  box-shadow: inset 0 1px 1px var(--chart-highlight), 0 1px 4px rgba(180, 88, 48, .16);
}

.ranking-period-tabs,
.stats-period-tabs { display: flex; gap: 6px; margin-top: 10px; }
.ranking-period-tab,
.stats-period-tab { min-height: 32px; padding: 0 11px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); color: var(--color-text-muted); background: var(--chart-track); font-size: var(--font-size-caption); font-weight: var(--font-weight-semibold); }
.ranking-period-tab.active,
.stats-period-tab.active { color: var(--color-on-brand); border-color: var(--color-brand); background: var(--color-brand); }
.ranking-period-nav,
.stats-period-nav { display: flex; align-items: center; gap: 6px; color: var(--color-text-secondary); font-size: var(--font-size-caption); }
.ranking-period-nav button,
.stats-period-nav button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: var(--radius-pill); color: var(--color-brand-strong); background: var(--chart-track); font-size: 22px; line-height: 1; }
.ranking-period-nav strong,
.stats-period-nav strong { white-space: nowrap; }
.ranking-period-nav button:disabled,
.stats-period-nav button:disabled { opacity: .32; }
.annual-trend-panel { grid-column: 1 / -1; margin-top: 2px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface-raised); }
.annual-trend-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.annual-trend-heading h2 { margin: 0; color: var(--color-text-primary); font-size: var(--font-size-section); }
.annual-trend-nav { display: flex; align-items: center; gap: 6px; color: var(--color-text-secondary); font-size: var(--font-size-caption); }
.annual-trend-nav button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: var(--radius-pill); color: var(--color-brand-strong); background: var(--chart-track); font-size: 22px; line-height: 1; }
.annual-trend-nav button:disabled { opacity: .32; }
.annual-trend-nav strong { white-space: nowrap; }
.annual-trend-chart-wrap { position: relative; margin-top: 10px; padding: 8px 6px 4px; border-radius: var(--radius-control); background: var(--color-surface-muted); }
.annual-trend-chart { display: block; width: 100%; height: auto; overflow: visible; }
.annual-trend-axis { stroke: var(--chart-baseline); stroke-width: 1.6; opacity: .72; stroke-linecap: round; }
.annual-trend-grid { stroke: var(--chart-baseline); stroke-width: .8; opacity: .2; stroke-dasharray: 2 6; }
.annual-trend-axis-label, .annual-trend-month { fill: var(--color-text-muted); stroke: none; stroke-width: 0; font-family: var(--font-family-sans); font-size: 10.5px; font-weight: 400; letter-spacing: 0; }
.annual-trend-line { fill: none; stroke: var(--trend-color); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.annual-trend-point { fill: var(--trend-color); stroke: var(--color-surface-raised); stroke-width: 1.2; pointer-events: none; }
.annual-trend-point.is-active { r: 4.5px; }
.annual-trend-point-hit { fill: transparent; stroke: transparent; cursor: pointer; }
.annual-trend-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 16px; margin-top: 2px; color: var(--color-text-muted); font-size: var(--font-size-caption); }
.annual-trend-legend span { display: inline-flex; align-items: center; gap: 5px; }
.annual-trend-legend i { width: 9px; height: 9px; border-radius: var(--radius-pill); background: var(--trend-color); }
.annual-trend-tooltip { position: absolute; top: 6px; right: 4px; display: grid; gap: 2px; max-width: calc(100% - 8px); padding: 7px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-control); color: var(--color-text-primary); background: var(--color-surface-overlay); box-shadow: var(--shadow-card); font-size: var(--font-size-caption); pointer-events: none; }
.annual-trend-tooltip span { color: var(--color-text-secondary); }
.annual-trend-series.member-1, .annual-trend-legend .member-1 { --trend-color: var(--chart-member-4); }
.annual-trend-series.member-2, .annual-trend-legend .member-2 { --trend-color: var(--chart-member-1); }
.annual-trend-series.member-3, .annual-trend-legend .member-3 { --trend-color: var(--chart-member-2); }
.annual-trend-series.member-4, .annual-trend-legend .member-4 { --trend-color: var(--chart-member-3); }
.family-stats-panel { grid-column: 1 / -1; margin-top: 2px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface-raised); }
.family-stats-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.family-stats-heading h2 { margin: 0; color: var(--color-text-primary); font-size: var(--font-size-section); }
.member-stat-chart { position: relative; min-width: 0; height: var(--chart-bar-height); margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; align-items: end; }
.member-stat-chart::after { content: ""; position: absolute; right: 0; bottom: var(--chart-member-label-space); left: 0; z-index: 0; height: 2px; border-radius: var(--radius-pill); background: var(--chart-baseline); pointer-events: none; }
.member-stat { position: relative; z-index: 1; min-width: 0; height: 100%; display: grid; grid-template-rows: 20px minmax(0, 1fr) 18px; justify-items: center; gap: 4px; }
.member-stat-values { width: 100%; display: flex; justify-content: center; gap: 9px; color: var(--color-text-secondary); font-size: 10px; font-weight: var(--font-weight-semibold); white-space: nowrap; }
.member-stat-values span { display: inline-flex; align-items: baseline; gap: 1px; }
.member-stat-values b { color: var(--color-text-primary); font-size: 13px; font-weight: var(--font-weight-bold); }
.member-stat-bars { width: min(58px, 100%); height: 100%; display: flex; align-items: end; justify-content: center; gap: 7px; padding: 0; background: transparent; }
.member-bar { width: 17px; height: var(--bar-height); min-height: 0; display: block; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--member-color), var(--member-color-soft)); box-shadow: inset 1px 1px 2px var(--chart-highlight), 0 2px 5px rgba(60, 45, 30, .09); }
.member-bar.recipe { opacity: .72; }
.member-stat:nth-child(1) { --member-color: var(--chart-member-4); --member-color-soft: var(--chart-member-4-soft); }
.member-stat:nth-child(2) { --member-color: var(--chart-member-1); --member-color-soft: var(--chart-member-1-soft); }
.member-stat:nth-child(3) { --member-color: var(--chart-member-2); --member-color-soft: var(--chart-member-2-soft); }
.member-stat:nth-child(4) { --member-color: var(--chart-member-3); --member-color-soft: var(--chart-member-3-soft); }
.member-stat > strong { max-width: 100%; overflow: hidden; color: var(--color-text-primary); font-size: var(--font-size-caption); text-overflow: ellipsis; white-space: nowrap; }
.member-stat-legend { display: flex; justify-content: center; gap: 14px; margin-top: 8px; color: var(--color-text-muted); font-size: var(--font-size-caption); }
.member-stat-legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; border-radius: var(--radius-pill); background: var(--color-brand); }
.legend-dot.recipe { opacity: .55; }

.home-leaderboard-empty,
.home-leaderboard p {
  margin: 3px 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  line-height: var(--line-height-normal);
}

.home-show-more {
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  color: var(--color-brand-strong);
  background: var(--color-surface-raised);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-bold);
}

.home-show-more span {
  margin-left: 4px;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

:root[data-theme="dark"] .home-shell .home-header {
  background: var(--color-bg);
}

:root[data-theme="dark"] .home-shell .home-stats button.active {
  color: var(--primary-text);
  background: var(--color-brand);
}

/* Phase 7.3: compact detail actions and one-tap cooking completion. */
.share-status-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.share-card-actions {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.detail-favorite-button {
  min-height: 30px;
  padding: 3px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-brand-strong);
  background: transparent;
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.cook-completion-card {
  padding: 14px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface-raised);
}

.cook-completion-card strong {
  color: var(--color-text-primary);
  font-size: var(--font-size-card-title);
}

.cook-completion-card small {
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
}

.cook-complete-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--primary-text);
  background: var(--color-brand);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-bold);
}

.cook-complete-button.completed,
.cook-complete-button:disabled.completed {
  color: var(--color-text-secondary);
  background: var(--color-surface-muted);
  cursor: default;
}

.detail-content > .image-area + .hidden-input + .recipe-section {
  margin-top: var(--space-2);
}

:root[data-theme="dark"] .detail-favorite-button {
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

:root[data-theme="dark"] .cook-complete-button.completed,
:root[data-theme="dark"] .cook-complete-button:disabled.completed {
  color: var(--color-text-secondary);
  background: var(--color-surface-muted);
}

@media (max-width: 360px) {
  .share-card-actions { gap: 5px; }
  .detail-favorite-button { padding-left: 7px; padding-right: 7px; font-size: 11px; }
}

@media (max-width: 360px) {
  .home-shell .home-header,
  .home-shell .recipe-panel { padding-left: 12px; padding-right: 12px; }
  .home-search-row { grid-template-columns: minmax(80px, 30fr) minmax(0, 70fr); gap: 5px; }
  .home-shell .home-stats { gap: 3px; }
  .home-shell .home-stats button { padding-left: 2px; padding-right: 2px; font-size: 11px; }
  .home-search-row .category-nav button { padding-left: 6px; padding-right: 6px; font-size: 11px; }
  .home-shell .recipe-list { gap: 10px 8px; }
  .member-stat-chart { gap: 3px; }
  .member-stat-bars { width: 46px; gap: 4px; }
  .member-bar { width: 14px; }
  .member-stat-values { gap: 4px; font-size: 9px; }
  .member-stat-values b { font-size: 11px; }
  .family-stats-panel { padding-inline: 10px; }
  .annual-trend-panel { padding-inline: 10px; }
  .annual-trend-legend { gap: 8px 10px; }
}
