:root {
  --bg: #f7f2e7;
  --panel: rgba(255, 252, 246, 0.84);
  --panel-strong: #fffdf8;
  --ink: #1f211d;
  --muted: #677066;
  --line: rgba(31, 33, 29, 0.11);
  --accent: #17322b;
  --accent-soft: #dfe9e4;
  --shadow: 0 18px 48px rgba(28, 25, 18, 0.1);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(34, 83, 68, 0.12), transparent 28%),
    linear-gradient(180deg, #f2ebdd 0%, #faf7f0 46%, #f3eddf 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.18;
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 44px 16px 64px;
}

.topbar,
.control-panel,
.status-panel,
.result-panel,
.pager-panel,
.repo-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  padding: 22px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(23, 50, 43, 0.58);
}

.topbar h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "STSong", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.05em;
}

.topbar-note {
  margin: 10px 0 0;
  max-width: 700px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.96rem;
}

.control-panel,
.status-panel,
.pager-panel,
.repo-panel {
  margin-top: 14px;
  padding: 16px;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.number-input,
.page-input,
.primary-button,
.secondary-button {
  min-height: 50px;
  border-radius: 16px;
  font-size: 0.98rem;
}

.number-input,
.page-input {
  border: 1px solid rgba(23, 50, 43, 0.12);
  background: rgba(255, 255, 255, 0.9);
  padding: 0 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.number-input:focus,
.page-input:focus {
  border-color: rgba(23, 50, 43, 0.42);
  box-shadow: 0 0 0 4px rgba(23, 50, 43, 0.08);
}

.primary-button,
.secondary-button {
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
  color: #f4f7f4;
  background: linear-gradient(135deg, #284c42 0%, #17322b 100%);
}

.secondary-button {
  color: var(--accent);
  background: var(--panel-strong);
  border-color: rgba(23, 50, 43, 0.12);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.status-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.status-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  min-height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 50, 43, 0.1);
}

.metric strong {
  font-size: 1rem;
}

.metric--muted {
  color: var(--muted);
}

.progress-track {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(23, 50, 43, 0.08);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #284c42, #5f897b);
  transition: width 120ms linear;
}

.result-panel {
  margin-top: 14px;
  padding: 14px;
  min-height: 260px;
}

.pair-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pair-item {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 50, 43, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  padding: 14px;
}

.pair-item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(23, 50, 43, 0.82), rgba(23, 50, 43, 0.08));
}

.pair-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

.pair-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.38rem;
  letter-spacing: -0.03em;
}

.pair-total {
  color: var(--accent);
}

.pair-sign {
  color: rgba(31, 33, 29, 0.38);
}

.empty-note {
  margin: 0;
  min-height: 228px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.empty-note[hidden] {
  display: none;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.page-status {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(23, 50, 43, 0.1);
  background: rgba(255, 255, 255, 0.82);
}

.page-input {
  width: 88px;
  min-width: 88px;
}

.pager-hint {
  min-height: 22px;
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.repo-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.repo-copy {
  display: grid;
  gap: 4px;
}

.repo-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.repo-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.repo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(23, 50, 43, 0.12);
  color: var(--accent);
  background: var(--panel-strong);
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.repo-link:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 50, 43, 0.22);
}

.repo-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(23, 50, 43, 0.08);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: 14px;
  color: #f8faf8;
  background: rgba(23, 50, 43, 0.94);
  box-shadow: 0 18px 48px rgba(23, 50, 43, 0.22);
  text-align: center;
  line-height: 1.5;
}

.toast[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .control-panel,
  .status-panel,
  .pair-list {
    grid-template-columns: 1fr;
  }

  .control-panel .primary-button,
  .status-panel .secondary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding-inline: 12px;
  }

  .topbar,
  .control-panel,
  .status-panel,
  .result-panel,
  .pager-panel,
  .repo-panel {
    border-radius: 22px;
  }

  .pair-main {
    font-size: 1.2rem;
  }

  .pager > * {
    flex: 1 1 auto;
  }

  .page-status {
    justify-content: center;
  }

  .repo-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .repo-link {
    width: 100%;
  }
}
