:root {
  --bg: #070c1a;
  --card: #0f172a;
  --text: #e8efff;
  --muted: #93a2c4;
  --stroke: #223456;
  --accent: #2f7cf6;
  --accent-2: #4ea1ff;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Be Vietnam Pro", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 90% -10%, #1e3f8f 0%, transparent 48%),
    radial-gradient(900px 520px at -10% 100%, #11255a 0%, transparent 50%),
    var(--bg);
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.35;
  z-index: -1;
}

.bg-glow-1 {
  width: 260px;
  height: 260px;
  background: #2f7cf6;
  top: 10%;
  right: 8%;
  animation: floatA 10s ease-in-out infinite;
}

.bg-glow-2 {
  width: 220px;
  height: 220px;
  background: #6cb4ff;
  bottom: 10%;
  left: 6%;
  animation: floatB 12s ease-in-out infinite;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, #22262e 0%, #1b1f27 100%);
  border-bottom: 1px solid #2f3440;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.header-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  color: #ffffff;
  font: 700 2rem/1 "Manrope", sans-serif;
  text-decoration: none;
  letter-spacing: -0.02em;
  margin-right: 4px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: #f3f6ff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.nav-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  flex-shrink: 0;
}

.nav-icon .dot {
  fill: currentColor;
  stroke: none;
}

.nav-label {
  line-height: 1;
}

.nav-item:hover {
  background: #2c3442;
  border-color: #3a4457;
}

.language-btn {
  border: 1px solid #3c4c66;
  background: #1e4ea8;
  color: #ffffff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.lang-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
  flex-shrink: 0;
}

.language-btn:hover {
  filter: brightness(1.08);
}

.topbar {
  max-width: 1540px;
  margin: 0 auto;
  padding: 14px 24px 4px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.layout {
  max-width: 1540px;
  margin: 0 auto;
  padding: 16px 24px 30px;
  display: grid;
  grid-template-columns: 310px minmax(560px, 1fr) 310px;
  gap: 20px;
  align-items: start;
}

.panel {
  background: color-mix(in srgb, var(--card) 92%, #1a2646 8%);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 1.05rem;
}

.panel p {
  color: var(--muted);
  margin: 7px 0 12px;
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  font: 600 0.95rem/1.45 "Be Vietnam Pro", sans-serif;
  resize: vertical;
  background: #0a1226;
  color: var(--text);
}

textarea:focus,
input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}

.row-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost {
  background: #162646;
  color: #d9e7ff;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #2f4671;
}

.ghost:hover:not(:disabled) {
  background: #20345d;
}

.settings {
  margin-top: 14px;
  display: grid;
  gap: 7px;
}

.settings label {
  font-size: 0.9rem;
  color: #b5c5e8;
}

.settings input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.wheel-panel {
  text-align: center;
  overflow: hidden;
}

.wheel-wrap {
  width: min(100%, 760px, calc(100vh - 110px));
  margin: 0 auto;
  position: relative;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  overflow: visible;
  --pointer-color: #f0f5ff;
}

.wheel-wrap::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    inset 0 -18px 36px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  z-index: 1;
}

.wheel-wrap:hover {
  filter: brightness(1.03);
}

.wheel-wrap.disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  position: relative;
  z-index: 0;
  box-shadow: 0 24px 36px rgba(0, 0, 0, 0.32);
}

.pointer {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
  border-right: 50px solid var(--pointer-color);
  z-index: 5;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.35));
  pointer-events: none;
  transition: border-right-color 0.09s linear;
}

.spin-hint {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.spin-hint.hidden {
  opacity: 0;
}

.spin-hint-svg {
  width: 86%;
  max-width: 620px;
  overflow: visible;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.42));
}

.spin-hint-main {
  font: 800 12.4px/1 "Manrope", sans-serif;
  letter-spacing: -0.025em;
  fill: #ffffff;
}

.spin-hint-sub {
  font: 800 8.2px/1 "Manrope", sans-serif;
  letter-spacing: -0.015em;
  fill: #ffffff;
}

.wheel-wrap.disabled .spin-hint {
  opacity: 0;
}

.result {
  margin: 10px 0 0;
  font-weight: 700;
  color: #a8c6ff;
  min-height: 1.4em;
}

.history-panel ul {
  list-style: none;
  margin: 10px 0 12px;
  padding: 0;
  max-height: 340px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.input-panel,
.history-panel {
  min-height: 540px;
}

.history-panel {
  display: flex;
  flex-direction: column;
}

.history-panel li {
  border: 1px solid #293f69;
  background: #0b142b;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.92rem;
  color: #deebff;
}

.full {
  width: 100%;
}

.fake-ad {
  margin-top: auto;
  width: 100%;
  border-radius: 12px;
  border: 1px solid #2f4167;
  background:
    radial-gradient(180px 120px at 95% -10%, rgba(126, 170, 255, 0.24) 0%, transparent 60%),
    linear-gradient(160deg, #0f182e 0%, #0b1324 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.fake-ad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.fake-ad-tag {
  margin: 0;
  font: 800 0.68rem/1 "Manrope", sans-serif;
  letter-spacing: 0.08em;
  color: #9ec0ff;
}

.fake-ad-muted {
  color: #7f95c3;
  font: 700 0.68rem/1 "Manrope", sans-serif;
  text-transform: uppercase;
}

.fake-ad-media {
  width: 100%;
  height: 96px;
  border-radius: 9px;
  border: 1px solid #3a4d78;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(130px 86px at 84% 24%, rgba(255, 231, 131, 0.95) 0%, rgba(255, 171, 86, 0.58) 44%, transparent 72%),
    linear-gradient(126deg, #102e61 0%, #1f57a8 45%, #0e2148 100%);
}

.fake-ad-media::before {
  content: "NEW PRO THEME\AWin-ready effects";
  white-space: pre;
  position: absolute;
  left: 10px;
  top: 9px;
  z-index: 2;
  color: #ffffff;
  font: 800 0.72rem/1.15 "Manrope", sans-serif;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.fake-ad-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, transparent 0%, rgba(6, 13, 28, 0.4) 100%),
    repeating-linear-gradient(-28deg, rgba(255, 255, 255, 0.12) 0 8px, rgba(255, 255, 255, 0.02) 8px 22px);
}

.fake-ad-title {
  margin: 10px 0 0;
  font: 800 1rem/1.2 "Manrope", sans-serif;
  color: #f5f8ff;
}

.fake-ad-copy {
  margin: 7px 0 10px;
  color: #b8c9ef;
  font-size: 0.83rem;
  line-height: 1.35;
}

.fake-ad-btn {
  width: 100%;
  border: 1px solid #4b6fb0;
  background: linear-gradient(180deg, #2f63d1 0%, #1f4ea9 100%);
  color: #ffffff;
  border-radius: 9px;
  padding: 8px 10px;
  font: 800 0.82rem/1 "Manrope", sans-serif;
}

.fake-ad-btn:hover {
  filter: brightness(1.08);
}

.celebration-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.celebration-canvas.active {
  opacity: 1;
}

.winner-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 14, 19, 0.56);
  backdrop-filter: blur(2px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  padding: 16px;
}

.winner-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.winner-modal {
  width: min(620px, 92vw);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #394651;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  transform: translateY(10px) scale(0.97);
  transition: transform 0.2s ease;
}

.winner-overlay.active .winner-modal {
  transform: translateY(0) scale(1);
}

.winner-modal-head {
  background: #dd1032;
  padding: 12px 16px;
}

.winner-modal-head p {
  margin: 0;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.winner-modal-body {
  background: #181c22;
  padding: 26px 20px 16px;
}

.winner-name {
  margin: 0;
  color: #f4f8fa;
  text-align: center;
  font: 700 clamp(2.1rem, 6vw, 3rem)/1.1 "Manrope", sans-serif;
  letter-spacing: -0.02em;
}

.winner-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.winner-btn {
  padding: 10px 14px;
  border-radius: 9px;
  color: #ffffff;
  font-size: 0.95rem;
}

.winner-btn.close {
  background: #2e3640;
}

.winner-btn.remove {
  background: #5f88e3;
}

.winner-btn:hover {
  filter: brightness(1.08);
}

@keyframes floatA {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes floatB {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(18px); }
}

@media (max-width: 1480px) {
  .layout {
    grid-template-columns: 280px minmax(500px, 1fr) 280px;
  }

  .wheel-wrap {
    width: min(100%, 700px, calc(100vh - 140px));
  }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 250px minmax(420px, 1fr) 250px;
    gap: 16px;
  }

  .wheel-wrap {
    width: min(100%, 620px, calc(100vh - 180px));
  }

  .input-panel,
  .history-panel {
    min-height: 500px;
  }

  .brand {
    font-size: 1.5rem;
  }

  .nav-item {
    font-size: 0.88rem;
    padding: 7px 8px;
  }
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .wheel-wrap {
    width: min(100%, 520px, calc(100vh - 220px));
  }

  textarea {
    min-height: 200px;
  }

  .header-nav {
    display: none;
  }

  .header-inner {
    justify-content: space-between;
  }
}
