:root {
  --text: #ffffff;
  --button-bg: #13264f;
  --button-border: #ffffff;
  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: hidden;
}

.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.72) 95%);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
}

.intro {
  text-align: center;
}

.intro h1 {
  margin: 0 0 20px;
  font-size: clamp(34px, 6vw, 64px);
  letter-spacing: 2px;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

#startButton {
  border: 1px solid var(--button-border);
  border-radius: 999px;
  padding: 14px 42px;
  font-size: 22px;
  color: #fff;
  background: var(--button-bg);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

#startButton:hover {
  transform: scale(1.04);
  background: #1a356b;
}

.top-actions {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 4;
  display: flex;
  gap: 10px;
}

.top-actions button {
  border: 1px solid var(--button-border);
  background: #13264f;
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.wheel-scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.hint {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: #0b1b3b;
  z-index: 3;
}

.draw-zone {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: min(92vw, 980px);
  pointer-events: none;
}

.draw-title {
  font-size: 13px;
  margin-bottom: 6px;
  text-align: center;
  color: #dbe7ff;
}

.selected-cards {
  min-height: 120px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.selected-card {
  width: clamp(104px, 11vw, 196px);
  aspect-ratio: 3 / 5;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  pointer-events: auto;
}

.selected-card.is-hidden {
  opacity: 0;
}

.flying-card {
  position: fixed;
  z-index: 10;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: var(--card-shadow);
  transition: left 0.35s ease, top 0.35s ease, width 0.35s ease, height 0.35s ease;
}

.wheel-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.wheel-stage:active {
  cursor: grabbing;
}

.wheel-stage.dragging .wheel-card {
  transition: none;
}

.wheel {
  position: absolute;
  inset: 0;
}

.wheel-card {
  position: absolute;
  left: 50%;
  top: 97%;
  width: clamp(62px, 6.6vw, 116px);
  aspect-ratio: 3 / 5;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, 0.5);
  will-change: transform, opacity;
  transition: transform 0.24s ease, opacity 0.2s ease;
}

.deck-view {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  padding: 88px 10px 10px;
}

.deck-view img {
  width: 100%;
  aspect-ratio: 3 / 5;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--card-shadow);
  object-fit: cover;
  cursor: pointer;
}

.meaning-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 20, 0.78);
  padding: 18px;
}

.meaning-panel {
  width: min(980px, 96vw);
  max-height: 92vh;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(6, 12, 28, 0.78) 0%, rgba(6, 12, 28, 0.6) 52%, rgba(6, 12, 28, 0.76) 100%),
    url("./back/牌面解释.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.62);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.meaning-panel {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.meaning-modal {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.meaning-close {
  align-self: flex-end;
  margin: 10px 10px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: #13264f;
  color: #fff;
  padding: 6px 12px;
  cursor: pointer;
}

.meaning-content {
  overflow: auto;
  padding: 12px 16px 18px;
}

.meaning-header {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.meaning-card-image {
  width: min(220px, 45vw);
  aspect-ratio: 3 / 5;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  object-fit: cover;
}

.meaning-title {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 30px);
}

.meaning-subtitle {
  margin: 0;
  color: #c3d4ff;
  font-size: 13px;
  letter-spacing: 0.4px;
}

.meaning-section {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meaning-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.meaning-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.3;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.keyword-chip.is-upright {
  background: rgba(95, 182, 133, 0.22);
}

.keyword-chip.is-reversed {
  background: rgba(214, 101, 101, 0.22);
}

.meaning-section p {
  margin: 0 0 6px;
  line-height: 1.55;
  color: #e7edff;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .hint {
    font-size: 12px;
    top: 14px;
    width: min(94vw, 420px);
    text-align: center;
  }

  .top-actions {
    right: 10px;
    gap: 6px;
    top: 10px;
  }

  .top-actions button {
    padding: 7px 10px;
    font-size: 12px;
  }

  .draw-zone {
    top: 64px;
  }

  .selected-card {
    width: clamp(96px, 28vw, 156px);
  }
}
