:root {
  color-scheme: light;
  --ink: #151414;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #ded8cf;
  --muted: #736b65;
  --pink: #ff2e63;
  --green: #00a878;
  --yellow: #f8c537;
  --blue: #3568ff;
  --dark: #11100f;
  --shadow: 0 18px 60px rgba(21, 20, 20, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 46, 99, 0.13), transparent 36%),
    linear-gradient(225deg, rgba(0, 168, 120, 0.14), transparent 42%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hero {
  min-height: 390px;
  display: grid;
  align-content: space-between;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(17, 16, 15, 0.78), rgba(17, 16, 15, 0.28) 54%, rgba(17, 16, 15, 0.74)),
    linear-gradient(0deg, rgba(17, 16, 15, 0.68), rgba(17, 16, 15, 0.02) 48%),
    url("assets/clip-arena-hero.png") center / cover no-repeat;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(16px, 4vw, 46px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--dark) 0 17%, transparent 18%),
    conic-gradient(from 210deg, var(--pink), var(--yellow), var(--green), var(--blue), var(--pink));
  box-shadow: 0 8px 28px rgba(255, 46, 99, 0.36);
  flex: 0 0 auto;
}

.kicker {
  margin: 0 0 4px;
  color: currentColor;
  opacity: 0.68;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.05rem);
  line-height: 1;
}

h2 {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.1;
}

.hero-content {
  width: min(780px, calc(100% - 32px));
  padding: 0 clamp(16px, 4vw, 46px) 34px;
}

.hero-content h2 {
  max-width: 720px;
  font-size: clamp(2.3rem, 8vw, 5.8rem);
  line-height: 0.9;
}

.hero-actions,
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 7px 11px;
  color: #fff;
  background: rgba(17, 16, 15, 0.42);
  font-size: 0.86rem;
  font-weight: 850;
  backdrop-filter: blur(10px);
}

.user-box {
  display: grid;
  gap: 6px;
  width: min(250px, 42vw);
}

label,
legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
}

.hero label {
  color: rgba(255, 255, 255, 0.82);
}

input[type="text"],
input[type="url"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

input[type="text"]:focus,
input[type="url"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(53, 104, 255, 0.14);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, 390px);
  gap: 20px;
  padding: 24px clamp(16px, 4vw, 46px) 42px;
}

.arena-panel,
.submit-panel,
.podium-panel,
.library-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(21, 20, 20, 0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.arena-panel,
.submit-panel,
.podium-panel,
.library-panel {
  padding: 18px;
}

.arena-panel {
  min-height: 600px;
}

.podium-panel,
.library-panel {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 86px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--ink);
  background: #f4f1eb;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.primary-button,
.glass-button,
.ghost-button,
.pick-button,
.danger-button,
.open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 9px 13px;
  font-weight: 880;
  text-decoration: none;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.primary-button {
  color: #fff;
  background: var(--pink);
  box-shadow: 0 14px 28px rgba(255, 46, 99, 0.28);
}

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

.glass-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
}

.ghost-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost-button:hover,
.danger-button:hover {
  border-color: var(--ink);
}

.clip-form {
  display: grid;
  gap: 14px;
}

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

.file-field input {
  width: 100%;
  min-height: 52px;
  border: 1px dashed #bab1a7;
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.source-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}

.source-switch legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.source-switch label {
  min-height: 42px;
  position: relative;
}

.source-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-switch span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.source-switch input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.tournament-stage {
  display: grid;
  min-height: 468px;
}

.matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.versus {
  align-self: center;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #fff;
  background: var(--dark);
  font-weight: 950;
  box-shadow: 0 18px 40px rgba(21, 20, 20, 0.22);
}

.duel-card,
.clip-card,
.champion-card {
  overflow: hidden;
  border: 1px solid rgba(21, 20, 20, 0.1);
  border-radius: var(--radius);
  background: #fff;
}

.duel-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.media-wrap {
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgba(255, 46, 99, 0.24), transparent),
    linear-gradient(225deg, rgba(0, 168, 120, 0.22), transparent),
    #171514;
}

.media-wrap video,
.media-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.link-preview {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  color: #fff;
  text-align: center;
}

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

.duel-body,
.clip-body,
.champion-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.duel-body {
  align-content: space-between;
}

.duel-title,
.clip-title {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.14;
}

.clip-author,
.duel-meta,
.history-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 730;
}

.pick-button {
  width: 100%;
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(0, 168, 120, 0.2);
}

.pick-button.is-left {
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(53, 104, 255, 0.2);
}

.round-strip {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid rgba(21, 20, 20, 0.08);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fbfaf7;
}

.history-item strong {
  font-size: 0.9rem;
}

.history-item span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
  text-align: right;
}

.champion-card,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 430px;
  border: 1px dashed #bab1a7;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  padding: 24px;
}

.champion-card {
  border-style: solid;
  background:
    linear-gradient(135deg, rgba(248, 197, 55, 0.22), transparent 44%),
    #fff;
}

.champion-card h3 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 4.2rem);
  line-height: 0.95;
}

.champion-card p,
.empty-state p {
  max-width: 520px;
  margin: 10px auto 0;
  color: var(--muted);
  font-weight: 760;
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.08fr 1fr;
  align-items: end;
  gap: 12px;
  min-height: 214px;
}

.podium-slot {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 162px;
  border-radius: var(--radius);
  padding: 14px;
  color: #fff;
  background: #23201d;
  overflow: hidden;
  position: relative;
}

.podium-slot::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 7px;
  background: var(--accent);
}

.podium-slot.rank-1 {
  min-height: 202px;
  order: 2;
  --accent: var(--yellow);
}

.podium-slot.rank-2 {
  min-height: 176px;
  order: 1;
  --accent: var(--green);
}

.podium-slot.rank-3 {
  min-height: 150px;
  order: 3;
  --accent: var(--pink);
}

.rank-badge {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-weight: 950;
}

.podium-title {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.34rem);
  line-height: 1.05;
}

.podium-meta {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 730;
}

.podium-score {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 900;
}

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

.clip-card {
  display: grid;
}

.clip-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--ink);
  background: #f4f1eb;
  font-weight: 900;
  white-space: nowrap;
}

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

.danger-button {
  width: 44px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.danger-button:hover {
  color: var(--pink);
  border-color: var(--pink);
}

.toast {
  position: fixed;
  right: clamp(14px, 4vw, 34px);
  bottom: 22px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--ink);
  box-shadow: 0 18px 45px rgba(21, 20, 20, 0.22);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  z-index: 20;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .arena-panel {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .hero {
    min-height: 470px;
    background-position: 62% center;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .user-box {
    width: 100%;
  }

  .matchup {
    grid-template-columns: 1fr;
  }

  .versus {
    justify-self: center;
    width: 48px;
    height: 48px;
  }

  .podium {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .podium-slot,
  .podium-slot.rank-1,
  .podium-slot.rank-2,
  .podium-slot.rank-3 {
    min-height: 132px;
    order: initial;
  }
}

@media (max-width: 520px) {
  .hero-content h2 {
    font-size: 3.1rem;
  }

  .section-head,
  .clip-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .counter,
  .ghost-button,
  .hero-actions button {
    width: 100%;
  }

  .clips-grid {
    grid-template-columns: 1fr;
  }
}
