:root {
      --paper: #f4f0e8;
      --paper-2: #ebe5db;
      --white: #fffdf9;
      --ink: #202722;
      --muted: #667069;
      --deep: #263b33;
      --deep-2: #172820;
      --accent: #b56f55;
      --line: #d8d0c4;
      --focus: #2f6f61;
      --anger: #b85c4d;
      --fear: #74558d;
      --sad: #47738c;
      --joy: #9a761f;
      --love: #a45d73;
      --radius: 8px;
      --shadow: 0 14px 38px rgba(32, 39, 34, .08);
    }

    * { box-sizing: border-box; }
    .is-hidden { display: none !important; }
    html { color-scheme: light; }
    body {
      margin: 0;
      min-width: 320px;
      background: var(--paper);
      color: var(--ink);
      font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    button, input, textarea { font: inherit; }
    button { color: inherit; }
    button:focus-visible, input:focus-visible, textarea:focus-visible {
      outline: 3px solid rgba(47, 111, 97, .25);
      outline-offset: 2px;
    }
    .app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
    .sidebar {
      position: sticky;
      top: 0;
      height: 100vh;
      padding: 24px 18px;
      background: var(--deep-2);
      color: #e7eee9;
      display: flex;
      flex-direction: column;
    }
    .brand { display: flex; align-items: center; gap: 11px; margin: 0 5px 34px; }
    .brand-mark {
      width: 42px;
      height: 42px;
      flex: 0 0 42px;
      border-radius: 50%;
      background: var(--paper);
      display: grid;
      place-items: center;
      color: var(--deep);
      font: 700 14px Georgia, serif;
    }
    .brand strong { display: block; font-size: .92rem; }
    .brand small { display: block; color: #9eada5; font-size: .69rem; margin-top: 2px; }
    .side-nav { display: grid; gap: 6px; }
    .side-nav button {
      border: 0;
      background: transparent;
      color: #c5d0ca;
      text-align: left;
      padding: 12px 13px;
      border-radius: 7px;
      cursor: pointer;
      font-weight: 650;
    }
    .side-nav button[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; }
    .side-nav .nav-count {
      float: right;
      min-width: 23px;
      padding: 1px 6px;
      border-radius: 10px;
      background: rgba(255, 255, 255, .12);
      text-align: center;
      font-size: .72rem;
    }
    .privacy-state {
      margin-top: auto;
      padding: 14px 12px;
      border-top: 1px solid rgba(255, 255, 255, .12);
      color: #aebbb4;
      font-size: .76rem;
    }
    .privacy-state strong { display: block; color: #eef3f0; margin-bottom: 4px; }
    .main { min-width: 0; }
    .topbar {
      min-height: 72px;
      padding: 0 34px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      background: rgba(244, 240, 232, .94);
      position: sticky;
      top: 0;
      z-index: 10;
      backdrop-filter: blur(12px);
    }
    .mobile-brand { display: none; font-weight: 800; }
    .today { font-size: .82rem; color: var(--muted); }
    .user-menu { display: flex; align-items: center; gap: 10px; font-size: .84rem; font-weight: 750; }
    .logout-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 7px 2px; font-size: .78rem; }
    .logout-button:hover { color: var(--deep); }
    .avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      color: #fff;
      background: var(--accent);
      font-size: .74rem;
    }
    .content { width: min(100% - 64px, 1380px); margin: 0 auto; padding: 38px 0 72px; }
    .page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
    .page-head h1 { margin: 0; font: 600 clamp(2rem, 4vw, 3.35rem)/1.03 Georgia, serif; letter-spacing: 0; }
    .page-head p { margin: 8px 0 0; color: var(--muted); }
    .compact-page-head { justify-content: flex-end; margin-bottom: 14px; }
    .mode-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); }
    .mode-switch button { border: 0; background: transparent; border-radius: 5px; padding: 8px 12px; cursor: pointer; font-size: .8rem; }
    .mode-switch button.is-active { background: var(--white); box-shadow: 0 2px 8px rgba(32, 39, 34, .08); font-weight: 750; }
    .workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; }
    .entry-panel, .dictionary, .history {
      border: 1px solid var(--line);
      background: rgba(255, 253, 249, .82);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }
    .entry-panel { overflow: hidden; }
    .entry-meta {
      display: flex;
      gap: 14px;
      align-items: center;
      justify-content: space-between;
      padding: 18px 22px;
      border-bottom: 1px solid var(--line);
      background: rgba(235, 229, 219, .48);
    }
    .date-time { display: flex; gap: 8px; align-items: center; }
    .date-time input {
      width: 142px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--white);
      padding: 8px 10px;
    }
    .date-time input[type="time"] { width: 105px; }
    .save-state { color: var(--muted); font-size: .74rem; }
    .progress { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
    .progress button {
      position: relative;
      min-height: 52px;
      padding: 10px 6px;
      border: 0;
      border-right: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font-size: .76rem;
    }
    .progress button:last-child { border-right: 0; }
    .progress button.is-active { color: var(--deep); font-weight: 800; background: var(--white); }
    .progress button.is-active::after {
      content: "";
      position: absolute;
      left: 16px;
      right: 16px;
      bottom: 0;
      height: 3px;
      background: var(--accent);
    }
    .progress span { display: block; margin-bottom: 2px; font-size: .68rem; color: var(--accent); }
    .form-body { padding: 26px 28px 30px; }
    .step { display: none; min-height: 390px; }
    .step.is-active { display: block; }
    .step h2 { margin: 0 0 7px; font: 600 1.55rem/1.15 Georgia, serif; letter-spacing: 0; }
    .step-intro { margin: 0 0 24px; color: var(--muted); font-size: .9rem; max-width: 700px; }
    .field-label { display: block; margin: 0 0 8px; font-weight: 800; font-size: .83rem; }
    .textarea, .text-input {
      width: 100%;
      border: 1px solid var(--line);
      background: var(--white);
      border-radius: 7px;
      padding: 14px 15px;
      color: var(--ink);
    }
    .textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
    .textarea::placeholder, .text-input::placeholder { color: #939a95; }
    .hint-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
    .hint-chip, .emotion-word, .body-chip {
      border: 1px solid var(--line);
      background: transparent;
      border-radius: 999px;
      padding: 8px 11px;
      cursor: pointer;
      font-size: .78rem;
    }
    .hint-chip:hover, .body-chip:hover { border-color: var(--sage, #72847a); background: var(--paper-2); }
    .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .emotion-selection-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 8px; background: var(--white); }
    .emotion-selection-status strong { color: var(--deep); font-size: .86rem; }
    .emotion-selection-status > span { color: var(--muted); font-size: .76rem; text-align: right; }
    .emotion-selection-status.is-complete { border-color: var(--focus); background: rgba(47, 111, 97, .08); }
    .emotion-selection-status.is-complete strong { color: var(--focus); }
    .emotion-picks { min-height: 50px; display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
    .empty-pick { width: 100%; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .84rem; padding: 12px; }
    .emotion-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; border: 2px solid var(--deep); background: var(--deep); color: #fff; border-radius: 999px; padding: 6px 10px 6px 7px; cursor: pointer; font-size: .82rem; font-weight: 800; box-shadow: 0 4px 12px rgba(38, 59, 51, .16); }
    .emotion-pick-number { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--deep); font-size: .72rem; }
    .emotion-pick-remove { margin-left: 2px; font-size: 1.1rem; line-height: 1; opacity: .8; }
    .range-wrap { margin: 19px 0 24px; padding-top: 18px; border-top: 1px solid var(--line); }
    .range-line { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; }
    .range-line output { min-width: 46px; font-weight: 850; color: var(--deep); text-align: right; }
    input[type="range"] { width: 100%; accent-color: var(--accent); }
    .segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .segmented button {
      min-height: 48px;
      border: 1px solid var(--line);
      background: var(--white);
      border-radius: 7px;
      cursor: pointer;
      font-weight: 700;
      font-size: .82rem;
    }
    .segmented button[aria-pressed="true"] { border-color: var(--deep); background: var(--deep); color: #fff; }
    .body-selection-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 10px 13px; border: 2px solid var(--line); border-radius: 8px; background: var(--white); }
    .body-selection-status strong { color: var(--deep); font-size: .86rem; }
    .body-selection-status > span { color: var(--muted); font-size: .76rem; }
    .body-selection-status.has-selection { border-color: var(--focus); background: rgba(47, 111, 97, .08); }
    .body-picks { min-height: 46px; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
    .body-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; border: 2px solid var(--focus); border-radius: 999px; background: var(--focus); color: #fff; padding: 6px 10px 6px 12px; cursor: pointer; font-size: .8rem; font-weight: 800; }
    .body-pick-remove { font-size: 1.05rem; line-height: 1; opacity: .82; }
    .body-picker { width: min(92vw, 760px); max-height: min(82vh, 720px); margin: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); padding: 0; box-shadow: 0 24px 70px rgba(23, 40, 32, .28); overflow: auto; }
    .body-picker::backdrop { background: rgba(23, 40, 32, .48); backdrop-filter: blur(3px); }
    .body-picker-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .97); backdrop-filter: blur(10px); }
    .body-picker-head h3 { margin: 0; font: 600 1.35rem/1.15 Georgia, serif; }
    .body-picker-head small { display: block; margin-top: 3px; color: var(--muted); }
    .body-picker-close { min-height: 38px; border: 1px solid var(--deep); border-radius: 7px; background: var(--deep); color: #fff; padding: 7px 12px; cursor: pointer; font-weight: 800; }
    .body-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 18px; }
    .body-chip { min-height: 44px; border-radius: 8px; background: var(--white); }
    .body-chip.is-selected { border: 2px solid var(--focus); background: var(--focus); color: #fff; padding: 7px 10px; font-weight: 800; box-shadow: 0 3px 10px rgba(47, 111, 97, .18); }
    .step-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 27px; }
    .button {
      min-height: 44px;
      border: 1px solid var(--deep);
      border-radius: 7px;
      background: var(--deep);
      color: #fff;
      padding: 10px 17px;
      font-weight: 800;
      cursor: pointer;
    }
    .button:hover { background: var(--deep-2); }
    .button.secondary { background: transparent; color: var(--deep); border-color: var(--line); }
    .button.secondary:hover { background: var(--paper-2); }
    .button:disabled { opacity: .45; cursor: not-allowed; }
    .dictionary { padding: 20px; position: sticky; top: 96px; }
    .dictionary-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
    .dictionary-title-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; width: 100%; }
    .dictionary h2 { margin: 0; font: 600 1.35rem/1.15 Georgia, serif; letter-spacing: 0; }
    .dictionary small { color: var(--muted); }
    .dictionary-close, .open-dictionary { display: none; }
    .search { width: 100%; border: 1px solid var(--line); background: var(--white); border-radius: 7px; padding: 10px 12px; }
    .family-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 14px 0 12px; }
    .family-tabs button {
      border: 1px solid var(--line);
      border-radius: 999px;
      background: transparent;
      min-width: 0;
      padding: 7px 4px;
      cursor: pointer;
      font-size: .68rem;
      font-weight: 750;
    }
    .family-tabs button.is-active { background: var(--family-color, var(--deep)); color: #fff; border-color: transparent; }
    .emotion-list { display: flex; flex-wrap: wrap; gap: 7px; max-height: 352px; overflow-y: auto; padding: 3px 3px 8px 0; }
    .emotion-word { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); padding: 7px 11px; cursor: pointer; font-size: .78rem; }
    .emotion-word:hover { border-color: var(--family-color, var(--deep)); color: var(--family-color, var(--deep)); }
    .emotion-word.is-selected { border: 2px solid var(--family-color, var(--deep)); background: var(--family-color, var(--deep)); color: #fff; padding: 6px 10px; font-weight: 850; box-shadow: 0 3px 10px rgba(32, 39, 34, .18); }
    .emotion-word:disabled:not(.is-selected) { opacity: .34; cursor: not-allowed; filter: grayscale(.5); }
    .emotion-check { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--family-color, var(--deep)); font-size: .72rem; }
    .dictionary-note { margin: 15px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
    .history { margin-top: 30px; box-shadow: none; overflow: hidden; }
    .history-head { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
    .history h2 { margin: 0; font: 600 1.45rem/1.1 Georgia, serif; letter-spacing: 0; }
    .history table { width: 100%; border-collapse: collapse; }
    .history th, .history td { padding: 15px 20px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
    .history th { background: rgba(235, 229, 219, .45); color: var(--muted); font-size: .7rem; text-transform: uppercase; font-weight: 850; }
    .history td { font-size: .86rem; }
    .history tr:last-child td { border-bottom: 0; }
    .entry-situation { margin-bottom: 8px; }
    .history details summary { width: fit-content; color: var(--deep); cursor: pointer; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
    .entry-details { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--paper); border-radius: 0 7px 7px 0; }
    .entry-details p { margin: 0 0 8px; }
    .entry-details p:last-child { margin-bottom: 0; }
    .feeling-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--dot, var(--accent)); }
    .entry-preview { color: var(--muted); max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .desktop-only { display: table-cell; }
    .toast {
      position: fixed;
      right: 24px;
      bottom: 24px;
      z-index: 30;
      max-width: 330px;
      background: var(--deep-2);
      color: #fff;
      border-radius: 7px;
      padding: 14px 16px;
      box-shadow: var(--shadow);
      transform: translateY(18px);
      opacity: 0;
      pointer-events: none;
      transition: .25s ease;
      font-size: .84rem;
    }
    .toast.is-visible { transform: none; opacity: 1; }
    .install-banner {
      position: fixed;
      left: 50%;
      bottom: max(18px, env(safe-area-inset-bottom));
      z-index: 55;
      width: min(calc(100% - 28px), 720px);
      transform: translateX(-50%);
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto auto;
      align-items: center;
      gap: 12px;
      border: 1px solid rgba(255, 255, 255, .14);
      border-radius: 12px;
      background: var(--deep-2);
      color: #fff;
      padding: 12px;
      box-shadow: 0 18px 48px rgba(23, 40, 32, .28);
    }
    .install-app-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--paper); color: var(--deep); font: 700 .8rem Georgia, serif; }
    .install-app-copy { min-width: 0; }
    .install-app-copy strong, .install-app-copy span { display: block; }
    .install-app-copy strong { font-size: .88rem; }
    .install-app-copy span { margin-top: 2px; color: #b9c6bf; font-size: .74rem; }
    .install-app-button { min-height: 38px; border: 0; border-radius: 7px; background: var(--paper); color: var(--deep); padding: 8px 13px; cursor: pointer; font-weight: 850; }
    .install-dismiss { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #b9c6bf; cursor: pointer; font-size: 1.25rem; line-height: 1; }
    .install-dismiss:hover { background: rgba(255, 255, 255, .1); color: #fff; }
    .install-dialog {
      border: 0;
      border-radius: 14px;
      padding: 0;
      width: min(calc(100% - 32px), 460px);
      max-height: min(88vh, 640px);
      box-shadow: 0 24px 60px rgba(23, 40, 32, .32);
      background: var(--card, #fff);
      color: var(--deep);
    }
    .install-dialog[open] { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; }
    .install-dialog::backdrop { background: rgba(23, 40, 32, .55); }
    .install-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
    .install-dialog-head h2 { margin: 0; font-size: 1.02rem; }
    .install-dialog-close { width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: var(--paper); color: var(--deep); cursor: pointer; font-size: 1.2rem; line-height: 1; }
    .install-dialog-close:hover { background: var(--accent-soft, #e7e1d0); }
    .install-steps { max-height: calc(min(88vh, 640px) - 58px); padding: 14px 20px 20px; overflow-y: auto; }
    .install-steps-lead { margin: 0 0 12px; font-size: .86rem; color: var(--muted); }
    .install-steps-warning { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: #fff3d6; color: #6a5115; font-size: .8rem; }
    .install-steps-list { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 9px; font-size: .88rem; }
    .install-steps-list li { padding-left: 2px; }
    .install-copy-link { width: 100%; min-height: 42px; border: 1px solid var(--line, #d8d2c2); border-radius: 8px; background: var(--paper); color: var(--deep); cursor: pointer; font-weight: 700; font-size: .84rem; }
    .install-apk { margin-top: 4px; padding-top: 14px; border-top: 1px dashed var(--line, #d8d2c2); }
    .install-apk strong { display: block; margin-bottom: 6px; font-size: .86rem; }
    .install-apk p { margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
    .install-apk-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: .84rem; text-decoration: none; }
    @media (max-width: 620px) {
      .install-dialog { width: calc(100% - 20px); }
    }
    .demo-banner {
      display: none;
      margin-bottom: 18px;
      padding: 10px 13px;
      border: 1px solid #d9c99c;
      border-radius: 7px;
      background: #fff8df;
      color: #67551d;
      font-size: .78rem;
    }

    .auth-shell {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 28px 16px;
      background: var(--paper);
    }
    .auth-card {
      width: min(100%, 460px);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: var(--white);
      box-shadow: var(--shadow);
      padding: clamp(24px, 6vw, 38px);
    }
    .auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
    .auth-brand > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--deep); color: #fff; font: 700 .8rem Georgia, serif; }
    .auth-brand strong, .auth-brand small { display: block; }
    .auth-brand small { margin-top: 2px; color: var(--muted); font-size: .73rem; }
    .auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 24px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); }
    .auth-tabs button { border: 0; border-radius: 5px; background: transparent; padding: 9px 8px; cursor: pointer; font-size: .8rem; }
    .auth-tabs button.is-active { background: var(--white); box-shadow: 0 2px 8px rgba(32,39,34,.08); font-weight: 800; }
    .auth-form { display: grid; gap: 15px; }
    .auth-form h1 { margin: 0 0 3px; font: 600 2rem/1.05 Georgia, serif; letter-spacing: 0; }
    .auth-form p { margin: 0; color: var(--muted); font-size: .88rem; }
    .auth-form .session-note { padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-size: .74rem; line-height: 1.4; }
    .auth-form label:not(.consent-check) { display: grid; gap: 7px; font-size: .8rem; font-weight: 800; }
    .auth-form input[type="email"], .auth-form input[type="password"] { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 10px 12px; }
    .auth-form small { color: var(--muted); font-weight: 500; }
    .consent-check { display: grid; grid-template-columns: 18px 1fr; gap: 9px; align-items: start; color: var(--muted); font-size: .76rem; }
    .consent-check input { margin-top: 3px; }
    .consent-check a { color: var(--deep); text-decoration: underline; text-underline-offset: 2px; }
    .text-button { border: 0; background: transparent; color: var(--deep); cursor: pointer; padding: 4px; font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
    .auth-message { min-height: 24px; margin-top: 16px; font-size: .82rem; color: var(--muted); }
    .auth-message.is-error { color: #9b3f35; }
    .auth-message.is-success { color: var(--focus); }

    .archive-layout { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: 380px; }
    .day-list { border-right: 1px solid var(--line); padding: 14px; display: grid; align-content: start; gap: 7px; }
    .day-list button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--white); padding: 10px 11px; cursor: pointer; text-align: left; font-size: .79rem; }
    .day-list button.is-active { border-color: var(--deep); background: var(--deep); color: #fff; }
    .day-list small { opacity: .72; }
    .day-empty { padding: 14px 10px; color: var(--muted); font-size: .82rem; }
    .day-entries { min-width: 0; }
    .day-entries h3 { margin: 0; padding: 17px 20px; border-bottom: 1px solid var(--line); font: 600 1.18rem/1.2 Georgia, serif; letter-spacing: 0; }
    .history-head p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
    .mobile-day-picker { display: none; }

    @media (max-width: 1080px) {
      .app-shell { grid-template-columns: 188px minmax(0, 1fr); }
      .workspace { grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; }
      .content { width: min(100% - 40px, 1180px); }
      .form-body { padding-inline: 22px; }
    }

    @media (max-width: 820px) {
      .app-shell { display: block; }
      .sidebar { display: none; }
      .topbar { min-height: 56px; padding: 0 16px; }
      .mobile-brand { display: block; }
      .today { display: none; }
      .content { width: min(100% - 24px, 720px); padding: 12px 0 28px; }
      .page-head { align-items: start; flex-direction: column; }
      .page-head h1 { font-size: 2.2rem; }
      .mode-switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
      .compact-page-head { margin-bottom: 10px; }
      .mode-switch button { min-height: 40px; font-size: .86rem; font-weight: 750; }
      .demo-banner { display: block; }
      .workspace { display: block; }
      .dictionary { position: static; margin-top: 16px; }
      .dictionary h2 { font-size: 1.2rem; }
      .open-dictionary { display: inline-flex; margin: 2px 0 18px; }
      .dictionary {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        width: 100%;
        max-height: 78vh;
        margin: 0;
        border-radius: 8px 8px 0 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--white);
        transform: translateY(105%);
        opacity: 0;
        pointer-events: none;
        transition: transform .25s ease, opacity .25s ease;
        box-shadow: 0 -18px 50px rgba(23, 40, 32, .2);
      }
      .dictionary.is-open { transform: none; opacity: 1; pointer-events: auto; }
      .dictionary-close {
        display: inline-flex;
        min-height: 36px;
        align-items: center;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--white);
        padding: 6px 10px;
        cursor: pointer;
        font-weight: 800;
        font-size: .76rem;
      }
      .step { min-height: auto; }
      .history { margin-top: 20px; }
      .archive-layout { grid-template-columns: 1fr; }
      .day-list { display: none; }
      .mobile-day-picker { display: grid; gap: 7px; padding: 16px; border-bottom: 1px solid var(--line); background: rgba(235, 229, 219, .45); color: var(--deep); font-size: .8rem; font-weight: 850; }
      .mobile-day-picker select { width: 100%; min-height: 48px; border: 2px solid var(--deep); border-radius: 8px; background: var(--white); color: var(--ink); padding: 9px 38px 9px 12px; font-weight: 750; }
      .day-entries h3 { position: sticky; top: 56px; z-index: 4; background: var(--white); }
    }

    @media (max-width: 560px) {
      .user-menu > span { display: none; }
      .page-head { margin-bottom: 9px; }
      .entry-meta { align-items: start; padding: 9px 11px; }
      .date-time { flex-wrap: wrap; }
      .date-time input { width: 132px; padding-block: 6px; }
      .date-time input[type="time"] { width: 94px; }
      .save-state { display: none; }
      .progress { grid-template-columns: repeat(5, minmax(0, 1fr)); }
      .progress button { min-height: 46px; padding: 5px 2px; font-size: .68rem; }
      .progress span { margin-bottom: 0; }
      .form-body { padding: 14px 14px 16px; }
      .step h2 { font-size: 1.38rem; }
      .step-intro { margin-bottom: 11px; }
      .textarea, .text-input { padding: 10px 12px; }
      .textarea { min-height: 96px; }
      .hint-row { gap: 6px; margin-top: 8px; }
      .hint-chip { padding-block: 6px; }
      .field-label { margin-bottom: 5px; }
      .range-wrap { margin: 12px 0 14px; padding-top: 11px; }
      .two-col { grid-template-columns: 1fr; gap: 16px; }
      .segmented { grid-template-columns: 1fr; }
      .step-actions { position: sticky; bottom: 0; margin: 14px -14px -16px; padding: 8px 14px; background: rgba(255, 253, 249, .96); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
      .step-actions .button { flex: 1; }
      .dictionary { padding: 17px 15px; }
      .dictionary-head { position: sticky; top: -17px; z-index: 3; margin: -17px -15px 14px; padding: 15px; border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .97); backdrop-filter: blur(10px); }
      .emotion-list { max-height: 260px; }
      .emotion-selection-status { align-items: flex-start; flex-direction: column; gap: 3px; margin-bottom: 10px; padding: 8px 10px; }
      .emotion-selection-status strong { font-size: .94rem; }
      .emotion-selection-status > span { text-align: left; }
      .emotion-picks, .body-picks { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 3px; }
      .emotion-pick { width: auto; flex: 0 0 auto; max-width: 84vw; border-radius: 8px; justify-content: flex-start; }
      .emotion-pick-remove { margin-left: auto; }
      .emotion-word { min-height: 44px; padding: 9px 13px; font-size: .82rem; }
      .emotion-word.is-selected { padding: 8px 12px; }
      .emotion-picks { min-height: 42px; margin-bottom: 10px; gap: 6px; }
      .body-selection-status { align-items: flex-start; flex-direction: column; gap: 2px; margin-bottom: 9px; padding: 8px 10px; }
      .body-picks { min-height: 40px; margin-bottom: 9px; gap: 6px; }
      .body-pick { width: auto; flex: 0 0 auto; max-width: 84vw; min-height: 36px; justify-content: space-between; border-radius: 8px; }
      .body-picker { width: 100%; max-width: none; max-height: 82vh; margin: auto 0 0; border-width: 1px 0 0; border-radius: 12px 12px 0 0; }
      .body-picker-head { padding: 13px 14px; }
      .body-picker-head h3 { font-size: 1.2rem; }
      .body-map { grid-template-columns: 1fr 1fr; gap: 7px; padding: 12px; }
      .body-chip { min-height: 42px; padding: 7px 8px; }
      .history-head { padding: 16px; }
      .history-head { align-items: stretch; flex-direction: column; }
      .history-head .button { width: 100%; }
      .desktop-only { display: none; }
      .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
      .history table, .history tbody { display: block; width: 100%; }
      .history thead { display: none; }
      .history tr { display: block; margin: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); box-shadow: 0 5px 16px rgba(32, 39, 34, .06); overflow: hidden; }
      .history td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; width: 100%; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: .85rem; }
      .history td.desktop-only { display: grid; }
      .history td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 850; text-transform: uppercase; }
      .history td:last-child { display: block; border-bottom: 0; padding: 14px; }
      .history td:last-child::before { display: block; margin-bottom: 7px; }
      .history details summary { display: block; width: 100%; margin-top: 12px; border: 1px solid var(--deep); border-radius: 7px; background: var(--deep); color: #fff; padding: 10px 12px; text-align: center; text-decoration: none; }
      .history .entry-details { font-size: .82rem; }
      .auth-card { padding: 22px 18px; }
      .install-banner { grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; bottom: max(10px, env(safe-area-inset-bottom)); padding: 10px; }
      .install-app-icon { width: 38px; height: 38px; }
      .install-app-copy span { display: none; }
      .install-app-button { min-height: 36px; padding-inline: 11px; }
      .install-dismiss { position: absolute; top: -10px; right: -5px; background: var(--deep); color: #fff; box-shadow: 0 3px 10px rgba(23, 40, 32, .25); }
    }

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