@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --ink: #17221b;
  --muted: #687169;
  --paper: #f3f0e8;
  --cream: #fbfaf5;
  --line: rgba(23, 34, 27, 0.15);
  --acid: #d6ff48;
  --blue: #555af4;
  --coral: #ff755b;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-height: 100dvh; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.grain { position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: .025; background: repeating-radial-gradient(circle at 30% 20%, #17221b 0 .4px, transparent .5px 3px); }

.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 600; font-size: 16px; text-decoration: none; letter-spacing: -.03em; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; font-family: var(--serif); font-size: 20px; font-style: italic; }
.eyebrow { margin: 0 0 13px; font-size: 10px; font-weight: 600; letter-spacing: .17em; text-transform: uppercase; }
.form-error { min-height: 20px; margin: 10px 0 0; color: #a23226; font-size: 13px; }

.login-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(340px, .9fr) 1.1fr; background: var(--cream); }
.login-art { position: relative; overflow: hidden; min-height: 100dvh; color: var(--cream); background: var(--blue); }
.orb { position: absolute; border-radius: 50%; mix-blend-mode: screen; filter: blur(1px); }
.orb-one { width: min(54vw, 750px); aspect-ratio: 1; left: -24%; top: -10%; background: var(--coral); animation: drift 12s ease-in-out infinite alternate; }
.orb-two { width: min(42vw, 580px); aspect-ratio: 1; right: -20%; bottom: -8%; background: var(--acid); animation: drift 10s ease-in-out -4s infinite alternate-reverse; }
@keyframes drift { to { transform: translate(8%, 6%) scale(1.06); } }
.vertical-word { position: absolute; top: 50%; left: 24px; margin: 0; font-size: 10px; letter-spacing: .28em; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
.art-caption {
  position: absolute;
  left: clamp(36px, 5vw, 80px);
  bottom: clamp(36px, 6vw, 84px);
  z-index: 2;
  margin: 0;
  background: linear-gradient(
    90deg,
    var(--cream) 0%,
    var(--cream) 43%,
    var(--ink) 54%,
    var(--ink) 82%,
    var(--cream) 94%,
    var(--cream) 100%
  );
  background-clip: text;
  color: transparent;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 76px);
  line-height: .94;
  letter-spacing: -.04em;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-panel { display: flex; flex-direction: column; justify-content: space-between; min-height: 100dvh; padding: clamp(28px, 6vw, 82px); }
.login-copy { max-width: 540px; margin: auto 0 7vh; }
.login-copy h1, .hero h1, .step h2, .recent-card h2 { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -.055em; }
.login-copy h1 { font-size: clamp(72px, 9vw, 136px); line-height: .72; }
.login-copy > p:last-child { max-width: 420px; margin: 38px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.login-form { max-width: 540px; }
.login-form label, .field-label { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.password-row { position: relative; min-height: 58px; border-bottom: 1.5px solid var(--ink); }
.password-row input { width: 100%; min-height: 58px; padding: 13px 68px 13px 0; border: 0; outline: 0; background: transparent; font-size: 22px; letter-spacing: .08em; }
.arrow-button { position: absolute; right: 0; bottom: 5px; z-index: 2; display: grid; width: 48px; height: 48px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: var(--ink); color: white; font-size: 24px; line-height: 1; transition: transform .2s; }
.arrow-button:hover { transform: rotate(-8deg); }
.privacy-note { display: flex; gap: 8px; align-items: center; margin: 28px 0 0; color: var(--muted); font-size: 11px; }
.privacy-note span { color: #57a95d; font-size: 7px; }

.app-shell { max-width: 1500px; min-height: 100dvh; margin: auto; padding: 0 clamp(20px, 4vw, 64px) 70px; }
.app-header { display: flex; align-items: center; justify-content: space-between; height: 90px; border-bottom: 1px solid var(--line); }
.header-actions { display: flex; gap: 18px; align-items: center; }
.today-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.icon-button, .month-controls button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; }
.diagonal-arrow { position: relative; display: inline-block; width: 18px; height: 18px; color: currentColor; font-size: 0; }
.diagonal-arrow::before { position: absolute; top: 8px; left: 1px; width: 16px; height: 1.5px; border-radius: 2px; background: currentColor; content: ""; transform: rotate(-45deg); transform-origin: center; }
.diagonal-arrow::after { position: absolute; top: 1px; right: 1px; width: 8px; height: 8px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; content: ""; }
.export-button { display: flex; gap: 14px; align-items: center; height: 40px; padding: 0 17px; border: 1px solid var(--ink); border-radius: 30px; background: transparent; font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; transition: background .2s, color .2s; }
.export-button:hover { background: var(--ink); color: white; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 50px; padding: clamp(56px, 9vw, 120px) 0 clamp(44px, 7vw, 90px); }
.hero h1 { font-size: clamp(68px, 10vw, 150px); line-height: .75; }
.hero-message { max-width: 480px; margin: 35px 0 0; color: var(--muted); line-height: 1.6; }
.check-in-button { display: grid; grid-template-columns: auto auto; width: clamp(210px, 17vw, 260px); aspect-ratio: 1; padding: 27px; border: 0; border-radius: 50%; background: var(--acid); text-align: left; transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s; }
.check-in-button:hover { transform: scale(1.035) rotate(-2deg); box-shadow: 0 18px 45px rgba(23,34,27,.12); }
.check-in-button span { grid-column: 1 / -1; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.check-in-button b { align-self: end; font-family: var(--serif); font-size: 46px; font-weight: 400; letter-spacing: -.05em; }
.check-in-button i { align-self: end; justify-self: end; font-style: normal; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .75fr); gap: 18px; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 2px; background: rgba(251,250,245,.68); }
.month-card, .recent-card { padding: clamp(24px, 3vw, 44px); }
.card-head { display: flex; justify-content: space-between; gap: 30px; }
.card h2 { margin: 0; font-family: var(--serif); font-size: clamp(32px, 4vw, 54px); font-weight: 400; letter-spacing: -.04em; }
.month-controls { display: flex; gap: 7px; }
.month-controls button { width: 36px; height: 36px; }
.chart-wrap { position: relative; height: 280px; margin: 38px 0 12px 30px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-scale { position: absolute; inset: 0 auto 0 -30px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 10px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.chart-legend { display: flex; gap: 20px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.chart-legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.mood-dot { background: var(--blue); }
.sleep-dot { background: var(--coral); }
.pulse-card { padding: 35px; background: var(--ink); color: var(--cream); }
.pulse-card .eyebrow { color: #aeb7b0; }
.pulse-value { display: flex; align-items: flex-end; gap: 15px; padding: 20px 0 40px; }
.pulse-value strong { font-family: var(--serif); font-size: 88px; font-weight: 400; line-height: .75; letter-spacing: -.06em; }
.pulse-value span { color: #aeb7b0; font-size: 10px; line-height: 1.2; text-transform: uppercase; }
.pulse-row { display: flex; justify-content: space-between; padding: 17px 0; border-top: 1px solid rgba(255,255,255,.16); font-size: 12px; }
.pulse-row span { color: #aeb7b0; }
.pulse-row b { font-weight: 500; }
.recent-card { min-height: 360px; }
.recent-list { margin-top: 30px; }
.recent-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 18px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); cursor: pointer; }
.recent-date { font-family: var(--serif); font-size: 34px; line-height: 1; }
.recent-date small { display: block; color: var(--muted); font-family: var(--sans); font-size: 8px; text-transform: uppercase; letter-spacing: .09em; }
.recent-note { overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.recent-mood { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 50%; background: #e9e5da; font-family: var(--serif); font-size: 20px; }
.empty-list { padding: 30px 0; color: var(--muted); font-family: var(--serif); font-size: 20px; }
.reflection-card { position: relative; display: flex; flex-direction: column; justify-content: end; min-height: 360px; overflow: hidden; padding: 35px; background: var(--coral); }
.reflection-symbol { position: absolute; top: 20px; right: 28px; margin: 0; font-size: 80px; opacity: .3; }
.reflection-card blockquote { margin: 12px 0 0; font-family: var(--serif); font-size: clamp(26px, 3vw, 38px); line-height: 1.06; letter-spacing: -.03em; }
.checkin-dialog { width: min(760px, 100%); height: min(900px, 100dvh); max-height: 100dvh; padding: 0; border: 0; background: var(--cream); color: var(--ink); }
.checkin-dialog::backdrop { background: rgba(12,20,15,.64); backdrop-filter: blur(10px); }
.checkin-dialog form { display: grid; grid-template-rows: auto auto 1fr auto auto; height: 100%; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; padding: 25px 35px; }
.close-button, .text-button { border: 0; background: transparent; }
.close-button { font-size: 26px; }
.text-button, #stepCounter { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.progress-track { height: 2px; background: #e7e3d9; }
.progress-track span { display: block; width: 20%; height: 100%; background: var(--blue); transition: width .35s ease; }
.step { display: none; overflow-y: auto; padding: clamp(36px, 7vh, 70px) clamp(28px, 8vw, 80px) 30px; }
.step.active { display: block; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.step h2 { font-size: clamp(48px, 8vw, 78px); line-height: .86; }
.step-intro { max-width: 490px; margin: 25px 0 40px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.large-input { width: 100%; padding: 16px 0; border: 0; border-bottom: 1.5px solid var(--ink); outline: none; background: transparent; font-family: var(--serif); font-size: 34px; }
.number-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.number-fields > label > span:first-child { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.number-input { display: flex; align-items: baseline; border-bottom: 1.5px solid var(--ink); }
.number-input input { min-width: 0; width: 100%; padding: 13px 0; border: 0; outline: 0; background: transparent; font-family: var(--serif); font-size: 48px; }
.number-input i { color: var(--muted); font-size: 11px; font-style: normal; }
.mood-picker { display: grid; grid-template-columns: repeat(9, 1fr); gap: 7px; }
.mood-option { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-family: var(--serif); font-size: 18px; transition: .2s; }
.mood-option[aria-checked="true"] { border-color: var(--blue); background: var(--blue); color: white; transform: translateY(-5px); }
.mood-words { display: flex; justify-content: space-between; margin-top: 16px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.mood-words strong { color: var(--ink); font-weight: 500; }
.choice-list { border-top: 1px solid var(--line); }
.choice-list label { display: grid; grid-template-columns: 18px 1fr auto; gap: 15px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.choice-list input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--ink); border-radius: 50%; }
.choice-list input:checked { border: 4px solid var(--blue); }
.choice-list span, .toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.choice-list b, .toggle-row b { font-size: 13px; font-weight: 500; }
.choice-list small, .toggle-row small { color: var(--muted); font-size: 10px; }
.choice-list i { font-family: var(--serif); font-size: 22px; font-style: normal; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; }
.toggle-row i { position: relative; width: 44px; height: 25px; border-radius: 20px; background: #d9d7cf; transition: .2s; }
.toggle-row i::after { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: white; content: ''; transition: .2s; }
.toggle-row input:checked + i { background: var(--blue); }
.toggle-row input:checked + i::after { transform: translateX(19px); }
textarea { width: 100%; min-height: 170px; resize: vertical; padding: 20px; border: 1px solid var(--line); outline: 0; background: var(--paper); font-family: var(--serif); font-size: 23px; line-height: 1.4; }
textarea:focus { border-color: var(--ink); }
.note-prompt { color: var(--muted); font-size: 11px; font-style: italic; }
.dialog-footer { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 20px 35px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.primary-button, .secondary-button { min-height: 54px; padding: 0 24px; border: 0; }
.primary-button { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: white; }
.primary-button span { margin-left: 50px; font-size: 20px; }
.secondary-button { background: transparent; color: var(--muted); }
.secondary-button:disabled { opacity: .3; }
.checkin-dialog .form-error { position: absolute; right: 35px; bottom: 89px; }
.toast { position: fixed; z-index: 200; bottom: 25px; left: 50%; display: flex; gap: 30px; align-items: center; padding: 15px 20px; transform: translate(-50%, 100px); background: var(--ink); color: white; font-size: 12px; opacity: 0; transition: .35s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast span { color: var(--acid); }

.export-dialog { width: min(760px, calc(100% - 32px)); max-width: 760px; padding: 0; border: 0; background: var(--cream); color: var(--ink); }
.export-dialog::backdrop { background: rgba(12,20,15,.64); backdrop-filter: blur(10px); }
.export-dialog form { display: grid; grid-template-columns: 210px 1fr; min-height: 570px; }
.export-art { position: relative; overflow: hidden; background: var(--blue); }
.export-art span { position: absolute; top: -45px; left: -55px; width: 230px; height: 230px; border-radius: 50%; background: var(--coral); mix-blend-mode: screen; }
.export-art::after { position: absolute; right: -75px; bottom: -45px; width: 220px; height: 220px; border-radius: 50%; background: var(--acid); content: ''; mix-blend-mode: screen; }
.export-art p { position: absolute; right: 20px; bottom: 24px; z-index: 2; margin: 0; color: white; font-family: var(--serif); font-size: 65px; letter-spacing: -.06em; writing-mode: vertical-rl; }
.export-content { position: relative; padding: 52px 50px 42px; }
.export-content > .close-button { position: absolute; top: 20px; right: 25px; }
.export-content h2 { margin: 0; font-family: var(--serif); font-size: 66px; font-weight: 400; line-height: .82; letter-spacing: -.055em; }
.export-content .step-intro { margin-bottom: 30px; }
.export-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.export-dates label { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.export-dates label span { display: block; margin-bottom: 7px; }
.export-dates input { width: 100%; padding: 12px 0; border: 0; border-bottom: 1.5px solid var(--ink); outline: 0; background: transparent; font-family: var(--serif); font-size: 18px; }
.export-content .primary-button { width: 100%; margin-top: 8px; }
.export-content .primary-button:disabled { cursor: wait; opacity: .65; }
.export-privacy { margin: 15px 0 0; color: var(--muted); font-size: 9px; text-align: center; }

@media (max-width: 800px) {
  .grain { display: none; }
  .login-shell { display: block; }
  .login-art { min-height: 38dvh; }
  .orb-one { width: 100vw; }
  .orb-two { width: 75vw; }
  .art-caption { font-size: 48px; }
  .login-panel { min-height: 62dvh; padding: 26px 24px 30px; }
  .login-panel > .brand { position: absolute; top: 25px; left: 24px; z-index: 3; color: white; }
  .login-copy { margin: 28px 0 40px; }
  .login-copy h1 { font-size: 64px; line-height: .78; }
  .login-copy > p:last-child { margin-top: 25px; font-size: 13px; }
  .privacy-note { margin-top: 18px; }
  .app-shell { padding: 0 18px 40px; }
  .app-header { height: 72px; }
  .today-label { display: none; }
  .header-actions { gap: 8px; }
  .export-button { width: 40px; padding: 0; justify-content: center; border-radius: 50%; font-size: 16px; }
  .export-button span { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0 0 0 0); white-space: nowrap; }
  .hero { display: block; padding: 50px 0 42px; }
  .hero h1 { font-size: 72px; line-height: .78; }
  .hero-message { max-width: 290px; margin-top: 25px; font-size: 13px; }
  .check-in-button { width: 148px; margin: -25px 0 0 auto; padding: 19px; }
  .check-in-button b { font-size: 32px; }
  .dashboard-grid { display: block; }
  .card { margin-bottom: 12px; }
  .pulse-card { padding: 28px; }
  .chart-wrap { height: 230px; margin-top: 30px; }
  .recent-card, .reflection-card { min-height: 310px; }
  .checkin-dialog { width: 100%; height: 100dvh; max-width: none; max-height: none; }
  .dialog-top { padding: 20px 22px; }
  .step { padding: 36px 22px 20px; }
  .step h2 { font-size: 52px; }
  .step-intro { margin: 20px 0 30px; }
  .number-fields { grid-template-columns: 1fr; gap: 25px; }
  .mood-picker { gap: 3px; }
  .mood-option { font-size: 15px; }
  .dialog-footer { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); }
  .checkin-dialog .form-error { right: 22px; bottom: 82px; }
  .export-dialog { width: 100%; max-width: none; max-height: 100dvh; }
  .export-dialog form { display: block; min-height: 0; }
  .export-art { height: 145px; }
  .export-art span { width: 190px; height: 190px; }
  .export-art::after { width: 180px; height: 180px; }
  .export-art p { right: 22px; bottom: 9px; font-size: 44px; writing-mode: initial; }
  .export-content { padding: 38px 24px calc(26px + env(safe-area-inset-bottom)); }
  .export-content h2 { font-size: 56px; }
  .export-content .step-intro { margin: 20px 0 26px; }
  .export-dates { gap: 16px; }
}

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