:root {
  color-scheme: light;
  --bg: #f7fbf4;
  --bg-blue: #dff4ff;
  --green: #49c779;
  --green-deep: #0f7b5b;
  --teal: #0d4e55;
  --coral: #ff7b68;
  --yellow: #ffd766;
  --ink: #12343b;
  --muted: #597173;
  --surface: #ffffff;
  --line: rgba(18, 52, 59, 0.12);
  --shadow: 0 18px 45px rgba(13, 78, 85, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 215, 102, 0.35), transparent 22rem),
    radial-gradient(circle at 82% 8%, rgba(73, 199, 121, 0.28), transparent 20rem),
    linear-gradient(135deg, #f8fff2 0%, #eefbff 48%, #fff8ef 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-shell::before,
.site-shell::after {
  position: fixed;
  z-index: -1;
  width: 16rem;
  height: 16rem;
  content: "";
  border-radius: 42% 58% 62% 38%;
  opacity: 0.8;
}

.site-shell::before {
  top: 8rem;
  left: -5rem;
  background: #b9efcc;
}

.site-shell::after {
  right: -4rem;
  bottom: 4rem;
  background: #bdefff;
}

.campaign-page {
  width: min(1180px, calc(100% - 360px));
  margin: 0 320px 0 max(32px, calc((100vw - 1460px) / 2));
  padding: 34px 0 52px;
}

.admin-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.hero,
.admin-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.hero-copy {
  max-width: 720px;
}

.label {
  margin: 0 0 10px;
  color: var(--green-deep);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.6rem, 2.4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-text,
.admin-hero p,
.rail-head p,
.story-summary {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.75;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: 340px;
}

.hero-badges span,
.ghost-link,
.secondary-action {
  border: 1px solid rgba(15, 123, 91, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.hero-badges span {
  padding: 10px 14px;
}

.voting-layout {
  display: block;
}

.story-card,
.admin-panel,
.admin-hero {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.story-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
}

.story-card::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(120deg, rgba(73, 199, 121, 0.15), transparent 42%),
    radial-gradient(circle at 94% 8%, rgba(255, 123, 104, 0.18), transparent 15rem);
}

.story-content {
  position: relative;
  z-index: 1;
}

.story-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  max-width: 900px;
  padding-block: 8px;
}

.story-body {
  color: #24484f;
  font-size: 1.08rem;
  line-height: 2.05;
  text-wrap: pretty;
}

.vote-panel {
  margin: 4px 0 24px;
}

.story-body p {
  margin-bottom: 18px;
}

.story-body h3,
.story-body h4 {
  margin: 28px 0 12px;
  color: var(--teal);
  line-height: 1.25;
}

.story-body h3 {
  font-size: 1.45rem;
}

.story-body h4 {
  font-size: 1.22rem;
}

.story-body ul {
  margin: 0 0 18px;
  padding-left: 1.2em;
}

.story-body li {
  margin-bottom: 8px;
}

.primary-action {
  width: fit-content;
  min-width: 178px;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: var(--coral);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 8px 0 rgba(255, 123, 104, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 0 rgba(255, 123, 104, 0.2);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.vote-hint {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--green-deep);
  font-weight: 800;
}

.story-rail {
  position: fixed;
  z-index: 8;
  top: 200px;
  right: clamp(12px, 2.4vw, 34px);
  width: min(280px, calc(100vw - 24px));
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  padding: 0 2px 4px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.story-list {
  display: grid;
  gap: 10px;
}

.story-tab {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(15, 123, 91, 0.18);
  border-radius: 999px 0 0 999px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.story-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 123, 91, 0.36);
}

.story-tab span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--bg-blue);
  color: var(--green-deep);
  font-weight: 900;
}

.story-tab strong {
  font-size: 0.96rem;
  line-height: 1.35;
}

.story-tab.active {
  border-color: rgba(255, 123, 104, 0.5);
  background: #fff3e8;
}

.story-tab.active span {
  background: var(--coral);
  color: #fff;
}

.admin-link {
  position: fixed;
  right: 20px;
  bottom: 20px;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.admin-body {
  background:
    radial-gradient(circle at 8% 5%, rgba(255, 215, 102, 0.3), transparent 20rem),
    linear-gradient(135deg, #f3fff8, #edf7ff);
}

.admin-hero,
.admin-panel {
  padding: 24px;
}

.ghost-link,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
}

.secondary-action {
  background: #fff;
}

.hidden {
  display: none !important;
}

.login-panel {
  max-width: 520px;
}

.login-form {
  display: flex;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
  outline-color: var(--green);
}

textarea {
  resize: vertical;
}

code {
  border-radius: 8px;
  padding: 2px 6px;
  background: #eef8f1;
  color: var(--green-deep);
}

.admin-message,
.field-help {
  display: block;
  margin-top: 8px;
  color: var(--green-deep);
  font-size: 0.92rem;
  font-weight: 800;
}

.admin-content {
  display: grid;
  gap: 20px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  border: 1px solid rgba(15, 123, 91, 0.12);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(135deg, #f7fcff, #fff8ef);
}

.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
}

.summary-card span {
  font-weight: 900;
}

.summary-card strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--teal);
  font-size: 2.4rem;
  line-height: 1;
}

.refresh-status {
  min-height: 22px;
  margin: -6px 0 16px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.result-card {
  border-radius: 18px;
  padding: 16px;
  background: #f7fcff;
}

.result-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-on,
.status-off {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-on {
  background: #dff7eb;
  color: var(--green-deep);
}

.status-off {
  background: #f1f1f1;
  color: #777;
}

.vote-number {
  margin: 18px 0 10px;
  color: var(--teal);
  font-size: 2.4rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.vote-number span {
  margin-left: 4px;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcebef;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--coral));
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.story-form {
  display: grid;
  gap: 15px;
}

.story-form label {
  display: grid;
  gap: 8px;
  color: var(--teal);
  font-weight: 900;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

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

.admin-story-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}

.admin-story-item img {
  width: 88px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: #eef8f1;
}

.admin-story-item p {
  margin: 5px 0;
  color: var(--muted);
}

.admin-story-item small {
  color: var(--green-deep);
  font-weight: 900;
}

.story-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.story-actions button {
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  background: #eef8f1;
  color: var(--teal);
  font-weight: 900;
}

@media (max-width: 980px) {
  .hero,
  .admin-hero,
  .story-card,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .campaign-page {
    width: min(100% - 32px, 1180px);
    margin: 0 auto;
    padding-bottom: 32px;
  }

  .hero,
  .admin-hero {
    display: grid;
  }

  .hero {
    margin-bottom: 14px;
  }

  .hero-badges {
    justify-content: flex-start;
  }

  .voting-layout {
    display: flex;
    flex-direction: column;
  }

  .story-rail {
    position: sticky;
    top: 0;
    order: -1;
    width: 100%;
    max-height: none;
    margin-bottom: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0 12px;
    background: linear-gradient(180deg, rgba(245, 255, 251, 0.96), rgba(245, 255, 251, 0.72));
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .story-rail::-webkit-scrollbar {
    display: none;
  }

  .story-list {
    display: flex;
    gap: 10px;
    padding: 0 2px;
  }

  .story-tab {
    flex: 0 0 min(82vw, 320px);
    min-width: 0;
    border-radius: 999px;
  }

  .story-content {
    max-width: none;
  }
}

@media (max-width: 620px) {
  .site-shell::before,
  .site-shell::after {
    width: 11rem;
    height: 11rem;
  }

  .campaign-page,
  .admin-page {
    width: min(100% - 24px, 1180px);
    padding-top: 22px;
  }

  .hero {
    margin-bottom: 10px;
  }

  .label {
    margin-bottom: 8px;
    font-size: 0.8rem;
  }

  h1 {
    margin-bottom: 0;
    font-size: 2.6rem;
    line-height: 1;
  }

  h2 {
    margin-bottom: 12px;
    font-size: 1.75rem;
    line-height: 1.16;
  }

  .story-card,
  .admin-panel,
  .admin-hero {
    border-radius: 18px;
  }

  .story-card {
    padding: 18px 16px 20px;
  }

  .story-summary {
    font-size: 0.98rem;
    line-height: 1.7;
  }

  .story-body {
    font-size: 1rem;
    line-height: 1.9;
  }

  .story-body p {
    margin-bottom: 15px;
  }

  .story-body h3 {
    font-size: 1.24rem;
  }

  .story-body h4 {
    font-size: 1.1rem;
  }

  .primary-action {
    width: 100%;
    min-width: 0;
    padding: 14px 18px;
  }

  .vote-panel {
    margin: 2px 0 22px;
  }

  .vote-hint {
    min-height: 0;
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .story-rail {
    margin-inline: -12px;
    width: calc(100% + 24px);
    padding: 8px 12px 10px;
  }

  .story-tab {
    flex-basis: min(86vw, 300px);
    grid-template-columns: 38px 1fr;
    gap: 10px;
    padding: 10px 12px;
  }

  .story-tab span {
    width: 31px;
    height: 31px;
    font-size: 0.9rem;
  }

  .story-tab strong {
    font-size: 0.9rem;
  }

  .admin-link {
    position: static;
    display: inline-flex;
    margin: 0 0 18px 12px;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .login-form,
  .admin-story-item {
    grid-template-columns: 1fr;
  }

  .login-form {
    display: grid;
  }

  .story-actions {
    justify-content: flex-start;
  }
}

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