﻿:root {
  --sky-top: #77d8ff;
  --sky-mid: #5ab8ff;
  --sky-bottom: #2f84f4;
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-border: rgba(255, 255, 255, 0.62);
  --text-main: #10345a;
  --text-soft: #2f5f8f;
  --accent: #ff8a00;
  --accent-2: #ff5e3a;
  --btn: #17a84b;
  --btn-hover: #0f8f3f;
  --shadow: 0 18px 38px rgba(16, 52, 90, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text-main);
}

body {
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 44%, var(--sky-bottom) 100%);
  overflow: hidden;
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

.shape-1 {
  width: 460px;
  height: 460px;
  border-radius: 53% 47% 40% 60%;
  background: rgba(255, 255, 255, 0.18);
  top: -120px;
  left: -90px;
  animation: floatA 7s ease-in-out infinite;
}

.shape-2 {
  width: 360px;
  height: 360px;
  border-radius: 62% 38% 56% 44%;
  background: rgba(255, 214, 120, 0.22);
  bottom: -130px;
  right: 20px;
  animation: floatB 9s ease-in-out infinite;
}

.shape-3 {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  top: 40%;
  right: 30%;
  filter: blur(2px);
  animation: pulse 6s ease-in-out infinite;
}

.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 18px 24px 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(13, 55, 98, 0.2);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

.icon-btn.active {
  background: #ffecc8;
  color: #7e4700;
}

.icon-btn.ghost {
  background: #eff5fb;
}

.main-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 320px);
  gap: 18px;
  padding: 6px 22px 22px;
  height: calc(100vh - 92px);
}

.wheel-panel {
  position: relative;
  border-radius: 26px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.wheel-wrap {
  width: min(74vh, 75vw, 760px);
  height: min(74vh, 75vw, 760px);
  border-radius: 50%;
  box-shadow: 0 24px 42px rgba(18, 73, 119, 0.22);
  transition: transform 0.12s linear;
}

.wheel-wrap canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.pointer {
  position: absolute;
  top: 8px;
  width: 0;
  height: 0;
  border-left: 26px solid transparent;
  border-right: 26px solid transparent;
  border-top: 54px solid var(--accent);
  border-bottom: 0;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.22));
  z-index: 3;
}

.spin-btn {
  position: absolute;
  width: clamp(130px, 15vw, 158px);
  height: clamp(130px, 15vw, 158px);
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.92);
  background: radial-gradient(circle at 30% 30%, #ffd057 0%, #ff9f1c 58%, #ff7f11 100%);
  color: #fff;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(255, 125, 24, 0.46);
  z-index: 4;
  transition: transform 0.16s ease, filter 0.16s ease;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  line-height: 1.05;
}

.spin-btn span {
  display: block;
}

.spin-btn:hover {
  transform: scale(1.03);
  filter: saturate(1.1);
}

.spin-btn:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.history-panel {
  border-radius: 24px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.history-header h2 {
  margin: 0;
  font-size: 20px;
}

.small-btn,
.primary-btn {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
}

.small-btn {
  background: #e7f1fb;
  color: #1c4a78;
  padding: 10px 14px;
}

.small-btn.warning {
  background: #ffefdc;
  color: #8d4a00;
}

.small-btn:hover {
  filter: brightness(0.97);
}

.primary-btn {
  flex: 1;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--btn), #25c55d);
  color: #fff;
  font-size: 18px;
}

.primary-btn:hover {
  background: linear-gradient(135deg, var(--btn-hover), #19ab4d);
}

#historyList {
  margin: 0;
  padding-left: 24px;
  overflow: auto;
  font-size: 16px;
  line-height: 1.7;
}

#historyList li {
  margin-bottom: 6px;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 24;
}

.confetti-canvas.show {
  opacity: 1;
}

.result-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 42, 78, 0.34);
  backdrop-filter: blur(3px);
  z-index: 25;
}

.result-modal[hidden] {
  display: none;
}

.result-card {
  width: min(86vw, 560px);
  background: linear-gradient(165deg, #ffffff 0%, #f1fbff 100%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(5, 35, 66, 0.28);
  text-align: center;
  padding: 28px 24px 22px;
  animation: popIn 0.35s cubic-bezier(0.2, 0.74, 0.28, 1.24);
}

.result-title {
  margin: 0;
  color: #14609a;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 800;
}

.result-text {
  margin: 14px 0 20px;
  color: #0e3e65;
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.2;
  letter-spacing: 1px;
}

.result-close-btn {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a00 0%, #ff5d2e 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  padding: 10px 28px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(255, 107, 43, 0.32);
}

.result-close-btn:hover {
  filter: brightness(1.03);
}

.result-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(32px);
  min-width: 240px;
  max-width: min(84vw, 760px);
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(6, 48, 85, 0.84);
  color: #fff;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s ease;
  z-index: 15;
}

.result-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 26, 50, 0.46);
  backdrop-filter: blur(2px);
  z-index: 20;
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: min(540px, 90vw);
  height: 100vh;
  background: #f7fbff;
  box-shadow: -20px 0 34px rgba(5, 31, 61, 0.22);
  transform: translateX(108%);
  transition: transform 0.32s ease;
  z-index: 21;
  display: grid;
  grid-template-rows: auto 1fr;
}

.drawer.show {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #deebf7;
}

.drawer-head h2 {
  margin: 0;
  font-size: 24px;
}

.drawer-content {
  padding: 14px 18px 24px;
  overflow: auto;
  display: grid;
  gap: 14px;
}

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

.field span {
  color: #184b7a;
  font-weight: 700;
}

.field select,
.field input[type="text"],
.field textarea,
.field input[type="file"],
.field input[type="range"] {
  width: 100%;
  border: 1px solid #c7d9ea;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: #143f68;
}

.field textarea {
  resize: vertical;
  min-height: 98px;
}

.field-inline .toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 2px;
}

.toggle-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #1b4d79;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-row input[type="text"] {
  flex: 1;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row.wide {
  justify-content: space-between;
  margin-top: 6px;
}

.wheel-fs .main-layout {
  grid-template-columns: 1fr;
  height: calc(100vh - 76px);
  padding: 6px 12px 12px;
}

.wheel-fs .history-panel {
  display: none;
}

.wheel-fs .wheel-panel {
  min-height: calc(100vh - 90px);
}

.wheel-fs .top-bar {
  padding: 10px 14px 6px;
}

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

  .main-layout {
    height: auto;
    grid-template-columns: 1fr;
    padding-bottom: 16px;
  }

  .wheel-panel {
    min-height: 72vh;
  }

  .history-panel {
    min-height: 240px;
  }

}

@media (max-width: 720px) {
  .top-bar {
    padding: 14px;
  }

  .title-wrap p {
    font-size: 15px;
  }

  .spin-btn {
    width: 124px;
    height: 124px;
    font-size: 24px;
  }

  .pointer {
    border-left-width: 18px;
    border-right-width: 18px;
    border-top-width: 36px;
  }
}

@keyframes floatA {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(12px) rotate(5deg);
  }
}

@keyframes floatB {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(-6deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.5;
  }
}

@keyframes popIn {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}
