:root {
  --bg: #f4f7f5;
  --ink: #18211f;
  --muted: #61706c;
  --line: #d8e2de;
  --panel: #ffffff;
  --panel-soft: #f8fbfa;
  --accent: #0f8f72;
  --accent-strong: #09664f;
  --accent-soft: #e4f5ef;
  --danger: #c2412d;
  --warning: #b7791f;
  --shadow: 0 18px 50px rgba(24, 33, 31, 0.09);
  --shadow-soft: 0 10px 28px rgba(24, 33, 31, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 143, 114, 0.09), transparent 34%),
    linear-gradient(180deg, #eef4f1 0%, var(--bg) 52%, #f8faf9 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.shell--score {
  width: min(860px, calc(100vw - 28px));
}

.topbar,
.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-nav__link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  min-height: 38px;
  padding: 9px 12px;
  text-decoration: none;
}

.admin-nav__link:hover,
.admin-nav__link.is-active {
  border-color: rgba(15, 143, 114, 0.32);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.topbar-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 9px 11px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.section-caption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  margin-top: 4px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.muted,
.form-note {
  color: var(--muted);
  line-height: 1.7;
}

.layout {
  display: grid;
  gap: 18px;
}

.layout--admin {
  grid-template-columns: minmax(320px, 430px) 1fr;
  align-items: start;
}

.layout--create {
  grid-template-columns: minmax(0, 680px) minmax(280px, 1fr);
  align-items: start;
}

.layout--results {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  align-items: start;
}

.panel,
.score-sheet,
.score-hero {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.score-sheet {
  padding: 22px;
}

.panel--create {
  position: sticky;
  top: 14px;
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ops-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
  padding: 15px;
}

.ops-card--link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.ops-card--link:hover {
  border-color: rgba(15, 143, 114, 0.36);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.ops-card__index,
.flow-step__index {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.ops-card__index {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 12px;
}

.ops-card h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.ops-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.section-title,
.score-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-title {
  justify-content: flex-start;
}

.section-title--with-action {
  align-items: flex-start;
}

.section-title--with-action .ghost-link {
  margin-left: auto;
}

.marker {
  width: 9px;
  height: 28px;
  background: var(--accent);
  border-radius: 2px;
  flex: 0 0 auto;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 3px rgba(15, 143, 114, 0.14);
}

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

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

.identity-grid .primary-button {
  align-self: end;
}

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

.entry-panel {
  color: inherit;
  display: grid;
  gap: 18px;
  min-height: 180px;
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.entry-panel:hover {
  border-color: rgba(15, 143, 114, 0.36);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.entry-panel__action {
  align-self: end;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.created-link-panel {
  display: grid;
  gap: 16px;
}

.auth-status-panel {
  display: grid;
  gap: 16px;
}

.primary-button,
.ghost-link,
.small-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.ghost-link,
.small-button {
  color: var(--accent-strong);
  background: #e4f1ed;
  padding: 10px 13px;
  font-weight: 800;
}

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

.activity-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  background: var(--panel-soft);
}

.activity-item.is-selected {
  border-color: rgba(15, 143, 114, 0.46);
  background: var(--accent-soft);
}

.activity-item--compact {
  padding: 12px;
}

.activity-item--compact .small-button {
  width: 100%;
}

.activity-item__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.activity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8ecea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status--active {
  background: #dbf5ee;
  color: var(--accent-strong);
}

.status--closed {
  background: #f5e2dc;
  color: var(--danger);
}

.result-area {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.result-area--page {
  margin-top: 0;
}

.result-picker {
  position: sticky;
  top: 14px;
}

.score-hero {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: #102320;
  color: white;
}

.score-hero strong {
  display: block;
  font-size: clamp(42px, 9vw, 82px);
  line-height: 1;
}

.score-meta {
  color: #b9d2ca;
  line-height: 1.8;
  text-align: right;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 26px;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #f1f7f4;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: #f8fbfa;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.countdown {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #102320;
  color: white;
  font-size: 26px;
  font-weight: 900;
  padding: 14px 16px;
  text-align: center;
}

.score-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.flow-step {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 11px 12px;
}

.flow-step.is-current {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgba(15, 143, 114, 0.26);
}

.flow-step__index {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 12px;
  flex: 0 0 auto;
}

.score-sheet {
  display: grid;
  gap: 16px;
}

.criteria-list {
  display: grid;
  gap: 14px;
}

.criterion-row {
  display: grid;
  grid-template-columns: 160px 1fr 74px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.criterion-row input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
  min-height: 32px;
}

.criterion-row input[type="number"] {
  text-align: center;
}

.total-box {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#totalPreview {
  color: var(--accent-strong);
  font-size: 28px;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #102320;
  color: white;
  padding: 12px 16px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  max-width: min(520px, calc(100vw - 32px));
  z-index: 20;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .layout--admin,
  .layout--create,
  .layout--results,
  .field-grid,
  .identity-grid,
  .metrics-grid,
  .ops-strip,
  .score-progress,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .score-header,
  .score-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .score-meta {
    text-align: left;
  }

  .criterion-row {
    grid-template-columns: 1fr;
  }

  .panel--create {
    position: static;
  }

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

  .admin-nav {
    justify-content: flex-start;
  }

  .result-picker {
    position: static;
  }

  .score-sheet__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .total-box {
    justify-items: start;
    width: 100%;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .panel,
  .score-sheet {
    padding: 16px;
  }

  h1 {
    font-size: 27px;
  }

  .countdown {
    min-width: 0;
    width: 100%;
  }

  .activity-item__top,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title--with-action .ghost-link {
    margin-left: 0;
    width: 100%;
  }

  .admin-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .marker {
    width: 30px;
    height: 6px;
  }
}
