:root {
  color-scheme: light;
  --green: #16a63c;
  --green-deep: #0b862c;
  --green-soft: #21bf4d;
  --panel: #f7f7f7;
  --line: rgba(255, 255, 255, 0.42);
  --text: #ffffff;
  --ink: #17231b;
  --muted: #7c877f;
  --card: #bdbdbd;
  --admin-accent: #16a63c;
  --site-theme: #16a63c;
  --enter-button: #11a63c;
  --site-background-image: none;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--site-theme);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,0.18), transparent 24%),
    linear-gradient(180deg, color-mix(in srgb, var(--site-theme) 82%, #ffffff), color-mix(in srgb, var(--site-theme) 74%, #000000));
  overflow-x: hidden;
}

body.site-loading {
  background: #f1f4f2;
}

body.site-loading > * {
  visibility: hidden;
}

body.has-custom-background {
  background-image:
    linear-gradient(rgba(8, 64, 26, 0.36), rgba(4, 48, 18, 0.58)),
    var(--site-background-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

#mesh {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 44px 0 32px;
}

.site-shell h1 {
  margin: 0 0 28px;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.18);
}

.nav-panel {
  width: 100%;
  padding: 14px 12px 20px;
  border: 10px solid #eeeeee;
  border-radius: 14px;
  background: #efefef;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.top-banner {
  min-height: 86px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--top-banner-background, var(--site-theme));
  color: var(--top-banner-text, #ffffff);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  padding: 16px;
  text-decoration: none;
}

.top-banner[hidden] {
  display: none;
}

.top-banner.is-clickable {
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.top-banner.is-clickable:hover {
  filter: brightness(1.06);
}

.top-banner.is-clickable:active {
  transform: translateY(1px);
}

.top-banner-switch {
  align-self: end;
}

.link-list {
  display: grid;
  gap: 12px;
}

.link-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--link-background, var(--card));
  color: var(--link-text, #fff);
}

.link-row.is-clickable {
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.link-row.is-clickable:hover {
  filter: brightness(1.04);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.link-row.is-clickable:focus-visible {
  outline: 3px solid var(--site-theme);
  outline-offset: 2px;
}

.link-row.is-clickable:active {
  transform: translateY(1px);
}

.link-title {
  margin: 0 0 3px;
  font-size: clamp(19px, 5vw, 25px);
  line-height: 1.1;
  text-align: center;
  font-weight: 500;
}

.link-url {
  display: block;
  max-width: 100%;
  color: var(--link-text, rgba(255, 255, 255, 0.92));
  opacity: 0.88;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(12px, 3vw, 15px);
  font-style: italic;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
}

.enter-button {
  display: inline-grid;
  width: 88px;
  min-height: 48px;
  place-items: center;
  border-radius: 9px;
  background: var(--enter-button);
  color: #fff;
  text-decoration: none;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.15;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.site-footer {
  padding: 30px 8px 0;
  color: rgba(255, 255, 255, 0.96);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(17px, 4vw, 22px);
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.18);
}

.site-footer p {
  margin: 10px 0;
}

.float-button {
  position: fixed;
  right: 18px;
  z-index: 3;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(93, 168, 101, 0.46);
  color: #fff;
  font-size: 44px;
  line-height: 40px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
}

.float-up {
  bottom: 132px;
}

.float-down {
  bottom: 72px;
}

.admin-body {
  color: var(--ink);
  background: color-mix(in srgb, var(--admin-accent) 76%, #15261b);
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 28px, 1080px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 38px 0;
}

.admin-panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.22);
}

.login-panel {
  width: min(100%, 420px);
  margin: 9vh auto 0;
  padding: 28px;
}

.login-panel h1,
.dashboard h1,
.section-head h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.15;
}

.form-grid,
.settings-grid {
  display: grid;
  gap: 16px;
}

.login-panel .form-grid {
  margin-top: 24px;
}

label {
  display: grid;
  gap: 7px;
  color: #354139;
  font-size: 14px;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid #cbd4ce;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--admin-accent) 18%, transparent);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  background: var(--admin-accent);
  color: #fff;
}

.ghost-button {
  background: #eef3ef;
  color: var(--ink);
}

.danger-button {
  background: #ffe8e8;
  color: #aa1e1e;
}

.message {
  min-height: 20px;
  margin: 0;
  color: #bb2424;
}

.dashboard {
  padding: 28px;
}

.dashboard-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  padding: 8px;
  border: 1px solid #e0e8e2;
  border-radius: 8px;
  background: #f5f8f6;
}

.admin-tab,
.stats-day-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: #e6ece8;
  color: var(--ink);
  font-weight: 700;
}

.admin-tab.active,
.stats-day-button.active {
  background: var(--admin-accent);
  color: #fff;
}

.admin-view {
  padding: 18px;
  border: 1px solid #e4ebe6;
  border-radius: 8px;
  background: #fbfdfb;
}

.site-view[hidden],
.admin-view[hidden] {
  display: none !important;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.view-head h2 {
  margin: 0;
  color: var(--ink);
}

.view-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.stat-card {
  min-height: 138px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 20px;
  border-radius: 8px;
  color: #fff;
}

.stat-card.today { background: #2f6be8; }
.stat-card.visits { background: #0ca276; }
.stat-card.yesterday { background: #52637a; }
.stat-card.old-visits { background: #7b31e8; }

.stat-card span { font-weight: 700; }
.stat-card strong { font-size: 38px; line-height: 1; }
.stat-card small { opacity: 0.88; }

.stats-day-tabs {
  display: flex;
  gap: 10px;
  margin: 20px 0 12px;
}

.stats-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  padding: 14px;
  border-radius: 8px 8px 0 0;
  background: #eef2f5;
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

.stats-table th,
.stats-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e4e9e6;
  text-align: left;
  white-space: nowrap;
}

.stats-table th {
  background: #f7f9f8;
}

.stats-table td:first-child,
.stats-table td:nth-child(2) {
  color: var(--admin-accent);
  font-weight: 700;
}

.empty-stats {
  color: var(--muted) !important;
  text-align: center !important;
  font-weight: 400 !important;
}

.password-view {
  max-width: 620px;
}

.password-form {
  display: grid;
  gap: 16px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  padding: 18px;
  border: 1px solid #e4ebe6;
  border-radius: 8px;
  background: #fbfdfb;
}

.wide {
  grid-column: span 2;
}

.appearance-settings {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  padding-top: 4px;
}

.background-preview-wrap {
  display: grid;
  gap: 8px;
}

.background-preview {
  min-height: 108px;
  display: grid;
  place-items: center;
  border: 1px dashed #b7c4bb;
  border-radius: 6px;
  background-color: #eef3ef;
  background-position: center;
  background-size: cover;
  color: var(--muted);
}

.color-setting {
  grid-column: span 2;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-control input[type="color"] {
  width: 64px;
  padding: 3px;
}

.color-control output {
  font-family: Consolas, monospace;
  color: var(--muted);
}

.settings-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

.settings-message.success { color: #147a30; }
.settings-message.error { color: #b3261e; }

.link-editor {
  margin-top: 28px;
}

.admin-links {
  display: grid;
  gap: 12px;
}

.admin-link {
  display: grid;
  grid-template-columns: 72px minmax(140px, 1fr) minmax(190px, 1.4fr) minmax(140px, 1fr) 104px 104px 76px 82px;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid #e1e7e3;
  border-radius: 8px;
  background: #fff;
}

.link-color-field input[type="color"] {
  height: 42px;
  padding: 3px;
}

.switch-label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
}

.switch-label input {
  width: 18px;
  height: 18px;
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 22px, 560px);
    padding-top: 34px;
  }

  .nav-panel {
    border-width: 8px;
    padding: 10px 8px 16px;
  }

  .link-row {
    grid-template-columns: 1fr 82px;
    min-height: 68px;
    padding: 7px 10px;
  }

  .enter-button {
    width: 82px;
    min-height: 46px;
  }

  .dashboard,
  .login-panel {
    padding: 20px;
  }

  .dashboard-head,
  .section-head,
  .view-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-grid,
  .admin-link,
  .appearance-settings {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  .color-setting {
    grid-column: span 1;
  }

  .admin-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .stat-card {
    min-height: 112px;
    padding: 15px;
  }

  .stat-card strong {
    font-size: 30px;
  }

  .stats-meta {
    gap: 10px 16px;
  }
}
