@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #6d060f;
  --panel: #8b0c17;
  --text: #fff2cf;
  --muted: #f4d49a;
  --accent: #ffd36e;
  --border: #e6b35b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background:
    radial-gradient(1000px 500px at 12% -8%, rgba(255, 205, 95, 0.22), transparent 55%),
    radial-gradient(1000px 600px at 100% 100%, rgba(167, 19, 30, 0.28), transparent 65%),
    linear-gradient(160deg, #7c0813, var(--bg));
  color: var(--text);
  font-family: "Be Vietnam Pro", "Segoe UI", Tahoma, sans-serif;
}

.festival-bg-video {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 460px at 14% -8%, rgba(255, 205, 95, 0.22), transparent 55%),
    radial-gradient(900px 540px at 100% 100%, rgba(167, 19, 30, 0.24), transparent 65%),
    linear-gradient(160deg, rgba(124, 8, 19, 0.98), rgba(109, 6, 15, 0.98));
  pointer-events: auto;
}

.start-overlay.hidden {
  display: none;
}

.start-loading-text {
  margin: 0;
  color: #ffe7b2;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px;
}

body.startup-lock .app {
  visibility: hidden;
}

.status-modal {
  width: 100%;
  margin-top: 0;
  pointer-events: auto;
}

.status-modal.hidden {
  display: none;
}

.status-modal-content {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  text-align: center;
}

.left,
.right {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  position: relative;
}

.left {
  --wheel-size: min(72vw, calc(100vh - 220px), 620px);
  min-height: calc(100vh - 32px);
  overflow: hidden;
}

.right {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: calc(100vh - 32px);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 202, 92, 0.1), transparent 35%),
    linear-gradient(165deg, rgba(133, 0, 27, 0.9), rgba(92, 0, 21, 0.66));
  border: 1px solid rgba(255, 214, 112, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 221, 146, 0.2),
    0 12px 28px rgba(28, 0, 7, 0.45);
}

.panel h2 {
  margin: 0 0 8px;
  color: #ffd67a;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel {
  background: rgba(255, 214, 112, 0.03);
  border: 1px solid rgba(255, 214, 112, 0.22);
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#statusText {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fef08a;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.35;
}

.wheel-wrap {
  margin-top: 12px;
  position: absolute;
  width: var(--wheel-size);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  top: 49%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.wheel-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  transform: rotate(0rad);
  position: relative;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

#overlayCanvas {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.wheel-center {
  position: absolute;
  width: clamp(48px, 16%, 192px);
  height: auto;
  transform-origin: 50% 50%;
  transform: rotate(0rad);
  z-index: 4;
  pointer-events: none;
  user-select: none;
}

.wheel-border {
  position: absolute;
  inset: 0;
  width: 126%;
  height: 126%;
  left: -13%;
  top: -13%;
  object-fit: contain;
  z-index: 5;
  pointer-events: none;
  user-select: none;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 6px;
  max-height: min(300px, 34vh);
  overflow: auto;
}

.list li {
  border: 1px solid rgba(255, 214, 112, 0.18);
  border-radius: 10px;
  background: rgba(40, 0, 10, 0.14);
  padding: 8px 10px;
  font-size: 0.92rem;
  line-height: 1.3;
  color: #fff2c9;
}

.list li.empty {
  color: #ffdca0;
}

.stock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.stock-table th,
.stock-table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 214, 112, 0.2);
}

.stock-table th {
  text-align: left;
  color: #ffd67a;
  font-weight: 400;
}

.stock-table td {
  color: #fff2c9;
}

.stock-table td:last-child {
  text-align: right;
  font-weight: 400;
}

.stock-table td.out {
  color: #ffdca0;
}

.stock-table td.empty {
  text-align: center;
  color: #ffdca0;
}

.actions {
  margin: 10px 0 0;
}

.winners-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#winnerList {
  flex: 1;
  min-height: 0;
  max-height: none;
  scrollbar-width: thin;
  scrollbar-color: #ffcf66 rgba(92, 0, 21, 0.55);
}

#winnerList::-webkit-scrollbar {
  width: 10px;
}

#winnerList::-webkit-scrollbar-track {
  background: rgba(92, 0, 21, 0.55);
  border-radius: 999px;
}

#winnerList::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ffe08f, #ffbf45);
  border-radius: 999px;
  border: 1px solid rgba(126, 57, 0, 0.45);
}

#winnerList::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffe9a8, #ffc95e);
}

.controls-panel {
  margin-top: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.controls-row .actions {
  margin: 0;
  min-width: 0;
}

.controls-row .primary-action {
  flex: 1;
}

.controls-row .admin-action {
  flex: 0 0 auto;
}

.actions a,
.actions button {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(137, 74, 0, 0.35);
  border-radius: 999px;
  padding: 0 14px;
  height: 42px;
  line-height: 42px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(180deg, #ffd67a, #ffbf45);
  color: #6a0015;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-shadow: 0 6px 12px rgba(41, 0, 8, 0.28);
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
}

.controls-row .actions > a,
.controls-row .actions > button {
  width: 100%;
}

.controls-row .admin-action > .icon-link {
  width: auto;
  min-width: 0;
  padding: 0;
  height: auto;
  line-height: 1;
  font-size: 1rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #ffd67a;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .left {
    --wheel-size: min(79vw, calc(100vh - 260px), 560px);
    min-height: 56vh;
  }

  .wheel-wrap {
    top: 48%;
    width: var(--wheel-size);
  }

  .right {
    height: auto;
    overflow: visible;
  }

  .status-modal-content {
    padding: 3px 6px;
  }
}
