:root {
  --paper: #f4fbfb;
  --surface: #ffffff;
  --surface-soft: #eaf7f8;
  --ink: #193236;
  --muted: #60757b;
  --sky: #79cdd5;
  --teal: #177a83;
  --deep: #0f5961;
  --gold: #bb8d35;
  --coral: #c96b57;
  --line: #cfe6e8;
  --shadow: 0 22px 60px rgba(24, 99, 106, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 122, 131, 0.12);
}

.hidden {
  display: none !important;
}

.hero {
  min-height: 660px;
  position: relative;
  overflow: hidden;
  padding: 22px 40px 64px;
  background:
    linear-gradient(90deg, rgba(244, 251, 251, 0.97) 0%, rgba(244, 251, 251, 0.82) 42%, rgba(244, 251, 251, 0.2) 100%),
    url("assets/huaying-background.png") center / cover no-repeat;
  border-bottom: 1px solid var(--line);
}

.daily-visits {
  position: absolute;
  left: 38px;
  top: 90px;
  z-index: 2;
  width: 126px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 122, 131, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(24, 99, 106, 0.12);
  backdrop-filter: blur(8px);
}

.daily-visits span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.daily-visits strong {
  display: block;
  margin-top: 2px;
  color: var(--deep);
  font-size: 24px;
  line-height: 1;
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 3;
}

.brand {
  flex: 0 0 auto;
  color: var(--deep);
  font-size: 22px;
  font-weight: 900;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.nav-links a,
.ghost-button,
.primary-button,
.tab-button,
.unit-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
}

.nav-links a {
  padding: 0 12px;
  color: #36545a;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(23, 122, 131, 0.22);
  background: rgba(255, 255, 255, 0.76);
  outline: none;
}

.account-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--deep);
  font-size: 13px;
  font-weight: 800;
}

.ghost-button {
  padding: 0 14px;
  color: var(--deep);
  background: rgba(255, 255, 255, 0.56);
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--deep);
  outline: none;
}

.hero-copy {
  max-width: 1180px;
  margin: 132px auto 0;
  position: relative;
  z-index: 2;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 620px;
  margin: 0;
  color: #123136;
  font-size: 68px;
  line-height: 1.03;
  letter-spacing: 0;
}

.hero-text {
  max-width: 540px;
  margin: 20px 0 0;
  color: #3f5d63;
  font-size: 20px;
}

.value-row,
.motto-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.value-row {
  max-width: 560px;
  margin-top: 32px;
}

.value-row span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid rgba(23, 122, 131, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--deep);
  font-weight: 900;
}

.motto-row {
  margin-top: 18px;
}

.motto-row span {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--deep);
  color: #ffffff;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(15, 89, 97, 0.18);
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 40px 0;
}

.feature-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
}

.notice-panel,
.spotlight-panel,
.unit-picker,
.unit-detail,
.guestbook-section,
.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.notice-panel,
.spotlight-panel {
  min-height: 258px;
  padding: 24px;
}

.panel-heading h2,
.section-heading h2,
.guestbook-head h2,
.modal-heading h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.24;
  letter-spacing: 0;
}

.notice-text {
  min-height: 112px;
  margin: 24px 0 0;
  display: flex;
  align-items: center;
  color: var(--deep);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.45;
}

.spotlight-viewer {
  width: 100%;
  margin-top: 18px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.spotlight-media {
  display: block;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(23, 122, 131, 0.16), rgba(187, 141, 53, 0.18)),
    var(--surface-soft);
}

.spotlight-media img,
.spotlight-media video,
.media-thumb img,
.media-thumb video,
.modal-media {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.spotlight-caption {
  display: block;
  min-height: 46px;
  padding: 10px 12px;
  color: #36545a;
  font-weight: 800;
}

.section-heading {
  max-width: 740px;
}

.unit-layout {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  align-items: start;
}

.unit-picker {
  padding: 12px;
  position: sticky;
  top: 18px;
  box-shadow: 0 12px 36px rgba(24, 99, 106, 0.1);
}

.mobile-select-label,
.unit-select {
  display: none;
}

.unit-buttons {
  display: grid;
  gap: 8px;
}

.unit-button {
  width: 100%;
  padding: 0 12px;
  justify-content: flex-start;
  background: transparent;
  color: #3d5960;
  text-align: left;
  font-weight: 800;
}

.unit-button:hover,
.unit-button:focus-visible,
.unit-button.is-active {
  border-color: rgba(23, 122, 131, 0.24);
  background: #e9f8f9;
  color: var(--deep);
  outline: none;
}

.unit-detail {
  min-height: 560px;
  padding: 28px;
  box-shadow: 0 12px 36px rgba(24, 99, 106, 0.1);
}

.unit-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.unit-detail h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.24;
}

.unit-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
}

.tabs {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-button {
  padding: 0 16px;
  border-color: var(--line);
  background: #ffffff;
  color: #38565c;
  font-weight: 900;
}

.tab-button:hover,
.tab-button:focus-visible,
.tab-button.is-active {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
  outline: none;
}

.tab-panel {
  display: none;
  padding-top: 24px;
}

.tab-panel.is-active {
  display: block;
}

.unit-intro {
  min-height: 96px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #38565c;
  white-space: pre-wrap;
}

.org-block {
  margin-top: 20px;
}

.org-block h4,
.admin-section h3,
.admin-section h4,
.login-card h3 {
  margin: 0 0 12px;
  color: var(--deep);
  font-size: 18px;
}

.org-list,
.editable-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.org-list li,
.editable-list li {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.org-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--coral);
}

.org-list li span {
  flex: 1 1 auto;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.media-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(23, 122, 131, 0.14), rgba(187, 141, 53, 0.18)),
    #eef8f8;
}

.media-card h4 {
  margin: 0;
  padding: 12px;
  color: #37565c;
  font-size: 15px;
}

.empty-state {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.guestbook-section {
  margin-top: 72px;
  padding: 28px;
}

.guestbook-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.message-count {
  color: var(--muted);
  font-weight: 900;
}

.message-form {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.message-list {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.message-item {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.message-item p {
  margin: 0;
  color: #36545a;
  word-break: break-word;
}

.message-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.site-footer {
  margin-top: 84px;
  padding: 34px 40px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  text-align: center;
  color: var(--muted);
}

.site-footer p {
  margin: 0 0 6px;
  color: var(--deep);
  font-weight: 900;
}

.site-footer small {
  font-size: 12px;
}

.modal {
  width: min(100% - 28px, 980px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(11, 37, 42, 0.56);
}

.modal-card {
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 0;
  padding: 28px;
  position: relative;
}

.login-card {
  width: min(100%, 760px);
  margin: 0 auto;
}

.admin-card {
  width: 100%;
}

.icon-close {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--deep);
  font-size: 24px;
  line-height: 1;
}

.login-grid,
.admin-grid {
  margin-top: 22px;
  display: grid;
  gap: 18px;
}

.login-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.login-grid section,
.admin-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.login-grid label,
.admin-section label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-weight: 800;
}

.login-grid .primary-button,
.admin-section .primary-button {
  width: 100%;
  margin-top: 14px;
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-actions,
.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.admin-actions {
  margin-top: 10px;
}

.admin-actions span {
  color: var(--muted);
  font-weight: 800;
}

.org-editor {
  margin-top: 18px;
}

.editable-list {
  margin-top: 12px;
}

.delete-button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid rgba(201, 107, 87, 0.32);
  border-radius: 8px;
  background: #fff4f1;
  color: #9a3f30;
  font-weight: 800;
}

.editable-media-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.editable-media-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.editable-media-item img,
.editable-media-item video {
  width: 64px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-soft);
}

.editable-media-item strong {
  display: block;
  color: #36545a;
  font-size: 14px;
}

.editable-media-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.media-modal-card {
  width: min(100%, 920px);
  margin: 0 auto;
}

#mediaModalBody h3 {
  margin: 16px 0 0;
  color: var(--deep);
}

#mediaModalBody img,
#mediaModalBody video {
  max-height: 70vh;
  border-radius: 8px;
  background: #000000;
  object-fit: contain;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  min-width: 220px;
  max-width: min(460px, calc(100vw - 32px));
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 8px;
  background: #123136;
  color: #ffffff;
  font-weight: 800;
  text-align: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .hero {
    min-height: 620px;
    padding: 18px 22px 48px;
    background-position: 42% center;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .daily-visits {
    left: 22px;
    top: 132px;
  }

  .hero-copy {
    margin-top: 132px;
  }

  .hero h1 {
    font-size: 54px;
  }

  .feature-section,
  .unit-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .unit-picker {
    position: static;
  }

  .unit-buttons {
    display: none;
  }

  .mobile-select-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 800;
  }

  .unit-select {
    display: block;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .hero {
    min-height: 610px;
    padding: 16px 16px 42px;
    background-position: 48% center;
  }

  .brand {
    font-size: 20px;
  }

  .account-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .daily-visits {
    left: 16px;
    top: 176px;
  }

  .hero-copy {
    margin-top: 134px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .hero-text,
  .notice-text {
    font-size: 18px;
  }

  .value-row span {
    min-height: 34px;
    padding: 0 10px;
    font-size: 14px;
  }

  .motto-row span {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .section {
    padding: 54px 16px 0;
  }

  .notice-panel,
  .spotlight-panel,
  .unit-detail,
  .guestbook-section,
  .modal-card {
    padding: 20px;
  }

  .panel-heading h2,
  .section-heading h2,
  .guestbook-head h2,
  .modal-heading h2 {
    font-size: 26px;
  }

  .unit-detail-head,
  .guestbook-head {
    display: block;
  }

  .unit-count,
  .message-count {
    display: block;
    margin-top: 8px;
  }

  .media-grid,
  .message-list,
  .login-grid {
    grid-template-columns: 1fr;
  }

  .message-form,
  .admin-actions,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .editable-media-item {
    grid-template-columns: 54px 1fr;
  }

  .editable-media-item .delete-button {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .toast {
    transition: none;
  }
}
