:root {
  color-scheme: light;
  --paper: #f6f2ea;
  --surface: #fffdf8;
  --ink: #17191d;
  --muted: #6a6d76;
  --line: rgba(23, 25, 29, 0.13);
  --green: #147760;
  --blue: #2457a6;
  --coral: #d95d43;
  --yellow: #efb036;
  --shadow: 0 18px 48px rgba(23, 25, 29, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(160deg, rgba(20, 119, 96, 0.09), transparent 34%),
    linear-gradient(22deg, rgba(217, 93, 67, 0.11), transparent 32%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 34px;
}

.topbar {
  display: grid;
  gap: 12px;
  padding: 4px 0 18px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 220px;
  height: 58px;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tabs a {
  min-width: 0;
  border-radius: 6px;
  padding: 12px 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.tabs a.is-active {
  background: var(--ink);
  color: #fff;
}

.screen {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.section-head {
  display: grid;
  gap: 8px;
  padding: 12px 2px 4px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.55rem, 13vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.35rem, 5vw, 2rem);
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
  line-height: 1.45;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.74);
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-size: 1.18rem;
}

.stat span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.duel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #ded9ce;
}

.photo-body {
  display: grid;
  padding: 8px;
}

.primary-button,
.secondary-button,
.danger-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-button {
  background: rgba(217, 93, 67, 0.13);
  color: #9e2f1d;
}

.empty-state,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.82);
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  gap: 14px;
  min-height: 260px;
  align-content: center;
  text-align: center;
}

.ranking-list,
.admin-list {
  display: grid;
  gap: 10px;
}

.rank-item,
.admin-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.rank-item img,
.admin-item img {
  width: 58px;
  height: 58px;
  border-radius: 6px;
  object-fit: cover;
  background: #ded9ce;
}

.rank-meta,
.admin-meta {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.rank-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.rank-title strong,
.admin-meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-number {
  color: var(--coral);
  font-weight: 950;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.metrics span {
  border-radius: 999px;
  padding: 5px 7px;
  background: rgba(23, 25, 29, 0.07);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.field input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.file-input {
  padding: 11px 12px;
}

.compact-field {
  gap: 8px;
}

.compact-field input {
  padding: 0;
}

.crop-workspace {
  display: grid;
  gap: 12px;
}

.crop-workspace[hidden] {
  display: none;
}

.cropper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.cropper-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cropper-frame {
  width: min(100%, 420px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ded9ce;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.42);
}

#crop-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#crop-canvas:active {
  cursor: grabbing;
}

.crop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.message {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.duel-message {
  grid-column: 1 / -1;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.is-hidden {
  opacity: 0.5;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 22px 24px 42px;
  }

  .topbar {
    grid-template-columns: minmax(180px, 260px) minmax(360px, auto);
    align-items: center;
    justify-content: space-between;
  }

  .brand {
    max-width: 300px;
    height: 76px;
  }

  .tabs {
    display: flex;
    width: auto;
    min-width: 360px;
    box-shadow: none;
  }

  .tabs a {
    min-width: 108px;
  }

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

.versus {
  display: none;
}
