:root {
  color-scheme: light;
  --ink: #19372b;
  --muted: #537264;
  --red: #a53d2f;
  --red-dark: #85291f;
  --green: #17604c;
  --green-soft: #e9f2ec;
  --cream: #fbf7ee;
  --paper: #fffdf7;
  --line: #e8dfcd;
  --gold: #d7a63b;
  --shadow: 0 14px 38px #28443512;
  font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-size: 17px;
  background: #f6f1e6;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(ellipse at 85% 0%, #e9f2e8 0, #f6f1e6 46rem); }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], .import-button { cursor: pointer; }
button { border: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #ce9a36; outline-offset: 2px; }
.app-shell { max-width: 1440px; min-height: 100vh; margin: 0 auto; padding: 0 30px; display: flex; flex-direction: column; }
.topbar { min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #bdc9b544; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.brand-icon { width: 52px; height: 52px; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 12px #19372b22; background: #fff; }
.brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.brand b { display: block; font-size: 23px; letter-spacing: -.3px; }
.brand small { display: block; color: var(--muted); font-size: 14px; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 8px; padding: 15px 0 20px; }
.tab { min-height: 48px; padding: 0 24px; border-radius: 14px; background: transparent; color: var(--muted); font-weight: 650; }
.tab:hover { background: #ffffff80; color: var(--ink); }
.tab.active { background: var(--green); color: white; box-shadow: 0 5px 13px #17604c24; }
main { flex: 1; }
.view { display: none; animation: rise .18s ease-out; }
.view.active { display: block; }
@keyframes rise { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.paper-card { background: var(--paper); border: 1px solid #e9dfcb; border-radius: 22px; box-shadow: var(--shadow); }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); gap: 22px; align-items: stretch; }
.calendar-card { padding: 23px 25px 17px; }
.month-toolbar { display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; margin: 0 auto 15px; max-width: 580px; }
.month-title { text-align: center; }
.month-title h1 { margin: 0; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.2; }
.text-button { background: transparent; color: var(--red); font-weight: 700; min-height: 35px; padding: 2px 10px; }
.round-button { width: 48px; height: 48px; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 30px; line-height: 1; }
.round-button:hover { background: #d9eadf; }
.weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { color: var(--muted); font-size: 14px; font-weight: 700; text-align: center; padding: 5px 0 9px; }
.day-cell { position: relative; min-height: clamp(68px, 8vw, 94px); margin: 3px; padding: 8px 5px 5px; border: 1px solid transparent; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; color: var(--ink); background: transparent; }
.day-cell:hover { background: #f5f0e4; }
.day-cell.outside { color: #89978f; opacity: .7; }
.day-cell.selected { background: #e9f2ec; border-color: #9fbfac; }
.day-cell.today .solar { color: var(--red); }
.day-cell.has-event::after { content: ""; position: absolute; bottom: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.solar { font-size: 22px; font-weight: 700; line-height: 1.05; }
.lunar { color: var(--muted); font-size: 13px; line-height: 1; }
.calendar-hint { margin: 12px 4px 0; color: var(--muted); font-size: 14px; text-align: center; }
.day-panel { padding: 26px 25px; display: flex; flex-direction: column; }
.eyebrow { display: inline-block; color: var(--red); text-transform: uppercase; letter-spacing: .09em; font-size: 12px; font-weight: 800; }
.day-heading h2 { margin: 8px 0 3px; font-size: 30px; line-height: 1.15; }
.day-heading p { margin: 0; color: var(--muted); font-size: 20px; }
.day-divider { height: 1px; background: var(--line); margin: 21px 0; }
h3 { margin: 0 0 12px; font-size: 18px; }
.event-stack { display: grid; gap: 10px; flex: 1; align-content: start; }
.event-card { border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; padding: 10px 12px; background: #f8f3e8; }
.event-card strong { display: block; font-size: 16px; }
.event-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.empty-state { color: var(--muted); line-height: 1.55; padding: 10px 0; }
.primary-button, .secondary-button, .quiet-button { min-height: 48px; padding: 0 18px; border-radius: 13px; font-weight: 700; }
.primary-button { color: #fff; background: var(--red); box-shadow: 0 5px 12px #a53d2f1c; }
.primary-button:hover { background: var(--red-dark); }
.secondary-button { background: #eaf1eb; color: var(--green); border: 1px solid #d0e0d4; display: inline-flex; align-items: center; justify-content: center; }
.secondary-button:hover { background: #dcebe0; }
.quiet-button { background: transparent; color: var(--green); border: 1px solid var(--line); min-width: 52px; }
.wide-button { width: 100%; margin-top: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 8px 0 22px; }
.section-heading h1, .guide-card h1 { font-size: clamp(27px, 3vw, 38px); margin: 7px 0; line-height: 1.16; }
.section-heading p { margin: 0; color: var(--muted); }
.filters { display: flex; align-items: center; gap: 18px; padding: 14px; margin-bottom: 20px; }
.search-box { min-height: 52px; display: flex; align-items: center; flex: 1; gap: 10px; padding: 0 15px; background: #f6f2e8; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); }
.search-box span { font-size: 25px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-month { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--muted); }
select, input:not([type=checkbox]):not([type=file]) { min-height: 46px; border: 1px solid var(--line); border-radius: 11px; background-color: #fffefa; color: var(--ink); padding: 0 12px; }
.search-box input { border: 0 !important; padding: 0 !important; min-height: 42px !important; }
.occasion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.occasion-item { padding: 18px; display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.occasion-item h2 { margin: 0 0 5px; font-size: 17px; }
.occasion-item p { margin: 0; color: var(--muted); line-height: 1.45; font-size: 14px; }
.occasion-date { min-width: 90px; color: var(--red); font-weight: 750; font-size: 14px; }
.manage-list { display: grid; gap: 12px; }
.managed-event { display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; padding: 17px 19px; }
.managed-event h2 { margin: 0; font-size: 18px; }
.managed-event p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.manage-actions { display: flex; align-items: center; gap: 10px; }
.switch-row { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-weight: 650; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--green); }
.delete-button { min-height: 44px; min-width: 44px; border-radius: 12px; background: #fae9e4; color: var(--red); font-size: 21px; }
.local-tools { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px; margin-top: 18px; }
.local-tools h2 { margin: 0 0 4px; font-size: 18px; }
.local-tools p { margin: 0; color: var(--muted); font-size: 14px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.import-button input { display: none; }
.cloud-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.cloud-card { padding: 22px; }
.cloud-card h2 { margin: 0 0 12px; font-size: 21px; }
.cloud-help { color: var(--muted); font-size: 14px; line-height: 1.5; }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.cloud-actions > button { flex: 1; min-width: 145px; }
.cloud-status { min-height: 24px; color: var(--green); font-weight: 650; }
.cloud-backup-list { display: grid; gap: 10px; }
.cloud-backup-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.cloud-backup-item strong, .cloud-backup-item small { display: block; }
.cloud-backup-item small { color: var(--muted); margin-top: 4px; }
.danger-button { color: var(--red); }
.cloud-dialog-form { padding: 24px; }
.cloud-dialog-form h2 { margin: 0; }
.guide-card { max-width: 880px; margin: 10px auto; padding: clamp(25px, 5vw, 55px); }
.guide-card > p { color: var(--muted); line-height: 1.7; font-size: 18px; }
.privacy-note { padding: 19px; border-radius: 16px; background: var(--green-soft); margin: 25px 0; }
.privacy-note p { margin: 6px 0 0; line-height: 1.6; color: var(--muted); }
.maker-line { font-weight: 700; color: var(--green) !important; }
.reminder-limit { border-top: 1px solid var(--line); padding-top: 17px; font-size: 14px !important; }
footer { min-height: 70px; margin-top: 22px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
footer a { color: var(--green); font-weight: 650; text-decoration: none; }
.event-dialog { width: min(600px, calc(100% - 24px)); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 20px 70px #172f2750; color: var(--ink); background: var(--paper); }
.event-dialog::backdrop { background: #172f2766; backdrop-filter: blur(3px); }
.event-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dialog-heading h2 { margin: 5px 0 0; font-size: 26px; }
.field { display: grid; gap: 7px; margin: 13px 0; font-weight: 650; }
.field > span { color: var(--muted); font-size: 14px; }
.field input, .field select { width: 100%; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 15px 0; min-height: 48px; font-weight: 650; }
.check-row input { width: 21px; height: 21px; accent-color: var(--green); }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 22px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; color: white; background: #19372b; padding: 13px 20px; border-radius: 12px; box-shadow: var(--shadow); max-width: calc(100vw - 30px); z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
@media (min-width: 1200px) { .day-cell { min-height: 94px; } }
@media (min-width: 851px) and (max-height: 900px) {
  .topbar { min-height: 74px; }
  .tabs { padding: 8px 0 11px; }
  .calendar-layout { align-items: start; gap: 16px; }
  .calendar-card { padding: 15px 20px 12px; }
  .month-toolbar { margin-bottom: 6px; }
  .weekdays { padding: 2px 0 4px; }
  .day-cell { min-height: clamp(52px, 8.2vh, 72px); margin: 2px; padding: 6px 3px 4px; gap: 3px; }
  .calendar-hint { margin-top: 6px; font-size: 12px; }
  .day-panel { padding: 20px; }
  .day-heading h2 { font-size: 27px; }
  .day-heading p { font-size: 18px; }
  .day-divider { margin: 15px 0; }
  footer { min-height: 36px; margin-top: 8px; }
}
@media (max-width: 850px) {
  .app-shell { padding: 0 16px; }
  .calendar-layout { grid-template-columns: 1fr; }
  .cloud-layout { grid-template-columns: 1fr; }
  .day-panel { min-height: 250px; }
  .day-cell { min-height: 68px; }
}
@media (max-width: 600px) {
  :root { font-size: 16px; }
  .app-shell { padding: 0 12px; }
  .topbar { min-height: 78px; }
  .brand-icon { width: 44px; height: 44px; border-radius: 13px; }
  .brand b { font-size: 18px; }
  .brand small { max-width: 190px; font-size: 11px; }
  .top-actions { gap: 5px; }
  .top-actions .primary-button { min-height: 42px; padding: 0 10px; font-size: 13px; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 11px 0 14px; }
  .tab { min-width: 0; min-height: 44px; padding: 4px 8px; font-size: 14px; line-height: 1.2; }
  .calendar-card { padding: 14px 10px 13px; border-radius: 18px; }
  .month-toolbar { grid-template-columns: 44px 1fr 44px; margin-bottom: 9px; }
  .round-button { width: 42px; height: 42px; }
  .month-title h1 { font-size: 22px; }
  .weekdays { font-size: 11px; }
  .day-cell { min-height: 61px; margin: 1px; border-radius: 10px; gap: 4px; padding-top: 7px; }
  .solar { font-size: 18px; }
  .lunar { font-size: 11px; }
  .calendar-hint { font-size: 12px; }
  .day-panel { padding: 20px; border-radius: 18px; }
  .day-heading h2 { font-size: 26px; }
  .filters { align-items: stretch; flex-direction: column; gap: 9px; }
  .filter-month { justify-content: space-between; }
  .filter-month select { flex: 1; }
  .occasion-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .section-heading > .primary-button { width: 100%; }
  .local-tools { align-items: stretch; flex-direction: column; }
  .tool-actions > * { flex: 1; }
  .managed-event { grid-template-columns: 1fr; }
  .manage-actions { justify-content: space-between; }
  .two-fields { gap: 8px; }
  .event-dialog form { padding: 18px; }
  footer { font-size: 11px; }
}
