:root {
  --ink: #302823;
  --muted: #7e7067;
  --paper: #fffaf4;
  --cream: #f7ead9;
  --coral: #f36f56;
  --coral-dark: #cb4d39;
  --green: #65816f;
  --line: rgba(72, 53, 42, .12);
  --shadow: 0 18px 50px rgba(72, 53, 42, .12);
  font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  color: var(--ink);
  background: #f4eee8;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at top right, #ffd9cc 0, transparent 28rem), #f4eee8; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 18px calc(110px + env(safe-area-inset-bottom)); }
.topbar, .calendar-head, .section-title, .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.75rem, 7vw, 2.7rem); letter-spacing: -.05em; }
h1 span { color: var(--coral); }
h2 { margin-bottom: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.eyebrow { margin-bottom: 5px; color: var(--coral-dark); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.7; }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 14px; background: rgba(255,255,255,.72); color: var(--ink); font-size: 1.45rem; box-shadow: 0 6px 20px rgba(72,53,42,.08); }
.next-event { margin: 24px 0 16px; padding: 19px; border-radius: 22px; background: linear-gradient(135deg, #3c342f, #635148); color: white; box-shadow: var(--shadow); }
.next-event.empty { background: linear-gradient(135deg, #708879, #526b5b); }
.next-event p { margin: 0; }
.next-event .next-kicker { color: #ffd7c9; font-size: .78rem; font-weight: 800; }
.next-event h2 { margin: 6px 0; font-size: 1.45rem; }
.next-event .next-meta { color: rgba(255,255,255,.78); }
.calendar-card { padding: 16px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,250,244,.9); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.month-title { border: 0; background: transparent; color: var(--ink); font-size: 1.18rem; font-weight: 900; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.weekday-row { margin: 17px 0 8px; color: var(--muted); font-size: .72rem; font-weight: 700; text-align: center; }
.day { position: relative; aspect-ratio: 1; min-width: 0; border: 0; border-radius: 14px; background: transparent; color: var(--ink); font-size: .86rem; font-weight: 700; }
.day:hover, .day:focus-visible { background: var(--cream); outline: none; }
.day.outside { color: #bdb1a9; }
.day.today { background: var(--ink); color: white; }
.day.selected { box-shadow: inset 0 0 0 2px var(--coral); }
.day.has-event::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--coral); transform: translateX(-50%); }
.day.today.has-event::after { background: #ffd0c1; }
.agenda-section { margin-top: 28px; }
.count-pill { min-width: 34px; padding: 6px 10px; border-radius: 999px; background: #f2d9cf; color: var(--coral-dark); font-weight: 900; text-align: center; }
.agenda { display: grid; gap: 11px; margin-top: 14px; }
.event-card { display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 19px; background: var(--paper); color: inherit; text-align: left; box-shadow: 0 8px 24px rgba(72,53,42,.07); }
.event-card .date-block { padding: 8px 4px; border-radius: 13px; background: var(--cream); text-align: center; }
.date-block strong, .date-block span { display: block; }
.date-block strong { font-size: 1.2rem; }
.date-block span { color: var(--muted); font-size: .7rem; }
.event-card h3 { margin: 0 0 4px; font-size: 1rem; }
.event-card p { margin: 0; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.people { color: var(--green); font-size: .75rem; font-weight: 800; white-space: nowrap; }
.empty-state { padding: 28px 16px; border: 1px dashed #cdbdb2; border-radius: 20px; color: var(--muted); text-align: center; }
.fab { position: fixed; z-index: 5; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; padding: 15px 22px; border: 0; border-radius: 999px; background: var(--coral); color: white; font-weight: 900; box-shadow: 0 15px 35px rgba(203,77,57,.36); transform: translateX(-50%); }
.fab span { font-size: 1.25rem; vertical-align: -1px; }
.modal { width: min(calc(100% - 28px), 520px); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 26px; background: transparent; overflow: auto; }
.modal::backdrop { background: rgba(39,31,27,.58); backdrop-filter: blur(4px); }
.modal-card { display: grid; gap: 15px; padding: 24px; border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.modal-emoji { font-size: 2.7rem; }
label { display: grid; gap: 7px; color: #574b44; font-size: .82rem; font-weight: 800; }
input, textarea { width: 100%; padding: 13px 14px; border: 1px solid #d9ccc2; border-radius: 13px; background: white; color: var(--ink); outline: none; }
input:focus, textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(243,111,86,.14); }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.primary-button, .secondary-button, .danger-button { min-height: 48px; padding: 12px 16px; border-radius: 14px; font-weight: 900; }
.primary-button { border: 0; background: var(--coral); color: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.danger-button { border: 1px solid #e7b1a7; background: #fff1ee; color: #b93e2d; }
.form-error { min-height: 1.2em; margin: 0; color: #b93e2d; font-size: .8rem; }
.prototype-note { margin: 6px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.6; }
.detail-meta { display: grid; gap: 8px; padding: 15px; border-radius: 16px; background: var(--cream); }
.detail-meta p { margin: 0; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.attendee-list { color: var(--green); font-weight: 700; line-height: 1.7; }
.toast { position: fixed; z-index: 20; top: max(18px, env(safe-area-inset-top)); left: 50%; padding: 11px 16px; border-radius: 999px; background: #302823; color: white; font-size: .82rem; font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, -16px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 440px) {
  .app-shell { padding-inline: 12px; }
  .calendar-card { padding: 12px 8px; border-radius: 22px; }
  .day { border-radius: 11px; }
  .event-card { grid-template-columns: 52px minmax(0, 1fr); }
  .people { grid-column: 2; }
  .form-row, .detail-actions { grid-template-columns: 1fr; }
}
@media (min-width: 760px) {
  .app-shell { padding-top: 36px; }
  .calendar-card { padding: 22px; }
}
