:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --ink: #151a18;
  --muted: #626965;
  --line: #dfe3df;
  --accent: #0c5a45;
  --accent-ink: #ffffff;
  --danger: #a3342c;
  --radius: 18px;
  --shadow: 0 20px 70px rgba(28, 42, 35, .12);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:active, .button:active { transform: scale(.98); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, white); outline-offset: 3px; }
.hidden { display: none !important; }

.shell { min-height: 100dvh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: env(safe-area-inset-top) max(18px, calc((100vw - 1180px) / 2)) 0;
  border-bottom: 1px solid rgba(210, 216, 211, .82);
  background: rgba(244, 245, 242, .88);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand strong { font-size: 20px; letter-spacing: -.04em; }
.brand span { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.button, button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
button.secondary, .button.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
button.ghost { min-height: 38px; padding: 0 10px; background: transparent; color: var(--muted); }
button.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 22%, white); }
button[disabled] { cursor: wait; opacity: .55; }

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  position: relative;
}
.login-page::before {
  content: "";
  position: fixed;
  width: 72vw;
  height: 72vw;
  left: -28vw;
  top: -22vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(12, 90, 69, .16), transparent 70%);
  pointer-events: none;
}
.login-card { width: min(100%, 420px); position: relative; }
.login-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--accent); font-weight: 800; font-size: 20px; box-shadow: 0 14px 35px rgba(12, 90, 69, .24); }
.login-card h1 { margin: 30px 0 8px; font-size: clamp(34px, 9vw, 52px); letter-spacing: -.065em; line-height: 1.05; }
.login-card > p { max-width: 28ch; margin: 0 0 34px; color: var(--muted); line-height: 1.7; }
.field { display: grid; gap: 8px; }
.field label { font-weight: 650; font-size: 14px; }
.field input {
  width: 100%;
  height: 54px;
  border: 1px solid #b7c0ba;
  border-radius: 13px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255,255,255,.82);
  font-size: 17px;
}
.field input::placeholder { color: #707973; }
.login-card form button { width: 100%; height: 52px; margin-top: 14px; }
.helper, .error { min-height: 20px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.error { color: var(--danger); }

.hero { max-width: 1180px; margin: 0 auto; padding: 58px 20px 26px; }
.hero h1 { margin: 0; max-width: 13ch; font-size: clamp(40px, 7vw, 78px); letter-spacing: -.07em; line-height: .98; }
.hero p { max-width: 34ch; margin: 18px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }

.calendar-wrap { position: sticky; top: 64px; z-index: 15; border-bottom: 1px solid var(--line); background: rgba(244,245,242,.93); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); }
.month-calendar { max-width: 760px; margin: 0 auto; padding: 10px 20px 14px; touch-action: pan-y; user-select: none; }
.month-head { display: grid; grid-template-columns: 44px 1fr 44px auto; align-items: center; gap: 6px; }
.month-head > strong { text-align: center; font-size: 16px; }
.month-nav, .calendar-toggle { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.month-nav { padding: 0; font-size: 24px; }
.calendar-toggle { margin-left: 8px; color: var(--muted); font-size: 12px; }
.month-body { padding-top: 10px; }
.collapsed .month-body { display: none; }
.collapsed .month-calendar { padding-bottom: 10px; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(40px, 1fr)); gap: 4px; }
.month-weekday, .month-day { min-height: 36px; display: grid; place-items: center; }
.month-weekday { color: var(--muted); font-size: 12px; }
.month-day { border-radius: 10px; }
button.month-day { min-height: 40px; padding: 0; border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, white); color: var(--accent); }
button.month-day.active { border-color: var(--accent); background: var(--accent); color: white; }
.month-day.muted { color: #9ba19d; font-size: 13px; }

.gallery { max-width: 1180px; margin: 0 auto; padding: 36px 20px 100px; }
.date-section { scroll-margin-top: 170px; margin-bottom: 58px; }
.date-heading { display: flex; align-items: baseline; gap: 12px; margin: 0 0 18px; }
.date-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.05em; }
.date-heading span { color: var(--muted); font-size: 13px; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.media-item { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.media-card { position: relative; width: 100%; min-width: 0; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: #e4e7e3; color: white; text-align: left; aspect-ratio: 1536 / 2752; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.media-card img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s cubic-bezier(.2,.8,.2,1), filter .25s ease; }
.media-card:hover img { transform: scale(1.018); }
.media-card::after { content: ""; position: absolute; inset: 58% 0 0; background: linear-gradient(transparent, rgba(7,12,10,.78)); pointer-events: none; }
.media-label { position: absolute; z-index: 1; left: 16px; right: 16px; bottom: 15px; }
.media-label strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.media-label span { font-size: 11px; color: rgba(255,255,255,.74); }
.media-quick { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.media-quick button { min-height: 44px; padding: 0 8px; border-radius: 0; background: var(--surface); color: var(--ink); font-size: 13px; }
.media-quick button + button { border-left: 1px solid var(--line); color: var(--accent); }

.skeleton { overflow: hidden; position: relative; background: #e4e7e3; border-radius: var(--radius); aspect-ratio: 1536/2752; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty { min-height: 46dvh; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 8px; color: var(--ink); font-size: 22px; }

.viewer { position: fixed; inset: 0; z-index: 100; display: grid; background: rgba(11, 14, 13, .96); color: white; }
.viewer[hidden] { display: none; }
.viewer-head { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; padding: env(safe-area-inset-top) 14px 0; background: linear-gradient(rgba(0,0,0,.52), transparent); }
.viewer-title { min-width: 0; text-align: center; }
.viewer-title strong, .viewer-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title small { margin-top: 2px; color: rgba(255,255,255,.65); }
.viewer button { background: rgba(255,255,255,.14); color: white; backdrop-filter: blur(12px); }
.viewer-stage { display: grid; place-items: center; min-width: 0; min-height: 0; padding: calc(74px + env(safe-area-inset-top)) 10px calc(86px + env(safe-area-inset-bottom)); overflow: auto; }
.viewer-stage img { display: block; max-width: min(100%, 680px); max-height: calc(100dvh - 168px); border-radius: 8px; object-fit: contain; box-shadow: 0 20px 90px rgba(0,0,0,.45); }
.viewer-actions { position: absolute; z-index: 3; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.75) 32%); }
.viewer-actions button { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.18); }
.viewer-actions button:first-child { background: white; color: #101412; }
.viewer-nav { position: absolute; top: 50%; z-index: 3; width: 46px; padding: 0; }
.viewer-nav.prev { left: 14px; }
.viewer-nav.next { right: 14px; }
.wechat-tip { position: fixed; inset: 0; z-index: 120; display: grid; align-items: start; justify-items: end; padding: calc(18px + env(safe-area-inset-top)) 18px; background: rgba(8,11,10,.82); color: white; }
.wechat-tip[hidden] { display: none; }
.wechat-tip div { max-width: 250px; padding: 18px; border: 1px solid rgba(255,255,255,.2); border-radius: 16px; background: rgba(255,255,255,.12); backdrop-filter: blur(16px); line-height: 1.7; }

.admin { max-width: 1180px; margin: 0 auto; padding: 42px 20px 100px; }
.admin h1 { margin: 0 0 10px; font-size: clamp(38px,6vw,64px); letter-spacing: -.065em; }
.admin-intro { margin: 0 0 38px; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel h2 { margin: 0 0 18px; font-size: 20px; letter-spacing: -.035em; }
.panel form { display: grid; gap: 14px; }
.panel input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #b7c0ba; border-radius: 11px; background: white; color: var(--ink); }
.panel input[type=file] { padding: 11px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.share-list { display: grid; gap: 10px; }
.share-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.share-row:first-child { border-top: 0; }
.share-row strong, .share-row small { display: block; }
.share-row small { color: var(--muted); margin-top: 3px; }
.share-row button { min-height: 36px; }
.admin-media { margin-top: 24px; }
.admin-media-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.admin-thumb { position: relative; overflow: hidden; border-radius: 12px; background: #e5e7e4; aspect-ratio: 1536/2752; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-thumb button { position: absolute; right: 5px; bottom: 5px; min-height: 32px; padding: 0 8px; font-size: 11px; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: #14211c; color: white; box-shadow: var(--shadow); animation: toast-in .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (max-width: 760px) {
  .topbar { padding-left: 16px; padding-right: 10px; }
  .brand span { display: none; }
  .hero { padding: 38px 18px 22px; }
  .hero h1 { font-size: clamp(40px, 13vw, 58px); max-width: 9ch; }
  .hero p { font-size: 15px; }
  .month-calendar { padding-left: 12px; padding-right: 12px; }
  .month-grid { grid-template-columns: repeat(7, minmax(36px, 1fr)); }
  .gallery { padding: 28px 12px 90px; }
  .date-section { margin-bottom: 42px; }
  .date-heading { padding: 0 4px; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .media-item { border-radius: 14px; }
  .media-label { left: 10px; right: 10px; bottom: 10px; }
  .media-label span { display: none; }
  .viewer-nav { display: none; }
  .admin { padding: 28px 14px 80px; }
  .admin-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .two-fields { grid-template-columns: 1fr; }
  .admin-media-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .calendar-wrap { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
