:root {
  color-scheme: light;
  --paper: #f4f3ee;
  --surface: #fffefa;
  --surface-soft: #f0f3ee;
  --ink: #202a27;
  --muted: #737d77;
  --line: #e3e6df;
  --green: #4d705b;
  --green-dark: #355643;
  --green-soft: #e3ece3;
  --coral: #d7a798;
  --danger: #9d514b;
  --shadow: 0 24px 64px rgba(41, 54, 47, 0.075);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 85% 5%, rgba(220, 232, 222, 0.52), transparent 28rem),
    linear-gradient(180deg, #f7f6f1 0%, var(--paper) 58rem);
}

button, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 3px solid #9db6a2; outline-offset: 3px; }
a { color: var(--green-dark); text-underline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell { max-width: 1220px; margin: 0 auto; padding: 0 42px 36px; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(77, 96, 83, .1); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; color: var(--green); display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-family: Georgia, "Times New Roman", serif; font-size: 21px; letter-spacing: -.035em; }
.storage-chip { display: inline-flex; align-items: center; gap: 8px; color: #456651; background: rgba(255, 254, 250, .78); border: 1px solid rgba(78, 114, 95, .14); padding: 9px 13px; border-radius: 99px; font-size: 12px; white-space: nowrap; box-shadow: 0 3px 10px rgba(41, 54, 47, .025); }
.storage-chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.intro { max-width: 840px; padding: 45px 0 31px; }
.eyebrow { margin: 0 0 12px; color: #849088; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.intro h1, .section-heading h2, .capture-copy h2, .modal h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: .01em;
}
.intro h1 { max-width: 790px; margin: 0; font-size: clamp(34px, 4.2vw, 52px); line-height: 1.18; letter-spacing: -.025em; }
.intro-copy { margin: 13px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; }

.view { animation: fade-in .25s ease-out; }
.capture-card { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr); align-items: center; gap: clamp(26px, 5vw, 70px); min-height: 410px; padding: clamp(36px, 5vw, 58px); border: 1px solid rgba(224, 226, 219, .9); border-radius: 30px; background: linear-gradient(120deg, rgba(255, 254, 250, .98) 0%, rgba(255, 254, 250, .94) 60%, rgba(248, 248, 241, .95) 100%); box-shadow: var(--shadow); overflow: hidden; }
.capture-card::before { position: absolute; content: ""; width: 300px; height: 300px; right: 2%; top: -188px; border-radius: 50%; background: rgba(229, 210, 201, .27); }
.capture-card::after { position: absolute; content: ""; width: 240px; height: 240px; left: -165px; bottom: -188px; border: 1px solid rgba(78, 114, 95, .12); border-radius: 50%; box-shadow: 0 0 0 22px rgba(78, 114, 95, .025), 0 0 0 44px rgba(78, 114, 95, .02); }
.capture-copy { position: relative; z-index: 1; max-width: 560px; }
.card-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 17px; color: #87938b; font-size: 10px; font-weight: 700; letter-spacing: .15em; }
.mode-badge { display: inline-flex; align-items: center; margin-left: 2px; padding: 5px 8px; border: 1px solid #eadbd7; border-radius: 999px; background: #fbf2ef; color: #8b594f; font-size: 9px; font-weight: 700; letter-spacing: .08em; line-height: 1.2; white-space: nowrap; }
.mode-badge[data-mode="live"] { border-color: #c8d9ca; background: #edf4ed; color: var(--green-dark); }
.mode-copy { margin: -7px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9eb6a1; }
.capture-copy h2 { margin: 0; font-size: 31px; line-height: 1.28; letter-spacing: -.018em; }
.capture-hint { max-width: 400px; margin: 9px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.capture-actions { max-width: 520px; }
.capture-action-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(145px, .85fr); gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid transparent; border-radius: 15px; cursor: pointer; text-decoration: none; transition: background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { width: 100%; min-height: 56px; padding: 14px 17px; background: var(--green); color: white; font-weight: 600; box-shadow: 0 8px 20px rgba(65, 103, 81, .18); }
.button-primary:hover { background: var(--green-dark); box-shadow: 0 10px 24px rgba(47, 82, 60, .23); }
.button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.privacy-note { margin: 11px 2px 8px; color: #707b73; font-size: 11px; line-height: 1.65; }
.button-secondary { min-height: 56px; padding: 12px 15px; border-color: #d6ded6; background: rgba(255, 255, 255, .54); color: var(--green-dark); font-size: 13px; font-weight: 600; }
.button-secondary:hover { border-color: #b9c9bb; background: #f4f7f3; }
.button-danger { min-height: 44px; padding: 10px 16px; border-color: rgba(157, 81, 75, .3); background: #fff9f8; color: var(--danger); font-size: 13px; font-weight: 600; }
.button-danger:hover { background: #fff0ed; }
.button-small { min-height: 42px; width: auto; padding: 10px 17px; font-size: 13px; }
.connection-note { display: flex; align-items: center; gap: 8px; margin: 0 0 19px; color: #69766e; font-size: 10px; line-height: 1.5; }
.connection-note::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #b98c7e; content: ""; }
.portrait-art { position: relative; display: grid; justify-items: center; align-items: center; min-height: 315px; border: 1px solid rgba(216, 222, 213, .7); border-radius: 48% 48% 42% 42% / 44% 44% 34% 34%; background: radial-gradient(ellipse at 50% 43%, rgba(255, 254, 250, .92) 0 30%, rgba(239, 242, 234, .68) 64%, rgba(227, 234, 224, .28) 100%); }
.portrait-art::before, .portrait-art::after { position: absolute; border: 1px solid rgba(78, 114, 95, .13); border-radius: 50%; content: ""; }
.portrait-art::before { width: 83%; aspect-ratio: 1; }
.portrait-art::after { width: 67%; aspect-ratio: 1; border-color: rgba(215, 167, 152, .25); }
.portrait-halo { position: absolute; width: min(246px, 76%); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 44%, #f4f2ed 0, #f2f3ee 68%, rgba(236, 239, 231, .2) 69%); }
.portrait-svg { position: relative; z-index: 1; width: min(255px, 78%); height: auto; overflow: visible; filter: drop-shadow(0 9px 10px rgba(65, 75, 66, .035)); }
.art-caption { position: absolute; bottom: 14px; z-index: 2; color: #8d998f; font-size: 9px; font-weight: 700; letter-spacing: .22em; }
.capture-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 21px 0 0; padding: 15px 0 0; border-top: 1px solid rgba(77, 96, 83, .1); list-style: none; }
.capture-facts li { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 7px; color: #67746b; font-size: 9px; line-height: 1.5; }
.fact-mark { color: #a37b6c; font-size: 8px; font-weight: 700; letter-spacing: .08em; }

.card { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 10px 34px rgba(41, 54, 47, .045); }
.composer { margin-top: 22px; padding: 28px 32px 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 7px; }
.section-heading h2 { margin: 0; font-size: 28px; line-height: 1.28; letter-spacing: -.018em; }
.compact-heading { align-items: start; margin-bottom: 23px; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 23px; line-height: 1; cursor: pointer; }
.composer label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
.composer textarea { width: 100%; resize: vertical; min-height: 116px; padding: 14px 15px; border: 1px solid #dfe3dc; border-radius: 13px; background: #fdfdfa; color: var(--ink); line-height: 1.7; }
.composer textarea::placeholder { color: #a1a7a2; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 11px; }
.log-section { margin-top: 52px; }
.text-button { padding: 9px 0; border: 0; background: transparent; color: var(--green-dark); font-size: 13px; cursor: pointer; }
.text-button span { padding-left: 4px; }
.log-list { display: grid; gap: 12px; }
.empty-state { display: grid; justify-items: center; gap: 11px; min-height: 184px; padding: 33px 18px; border: 1px dashed #d4dcd3; border-radius: 20px; color: var(--muted); text-align: center; background: linear-gradient(120deg, rgba(255, 254, 250, .7), rgba(239, 243, 235, .46)); }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #f2f2ed; color: #7c857f; }
.empty-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty-title { margin: 0; color: #59635d; font-size: 14px; font-weight: 600; }
.empty-copy { margin: 0; color: #87908a; font-size: 12px; line-height: 1.7; }
.log-entry { display: grid; grid-template-columns: 86px 1fr auto; gap: 18px; align-items: start; padding: 21px 23px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 5px 16px rgba(41, 54, 47, .025); transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.log-entry:hover { transform: translateY(-1px); border-color: #d2dbd1; box-shadow: 0 10px 26px rgba(41, 54, 47, .06); }
.entry-date { color: #68746b; font-size: 12px; line-height: 1.6; }
.entry-kind { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: 10px; font-weight: 600; }
.entry-content p { margin: 0; color: #48544d; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-delete { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #8c9690; font-size: 19px; cursor: pointer; }
.entry-delete:hover { background: #f4f3ee; color: var(--danger); }
.page-section-heading { margin: 36px 0 22px; }
.history-list { padding-bottom: 20px; }

.settings-card { display: grid; grid-template-columns: 48px 1fr; gap: 17px; align-items: start; padding: 23px 25px; margin-bottom: 13px; }
.settings-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px; background: #e7efe6; color: var(--green-dark); font-size: 22px; }
.shield-icon { background: #f2eae5; color: #a16b5d; }
.settings-card h3, .danger-zone h3 { margin: 1px 0 7px; font-size: 14px; }
.settings-card p, .danger-zone p { max-width: 740px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 25px; margin-top: 25px; border-color: #eadbd7; }
.danger-zone p { max-width: 580px; }

.tabbar { position: static; display: flex; justify-content: center; gap: 6px; width: min(420px, calc(100% - 24px)); margin: 52px auto 0; padding: 8px; border: 1px solid rgba(221, 224, 216, .9); border-radius: 21px; background: rgba(255, 254, 250, .94); box-shadow: 0 12px 35px rgba(43, 56, 49, .12); backdrop-filter: blur(18px); }
.tab-button { display: grid; justify-items: center; align-content: center; gap: 4px; min-width: 94px; min-height: 61px; border: 0; border-radius: 15px; background: transparent; color: #7c8580; font-size: 10px; cursor: pointer; }
.tab-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab-button.is-current { background: #edf2ec; color: var(--green-dark); font-weight: 700; }
main { padding-bottom: 0; }

.modal { position: fixed; width: min(480px, calc(100vw - 28px)); max-width: none; max-height: calc(100dvh - 28px); padding: 31px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 100px rgba(22, 37, 28, .22); }
.modal::backdrop { background: rgba(29, 40, 33, .38); backdrop-filter: blur(3px); }
.modal-close { position: absolute; top: 17px; right: 17px; }
.modal h2 { margin: 0 38px 12px 0; font-size: 23px; line-height: 1.55; }
.modal-copy { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.9; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
.modal-actions .button { min-height: 44px; width: auto; padding: 10px 16px; font-size: 12px; }
.modal-art { margin: 4px 0 19px; overflow: hidden; border-radius: 14px; background: #f0f1ec; }
.modal-art img { display: block; width: 100%; max-height: 270px; object-fit: contain; }
.modal-confirm { width: min(440px, calc(100vw - 28px)); }
.live-analysis { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.live-analysis h3 { margin: 0 0 8px; font-size: 15px; }
.disclosure-copy, .result-caveat { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.consent-option { display: flex; align-items: flex-start; gap: 10px; margin-top: 15px; font-size: 12px; line-height: 1.65; cursor: pointer; }
.consent-option input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--green); }
.turnstile-container { margin-top: 14px; }
.analysis-progress { min-height: 1.4em; margin: 10px 0 0; color: var(--green-dark); font-size: 12px; line-height: 1.6; }
.analysis-results { margin-top: 12px; padding: 14px; border-radius: 12px; background: #f3f5f0; }
.score-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.score-item { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; }
.score-value { color: var(--green-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 104px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: #2f4337; color: white; font-size: 12px; line-height: 1.6; box-shadow: 0 8px 24px rgba(27, 46, 34, .2); opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .app-shell { padding: 0 19px 28px; }
  .topbar { min-height: 72px; }
  .brand { gap: 8px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-name { font-size: 17px; }
  .storage-chip { gap: 6px; padding: 8px 10px; font-size: 11px; }
  .intro { padding: 34px 0 24px; }
  .intro .eyebrow { margin-bottom: 8px; font-size: 9px; }
  .intro h1 { font-size: clamp(27px, 7.2vw, 36px); line-height: 1.26; }
  .intro-copy { margin-top: 9px; font-size: 13px; line-height: 1.8; }
  .capture-card { grid-template-columns: 1fr; gap: 1px; padding: 24px 21px 25px; border-radius: 24px; }
  .capture-copy { order: 1; }
  .portrait-art { order: 0; min-height: 184px; margin-bottom: 12px; border-radius: 45% 45% 38% 38% / 45% 45% 36% 36%; }
  .portrait-art::before { width: 78%; }
  .portrait-art::after { width: 64%; }
  .portrait-halo { width: 162px; }
  .portrait-svg { width: 152px; }
  .art-caption { bottom: 6px; font-size: 8px; }
  .card-kicker { margin-bottom: 8px; }
  .capture-copy h2 { font-size: 24px; }
  .capture-hint { margin: 4px 0 18px; font-size: 12px; }
  .capture-action-row { grid-template-columns: 1fr; gap: 9px; }
  .button-primary { min-height: 52px; padding: 13px 12px; font-size: 13px; }
  .privacy-note { margin: 10px 2px 8px; font-size: 10px; line-height: 1.75; }
  .button-secondary { min-height: 47px; width: 100%; padding: 10px; font-size: 13px; }
  .connection-note { font-size: 10px; line-height: 1.6; }
  .capture-facts { gap: 7px; margin-top: 16px; padding-top: 13px; }
  .capture-facts li { display: block; font-size: 8px; line-height: 1.45; }
  .fact-mark { display: block; margin-bottom: 3px; }
  .log-section { margin-top: 38px; }
  .section-heading h2 { font-size: 23px; }
  .section-heading .eyebrow { font-size: 9px; }
  .empty-state { min-height: 170px; padding: 24px 16px; }
  .composer { padding: 21px 18px 22px; }
  .form-footer { align-items: flex-start; }
  .form-footer span { padding-top: 5px; }
  .log-entry { grid-template-columns: 66px 1fr auto; gap: 11px; padding: 15px 13px; }
  .entry-date { font-size: 10px; }
  .entry-content p { font-size: 12px; }
  .tabbar { position: fixed; z-index: 5; left: 50%; bottom: max(12px, env(safe-area-inset-bottom, 0px)); width: min(380px, calc(100% - 28px)); margin: 0; transform: translateX(-50%); }
  .tab-button { flex: 1; min-width: 0; min-height: 55px; }
  main { padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
  .mode-copy { margin-top: -3px; }
  .page-section-heading { margin-top: 30px; }
  .settings-card { grid-template-columns: 38px 1fr; gap: 12px; padding: 18px 16px; }
  .settings-icon { width: 36px; height: 36px; border-radius: 12px; font-size: 19px; }
  .danger-zone { display: grid; padding: 19px 16px; }
  .danger-zone .button { width: 100%; }
  .modal { padding: 25px 20px 21px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
  .score-list { grid-template-columns: 1fr; }
}

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