/* =========================================================
   岁时 · 万年历  —  UI Stylesheet
   ========================================================= */
:root {
  --bg: #f4f3fb;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e6e1ff 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 10%, #ffe6ef 0%, transparent 55%);
  --card: rgba(255,255,255,.82);
  --card-solid: #fff;
  --line: rgba(30, 27, 75, .08);
  --text: #1e1b3a;
  --muted: #7b7894;
  --soft: #f1effa;
  --accent: #6d5dfc;
  --accent-2: #9a8cff;
  --accent-soft: rgba(109,93,252,.12);
  --rest: #e5484d;
  --work: #3b82f6;
  --weekend: #e5484d;
  --shadow: 0 1px 2px rgba(20,16,70,.04), 0 12px 40px -12px rgba(40,30,120,.18);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
  --c-violet: #7c6cf6; --c-rose: #f0567a; --c-amber: #f0a020; --c-emerald: #16b384; --c-sky: #2f9bf0; --c-slate: #64748b;
}
[data-theme="dark"] {
  --bg: #0f0e1a;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #231d52 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 10%, #3a1730 0%, transparent 55%);
  --card: rgba(26,24,44,.78);
  --card-solid: #1a182c;
  --line: rgba(255,255,255,.08);
  --text: #ecebf7;
  --muted: #9a97b5;
  --soft: #232038;
  --accent-soft: rgba(154,140,255,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 18px 50px -20px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--text);
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.app { max-width: 1440px; margin: 0 auto; padding: 20px 24px 28px; }
.card { background: var(--card); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Topbar ---------- */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), #b06cff); box-shadow: 0 8px 20px -6px rgba(109,93,252,.6); font-family: var(--serif); font-size: 20px; }
.brand-name { font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.month-nav { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  padding: 6px; border-radius: 999px; box-shadow: var(--shadow); }
.month-title { padding: 4px 18px; border-radius: 999px; line-height: 1.15; text-align: center; transition: background .2s; }
.month-title:hover { background: var(--soft); }
.month-title span { display: block; font-size: 19px; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.month-title small { display: block; font-size: 11.5px; color: var(--muted); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: .2s; }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--rest); color: #fff; font-size: 10px; line-height: 16px; font-weight: 700; }
.pill-btn { padding: 8px 16px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(109,93,252,.7); transition: transform .15s, filter .2s; white-space: nowrap; }
.pill-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.pill-btn.soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; padding: 6px 12px; }
[data-theme="dark"] .pill-btn.soft { color: var(--accent-2); }

.top-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.search { position: relative; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 14px; height: 40px; width: 240px; color: var(--muted); transition: width .25s, box-shadow .2s; }
.search:focus-within { width: 300px; box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); }
.search-results { position: absolute; top: 46px; right: 0; width: 340px; max-height: 420px; overflow: auto; background: var(--card-solid);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; z-index: 30; display: none; }
.search-results.show { display: block; }
.sr-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.sr-item:hover { background: var(--soft); }
.sr-item b { display: block; font-size: 14px; color: var(--text); }
.sr-item small { color: var(--muted); }
.sr-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.calendar { padding: 18px 18px 14px; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 8px; }
.weekdays div { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 0; letter-spacing: 1px; }
.weekdays div.we { color: var(--weekend); }

.grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(96px, 1fr); gap: 6px; }
.grid.anim-left { animation: slideL .32s ease; } .grid.anim-right { animation: slideR .32s ease; }
@keyframes slideL { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }

.cell { position: relative; border-radius: 16px; padding: 8px 10px; cursor: pointer; overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid transparent; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; user-select: none; isolation: isolate; }
.cell:hover { background: var(--soft); transform: translateY(-1px); }
.cell.out { opacity: .38; }
.cell .num { font-size: 22px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cell.we .num { color: var(--weekend); }
.cell .sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .sub.fest { color: var(--accent); font-weight: 600; }
.cell .sub.term { color: #1f9d8a; font-weight: 600; }
.cell .off { position: absolute; top: 7px; right: 8px; font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 6px; color: #fff; }
.cell .off.rest { background: var(--rest); } .cell .off.work { background: var(--work); }
.cell .marks { margin-top: auto; display: flex; gap: 4px; align-items: center; }
.cell .marks i { width: 6px; height: 6px; border-radius: 50%; }
.cell .marks .rem { display: inline-flex; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); margin-left: auto; }
.cell .marks .rem svg { width: 11px; height: 11px; }

/* 重大节日：图片单元格 */
.cell.pic { color: #fff; }
.cell.pic::before { content: ""; position: absolute; inset: 0; z-index: -2; background-image: var(--img); background-size: cover; background-position: center;
  transform: scale(1.02); transition: transform .5s ease; }
.cell.pic::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10,8,30,.15), rgba(10,8,30,.62)); }
.cell.pic:hover::before { transform: scale(1.1); }
.cell.pic .num, .cell.pic.we .num { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.35); }
.cell.pic .sub, .cell.pic .sub.fest { color: #ffe9b8; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.cell.pic .marks .rem { color: #fff; }

.cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cell.today:not(.pic) .num { color: var(--accent); }
.cell.today .num::after { content: "今"; font-size: 10px; font-weight: 700; margin-left: 4px; vertical-align: 4px; color: #fff;
  background: var(--accent); padding: 1px 4px; border-radius: 5px; }
.cell.selected:not(.pic) { background: var(--accent); color: #fff; box-shadow: 0 10px 24px -10px rgba(109,93,252,.9); }
.cell.selected:not(.pic) .num, .cell.selected:not(.pic) .sub { color: #fff !important; }
.cell.selected.pic { box-shadow: 0 0 0 3px var(--accent), 0 10px 24px -8px rgba(109,93,252,.8); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; padding: 10px 6px 0; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.rest { background: var(--rest); } .dot.work { background: var(--work); } .dot.memo { background: var(--c-violet); } .dot.rem { background: var(--c-amber); }
.legend-tip { margin-left: auto; }

/* ---------- Hero ---------- */
.side { display: flex; flex-direction: column; gap: 20px; }
.hero { position: relative; overflow: hidden; min-height: 300px; color: #fff; border: 0; }
.hero-bg { position: absolute; inset: 0; background: linear-gradient(135deg, #6d5dfc, #b06cff 60%, #ff8fb1); background-size: cover; background-position: center;
  transition: opacity .5s ease, transform 6s ease; }
.hero.has-img .hero-bg { animation: kenburns 14s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.12) translate(-2%, -1%); } }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,6,24,.05) 0%, rgba(8,6,24,.35) 45%, rgba(8,6,24,.82) 100%); }
.hero:not(.has-img) .hero-shade { background: radial-gradient(500px 240px at 90% 0%, rgba(255,255,255,.25), transparent 60%); }
.hero-body { position: relative; padding: 20px 22px 22px; display: flex; flex-direction: column; min-height: 300px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.2); backdrop-filter: blur(6px); }
.hero-chip:empty { display: none; }
.hero-diff { font-size: 12px; opacity: .9; }
.hero-date { display: flex; align-items: flex-end; gap: 14px; margin-top: 18px; }
.hero-day { font-size: 76px; font-weight: 750; line-height: .9; letter-spacing: -2px; font-variant-numeric: tabular-nums; text-shadow: 0 4px 24px rgba(0,0,0,.25); }
.hero-meta { font-size: 14px; line-height: 1.5; opacity: .95; padding-bottom: 6px; }
.hero-lunar { font-family: var(--serif); font-size: 22px; margin-top: 12px; letter-spacing: 2px; }
.hero-gz { font-size: 12.5px; opacity: .85; margin-top: 4px; line-height: 1.6; }
.hero-festival { margin-top: auto; padding-top: 18px; animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hero-festival h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 30px; letter-spacing: 4px; text-shadow: 0 2px 14px rgba(0,0,0,.4); }
.hero-festival p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.7; opacity: .95; }
.hero-festival blockquote { margin: 0 0 10px; padding-left: 10px; border-left: 2px solid rgba(255,255,255,.6); font-family: var(--serif); font-size: 13.5px; opacity: .9; }
.hero-festival blockquote:empty { display: none; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.hero-tags span { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); }
.hero.has-img { min-height: 420px; } .hero.has-img .hero-body { min-height: 420px; }

/* ---------- Panels ---------- */
.panel { padding: 16px 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-actions { display: flex; gap: 6px; }
.items { display: flex; flex-direction: column; gap: 8px; }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0 10px; }
.empty svg { width: 34px; height: 34px; opacity: .4; display: block; margin: 0 auto 8px; }

.item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--soft); cursor: pointer;
  transition: transform .15s, box-shadow .2s; border-left: 3px solid var(--tag, var(--c-violet)); }
.item:hover { transform: translateX(2px); box-shadow: 0 6px 18px -10px rgba(40,30,120,.35); }
.item .tick { flex: none; width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--tag); margin-top: 2px; display: grid; place-items: center; }
.item.done .tick { background: var(--tag); }
.item.done .tick::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.item.done .i-title { text-decoration: line-through; opacity: .55; }
.item .i-main { flex: 1; min-width: 0; }
.item .i-title { font-size: 14px; font-weight: 600; word-break: break-word; }
.item .i-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: pre-wrap; word-break: break-word; max-height: 3.2em; overflow: hidden; }
.item .i-time { flex: none; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c-amber); }
.item .pin { font-size: 11px; color: var(--accent); }
.item.rem { --tag: var(--c-amber); }
.item.off { opacity: .5; }
.item .tog { flex: none; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: .2s; cursor: pointer; }
[data-theme="light"] .switch i { background: #dcd9ea; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }

.upcoming { display: grid; gap: 8px; }
.up { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; cursor: pointer; transition: background .2s; }
.up:hover { background: var(--soft); }
.up .thumb { width: 54px; height: 40px; border-radius: 10px; background: var(--soft) center/cover; flex: none; box-shadow: 0 4px 12px -6px rgba(0,0,0,.4); }
.up .thumb.bell { display: grid; place-items: center; color: var(--c-amber); background: rgba(240,160,32,.12); box-shadow: none; }
.up .u-main { flex: 1; min-width: 0; }
.up b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up small { color: var(--muted); font-size: 12px; }
.up .u-days { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.up .u-days em { font-style: normal; font-size: 20px; margin-right: 2px; }
.up-sep { font-size: 11px; color: var(--muted); letter-spacing: 1px; margin: 6px 0 0 4px; }

.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 26px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(12,10,30,.42);
  backdrop-filter: blur(6px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 520px; background: var(--card-solid); border-radius: 24px; padding: 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45);
  animation: pop .25s cubic-bezier(.2,.9,.3,1.2); max-height: calc(100vh - 40px); overflow: auto; }
.modal-card.sm { max-width: 380px; } .modal-card.lg { max-width: 640px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.x { width: 32px; height: 32px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); }
.x:hover { background: var(--soft); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); outline: none; transition: .2s; }
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--card-solid); }
.row { display: flex; gap: 12px; } .row.three .field { flex: 1; }
.hint { font-size: 12.5px; color: var(--accent); margin: -6px 0 12px; min-height: 1px; }
.hint:empty { display: none; }
.colors { display: flex; gap: 10px; }
.colors input { display: none; }
.colors i { display: block; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; transition: transform .15s; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.colors input:checked + i { transform: scale(1.12); box-shadow: 0 0 0 2px var(--card-solid), 0 0 0 4px currentColor; }
.c-violet { background: var(--c-violet); color: var(--c-violet); } .c-rose { background: var(--c-rose); color: var(--c-rose); }
.c-amber { background: var(--c-amber); color: var(--c-amber); } .c-emerald { background: var(--c-emerald); color: var(--c-emerald); }
.c-sky { background: var(--c-sky); color: var(--c-sky); } .c-slate { background: var(--c-slate); color: var(--c-slate); }
.modal-foot { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.spacer { flex: 1; }
.btn { padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .2s; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 18px -8px rgba(109,93,252,.8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--soft); }
.btn.ghost:hover { filter: brightness(.97); }
.btn.danger { color: var(--rest); }
.btn.block { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 14px; color: var(--muted); }

.picker-year { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.picker-year input { width: 110px; text-align: center; font-size: 22px; font-weight: 700; border: 0; background: var(--soft); border-radius: 12px; padding: 6px; outline: none; }
.picker-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.picker-months button { padding: 12px 0; border-radius: 12px; background: var(--soft); font-weight: 600; transition: .15s; }
.picker-months button:hover { background: var(--accent-soft); color: var(--accent); }
.picker-months button.on { background: var(--accent); color: #fff; }

.tabs { display: flex; gap: 6px; background: var(--soft); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tab { flex: 1; padding: 8px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--card-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.result { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--accent-soft); font-size: 14px; line-height: 1.8; }
.result:empty { display: none; }
.result b { font-size: 18px; }

.notify-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: rgba(240,160,32,.12); color: #b7791f; font-size: 13px; margin-bottom: 12px; }

/* ---------- Festival popup ---------- */
.festival-pop { position: fixed; left: 24px; bottom: 24px; z-index: 90; width: 380px; border-radius: 22px; overflow: hidden; background: var(--card-solid);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); animation: popIn .6s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(40px) scale(.95); } }
.fp-img { height: 170px; background: center/cover; position: relative; }
.fp-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--card-solid)); }
.fp-body { padding: 0 20px 18px; margin-top: -26px; position: relative; }
.fp-kicker { font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: 1px; }
.fp-body h3 { margin: 4px 0 6px; font-family: var(--serif); font-size: 24px; letter-spacing: 3px; }
.fp-body p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.7; }

/* ---------- Alarm ---------- */
.alarm { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(12,10,30,.55); backdrop-filter: blur(8px); animation: fade .2s; }
.alarm-card { width: 360px; max-width: calc(100vw - 32px); text-align: center; background: var(--card-solid); border-radius: 26px; padding: 28px 24px 22px; animation: pop .3s; }
.alarm-ring { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #f7b733, #fc4a1a); box-shadow: 0 0 0 0 rgba(252,74,26,.5); animation: ring 1.4s infinite; }
.alarm-ring svg { width: 32px; height: 32px; animation: shake 1.4s infinite; }
@keyframes ring { 70% { box-shadow: 0 0 0 22px rgba(252,74,26,0); } 100% { box-shadow: 0 0 0 0 rgba(252,74,26,0); } }
@keyframes shake { 0%,50%,100% { transform: rotate(0); } 10%,30% { transform: rotate(-14deg); } 20%,40% { transform: rotate(14deg); } }
.alarm-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alarm-card h3 { margin: 6px 0; font-size: 22px; }
.alarm-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.alarm-card p:empty { display: none; }
.alarm-actions { display: flex; gap: 8px; } .alarm-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; border-radius: 999px; background: #1e1b3a; color: #fff; font-size: 13.5px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: toastIn .3s ease; }
.toast.err { background: var(--rest); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .side .hero { grid-row: span 2; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; }
  .month-nav { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .search { width: 40px; padding: 0 11px; } .search input { display: none; }
  .search:focus-within { width: 220px; } .search:focus-within input { display: block; }
  .side { grid-template-columns: 1fr; }
  .legend-tip { display: none; }
}
@media (max-width: 640px) {
  .app { padding: 12px 10px 20px; }
  .brand-sub { display: none; }
  .month-nav .icon-btn[data-nav="-12"], .month-nav .icon-btn[data-nav="12"] { display: none; }
  .calendar { padding: 10px 8px; }
  .grid { grid-auto-rows: minmax(64px, 1fr); gap: 3px; }
  .cell { padding: 5px 4px; border-radius: 10px; align-items: center; text-align: center; }
  .cell .num { font-size: 17px; }
  .cell .num::after { display: none; }
  .cell .sub { font-size: 10px; max-width: 100%; }
  .cell .off { top: 2px; right: 2px; font-size: 9px; padding: 0 3px; }
  .cell .marks .rem span { display: none; }
  .hero-day { font-size: 60px; }
  .festival-pop { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .row { flex-direction: column; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
