:root {
  --bg: #0a111a;
  --bg-soft: #0f1925;
  --panel: #111d2b;
  --panel-2: #162435;
  --panel-rgb: 17, 29, 43;
  --panel-2-rgb: 22, 36, 53;
  --field: #0e1824;
  --line: #243447;
  --line-soft: #1b293a;
  --text: #f3efe5;
  --muted: #8d9bad;
  --faint: #617084;
  --gold: #d9b477;
  --gold-bright: #efcf94;
  --gold-dim: #a8865a;
  --green: #66c7a0;
  --green-soft: #a7e2c5;
  --danger: #d97a6d;
  --danger-soft: #f0a69a;
  --accent-rgb: 217, 180, 119;
  --ambient-a: rgba(52, 83, 117, .25);
  --ambient-b: rgba(153, 115, 57, .12);
  --panel-grad: linear-gradient(155deg, rgba(20, 34, 50, .92), rgba(13, 23, 35, .94));
  --card-grad: linear-gradient(145deg, rgba(21, 35, 51, .94), rgba(14, 24, 37, .96));
  --sheet-grad: linear-gradient(160deg, #152436, #0e1925);
  --login-card-grad: linear-gradient(155deg, #142335, #0e1925);
  --login-bg: radial-gradient(700px 500px at 50% -15%, rgba(65, 95, 125, .35), transparent 65%), #0a111a;
  --icon-bg: rgba(17, 29, 43, .75);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100svh;
  background:
    radial-gradient(1200px 700px at 15% -10%, var(--ambient-a), transparent 60%),
    radial-gradient(900px 600px at 100% 20%, var(--ambient-b), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.hidden { display: none !important; }

.ambient { position: fixed; border-radius: 999px; filter: blur(90px); pointer-events: none; z-index: 0; }
.ambient-a { width: 340px; height: 340px; left: -180px; top: -140px; background: var(--ambient-a); }
.ambient-b { width: 300px; height: 300px; right: -180px; top: 35%; background: var(--ambient-b); }

html[data-theme="spring"] {
  --bg: #140d14; --bg-soft: #1d121b; --panel: #211521; --panel-2: #2a1a29;
  --panel-rgb: 33, 21, 33; --panel-2-rgb: 42, 26, 41;
  --field: #170f18; --line: #3a2937; --line-soft: #2a1d28;
  --text: #f7eef1; --muted: #b49aa6; --faint: #7e6975;
  --gold: #e5a6b8; --gold-bright: #f5c6d3; --gold-dim: #b87a8a;
  --green: #7ed0b0; --green-soft: #b8ecd9; --danger: #e28a8b; --danger-soft: #f4b6b6;
  --accent-rgb: 229, 166, 184;
  --ambient-a: rgba(160, 80, 110, .24); --ambient-b: rgba(230, 160, 180, .10);
  --panel-grad: linear-gradient(155deg, rgba(36, 24, 34, .94), rgba(20, 13, 20, .95));
  --card-grad: linear-gradient(145deg, rgba(38, 25, 36, .96), rgba(22, 14, 21, .97));
  --sheet-grad: linear-gradient(160deg, #281a26, #160f17);
  --login-card-grad: linear-gradient(155deg, #261824, #160f17);
  --login-bg: radial-gradient(700px 500px at 50% -15%, rgba(130, 65, 90, .32), transparent 65%), #140d14;
  --icon-bg: rgba(33, 21, 33, .75);
}
html[data-theme="summer"] {
  --bg: #071418; --bg-soft: #0c1c21; --panel: #0d2026; --panel-2: #123039;
  --panel-rgb: 13, 32, 38; --panel-2-rgb: 18, 48, 57;
  --field: #0a1a20; --line: #21414a; --line-soft: #18343b;
  --text: #eaf6f5; --muted: #8eaaa8; --faint: #5f7f7e;
  --gold: #68c9be; --gold-bright: #9ce7db; --gold-dim: #459b92;
  --green: #72d6a7; --green-soft: #b5efd4; --danger: #e0837d; --danger-soft: #f1b1ad;
  --accent-rgb: 104, 201, 190;
  --ambient-a: rgba(42, 130, 135, .24); --ambient-b: rgba(90, 200, 190, .10);
  --panel-grad: linear-gradient(155deg, rgba(17, 42, 49, .94), rgba(7, 20, 24, .96));
  --card-grad: linear-gradient(145deg, rgba(18, 44, 51, .96), rgba(8, 22, 27, .97));
  --sheet-grad: linear-gradient(160deg, #102a31, #08171b);
  --login-card-grad: linear-gradient(155deg, #102a31, #08171b);
  --login-bg: radial-gradient(700px 500px at 50% -15%, rgba(35, 100, 108, .34), transparent 65%), #071418;
  --icon-bg: rgba(13, 32, 38, .78);
}
html[data-theme="autumn"] {
  --bg: #15100b; --bg-soft: #1b140d; --panel: #231a13; --panel-2: #302319;
  --panel-rgb: 35, 26, 19; --panel-2-rgb: 48, 35, 25;
  --field: #1a130d; --line: #463321; --line-soft: #332417;
  --text: #f7ede0; --muted: #ab927a; --faint: #7c6753;
  --gold: #dfa761; --gold-bright: #f2c98b; --gold-dim: #a97b44;
  --green: #9fc58c; --green-soft: #d3e8c3; --danger: #df8b74; --danger-soft: #f2b39e;
  --accent-rgb: 223, 167, 97;
  --ambient-a: rgba(145, 95, 45, .24); --ambient-b: rgba(220, 160, 80, .10);
  --panel-grad: linear-gradient(155deg, rgba(43, 31, 21, .94), rgba(19, 13, 9, .96));
  --card-grad: linear-gradient(145deg, rgba(46, 33, 22, .96), rgba(21, 14, 10, .97));
  --sheet-grad: linear-gradient(160deg, #2b2015, #17100b);
  --login-card-grad: linear-gradient(155deg, #2b2015, #17100b);
  --login-bg: radial-gradient(700px 500px at 50% -15%, rgba(120, 80, 38, .32), transparent 65%), #15100b;
  --icon-bg: rgba(35, 26, 19, .78);
}
html[data-theme="winter"] {
  --bg: #091214; --bg-soft: #0d1a1c; --panel: #101f21; --panel-2: #172d2f;
  --panel-rgb: 16, 31, 33; --panel-2-rgb: 23, 45, 47;
  --field: #0c191b; --line: #294043; --line-soft: #1c3234;
  --text: #edf5f4; --muted: #8fa8a7; --faint: #607d7d;
  --gold: #93c9c1; --gold-bright: #c4e6df; --gold-dim: #659b94;
  --green: #80cfb7; --green-soft: #b9ebdc; --danger: #d98a8a; --danger-soft: #f0b4b4;
  --accent-rgb: 147, 201, 193;
  --ambient-a: rgba(45, 95, 100, .24); --ambient-b: rgba(140, 190, 185, .10);
  --panel-grad: linear-gradient(155deg, rgba(19, 39, 41, .94), rgba(8, 18, 20, .96));
  --card-grad: linear-gradient(145deg, rgba(21, 43, 45, .96), rgba(9, 20, 22, .97));
  --sheet-grad: linear-gradient(160deg, #152b2d, #0b1719);
  --login-card-grad: linear-gradient(155deg, #152b2d, #0b1719);
  --login-bg: radial-gradient(700px 500px at 50% -15%, rgba(40, 85, 90, .32), transparent 65%), #091214;
  --icon-bg: rgba(16, 31, 33, .78);
}

.app {
  position: relative;
  min-width: 0;
  overflow-x: clip;
  z-index: 1;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(26px + var(--safe-bottom));
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-icon { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.15; letter-spacing: .01em; }
.brand p { margin: 4px 0 0; font-size: 10px; letter-spacing: .11em; color: var(--gold-dim); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.weather-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 34px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--icon-bg); color: var(--text); font-size: 11px;
  transition: border-color .18s, background .18s, transform .18s;
}
.weather-chip:hover { border-color: var(--gold-dim); background: var(--panel-2); }
.weather-chip.loading .weather-icon { animation: weatherSpin 1s linear infinite; }
.weather-icon { font-size: 15px; line-height: 1; }
.weather-temp { font-variant-numeric: tabular-nums; font-weight: 650; }
.weather-text { color: var(--muted); font-size: 9px; max-width: 46px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.weather-fx {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 2; opacity: 0;
  transition: opacity .6s ease;
}
.weather-fx.active { opacity: .62; }
@keyframes weatherSpin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--icon-bg); color: var(--muted);
  transition: border-color .18s, color .18s, background .18s;
}
.icon-btn:hover { color: var(--text); border-color: #3b5068; background: var(--panel-2); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small { width: 34px; height: 34px; font-size: 23px; font-weight: 300; line-height: 1; }

.content { display: grid; gap: 22px; min-width: 0; }
.panel {
  background: var(--panel-grad);
  border: 1px solid rgba(77, 103, 133, .22);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.calendar-card { padding: 20px 18px 18px; min-width: 0; }
.month-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; min-width: 0; }
.month-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-shrink: 1; }
.month-title span { color: var(--faint); font-size: 12px; letter-spacing: .1em; }
.month-title strong { font-family: Georgia, "Songti SC", "STSong", serif; font-size: 30px; font-weight: 500; letter-spacing: .02em; }
.month-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.text-btn, .round-btn { border: 1px solid var(--line); color: var(--muted); background: transparent; transition: all .18s; }
.text-btn { padding: 7px 11px; border-radius: 999px; font-size: 11px; }
.round-btn { width: 32px; height: 32px; border-radius: 50%; font-size: 19px; line-height: 1; }
.text-btn:hover, .round-btn:hover { color: var(--gold-bright); border-color: var(--gold-dim); }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { margin-bottom: 6px; }
.weekdays span { text-align: center; font-size: 10px; color: var(--faint); padding: 4px 0; letter-spacing: .08em; }
.calendar-grid { gap: 2px; }
.day-cell {
  position: relative; aspect-ratio: 1 / 1.08; min-height: 44px;
  border: 1px solid transparent; border-radius: 12px; background: transparent;
  color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: background .16s, border-color .16s, transform .28s cubic-bezier(.34, 1.56, .64, 1), box-shadow .28s;
}
.day-cell:hover { background: rgba(255, 255, 255, .035); }
.day-cell.other-month { color: #435267; }
.day-cell.today .day-num { color: var(--gold-bright); }
.day-cell.selected {
  background: transparent;
  border: 1.5px solid rgba(var(--accent-rgb), .58);
  border-radius: 11px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(0, 0, 0, .18),
    0 0 0 1px rgba(255, 255, 255, .04),
    0 0 0 4px rgba(var(--accent-rgb), .045),
    0 8px 22px rgba(0, 0, 0, .16);
  transform: scale(1.025);
  will-change: transform;
}
.day-cell.selected .day-num { font-weight: 700; color: var(--text); text-shadow: 0 2px 10px rgba(0, 0, 0, .38); }
.day-cell.selected .today-ring { display: none; }
.day-cell.selected:hover { transform: scale(1.04); }
.day-cell.selected:active { transform: scale(.91); transition-duration: .09s; }

.day-num { font-size: 14px; line-height: 1; }
.day-dots { display: flex; height: 5px; align-items: center; gap: 3px; }
.day-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gold-dim); }
.day-dot.high { background: var(--danger); }
.day-dot.done { background: #42546a; }
.today-ring { position: absolute; inset: 5px; border: 1px solid rgba(var(--accent-rgb), .28); border-radius: 10px; pointer-events: none; }

.day-section { padding: 0 2px; min-width: 0; }
.day-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.day-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: .01em; }
.day-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.add-btn {
  width: 43px; height: 43px; border-radius: 14px; border: 1px solid rgba(var(--accent-rgb), .55);
  background: linear-gradient(145deg, var(--gold-bright), var(--gold)); color: #1a140b;
  display: grid; place-items: center; box-shadow: 0 10px 24px rgba(var(--accent-rgb), .18);
  transition: transform .16s, filter .16s;
}
.add-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.add-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.task-list { display: grid; gap: 9px; min-width: 0; }
.task-card {
  display: flex;
  min-width: 0; gap: 12px; align-items: flex-start;
  background: var(--card-grad);
  border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  padding: 14px 14px 13px; transition: border-color .18s, transform .18s;
}
.task-card:hover { border-color: #324760; }
.task-card.completed { opacity: .58; }
.task-card.completed .task-title { text-decoration: line-through; text-decoration-color: #718096; }
.check-btn {
  flex: 0 0 auto; width: 23px; height: 23px; border-radius: 50%;
  border: 1.5px solid #71839a; background: transparent; margin-top: 1px;
  display: grid; place-items: center; color: transparent; transition: all .18s;
}
.check-btn:hover { border-color: var(--gold); }
.task-card.completed .check-btn { border-color: var(--green); background: var(--green); color: #0f231c; }
.check-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.task-body { min-width: 0; flex: 1; cursor: pointer; }
.task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-title { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.priority-mark { flex: 0 0 auto; font-size: 9px; letter-spacing: .08em; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.priority-mark.high { color: var(--danger-soft); border-color: rgba(217, 122, 109, .3); background: rgba(217, 122, 109, .06); }
.priority-mark.low { color: #98a9bb; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 7px; font-size: 10px; color: var(--muted); }
.task-meta .urgent { color: var(--danger-soft); }
.task-meta .soon { color: var(--gold); }
.task-meta .done { color: var(--green); }
.task-note { margin: 7px 0 0; color: var(--faint); font-size: 11px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 30px 16px; border: 1px dashed #2a3b50; border-radius: var(--radius-md); color: var(--faint); font-size: 12px; line-height: 1.7; }
.empty-state strong { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; color: #53647a; font-size: 9px; letter-spacing: .04em; }
.cloud-badge { border: 1px solid #2b3e54; border-radius: 999px; padding: 4px 8px; color: #6f8299; }

/* Login */
.login-overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 22px;
  background: var(--login-bg);
}
.login-card {
  width: min(100%, 390px); background: var(--login-card-grad);
  border: 1px solid #27394e; border-radius: 26px; padding: 30px 25px 24px;
  box-shadow: var(--shadow);
}
.login-mark { width: 52px; height: 52px; border-radius: 15px; overflow: hidden; margin-bottom: 21px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.login-mark img { width: 100%; height: 100%; display: block; }
.eyebrow { margin: 0 0 8px; color: var(--gold-dim); font-size: 9px; letter-spacing: .18em; }
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: .02em; }
.login-copy { color: var(--muted); font-size: 12px; line-height: 1.75; margin: 12px 0 24px; }
label { display: block; color: #a9b6c6; font-size: 11px; margin: 15px 0 8px; }
input, textarea {
  width: 100%; color: var(--text); background: var(--field); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 13px; font-size: 14px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder, textarea::placeholder { color: #526378; }
input:focus, textarea:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08); }
textarea { resize: vertical; min-height: 82px; line-height: 1.55; }
.secret-field { position: relative; }
.secret-field input { padding-right: 56px; }
.inline-link { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--gold-dim); font-size: 11px; padding: 6px; }
.primary-btn, .secondary-btn, .danger-btn {
  border-radius: var(--radius-sm); padding: 12px 16px; border: 1px solid transparent; font-weight: 650; font-size: 13px;
  transition: transform .16s, filter .16s, background .16s;
}
.primary-btn { width: 100%; background: linear-gradient(145deg, var(--gold-bright), var(--gold)); color: #171107; box-shadow: 0 12px 26px rgba(var(--accent-rgb), .16); }
.primary-btn:hover { filter: brightness(1.04); }
.primary-btn:active { transform: translateY(1px); }
.secondary-btn { background: transparent; color: var(--gold-bright); border-color: #4a3d2b; }
.secondary-btn:hover { background: #1a2635; }
.danger-btn { background: transparent; color: var(--danger-soft); border-color: rgba(217, 122, 109, .28); }
.form-error { min-height: 16px; margin: 8px 0 0; color: var(--danger-soft); font-size: 11px; line-height: 1.5; }
.login-hint { color: #586a80; font-size: 9.5px; line-height: 1.6; margin: 15px 0 0; }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 8, 14, .68); backdrop-filter: blur(3px); }
.sheet {
  position: relative; z-index: 1; width: min(100%, 520px); max-height: 92svh; overflow-y: auto;
  background: var(--sheet-grad); border: 1px solid var(--line);
  border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + var(--safe-bottom));
  box-shadow: 0 -24px 70px rgba(0, 0, 0, .35); animation: sheetUp .22s ease-out;
}
@keyframes sheetUp { from { transform: translateY(18px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.sheet-grip { width: 34px; height: 4px; border-radius: 999px; background: #33475e; margin: 0 auto 16px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; }
.time-field { display: flex; align-items: center; gap: 2px; }
.time-field input { width: 0; min-width: 0; flex: 1; text-align: center; padding-left: 4px; padding-right: 4px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.time-colon { flex: 0 0 auto; color: var(--gold); font-weight: 700; font-size: 16px; line-height: 1; padding: 0 1px; }
.time-help { white-space: nowrap; }
.priority-row { display: flex; gap: 7px; }
.priority-chip { flex: 1; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 9px; padding: 9px; font-size: 12px; }
.priority-chip.active { border-color: #8a6c43; color: var(--gold-bright); background: rgba(var(--accent-rgb), .08); }
.optional { color: var(--faint); font-weight: 400; }
.sheet-actions { display: flex; gap: 9px; margin-top: 20px; }
.sheet-actions .primary-btn { flex: 1; }
.sheet-actions .danger-btn { flex: 0 0 auto; }
.status-card { display: flex; gap: 12px; align-items: flex-start; background: #0e1a27; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 14px 0 4px; }
.status-card p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.status-card strong { font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 5px; flex: 0 0 auto; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .08); }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(102, 199, 160, .08); }
.field-help { color: #607187; font-size: 9.5px; line-height: 1.5; margin: 7px 0 0; }
.settings-actions { display: flex; gap: 9px; margin-top: 17px; }
.settings-actions .primary-btn { flex: 1; }
.settings-divider { height: 1px; background: var(--line-soft); margin: 22px 0 6px; }
.settings-link { display: block; width: 100%; border: 0; background: transparent; color: #9eacbc; text-align: left; padding: 12px 0; font-size: 12px; }
.danger-text { color: var(--danger-soft); }
.settings-foot { color: #5e7085; font-size: 9.5px; line-height: 1.65; margin: 12px 0 0; }

/* Toast */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(24px + var(--safe-bottom));
  transform: translate(-50%, 14px); max-width: min(90vw, 380px);
  background: #1b2b3e; border: 1px solid #38506a; color: #e9edf3;
  border-radius: 12px; padding: 10px 14px; font-size: 11.5px; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 14px 35px rgba(0, 0, 0, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(217, 122, 109, .45); color: #ffd2ca; }
.toast.success { border-color: rgba(102, 199, 160, .35); color: #c9f1df; }


/* Journal card */
.journal-card {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px; margin: 0 2px 16px;
  background: var(--card-grad); border: 1px solid var(--line-soft);
  border-radius: var(--radius-md); min-width: 0;
}
.journal-icon {
  width: 39px; height: 39px; flex: 0 0 auto; border-radius: 13px;
  display: grid; place-items: center; font-size: 20px;
  background: rgba(var(--accent-rgb), .12);
  border: 1px solid rgba(var(--accent-rgb), .16);
}
.journal-body { flex: 1; min-width: 0; }
.journal-kicker { color: var(--gold-dim); font-size: 8.5px; letter-spacing: .16em; }
.journal-greeting { color: var(--text); font-size: 12.5px; font-weight: 650; margin-top: 3px; }
.journal-quote { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.journal-progress { flex: 0 0 auto; text-align: right; }
.journal-progress > span { display: block; color: var(--gold-bright); font-size: 10px; font-variant-numeric: tabular-nums; }
.journal-leaves { display: flex; justify-content: flex-end; gap: 3px; margin-top: 6px; }
.leaf-dot { width: 6px; height: 6px; border-radius: 50% 0 50% 50%; background: var(--line); transform: rotate(-45deg); }
.leaf-dot.on { background: var(--gold); box-shadow: 0 0 8px rgba(var(--accent-rgb), .38); }

/* Theme picker */
.theme-section { margin: 17px 0 4px; }
.theme-heading { display: flex; justify-content: space-between; align-items: center; color: #a9b6c6; font-size: 11px; margin-bottom: 8px; }
.theme-hint { color: var(--faint); font-size: 9px; }
.theme-row { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 9px; padding: 7px 10px; font-size: 10.5px; transition: all .16s;
}
.theme-chip:hover { border-color: var(--gold-dim); color: var(--gold-bright); }
.theme-chip.active { border-color: var(--gold); color: var(--gold-bright); background: rgba(var(--accent-rgb), .09); }

/* Task sticker */
.task-sticker { display: inline-block; margin-right: 5px; font-size: 14px; line-height: 1; vertical-align: -1px; filter: saturate(.9); }

/* Micro animations */
.today-ring { animation: todayPulse 3.4s ease-in-out infinite; }
.calendar-grid.month-enter { animation: monthIn .3s ease-out; }
.day-cell.selected.jelly { animation: jellyPop .62s cubic-bezier(.22, 1.35, .36, 1); }
.day-cell.selected.jelly .day-num { animation: jellyNum .54s cubic-bezier(.22, 1.35, .36, 1); }
@keyframes jellyPop {
  0% { transform: scale(.90); }
  28% { transform: scale(1.06); }
  48% { transform: scale(.985); }
  68% { transform: scale(1.025); }
  84% { transform: scale(.997); }
  100% { transform: scale(1.025); }
}
@keyframes jellyNum {
  0% { transform: scale(.92); }
  35% { transform: scale(1.08); }
  62% { transform: scale(.98); }
  100% { transform: scale(1); }
}
.task-card { transition: border-color .18s, transform .18s, background .3s; }
.task-card.just-completed { animation: cardComplete .45s ease-out; }
.check-btn.check-pop { animation: checkPop .38s cubic-bezier(.2, .9, .3, 1.4); }
.ambient-a { animation: driftA 18s ease-in-out infinite alternate; }
.ambient-b { animation: driftB 22s ease-in-out infinite alternate; }
body, .panel, .task-card, .sheet, .login-card, .journal-card { transition: background .35s ease, border-color .35s ease, color .35s ease; }

@keyframes todayPulse {
  0%, 100% { opacity: .35; transform: scale(.97); }
  50% { opacity: .9; transform: scale(1.02); }
}
@keyframes monthIn {
  from { opacity: .25; transform: translateX(7px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes dayPop {
  0% { transform: scale(.72); opacity: .5; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes checkPop {
  0% { transform: scale(.75); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes cardComplete {
  0% { transform: scale(1); }
  35% { transform: scale(1.012); }
  100% { transform: scale(1); }
}
@keyframes driftA {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(26px, 18px, 0) scale(1.08); }
}
@keyframes driftB {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-22px, -20px, 0) scale(1.06); }
}

/* Completion confetti */
.celebration-layer { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti {
  position: fixed; width: 7px; height: 7px; border-radius: 2px; left: 0; top: 0;
  opacity: 0; transform: translate(-50%, -50%);
  animation: confettiBurst .85s ease-out forwards;
}
@keyframes confettiBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(0deg) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.55); }
}


/* Custom background photo */
.bg-photo, .bg-scrim {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity .45s ease, filter .45s ease;
}
.bg-photo {
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
  filter: saturate(.9);
}
.bg-scrim { background: #05090e; }
html.has-custom-bg .panel {
  background-color: transparent;
  background-image:
    linear-gradient(rgba(var(--panel-rgb), var(--bg-photo-overlay, .52)), rgba(var(--panel-rgb), var(--bg-photo-overlay, .52))),
    var(--user-bg-image, none);
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  backdrop-filter: blur(1.5px) saturate(.92);
}
html.has-custom-bg .task-card,
html.has-custom-bg .journal-card {
  background-color: transparent;
  background-image:
    linear-gradient(rgba(var(--panel-2-rgb), var(--bg-card-overlay, .62)), rgba(var(--panel-2-rgb), var(--bg-card-overlay, .62))),
    var(--user-bg-image, none);
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  backdrop-filter: blur(1px);
}
html.has-custom-bg .panel,
html.has-custom-bg .task-card,
html.has-custom-bg .journal-card {
  text-shadow: 0 1px 9px rgba(0, 0, 0, .55);
}
html.has-custom-bg .topbar,
html.has-custom-bg .day-head,
html.has-custom-bg .month-title,
html.has-custom-bg .footer { text-shadow: 0 2px 14px rgba(0, 0, 0, .72); }

/* Custom background settings */
.custom-bg-section { margin: 18px 0 2px; }
.bg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bg-upload {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(var(--accent-rgb), .5); border-radius: 9px;
  padding: 8px 12px; color: var(--gold-bright); font-size: 10.5px;
  cursor: pointer; transition: background .18s, border-color .18s;
}
.bg-upload:hover { background: rgba(var(--accent-rgb), .08); border-color: var(--gold); }
.bg-remove {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 9px; padding: 8px 11px; font-size: 10.5px;
}
.bg-remove:hover { color: var(--danger-soft); border-color: rgba(217, 122, 109, .4); }
.bg-preview {
  width: 54px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background-size: cover; background-position: center; background-color: var(--field);
}
.bg-controls { display: grid; grid-template-columns: 1fr; gap: 5px; margin-top: 12px; }
.bg-controls label { margin: 5px 0 0; font-size: 10px; color: var(--muted); }
.bg-controls input[type="range"] {
  width: 100%; height: 20px; padding: 0; border: 0; background: transparent;
  accent-color: var(--gold); box-shadow: none;
}
.bg-controls input[type="range"]:focus { box-shadow: none; outline: 1px solid var(--gold-dim); outline-offset: 2px; }
.bg-controls .field-help { margin-top: 2px; }


/* Weather detail */
.weather-sheet { width: min(100%, 430px); }
.weather-hero {
  display: flex; align-items: center; gap: 15px;
  padding: 16px; margin: 2px 0 14px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  background: var(--card-grad);
}
.weather-detail-icon {
  width: 66px; height: 66px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 20px; font-size: 34px; line-height: 1;
  background: rgba(var(--accent-rgb), .12);
  border: 1px solid rgba(var(--accent-rgb), .18);
}
.weather-hero-text { min-width: 0; }
.weather-detail-temp { color: var(--text); font-size: 32px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.weather-detail-label { color: var(--gold-bright); font-size: 12px; margin-top: 6px; }
.weather-detail-location { color: var(--muted); font-size: 9.5px; margin-top: 5px; }
.weather-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.weather-grid > div {
  padding: 10px 8px; border: 1px solid var(--line-soft); border-radius: 11px;
  background: rgba(var(--accent-rgb), .035);
}
.weather-grid span { display: block; color: var(--faint); font-size: 8.5px; }
.weather-grid strong { display: block; color: var(--text); font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.weather-detail-updated { color: var(--faint); font-size: 9px; margin: 13px 0 0; }
.weather-detail-hint { color: var(--muted); font-size: 10px; line-height: 1.6; margin: 6px 0 14px; }
.weather-refresh-btn { width: 100%; }
@media (min-width: 680px) {
  .app { padding-top: 34px; }
  .content { grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); align-items: start; gap: 26px; }
  .calendar-card { padding: 24px 23px 22px; }
  .day-section { padding-top: 3px; }
  .day-head h2 { font-size: 24px; }
  .modal { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; padding: 12px 24px 25px; }
  .sheet-grip { margin-bottom: 18px; }
}
@media (max-width: 430px) {
  .brand { gap: 9px; }
  .brand-icon { width: 36px; height: 36px; border-radius: 10px; }
  .brand h1 { font-size: 18px; }
  .brand p { font-size: 9px; }
  .topbar-actions { gap: 6px; }
  .weather-chip { height: 32px; padding: 0 7px; gap: 3px; }
  .weather-text { max-width: 34px; font-size: 8px; }
  .icon-btn { width: 36px; height: 36px; }
}
@media (max-width: 380px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .calendar-card { padding-left: 12px; padding-right: 12px; }
  .month-title strong { font-size: 26px; }
  .task-card { padding: 12px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
