  :root {
    --cream: #ffffff;
    --cream-dark: #f4f4f4;
    --ink: #111111;
    --ink-light: #444444;
    --ink-faint: #999999;
    --accent: #c9a84c;
    --accent-light: #f5ecd0;
    --accent-dark: #a07a28;
    --vermillion: #c9a84c;
    --vermillion-light: #d4b86a;
    --vermillion-pale: #fdf8ec;
    --gold: #c9a84c;
    --sage: #555555;
    --paper: #ffffff;
    --border: #e8e8e8;
    --shadow: rgba(0,0,0,0.06);
    --nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  /* ===== APP SHELL ===== */
  #app { display: flex; flex-direction: column; height: 100dvh; }

  .screen {
    display: none;
    flex: 1;
    /* overflow-y: auto; */
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    -webkit-overflow-scrolling: touch;
  }
  .screen.active { display: flex; flex-direction: column; }

  /* ===== BOTTOM NAV ===== */
  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--paper);
    border-top: 1.5px solid var(--border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -4px 20px var(--shadow);
  }
  .nav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px;
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); transition: color 0.2s;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px; font-weight: 500;
    padding-top: 8px;
  }
  .nav-btn.active { color: var(--accent); }
  .nav-btn svg { width: 22px; height: 22px; }

  /* ===== HEADERS ===== */
  .screen-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--cream);
    border-bottom: 1.5px solid var(--border);
    padding: 16px 20px 14px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .screen-title {
    font-family: 'DM Serif Display', serif;
    font-size: 20px; font-weight: 400;
    color: var(--ink); letter-spacing: 0.01em;
  }
  .screen-subtitle { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }

  /* ===== BUTTONS ===== */
  .btn-primary {
    background: var(--ink); color: white;
    border: none; border-radius: 10px; padding: 12px 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px; font-weight: 500; cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.03em;
  }
  .btn-primary:active { background: #333; transform: scale(0.98); }

  .btn-secondary {
    background: white; color: var(--ink);
    border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 18px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: background 0.15s;
  }
  .btn-secondary:active { background: var(--cream-dark); }

  .btn-ghost {
    background: none; border: none; cursor: pointer;
    color: var(--ink-light); padding: 6px;
    display: flex; align-items: center; gap: 4px;
    font-size: 14px; font-family: 'DM Sans', sans-serif;
  }

  .fab {
    position: fixed; bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
    right: 20px; width: 56px; height: 56px;
    background: var(--ink); color: white;
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 90; transition: transform 0.15s, box-shadow 0.15s;
    font-size: 28px; line-height: 1;
  }
  .fab:active { transform: scale(0.93); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

  /* ===== HOME SCREEN ===== */
  .home-content { padding: 20px; display: flex; flex-direction: column; gap: 24px; }

  .random-card {
    background: #881337;
    border-radius: 20px; padding: 28px;
    color: white; position: relative; overflow: hidden;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(136,19,55,0.3);
  }
  .random-card::before { display: none; }
  .random-card::after { display: none; }
  .random-card-svg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none;
  }
  .random-label {
    font-size: 11px; letter-spacing: 0.18em;
    color: rgba(255,255,255,0.75); margin-bottom: 10px;
    text-transform: uppercase; font-weight: 500;
    position: relative; z-index: 1;
  }
  .random-name {
    font-family: 'DM Serif Display', serif;
    font-size: 30px; font-weight: 400;
    line-height: 1.3; margin-bottom: 22px;
    position: relative; z-index: 1;
    color: white;
  }
  .random-actions { display: flex; gap: 10px; position: relative; z-index: 1; }
  .random-btn {
    background: rgba(255,255,255,0.18); color: white;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 8px; padding: 8px 16px;
    font-size: 13px; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.15s;
    display: flex; align-items: center; gap: 5px;
  }
  .random-btn:active { background: rgba(255,255,255,0.3); }

  .section-label {
    font-size: 11px; letter-spacing: 0.12em;
    color: var(--ink-faint); font-weight: 500;
    text-transform: uppercase; margin-bottom: 12px;
  }

  .recent-list { display: flex; flex-direction: column; gap: 8px; }
  .recent-item {
    background: white; border-radius: 14px;
    padding: 16px 18px;
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; transition: border-color 0.15s;
  }
  .recent-item:active { border-color: var(--accent); background: var(--accent-light); }
  .recent-item-name {
    font-family: 'DM Serif Display', serif;
    font-size: 17px; font-weight: 400; color: var(--ink);
  }
  .recent-item-date { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
  .recent-item-arrow { color: var(--border); }

  .empty-state {
    text-align: center; padding: 40px 20px;
    color: var(--ink-faint);
  }
  .empty-state-icon { font-size: 48px; margin-bottom: 12px; }
  .empty-state-text { font-size: 15px; line-height: 1.6; }
  .empty-state-hint { font-size: 13px; color: var(--ink-faint); margin-top: 8px; }

  /* ===== RECIPE LIST ===== */
  .search-bar-wrap { padding: 12px 16px; background: var(--cream); }
  .search-bar {
    width: 100%; padding: 11px 16px 11px 40px;
    border: 1.5px solid var(--border); border-radius: 10px;
    background: white; font-size: 15px; color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    outline: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a89880' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
  }
  .search-bar:focus { border-color: var(--accent); }

  .tag-filter-wrap {
    padding: 2px 16px; display: flex; gap: 8px;
    overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tag-filter-wrap::-webkit-scrollbar { display: none; }
  .tag-chip {
    white-space: nowrap; padding: 9px 14px;
    border-radius: 20px; font-size: 13px;
    border: 1px solid var(--border); background-color: white;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    color: var(--ink-light);
    flex-shrink: 0;
    line-height: 1;
    display: inline-block;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
  }
  .tag-chip.active {
    background-color: var(--ink); color: white !important;
    -webkit-text-fill-color: white;
    border-color: var(--ink);
  }

  .recipe-list { padding: 8px 16px; display: flex; flex-direction: column; gap: 10px; }
  .recipe-card {
    background: white; border-radius: 14px;
    border: 1.5px solid var(--border);
    padding: 16px; cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
  }
  .recipe-card:active { border-color: var(--accent); transform: scale(0.99); }
  .recipe-card-name {
    font-family: 'DM Serif Display', serif;
    font-size: 18px; font-weight: 400; margin-bottom: 8px;
  }
  .recipe-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .tag-badge {
    background: var(--accent-light); color: var(--accent-dark);
    padding: 4px 10px; border-radius: 20px; font-size: 11px;
    font-weight: 500; white-space: nowrap; flex-shrink: 0;
    line-height: 1.4; display: inline-block;
    border: 1px solid rgba(160,122,40,0.15);
  }
  .recipe-card-meta { font-size: 12px; color: var(--ink-faint); }

  /* コンパクト表示（タイトルのみ） */
  .recipe-list.compact { gap: 10px; }
  .recipe-card.compact-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-radius: 10px;
  }
  .recipe-card.compact-item .recipe-card-name { margin-bottom: 0; font-size: 15px; }
  .recipe-card.compact-item .compact-arrow { color: var(--border); flex-shrink: 0; }

  /* ===== RECIPE DETAIL ===== */
  .detail-content { padding: 24px 20px; display: flex; flex-direction: column; gap: 24px; }
  .detail-name {
    font-family: 'DM Serif Display', serif;
    font-size: 30px; font-weight: 400; line-height: 1.3;
    color: var(--ink);
  }
  .detail-date { font-size: 13px; color: var(--ink-faint); margin-top: 6px; }

  .detail-section {}
  .detail-section-title {
    font-size: 11px; letter-spacing: 0.12em;
    color: var(--ink-faint); font-weight: 500;
    text-transform: uppercase; margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
  }

  .ingredient-list { display: flex; flex-direction: column; gap: 8px; }
  .ingredient-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 0 4px;
  }
  .ingredient-name { font-size: 15px; color: var(--ink); }
  .ingredient-amount {
    font-size: 14px; color: var(--ink-light);
    font-weight: 500; min-width: 60px; text-align: right;
  }
  .ingredient-dot {
    flex: 1; margin: 0 8px;
    border-bottom: 1px dotted var(--border);
  }

  .step-list { display: flex; flex-direction: column; gap: 12px; }
  .step-row { display: flex; gap: 12px; align-items: flex-start; }
  .step-num {
    min-width: 26px; height: 26px;
    background: var(--accent); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
  }
  .step-text { font-size: 15px; color: var(--ink); line-height: 1.6; padding-top: 3px; }

  .memo-box {
    background: var(--cream-dark); border-radius: 10px;
    padding: 14px; font-size: 14px; color: var(--ink-light);
    line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  }

  .history-list { display: flex; flex-direction: column; gap: 6px; }
  .history-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--ink-light);
    padding: 8px 12px; background: white;
    border-radius: 8px; border: 1px solid var(--border);
  }
  .history-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); flex-shrink: 0;
  }

  .cooked-btn {
    background: var(--accent); color: white;
    border: none; border-radius: 14px; padding: 18px;
    font-size: 16px; font-weight: 500; cursor: pointer;
    width: 100%; text-align: center;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.03em;
  }
  .cooked-btn:active { background: var(--accent-dark); transform: scale(0.98); }

  .detail-actions { display: flex; gap: 10px; }

  /* ===== FORM ===== */
  .form-content { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
  .form-group { display: flex; flex-direction: column; gap: 8px; }
  .form-label {
    font-size: 12px; font-weight: 500; color: var(--ink-light);
    letter-spacing: 0.08em;
  }
  .form-required { color: var(--accent); margin-left: 3px; }
  .form-input, .form-textarea {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--border); border-radius: 10px;
    font-size: 16px; color: var(--ink); background: white;
    font-family: 'DM Sans', sans-serif;
    outline: none; appearance: none;
    transition: border-color 0.15s;
  }
  .form-input:focus, .form-textarea:focus { border-color: var(--accent); }
  .form-textarea { min-height: 100px; resize: vertical; line-height: 1.6; }

  input[type="date"].form-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    box-sizing: border-box;
    display: block;
  }
  input[type="date"].form-input::-webkit-date-and-time-value {
    text-align: left;
    width: 100%;
    min-width: 100%;
  }

  .tag-input-wrap {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 10px; border: 1.5px solid var(--border);
    border-radius: 10px; background: white; min-height: 48px;
    cursor: text;
  }
  .tag-input-wrap:focus-within { border-color: var(--accent); }
  .tag-input-item {
    background: var(--accent-light); color: var(--accent-dark);
    padding: 4px 10px 4px 10px; border-radius: 20px;
    font-size: 13px; display: flex; align-items: center; gap: 5px;
  }
  .tag-remove {
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); font-size: 14px; padding: 0;
    line-height: 1; display: flex; align-items: center;
  }
  .tag-input-field {
    border: none; outline: none; font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    min-width: 80px; flex: 1; background: transparent;
    color: var(--ink);
  }

  .ingredient-rows { display: flex; flex-direction: column; gap: 8px; }
  .ingredient-input-row { display: flex; gap: 8px; align-items: center; }
  .ingredient-input-row .form-input { flex: 1; }
  .ingredient-input-row .form-input.amount { flex: 0 0 90px; }
  .remove-row-btn {
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); font-size: 20px; padding: 4px;
    line-height: 1; flex-shrink: 0;
  }
  .add-row-btn {
    background: none; border: 1.5px dashed var(--border);
    border-radius: 8px; padding: 10px;
    color: var(--ink-faint); font-size: 13px;
    cursor: pointer; width: 100%; text-align: center;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s, color 0.15s;
  }
  .add-row-btn:active { border-color: var(--accent); color: var(--accent); }

  .step-rows { display: flex; flex-direction: column; gap: 8px; }
  .step-input-row { display: flex; gap: 8px; align-items: flex-start; }
  .step-num-label {
    min-width: 26px; height: 26px; margin-top: 12px;
    background: var(--cream-dark); color: var(--ink-light);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
  }
  .step-input-row textarea {
    flex: 1; padding: 12px; border: 1.5px solid var(--border);
    border-radius: 10px; font-size: 15px; color: var(--ink);
    background: white; font-family: 'DM Sans', sans-serif;
    outline: none; resize: none; min-height: 80px; line-height: 1.5;
  }
  .step-input-row textarea:focus { border-color: var(--accent); }

  .form-actions { display: flex; gap: 10px; padding-bottom: 8px; }
  .form-actions .btn-primary { flex: 1; }

  /* ===== SETTINGS ===== */
  .settings-content { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
  .settings-section {
    background: white; border-radius: 14px;
    border: 1.5px solid var(--border); overflow: hidden;
  }
  .settings-section-title {
    font-size: 11px; letter-spacing: 0.1em; color: var(--ink-faint);
    padding: 12px 16px 8px; font-weight: 500; text-transform: uppercase;
  }
  .settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-top: 1px solid var(--cream-dark);
    cursor: pointer;
  }
  .settings-row:first-of-type { border-top: none; }
  .settings-row:active { background: var(--cream-dark); }
  .settings-row-label { font-size: 15px; color: var(--ink); }
  .settings-row-value { font-size: 14px; color: var(--ink-faint); }
  .settings-row-danger .settings-row-label { color: #cc3333; }

  .stats-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; padding: 4px 0 8px;
  }
  .stat-card {
    background: white; border-radius: 12px;
    border: 1.5px solid var(--border); padding: 16px; text-align: center;
  }
  .stat-num {
    font-family: 'DM Serif Display', serif;
    font-size: 32px; font-weight: 400; color: var(--accent);
  }
  .stat-label { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

  /* ===== TOAST ===== */
  .toast {
    position: fixed; bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: white; padding: 10px 20px;
    border-radius: 20px; font-size: 14px; z-index: 200;
    opacity: 0; transition: all 0.25s; pointer-events: none;
    white-space: nowrap;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* ===== MODAL / OVERLAY ===== */
  .overlay {
    position: fixed; inset: 0; background: rgba(26,20,16,0.5);
    z-index: 150; display: none; align-items: flex-end;
  }
  .overlay.open { display: flex; }
  .modal {
    background: white; border-radius: 20px 20px 0 0;
    padding: 24px; width: 100%;
    padding-bottom: calc(24px + var(--safe-bottom));
  }
  .modal-title {
    font-family: 'DM Serif Display', serif;
    font-size: 18px; font-weight: 400; margin-bottom: 12px;
  }
  .modal-text { font-size: 15px; color: var(--ink-light); line-height: 1.6; margin-bottom: 20px; }
  .modal-actions { display: flex; gap: 10px; }
  .modal-actions button { flex: 1; }

  /* ===== MISC ===== */
  .divider { height: 1px; background: var(--border); margin: 4px 0; }

  @media (min-width: 600px) {
    #app { max-width: 430px; margin: 0 auto; }
    .fab { right: calc(50% - 215px + 20px); }
    .toast { bottom: calc(var(--nav-height) + 20px); }
  }
