:root {
  color-scheme: light;
  --ink: #15151a;
  --muted: #5f616f;
  --accent: #ff7a4b;
  --accent-strong: #ff5a1f;
  --bg: #f7f7fb;
  --card: #ffffff;
  --line: #e5e7f0;
  --soft: #f1f2f7;
  --shadow: 0 14px 32px rgba(20, 20, 30, 0.08);
  --shadow-soft: 0 8px 18px rgba(20, 20, 30, 0.06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef0f6;
  --muted: #b6b7c4;
  --accent: #ff8a5c;
  --accent-strong: #ff6a2d;
  --bg: #0f1117;
  --card: #1a1d26;
  --line: #2b2f3b;
  --soft: #222634;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Futura", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f9f9ff 0%, #f1f2f7 100%);
  min-height: 100vh;
}

:root[data-theme="dark"] body {
  background: linear-gradient(180deg, #0d0f15 0%, #121622 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-soft);
}

.topbar__brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar__subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

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

.topbar__nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar__nav a {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}

.topbar__nav a:hover {
  border-color: var(--accent);
}

.mode-toggle {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-toggle__icon {
  font-size: 14px;
  line-height: 1;
}

:root[data-theme="dark"] .mode-toggle__icon[data-mode="dark"] {
  display: inline;
}

:root[data-theme="dark"] .mode-toggle__icon[data-mode="light"] {
  display: none;
}

:root[data-theme="light"] .mode-toggle__icon[data-mode="dark"] {
  display: none;
}

:root[data-theme="light"] .mode-toggle__icon[data-mode="light"] {
  display: inline;
}

.mode-toggle__label {
  font-size: 10px;
  letter-spacing: 0.12em;
}

.page {
  max-width: 1100px;
  margin: 28px auto 60px;
  padding: 0 20px;
  animation: page-in 0.45s ease both;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  background: var(--card);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 6px 0;
  font-size: 28px;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--soft);
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
}

.stat__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.stat__value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
}

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

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--soft);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.leaderboard-row__name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard-row__rank {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.leaderboard-row__value {
  font-size: 18px;
  font-weight: 700;
}

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

.image-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.image-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.button {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-weight: 600;
}

.image-detail__image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.image-detail__row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.form-stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.preview-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.preview-content {
  font-size: 14px;
  line-height: 1.5;
}

form input[type="number"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: "Courier New", Courier, monospace;
  background: var(--soft);
}

form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: "Courier New", Courier, monospace;
  background: var(--soft);
  resize: vertical;
}

form button {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}

.flash.error {
  background: #ffe8e2;
  border-color: #ffb5a3;
  color: #8a2f1d;
}

.flash.success {
  background: #e6f7ed;
  border-color: #9fe0b3;
  color: #1f6b39;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead th {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.table tbody td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero__stats {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
