:root {
  color-scheme: light;
  --paper: #e8e7f7;
  --card: #f8f9ffe0;
  --surface: #f9faff70;
  --solid-surface: #f3f3ff;
  --glass: #f1f1ff99;
  --lavender: #d9d7f4;
  --tint: #eeedfa;
  --ink: #171a2d;
  --muted: #505770;
  --purple: #234f9a;
  --border: #ffffffad;
  --field-border: #52669d58;
  --action: #2255c2;
  --action-hover: #1644a6;
  --error: #8a2736;
  --success: #225a40;
  --shadow: 0 13px 28px #3437581d, inset 0 1px #ffffffa6;
  --ambient:
    radial-gradient(ellipse at 10% 3%, #a89af0 0%, transparent 53%),
    radial-gradient(ellipse at 100% 0%, #a8d8f0 0%, transparent 49%),
    radial-gradient(ellipse at 52% 110%, #9ca9dc 0%, transparent 51%),
    #eae8f7;
  --gutter: clamp(16px, 4vw, 42px);
  --radius: 22px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Instrument Serif", "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171a2c;
  --card: #22273e;
  --surface: #272c45c9;
  --solid-surface: #242942;
  --glass: #222740e8;
  --lavender: #353b60;
  --tint: #303650;
  --ink: #f2f2ff;
  --muted: #c1c8e1;
  --purple: #b9d0ff;
  --border: #a7b1e04a;
  --field-border: #b0bbe066;
  --action: #3465cf;
  --action-hover: #2959c4;
  --error: #ffafb9;
  --success: #a8e8c6;
  --shadow: 0 13px 28px #06091d58, inset 0 1px #d5ddff24;
  --ambient:
    radial-gradient(ellipse at 10% 3%, #392d74 0%, transparent 53%),
    radial-gradient(ellipse at 100% 0%, #183950 0%, transparent 49%),
    radial-gradient(ellipse at 52% 110%, #313866 0%, transparent 51%),
    #141829;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; z-index: -1; inset: 0; background: var(--ambient); }
main { flex: 1; padding-block: 24px 62px; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { line-height: 1.3; overflow-wrap: anywhere; }
h1 { font-family: var(--sans); font-weight: 800; font-size: clamp(2.6rem, 7vw, 5.2rem); letter-spacing: -.045em; }
h2 { font-size: 1.25rem; letter-spacing: -.02em; font-weight: 670; }
h3 { font-size: 1rem; }
p, dd, a, time, figcaption { overflow-wrap: anywhere; }
a { color: var(--purple); text-underline-offset: .21em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid #7857a7; outline-offset: 4px; }
#main:focus:not(:focus-visible) { outline: none; }
.shell {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.skip-link {
  position: fixed;
  z-index: 10;
  left: max(12px, env(safe-area-inset-left));
  top: max(8px, env(safe-area-inset-top));
  transform: translateY(-200%);
  background: var(--card);
  border-radius: 12px;
  padding: .7rem 1rem;
}
.skip-link:focus { transform: none; }

.site-header {
  position: sticky;
  z-index: 5;
  top: max(10px, env(safe-area-inset-top));
  margin: max(12px, env(safe-area-inset-top)) auto 0;
  max-width: calc(100% - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
  width: min(100%, 470px);
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: 25px; background: var(--glass); box-shadow: var(--shadow);

}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand img { border-radius: 50%; }
.brand b, .brand small { display: block; line-height: 1.25; }
.brand b { font-size: .9rem; }
.brand small { display: none; }
.site-header nav {
  display: flex;
  align-items: center;
  justify-content: safe center;
  gap: 2px;
  width: 100%;
  order: 3;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 3px;
}
.site-header nav a, .admin-nav a {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding-inline: 8px;
  color: var(--muted);
  font-size: .83rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 999px;
}
.site-header nav a:hover, .admin-nav a:hover { background: var(--tint); color: var(--ink); }
.site-header a[aria-current="page"] { background: var(--card); color: var(--purple); box-shadow: var(--shadow); }
.nav-control { min-height: 40px; border: 0; border-radius: 999px; padding: 0 12px; background: var(--surface); color: var(--ink); font-size: .84rem; }
.nav-control:hover { background: var(--card); }
.nav-search { margin-left: auto; }
.theme-toggle { width: 40px; padding: 0; font-size: 1.22rem; }
.site-footer { border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); color: var(--muted); }
.footer-inner { min-height: 73px; display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px; padding-block: 15px; font-size: .78rem; }
.footer-inner a { color: inherit; }
.footer-brand { text-decoration: none; }
.footer-brand span { margin-inline: .3em; }
.footer-inner a[aria-current="page"] { color: var(--purple); font-weight: 700; }

.eyebrow { color: var(--purple); font-size: .71rem; font-weight: 720; letter-spacing: .21em; line-height: 1.35; }
.subtitle { color: var(--muted); line-height: 1.75; }
.page-heading { margin-block: clamp(13px, 4vw, 44px) clamp(26px, 5vw, 55px); }
.page-heading .eyebrow { display: inline-flex; padding: .45rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); letter-spacing: .1em; }
.page-heading h1 { margin-block: 7px 5px; }

.hero { min-height: clamp(400px, 73svh, 760px); display: grid; align-items: center; text-align: center; padding-block: clamp(42px, 8vh, 110px); }
.hero-copy { min-width: 0; }
.hero-status {
  display: inline-flex; align-items: center; gap: 9px; padding: 5px 13px 5px 5px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--glass);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-size: .84rem; font-weight: 720;
}
.hero .avatar { width: 43px; height: 43px; border-radius: 50%; object-fit: cover; }
#hero-status-label::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .45em; background: var(--muted); border-radius: 50%; vertical-align: .06em; }
#hero-status-label[data-state="online"]::before { background: var(--success); }
.hero-welcome { margin-top: 20px; color: var(--muted); font-weight: 750; letter-spacing: .18em; }
.hero h1 { margin-block: 8px 3px; font-size: clamp(3rem, 12.8vw, 10rem); line-height: 1.16; letter-spacing: -.065em; font-weight: 850; }
.hero .subtitle { margin-inline: auto; margin-top: 10px; max-width: 38ch; }
.hero .actions { justify-content: center; margin-top: clamp(18px, 4vw, 35px); }

.panel { min-width: 0; padding: clamp(17px, 4vw, 28px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > h2 { margin-bottom: .65rem; }
.overview, .split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; }
.overview { margin-top: 14px; }
.about p { color: var(--muted); }
.now { scroll-margin-top: 120px; }
#status-title, .admin-section { scroll-margin-top: 125px; }
.now dl { margin-top: .6rem; }
.now dl div, .link-list div {
  display: grid;
  grid-template-columns: minmax(6.5rem, .72fr) minmax(0, 1fr);
  align-items: baseline;
  padding-block: .35rem;
  gap: 7px 1rem;
}
.now dl div + div, .link-list div + div { border-top: 1px solid var(--border); }
.now dt, .link-list dt { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.now dd { font-size: .91rem; font-variant-numeric: tabular-nums; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .38em;
  flex-shrink: 0;
  padding: .24rem .58rem;
  border-radius: 999px;
  background: #eae5ec;
  color: #514958;
  font-size: .74rem;
  font-weight: 650;
}
.status-pill::before { content: ""; width: .49rem; height: .49rem; border-radius: 50%; background: currentColor; }
.status-pill[data-state="online"] { background: #dcefe4; color: #225a40; }
.status-pill[data-state="unknown"] { background: #f5e8d7; color: #6e491b; }
.gallery-section { margin-top: 29px; }
.gallery-section > .section-row { margin-bottom: 10px; }
.connection { margin-top: 25px; }
.contact-action { margin-top: 18px; }

.section-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; }
.section-row > * { min-width: 0; }
.section-row > a { flex-shrink: 0; }
.text-link { color: var(--purple); font-size: .9rem; font-weight: 650; }
.text-link:hover { text-decoration-thickness: .12em; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: .52rem .95rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 650;
  font-size: .9rem;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.button:active:not(:disabled), .icon-btn:active:not(:disabled) { transform: translateY(1px); }
.primary { color: #fff; background: linear-gradient(180deg, #3d75e0, var(--action)); border-color: #b8d3fb6e; box-shadow: 0 8px 18px #2353aa32; }
.primary:hover:not(:disabled) { background: var(--action-hover); }
.secondary, .icon-btn { background: var(--card); border-color: var(--border); }
.secondary:hover:not(:disabled), .icon-btn:hover:not(:disabled) { background: var(--tint); }
.compact { min-height: 38px; padding: .36rem .72rem; font-size: .81rem; }
.danger { background: var(--card); border-color: var(--field-border); color: var(--error); }
.danger:hover:not(:disabled) { background: var(--tint); }
.more { margin-top: 16px; }
.feedback, .hint, .notice { color: var(--muted); font-size: .9rem; }
.feedback:not([hidden]) { margin-block: .45em; }
.feedback[data-tone="error"] { color: var(--error); }
.feedback[data-tone="success"] { color: var(--success); }
.feedback button { margin-left: .35em; }
.multiline { white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .78rem; }
.toolbar { margin-bottom: 14px; }
.count { color: var(--muted); font-size: .91rem; }

.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photo-tile {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--lavender);
  aspect-ratio: 1;
  isolation: isolate;
  text-align: left;
  box-shadow: var(--shadow);
}
.photo-tile::after { content: ""; z-index: -1; position: absolute; inset: 42% 0 0; background: linear-gradient(transparent, #160f24d9); }
.photo-tile img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.photo-tile:hover img { transform: scale(1.04); }
.tile-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 12px 10px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .76rem;
  font-weight: 620;
  color: #fff;
  text-shadow: 0 1px 4px #170c22;
}
.photo-fallback { display: grid; place-items: center; height: 100%; padding: 10px; text-align: center; color: var(--purple); font-size: .8rem; padding-bottom: 32px; }
.album-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: clamp(18px, 4vw, 37px); }
#album-search { margin: 0; width: min(60%, 250px); border-radius: 999px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: clamp(24px, 6vw, 60px); padding: 8px clamp(12px, 4vw, 42px) 14px; }
.album-card { display: grid; gap: 18px; min-width: 0; width: 100%; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); }
.album-stack { position: relative; isolation: isolate; display: block; aspect-ratio: 1.45; border-radius: var(--radius); background: var(--lavender); box-shadow: var(--shadow); }
.album-stack::before, .album-stack::after {
  content: ""; position: absolute; z-index: -1; inset: 0; background: var(--lavender); border: 1px solid var(--border);
  border-radius: inherit; box-shadow: var(--shadow); transform: rotate(-3.5deg); transition: transform .24s ease;
}
.album-stack::after { transform: rotate(3.5deg); }
.album-stack img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; border: 1px solid var(--border); }
.album-card:hover .album-stack::before { transform: rotate(-5deg); }
.album-card:hover .album-stack::after { transform: rotate(5deg); }
.album-detail { display: grid; gap: 2px; justify-items: center; padding: .75rem; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--border); box-shadow: var(--shadow); }
.album-detail strong { font-size: 1.1rem; }
.album-detail > span { color: var(--muted); font-size: .81rem; }
.album-heading { justify-content: start; flex-wrap: wrap; margin-bottom: 18px; }
.album-heading h2 { font-size: clamp(1.25rem, 4vw, 2rem); }
.lightbox {
  --dialog-edge: max(10px, env(safe-area-inset-left), env(safe-area-inset-right));
  width: min(calc(100% - 2 * var(--dialog-edge)), 880px);
  max-height: calc(100dvh - max(env(safe-area-inset-top), 12px) - max(env(safe-area-inset-bottom), 12px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--card);
  overscroll-behavior: contain;
}
.lightbox::backdrop, .site-search::backdrop { background: #15172abb; }
.lightbox-inner { padding: clamp(12px, 3vw, 24px); }
.lightbox-top, .lightbox-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lightbox-controls { margin-top: 10px; }
.lightbox-top h2 { font-size: 1rem; }
.icon-btn { width: 44px; padding: 0; font-size: 1.4rem; }
.lightbox figure { background: var(--tint); border-radius: 13px; margin-top: 10px; padding: 7px; touch-action: pan-y pinch-zoom; }
.lightbox figure img { width: 100%; height: min(55vh, 580px); object-fit: contain; }
.lightbox figcaption { text-align: center; min-height: 1.6em; margin-block: 3px; font-size: .85rem; color: var(--muted); }
body:has(dialog[open]) { overflow: hidden; }
.site-search {
  width: min(calc(100% - 28px), 510px); max-height: calc(100dvh - 36px); padding: 19px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--solid-surface);
  color: var(--ink); box-shadow: var(--shadow);
}
.site-search .section-row { margin-bottom: 12px; }
.search-results { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.search-results a { display: block; padding: .62rem .75rem; border-radius: 12px; text-decoration: none; background: var(--surface); }
.search-results a:hover, .search-results a:focus-visible { background: var(--tint); }

.segmented { display: inline-flex; gap: 2px; border-radius: 14px; padding: 3px; background: var(--tint); }
.segmented button { min-height: 42px; padding-inline: 12px; background: transparent; border: 0; border-radius: 11px; color: var(--muted); font-size: .86rem; }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--purple); font-weight: 680; box-shadow: var(--shadow); }
.post-list, .record-list { display: grid; gap: 9px; }
.post-list.as-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); align-items: start; }
.post { padding: 0; }
.post summary { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 17px 19px; cursor: pointer; list-style: none; border-radius: var(--radius); }
.post summary::-webkit-details-marker { display: none; }
.post summary:hover { background: var(--tint); }
.post summary h2 { grid-column: 1; font-size: 1.12rem; }
.post-toggle { grid-column: 2; grid-row: 1 / span 2; color: var(--purple); font-size: 1.3rem; line-height: 1; }
.post-toggle::before { content: "+"; }
.post[open] .post-toggle::before { content: "−"; }
.post-body { margin: 0 19px 18px; padding-top: 13px; border-top: 1px solid var(--border); }

form label { display: block; color: var(--ink); font-size: .92rem; font-weight: 620; margin-bottom: 5px; }
form label span { color: var(--muted); font-weight: 450; font-size: .83rem; }
input:not([type="checkbox"]), textarea, select {
  display: block;
  width: 100%;
  min-height: 45px;
  margin-bottom: 14px;
  border-radius: 11px;
  padding: .55rem .7rem;
  border: 1px solid var(--field-border);
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:disabled { background: var(--tint); }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.field-pair { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
.check { display: flex; align-items: center; width: fit-content; padding-block: 5px; gap: 9px; }
.check input { accent-color: var(--purple); width: 19px; height: 19px; margin: 0; }
.hint { margin-bottom: 12px; }
.guest-form, .guest-list { max-width: 810px; }
.guest-list { margin-top: 22px; }
.guest-list > h2 { margin-bottom: 9px; }
.record .section-row { align-items: start; }
.record > p { margin-block: .38em; }
.record-state { margin-top: 6px; display: inline-block; border-radius: 999px; background: var(--tint); color: var(--purple); padding: .1em .6em; font-size: .77rem; }
.result { background: var(--surface); }
.result > .feedback { margin: 0; }
.score { color: var(--purple); font-variant-numeric: tabular-nums; }
.score strong { font-family: var(--serif); font-size: 3.1rem; line-height: 1.2; }
.score span { color: var(--muted); }
meter { width: 100%; height: 14px; accent-color: var(--purple); margin-block: 6px 13px; }
meter::-webkit-meter-bar { background: #e7e0ee; border: 0; }
meter::-webkit-meter-optimum-value { background: #7c65a6; }
meter::-moz-meter-bar { background: #7c65a6; }
.login, .admin-section { max-width: 900px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.admin-nav a { background: var(--tint); }
.admin-section { margin-bottom: 14px; }
.admin-section > form, .admin-section form + .record-list { margin-bottom: 12px; }
.admin-section .record { border: 1px solid var(--border); background: var(--card); padding: 12px; border-radius: 15px; }
.admin-section .record .actions { margin-top: 6px; }
.admin-section .section-row { margin-bottom: 6px; }

@media (min-width: 550px) {
  .field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-tile { aspect-ratio: 1.22; }
  .tile-caption { font-size: .85rem; padding-inline: 12px; }
}

@media (min-width: 760px) {
  main { padding-block: 32px 75px; }
  .site-header { width: max-content; }
  .header-inner { min-height: 54px; flex-wrap: nowrap; gap: 6px; padding-inline: 10px; border-radius: 999px; }
  .brand { margin-inline-end: 6px; }
  .site-header nav { width: auto; order: initial; gap: 4px; padding-block: 2px; }
  .site-header nav a { padding-inline: 13px; }
  #status-title, .admin-section { scroll-margin-top: 85px; }
  .overview, .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
  .overview { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
  .connection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-section { margin-top: 34px; }
}

@media (min-width: 1050px) {
  .preview-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  body[data-page="photos"] .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: hero-enter .55s ease-out both; }
  @keyframes hero-enter { from { opacity: 0; transform: translateY(14px); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
