:root {
  --ink: #171717;
  --muted: #666666;
  --line: rgba(23, 23, 23, 0.12);
  --surface: rgba(255, 255, 255, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.66);
  --accent: #111111;
  --ok: #167447;
  --error: #b32828;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", Arial, sans-serif;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.64;
}

.btn-primary {
  background: var(--accent);
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.display-page {
  min-height: 100vh;
  overflow: hidden;
  background: #004b3f;
}

.draw-stage {
  min-height: 100vh;
  background-image:
    linear-gradient(90deg, rgba(0, 68, 56, 0.42), rgba(0, 68, 56, 0.18)),
    url("assets/backgrounds/tring-bg.png");
  background-position: center;
  background-size: cover;
}

.raffle-layout {
  min-height: 100vh;
  padding: clamp(28px, 4.6vw, 70px) clamp(34px, 7.8vw, 150px);
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(520px, 1.12fr);
  align-content: center;
  align-items: center;
  column-gap: clamp(40px, 8vw, 130px);
  position: relative;
}

.display-header {
  grid-column: 1 / -1;
  min-height: clamp(42px, 6vw, 78px);
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(120px, 1fr) minmax(88px, 1fr);
  align-items: center;
  gap: 18px;
}

.partner-logo,
.main-logo {
  width: 100%;
  height: 100%;
  max-height: 74px;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.18));
}

.main-logo {
  justify-self: center;
}

.partner-logo:first-child {
  justify-self: start;
}

.partner-logo:last-child {
  justify-self: end;
}

.prize-area {
  display: grid;
  justify-items: center;
  align-self: center;
  gap: clamp(26px, 4vw, 46px);
}

.prize-name {
  margin: 0;
  color: #ffffff;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.8rem, 4.1vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

.gift-visual {
  width: min(440px, 100%);
  position: relative;
  display: none;
  place-items: center;
  animation: floatIn 0.7s ease both;
}

.gift-visual--has-image {
  display: grid;
  min-height: clamp(280px, 30vw, 430px);
}

.item-image {
  width: min(430px, 100%);
  max-height: 430px;
  object-fit: contain;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.22));
  animation: prizeReveal 0.55s ease both;
}

.raffle-area {
  align-self: center;
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: clamp(10px, 1.8vw, 20px);
}

.raffle-kicker {
  margin: 0;
  color: #ffffff;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(3rem, 4vw, 5.1rem);
  line-height: 0.98;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
}

.bib-number {
  color: #ffffff;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(9rem, 18vw, 24rem);
  line-height: 0.78;
  text-align: center;
  letter-spacing: 0;
  text-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.winner-name {
  max-width: 760px;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 1.7vw, 1.6rem);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  animation: softFade 0.5s ease both;
}

.prize-sponsor {
  margin: -14px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(0.95rem, 1.3vw, 1.2rem);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.idle-panel {
  min-height: 100vh;
  padding: clamp(28px, 4.6vw, 70px) clamp(34px, 7.8vw, 150px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(18px, 2.6vw, 30px);
  text-align: center;
}

.idle-event-name {
  margin: 0;
  color: #ffffff;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.4rem, 4vw, 4.6rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

.idle-kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(0.9rem, 1.3vw, 1.1rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.idle-prize-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  width: min(640px, 100%);
}

.idle-prize-item {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  font-weight: 700;
}

.idle-prize-item-empty {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.idle-panel[hidden],
.raffle-layout[hidden] {
  display: none;
}

.product-panel,
.product-copy,
.price-stack,
.item-info-image,
.price-current,
.price-old {
  display: none;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes prizeReveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes softFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.setup-page {
  min-height: 100vh;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.86)),
    url("assets/backgrounds/tring-bg.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

.setup-stage {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 26px;
}

.setup-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.title {
  margin: 6px 0 0;
  color: var(--ink);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(2.2rem, 4.6vw, 4.4rem);
  line-height: 0.96;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stat-card,
.panel {
  padding: 18px;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(1.85rem, 3vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
}

.stat-value-small {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.34;
}

.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.42fr);
  gap: 14px;
  align-items: start;
}

.setup-main {
  display: grid;
  gap: 14px;
}

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

.panel-title {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.status-badge,
.participant-meta {
  min-height: 30px;
  border-radius: 8px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-badge[data-tone="success"] {
  background: rgba(22, 116, 71, 0.12);
  color: var(--ok);
}

.status-badge[data-tone="error"] {
  background: rgba(179, 40, 40, 0.12);
  color: var(--error);
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.field input[type="file"] {
  padding: 7px 9px;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.34);
}

.field-wide {
  margin-bottom: 10px;
}

.draw-mode-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(260px, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.mode-note,
.status-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-text {
  margin: 0 0 14px;
}

.status-text[data-tone="success"] {
  color: var(--ok);
}

.status-text[data-tone="error"] {
  color: var(--error);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.copy-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.participant-panel {
  position: sticky;
  top: 18px;
}

.participant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.participant-item {
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px;
  display: flex;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.participant-item:last-child {
  border-bottom: 0;
}

.participant-item-empty {
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.btn-small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

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

.pool-table th {
  padding: 8px 6px;
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.pool-table td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.pool-table tr:last-child td {
  border-bottom: 0;
}

.pool-empty {
  text-align: center;
  color: var(--muted);
}

.pool-row-excluded td {
  color: var(--muted);
  text-decoration: line-through;
}

.pool-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.participant-panel .pool-table {
  max-height: calc(100vh - 220px);
  display: block;
  overflow: auto;
}

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

.prize-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.prize-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
}

.prize-item-empty {
  color: var(--muted);
  justify-content: center;
}

.prize-item-info {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
}

.prize-item-status {
  text-transform: uppercase;
}

.prize-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.manual-override-grid {
  margin-top: 14px;
}

.manual-override-action {
  align-items: flex-end;
}

.manual-override-action .btn {
  width: 100%;
}

@media (max-width: 1040px) {
  .display-page {
    overflow: auto;
  }

  .raffle-layout {
    grid-template-columns: 1fr;
    row-gap: clamp(28px, 6vw, 46px);
    padding: 40px 28px;
    align-content: center;
    justify-items: center;
  }

  .setup-layout,
  .form-grid,
  .copy-grid,
  .draw-mode-grid,
  .prize-form-grid {
    grid-template-columns: 1fr;
  }

  .participant-panel {
    position: static;
  }

  .participant-panel .pool-table {
    max-height: 420px;
  }
}

@media (max-width: 720px) {
  .draw-shell,
  .raffle-layout,
  .setup-stage {
    padding: 16px;
  }

  .display-header {
    grid-template-columns: 1fr 1fr;
    min-height: 86px;
  }

  .main-logo {
    grid-column: 1 / -1;
    grid-row: 1;
    max-height: 58px;
  }

  .partner-logo {
    grid-row: 2;
    max-height: 52px;
  }

  .setup-topbar,
  .stats-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}
