:root {
  --rose: #ff8fb1;
  --magenta: #ff4f7b;
  --plum: #8e55ff;
  --soft: #ffe9f4;
  --soft-2: #f7ecff;
  --text: #56213d;
  --muted: rgba(86, 33, 61, 0.68);
  --card-shadow: 0 18px 40px rgba(255, 79, 123, 0.18);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Heiti SC", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #ffd6e8 0%, #f4e5ff 45%, #ffd9f1 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 55%),
    url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M60 24c-6-13-24-21-38-9-14 12-6 34 6 46l32 32 32-32c12-12 20-34 6-46-14-12-32-4-38 9z' fill='%23ffc3d7' fill-opacity='0.24'/%3E%3C/svg%3E");
  background-size: cover, 240px;
  opacity: 0.55;
  z-index: -1;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

main {
  width: min(1080px, 92vw);
  margin: 0 auto 72px;
}

.hero {
  text-align: center;
  padding: clamp(60px, 12vw, 96px) 20px clamp(36px, 8vw, 60px);
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset-inline: 50%;
  bottom: clamp(18px, 4vw, 28px);
  width: clamp(220px, 40vw, 360px);
  height: 3px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255, 79, 123, 0.45), transparent);
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: 0.12em;
  text-shadow: 0 14px 28px rgba(255, 79, 123, 0.26);
}

.hero-subtitle {
  margin: 0 auto;
  max-width: 640px;
  line-height: 1.7;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  color: var(--muted);
}

.panel {
  background: rgba(255, 255, 255, 0.68);
  border-radius: clamp(20px, 3vw, 28px);
  box-shadow: 0 20px 60px rgba(255, 79, 123, 0.18);
  padding: clamp(20px, 4vw, 40px);
  backdrop-filter: blur(12px);
}

.section-title {
  font-size: clamp(1.4rem, 2.3vw, 1.8rem);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}

.section-title::before {
  content: "❤";
  font-size: 1.4rem;
  color: var(--magenta);
  filter: drop-shadow(0 6px 10px rgba(255, 79, 123, 0.25));
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(16px, 3.4vw, 26px);
}

.mode-card,
.game-card,
.link-card {
  border-radius: 24px;
  padding: clamp(20px, 3.2vw, 28px);
  background: linear-gradient(135deg, rgba(255, 175, 204, 0.7), rgba(255, 231, 246, 0.9));
  box-shadow: 0 16px 34px rgba(255, 79, 123, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  color: var(--text);
}

.mode-card:hover,
.game-card:hover,
.link-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 38px rgba(255, 79, 123, 0.28);
}

.card-meta {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.primary-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 14px 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--magenta), var(--plum));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 34px rgba(142, 85, 255, 0.28);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(142, 85, 255, 0.36);
}

.ghost-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px dashed rgba(255, 79, 123, 0.45);
  background: rgba(255, 255, 255, 0.62);
  color: var(--magenta);
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: background 0.25s ease;
}

.ghost-btn:hover {
  background: rgba(255, 143, 177, 0.18);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: rgba(86, 33, 61, 0.6);
  margin-bottom: 18px;
}

.breadcrumb a {
  text-decoration: underline;
  text-decoration-color: rgba(255, 79, 123, 0.5);
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: rgba(86, 33, 61, 0.7);
  margin-bottom: 18px;
}

.nav-back:hover {
  color: var(--magenta);
}

.notice {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.mode-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 4px solid rgba(255, 79, 123, 0.25);
  padding-left: 16px;
  margin-bottom: clamp(18px, 3vw, 28px);
}

.mode-summary h3 {
  margin: 0;
  font-size: 1.3rem;
}

.mode-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.game-area {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  padding: clamp(18px, 3.5vw, 36px);
  box-shadow: inset 0 0 0 1px rgba(255, 143, 177, 0.2);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.placeholder {
  margin: 0;
  font-size: 1rem;
  text-align: center;
  color: var(--muted);
}

.loading {
  text-align: center;
  color: var(--magenta);
  font-weight: 600;
  letter-spacing: 0.1em;
  animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.4;
  }
}

.error {
  color: #d10044;
  text-align: center;
  font-weight: 600;
}

.flight-wrapper {
  display: grid;
  gap: clamp(16px, 3vw, 26px);
}

.flight-status {
  display: grid;
  gap: 18px;
}

.flight-counter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: rgba(86, 33, 61, 0.55);
  text-transform: uppercase;
}

.value {
  font-size: 1.4rem;
  font-weight: 700;
}

.progress-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 143, 177, 0.25);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 143, 177, 0.4), rgba(255, 79, 123, 0.88));
  transition: width 0.4s ease;
}

.flight-punishment {
  background: rgba(255, 143, 177, 0.12);
  border-radius: 18px;
  padding: 16px 18px;
  line-height: 1.6;
  font-size: 1.05rem;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 177, 0.2);
}

.dice-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.dice-result {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: linear-gradient(145deg, #fff1f8, #ffd0e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--magenta);
  box-shadow: inset 0 0 0 1px rgba(255, 79, 123, 0.18), 0 16px 30px rgba(255, 79, 123, 0.22);
  transition: transform 0.45s ease;
}

.dice-result.spin {
  transform: rotate(360deg) scale(1.08);
}

.flight-history {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 177, 0.15);
}

.flight-history h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--text);
}

.flip-wrapper {
  display: grid;
  gap: 18px;
}

.flip-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}

.card-grid.flip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.flip-card {
  perspective: 1200px;
  position: relative;
}

.flip-card button {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  position: relative;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s ease;
  box-shadow: var(--card-shadow);
  border-radius: 22px;
}

.flip-card.revealed .flip-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  backface-visibility: hidden;
  padding: 18px;
}

.card-front {
  background: linear-gradient(135deg, rgba(255, 143, 177, 0.88), rgba(142, 85, 255, 0.9));
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: #fff9ff;
  letter-spacing: 0.12em;
}

.card-back {
  background: rgba(255, 255, 255, 0.94);
  transform: rotateY(180deg);
  color: var(--text);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 177, 0.25);
}

.flip-helper {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
}

.flip-result {
  min-height: 72px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 143, 177, 0.18);
  padding: 18px 20px;
  line-height: 1.6;
  font-size: 1rem;
  color: var(--muted);
  transition: color 0.3s ease;
}

.flip-result.active {
  color: var(--text);
}


@media (max-width: 720px) {
  main {
    width: min(640px, 94vw);
  }

  .panel {
    border-radius: 20px;
    padding: 20px;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .dice-panel {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .dice-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .dice-result {
    align-self: center;
  }

  .card-grid.flip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
