:root {
  --paper: #f4f1e9;
  --card: #fffdf8;
  --ink: #2f3a34;
  --muted: #708078;
  --line: #dfe5dc;
  --green: #416f5b;
  --green-soft: #e1eee5;
  --sun: #e9c77d;
  --lavender: #e8e4ed;
  --shadow: 0 10px 30px rgba(48, 64, 53, .08);
  --radius: 22px;
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; overscroll-behavior-y: none; }
body.sheet-open { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #9ebaa8; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

#app { min-height: 100dvh; }
.screen { width: min(100%, 680px); margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) 16px calc(108px + env(safe-area-inset-bottom)); }
.eyebrow { color: var(--muted); font-size: .78rem; font-weight: 750; letter-spacing: .08em; margin: 0 0 4px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.85rem, 7vw, 2.4rem); letter-spacing: -.035em; line-height: 1.1; margin-bottom: 5px; }
h2 { font-size: 1.35rem; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 0; }
h3 { color: var(--muted); font-size: .84rem; letter-spacing: .06em; text-transform: uppercase; }

.scene { background: #dbe3d7; border-radius: 28px; box-shadow: var(--shadow); min-height: 230px; overflow: hidden; position: relative; isolation: isolate; }
.scene-art, .scene-layer { inset: 0; position: absolute; }
.scene-base { background: center / cover no-repeat url('./assets/scene-background.webp'); filter: saturate(.82) contrast(.94); opacity: 1; transform: scale(1.01); }
.scene::after { background: linear-gradient(180deg, rgba(22, 44, 34, .02) 35%, rgba(22, 44, 34, .44)); content: ""; inset: 0; position: absolute; z-index: 3; }
.scene-copy { color: white; left: 22px; position: absolute; right: 20px; text-shadow: 0 1px 9px rgba(24, 45, 33, .32); top: 22px; z-index: 4; }
.scene-copy .eyebrow { color: rgba(255, 255, 255, .86); }
.scene-copy h1 { font-size: 1.9rem; margin-bottom: 3px; }
.scene-copy p:last-child { color: rgba(255,255,255,.9); margin: 0; }
.scene-variant-1 .scene-base { background-position: 58% center; filter: saturate(.78) contrast(.94) hue-rotate(-2deg); }
.scene-variant-2 .scene-base { background-position: 42% center; filter: saturate(.88) contrast(.94) hue-rotate(2deg); transform: scale(1.04) scaleX(-1); }
.scene-variant-3 .scene-base { background-position: center 44%; filter: saturate(.8) contrast(.97); transform: scale(1.04); }
.scene-variant-4 .scene-base { background-position: 64% 52%; filter: saturate(.9) contrast(.92) hue-rotate(1deg); }
.scene-layer { background-image: url('./assets/scene-sprite.webp'); background-repeat: no-repeat; background-size: 200% 200%; opacity: 0; transform-origin: center; z-index: 2; }
.scene-canopy { background-position: 0 0; opacity: .95; }
.scene-sunbeam { background-position: 100% 0; opacity: .8; }
.scene-birds { background-position: 0 100%; opacity: .95; }
.scene-variant-1 .scene-canopy { transform: scaleX(-1); }
.scene-variant-2 .scene-sunbeam { transform: translateX(3%) rotate(-1deg); }
.scene-variant-3 .scene-birds { transform: translateX(-3%); }

.today-heading { align-items: end; display: flex; justify-content: space-between; margin: 28px 2px 12px; }
.today-heading h2 { font-size: 1.65rem; }
.card { background: var(--card); border: 1px solid rgba(212, 220, 211, .7); border-radius: var(--radius); box-shadow: var(--shadow); }
.today-list ul, .day-activities, .sheet-existing ul { list-style: none; margin: 0; padding: 0; }
.activity-row { align-items: center; background: var(--card); border: 1px solid rgba(212, 220, 211, .7); border-radius: 17px; box-shadow: 0 5px 18px rgba(48,64,53,.055); display: flex; gap: 9px; margin: 0 0 9px; min-height: 58px; padding: 7px 8px 7px 9px; }
.activity-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-done .activity-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b8c7bd; }
.check-button { align-items: center; background: transparent; border: 2px solid #aabcae; border-radius: 50%; color: var(--green); display: inline-flex; flex: 0 0 38px; font-size: 1.15rem; font-weight: 800; height: 38px; justify-content: center; width: 38px; }
.check-button.checked { background: var(--green-soft); border-color: var(--green); }
.move-control { align-items: center; color: var(--muted); display: flex; flex: 0 0 36px; justify-content: center; position: relative; }
.date-input { height: 38px; opacity: 0; position: absolute; width: 38px; z-index: 1; }
.date-input::-webkit-calendar-picker-indicator { cursor: pointer; height: 100%; width: 100%; }
.icon-button { align-items: center; background: transparent; border-radius: 50%; color: var(--muted); display: inline-flex; flex: 0 0 34px; font-size: 1.4rem; height: 34px; justify-content: center; }
.icon-button:active, .check-button:active, .plus-button:active, .worry-fab:active { transform: scale(.93); }
.empty-card { padding: 22px; text-align: center; }
.empty-card p { color: var(--muted); margin-bottom: 16px; }

.button { align-items: center; border-radius: 14px; display: inline-flex; font-weight: 720; justify-content: center; min-height: var(--tap); padding: 0 17px; }
.button-primary { background: var(--green); box-shadow: 0 6px 15px rgba(65,111,91,.22); color: white; }
.button-soft { background: var(--green-soft); color: var(--green); }
.button.small { min-height: 40px; padding: 0 13px; }
.page-heading { margin: 8px 2px 22px; }
.page-heading > p:last-child { color: var(--muted); margin-bottom: 0; }
.week-grid { display: grid; gap: 10px; }
.day-card { background: rgba(255,253,248,.64); border: 1px solid var(--line); border-radius: 19px; padding: 12px; }
.day-card.is-today { background: var(--card); border-color: #acc4b3; box-shadow: var(--shadow); }
.day-card-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 7px; }
.day-open { align-items: baseline; background: transparent; display: inline-flex; gap: 9px; padding: 5px 6px; }
.day-open span { color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; }
.day-open strong { font-size: 1.28rem; }
.plus-button { align-items: center; background: var(--green-soft); border-radius: 50%; color: var(--green); display: inline-flex; font-size: 1.5rem; height: 40px; justify-content: center; width: 40px; }
.day-activities .activity-row { box-shadow: none; margin-bottom: 6px; min-height: 50px; }
.day-activities .check-button { flex-basis: 33px; height: 33px; width: 33px; }
.day-activities .icon-button { flex-basis: 28px; height: 30px; }
.day-activities .move-control { flex-basis: 30px; }
.day-activities .date-input { height: 34px; width: 34px; }
.three-note { color: var(--muted); font-size: .84rem; margin: 8px 3px 2px; }

.worry-fab { align-items: center; background: var(--green); border: 4px solid var(--paper); border-radius: 50%; bottom: calc(72px + env(safe-area-inset-bottom)); box-shadow: 0 7px 19px rgba(44,77,60,.25); color: white; display: flex; font-size: 1.75rem; height: 58px; justify-content: center; position: fixed; right: max(16px, calc((100vw - 680px) / 2 + 16px)); width: 58px; z-index: 9; }
.worry-fab::after { color: rgba(255,255,255,.88); content: "bekymring"; font-size: .68rem; font-weight: 700; left: 50%; position: absolute; top: 57px; transform: translateX(-50%); white-space: nowrap; }
.worry-card, .parked-note { margin-top: 24px; padding: 20px; }
.worry-card h2 { margin-bottom: 10px; }
.worry-text { font-size: 1.08rem; margin-bottom: 17px; }
.worry-actions { display: grid; gap: 9px; }
.convert-date { align-items: center; color: var(--muted); display: flex; font-size: .86rem; gap: 9px; justify-content: space-between; }
.convert-date input, .worry-form input[type="time"] { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; min-height: 42px; padding: 5px 9px; }
.parked-note { align-items: center; display: flex; gap: 14px; }
.note-icon { align-items: center; background: var(--lavender); border-radius: 50%; color: var(--muted); display: flex; flex: 0 0 40px; font-size: 1.8rem; height: 40px; justify-content: center; }
.parked-note strong { font-size: .98rem; }
.parked-note p { color: var(--muted); font-size: .86rem; margin: 2px 0 0; }

.tabs { align-items: center; backdrop-filter: blur(14px); background: rgba(255,253,248,.92); border-top: 1px solid rgba(205,216,207,.8); bottom: 0; display: grid; grid-template-columns: repeat(2, 1fr); left: 0; padding: 7px max(14px, env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom)); position: fixed; right: 0; z-index: 8; }
.tab { align-items: center; background: transparent; border-radius: 14px; color: var(--muted); display: flex; flex-direction: column; font-size: .76rem; gap: 1px; min-height: 50px; }
.tab span:first-child { font-size: 1.25rem; line-height: 1.1; }
.tab.active { background: var(--green-soft); color: var(--green); font-weight: 750; }

.sheet { align-items: end; display: flex; height: 100vh; height: 100dvh; height: var(--sheet-viewport-height, 100dvh); justify-content: center; left: 0; position: fixed; right: 0; top: var(--sheet-viewport-offset-top, 0px); z-index: 20; }
.sheet-scrim { background: rgba(25, 38, 29, .32); inset: 0; position: absolute; }
.sheet-card { background: var(--card); border-radius: 26px 26px 0 0; box-shadow: 0 -12px 40px rgba(40,53,43,.19); max-height: min(100%, 780px); max-width: 680px; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom) + var(--sheet-keyboard-padding, 0px)) max(18px, env(safe-area-inset-right)); position: relative; scroll-padding-bottom: calc(24px + env(safe-area-inset-bottom) + var(--sheet-keyboard-padding, 0px)); scroll-padding-top: max(12px, env(safe-area-inset-top)); -webkit-overflow-scrolling: touch; width: 100%; z-index: 1; }
.sheet-grab { background: #cad6cc; border-radius: 99px; display: block; height: 5px; margin: 0 auto 19px; width: 42px; }
.sheet-card h2 { margin-bottom: 5px; }
.sheet-hint { color: var(--muted); font-size: .92rem; margin-bottom: 17px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.suggestion { background: var(--green-soft); border-radius: 99px; color: var(--green); min-height: 40px; padding: 6px 13px; }
.inline-form, .worry-form { display: grid; gap: 8px; }
.inline-form label, .worry-form label { color: var(--muted); font-size: .84rem; font-weight: 700; }
.input-row { display: flex; gap: 8px; }
.input-row input, .worry-form textarea { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; min-height: 48px; min-width: 0; padding: 10px 12px; }
.input-row input { flex: 1; }
.input-row .button { min-height: 48px; }
.worry-form textarea { resize: vertical; width: 100%; }
.worry-form input[type="time"] { width: 100%; }
.worry-form .button { margin-top: 7px; }
.sheet-three { background: #f0f3ed; border-radius: 10px; margin: 15px 0 0; padding: 9px 11px; }
.sheet-existing { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 18px; }
.sheet-existing h3 { margin-bottom: 10px; }
.sheet-existing .activity-row { box-shadow: none; }
.toast { background: var(--ink); border-radius: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); color: white; left: 50%; max-width: calc(100vw - 32px); padding: 10px 15px; position: fixed; transform: translateX(-50%); z-index: 30; }

@media (min-width: 560px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .day-card:last-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: no-preference) {
  .scene-layer { animation: appear .7s ease both; }
  .screen { animation: settle .24s ease both; }
  @keyframes appear { from { opacity: 0; transform: scale(.97); } to { opacity: 1; } }
  @keyframes settle { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
