:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-dark: #0f1419;
  --border: #e2e8f0;
  --border-dark: #1e293b;
  --text: #0f1419;
  --text-on-dark: #f1f5f9;
  --muted: #5c6b7a;
  --muted-on-dark: #94a3b8;
  --accent: #16a34a;
  --accent-dim: #15803d;
  --danger: #dc2626;
  --radius: 10px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(22, 163, 74, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(15, 20, 25, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.site-header {
  margin-bottom: 2rem;
}

.logo {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}

.logo span {
  color: var(--accent);
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.lead {
  font-size: 1.125rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

.features {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem;
}

.features li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.features li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
}

.preview-table {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--surface-dark);
  color: var(--text-on-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2.5rem;
  box-shadow: 0 4px 24px rgba(15, 20, 25, 0.12);
}

.preview-table .row {
  display: grid;
  grid-template-columns: 1fr 4rem 4rem;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-dark);
}

.preview-table .row:last-child {
  border-bottom: none;
}

.preview-table .head {
  color: var(--muted-on-dark);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.25);
}

.preview-table .rank-up {
  color: #4ade80;
}

.preview-table .rank-down {
  color: #f87171;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(15, 20, 25, 0.04);
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form-group label .optional {
  font-weight: 400;
  opacity: 0.7;
}

input[type="email"],
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.checkbox-row input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--surface-dark);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
  background: #1e293b;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  width: auto;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #cbd5e1;
}

.message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  display: none;
}

.message.show {
  display: block;
}

.message.success {
  background: #f0fdf4;
  color: var(--accent-dim);
  border: 1px solid #bbf7d0;
}

.message.error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.site-footer {
  margin-top: 2.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

.footer {
  margin-top: 2.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Admin */
.admin-layout {
  max-width: 960px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.admin-nav a:hover,
.admin-nav a.active {
  color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(15, 20, 25, 0.04);
}

.stat .value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
}

.stat .label {
  font-size: 0.8125rem;
  color: var(--muted);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

table.data th {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.alert-info a {
  color: #1d4ed8;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--accent-dim);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
