:root {
  --bg-image: none;
  --bg-dim: 0.15;
  --bg-blur: 18px;
  --bg-fit: cover;
  --wheel-size: 360px;
  --orange: #ff9a1e;
  --orange-2: #ff7a00;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  font-family: "Inter", "Segoe UI", Tahoma, system-ui, sans-serif;
  color: #eaf2ff;
  background: #0a2150;
  position: relative;
  overflow-x: hidden;
}

/* Nền = poster làm mờ; phủ lớp xanh đậm cho dễ đọc */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  filter: blur(var(--bg-blur)) saturate(1.1);
  transform: scale(1.1);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #071a40, #081e4e);
  opacity: var(--bg-dim, 0.85);
  z-index: -1;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px clamp(12px, 3vw, 36px) 28px;
}

/* Banner tiêu đề */
.banner {
  width: 100%;
  margin-bottom: 18px;
}

.banner__bar {
  background: rgba(6, 20, 50, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 24px;
  position: relative;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.banner__bar::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--orange), var(--orange-2));
}

.banner__title {
  font-size: clamp(20px, 3.2vw, 32px);
  font-weight: 900;
  padding-left: 16px;
  letter-spacing: 0.2px;
}

.banner__sub {
  margin-top: 4px;
  padding-left: 16px;
  color: #b7c8e6;
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 600;
}

/* Bố cục chính */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
  justify-items: center;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

@media (min-width: 980px) {
  .main {
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
  }
}

/* Khu vực vòng quay */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.wheelWrap {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  max-width: 92vw;
  max-height: 92vw;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0a2150;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.6), 0 0 0 10px rgba(255, 255, 255, 0.08),
    0 0 0 16px rgba(255, 255, 255, 0.05);
}

.pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 50px;
  background: radial-gradient(circle at 50% 38%, #ffd47a 0 38%, var(--orange) 39% 70%, var(--orange-2) 71%);
  clip-path: path("M19 50 C8 30 0 22 0 13 A19 13 0 0 1 38 13 C38 22 30 30 19 50 Z");
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
  z-index: 3;
}

.controls {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 15px 48px;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(180deg, var(--orange), var(--orange-2));
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.45);
}

.btn--primary:disabled {
  filter: grayscale(0.55) brightness(0.75);
  cursor: not-allowed;
  box-shadow: none;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  font-size: 14px;
}

.statusText {
  min-height: 22px;
  text-align: center;
  color: #cdddf6;
  font-size: 15px;
}

/* Poster */
.poster {
  width: 100%;
  display: flex;
  justify-content: center;
}

.poster__img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.poster.is-empty {
  display: none;
}

/* Dialog */
.dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(440px, 92vw);
  background: #0f2147;
  color: #eaf2ff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(3, 12, 30, 0.7);
  backdrop-filter: blur(3px);
}

.dialog__inner {
  padding: 22px;
}

.dialog__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.dialog__title {
  font-size: 20px;
  font-weight: 800;
}

.field {
  display: block;
}

.field__label {
  display: block;
  font-size: 14px;
  color: #b7c8e6;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 13px 14px;
  font-size: 16px;
}

.input:focus {
  outline: 2px solid var(--orange);
  border-color: transparent;
}

.errorText {
  color: #ff8a9c;
  font-size: 14px;
  min-height: 18px;
  margin-top: 6px;
}

.dialog__foot {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.dialog--result .dialog__inner {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result__badge {
  display: inline-block;
  background: linear-gradient(90deg, #ffd47a, var(--orange-2));
  color: #3a1d00;
  font-weight: 900;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
}

.result__image {
  display: block;
  max-width: 170px;
  max-height: 170px;
  margin: 14px auto 0;
  border-radius: 12px;
}

.result__title {
  font-size: 27px;
  font-weight: 900;
  margin: 14px 0 6px;
  color: #ffd47a;
}

.result__sub {
  color: #cdddf6;
  font-size: 15px;
  margin-bottom: 18px;
}

/* Confetti */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confettiPiece {
  position: absolute;
  top: -12px;
  left: var(--left);
  width: var(--size);
  height: var(--size);
  background: #ffd47a;
  opacity: 0.95;
  animation: fall var(--duration) linear forwards;
  animation-delay: var(--delay);
}

@keyframes fall {
  to {
    transform: translate(var(--drift), 120vh) rotate(var(--rot));
    opacity: 0;
  }
}

/* Mobile: xếp dọc, vòng quay trên - poster dưới */
@media (max-width: 979px) {
  .main {
    gap: 20px;
  }
  .poster__img {
    max-height: none;
  }
}
