:root {
  --bg: #0f1220;
  --card: #1a1f35;
  --accent: #7c5cff;
  --accent-2: #ff6ec7;
  --green: #2ee6a6;
  --red: #ff4d6d;
  --gold: #ffd23f;
  --text: #f2f2f7;
  --muted: #9a9ab0;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, #2a1f4d, var(--bg) 60%);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

body.app {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.wrap {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(10px, 2.5vw, 18px) 16px clamp(8px, 2vw, 14px);
  gap: clamp(8px, 2vw, 14px);
  max-width: 460px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  width: 100%;
  flex: 0 0 auto;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(22px, 6.5vw, 32px);
  line-height: 1.1;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.song-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 700;
  padding: clamp(10px, 2.5vw, 14px) 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff0033, var(--accent-2));
  color: white;
  text-decoration: none;
  box-shadow: 0 12px 36px rgba(255, 0, 51, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

@media (hover: hover) {
  .song-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 44px rgba(255, 0, 51, 0.55);
  }
}

.deck-wrap {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.score-badge {
  margin: 0;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.deck-row {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: clamp(8px, 3vw, 16px);
}

.deck {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  min-height: 140px;
  max-height: 460px;
}

.card {
  position: absolute;
  inset: 0;
  background: var(--card);
  border-radius: 22px;
  padding: clamp(16px, 5vw, 26px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  text-align: center;
  touch-action: none;
  user-select: none;
  cursor: grab;
  will-change: transform;
}

.card.behind {
  z-index: 1;
  transform: scale(0.94) translateY(14px);
  pointer-events: none;
}

.card.top {
  z-index: 2;
}

.card.dragging {
  transition: none;
}

.card.snap-back {
  transition: transform 0.3s ease;
}

.card.fly-out {
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.story-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--muted);
}

.story-title {
  margin: 0 0 10px;
  font-size: clamp(18px, 5vw, 21px);
  color: var(--accent-2);
}

.story-text {
  margin: 0 0 14px;
  font-size: clamp(14px, 3.8vw, 15px);
  line-height: 1.55;
  overflow-y: auto;
  flex: 1;
}

.story-source {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.story-source:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  gap: 10px;
  animation: revealPop 0.35s ease;
}

@keyframes revealPop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.reveal-icon {
  font-size: clamp(40px, 12vw, 54px);
}

.reveal-verdict {
  margin: 0;
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 20px;
  border-radius: 12px;
  border: 4px solid;
  transform: rotate(-4deg);
}

.reveal.correct .reveal-verdict {
  color: var(--gold);
  border-color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 210, 63, 0.6);
}

.reveal.incorrect .reveal-verdict {
  color: var(--red);
  border-color: var(--red);
}

.reveal-guess {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.reveal .story-source {
  margin: 0;
}

.reveal-community {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.stamp {
  position: absolute;
  top: 24px;
  padding: 6px 14px;
  border: 3px solid;
  border-radius: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}

.stamp-up {
  right: 20px;
  color: var(--gold);
  border-color: var(--gold);
  transform: rotate(-12deg);
}

.stamp-down {
  left: 20px;
  color: var(--red);
  border-color: var(--red);
  transform: rotate(12deg);
}

.stamp-share {
  left: 50%;
  top: 16px;
  transform: translateX(-50%) rotate(0deg);
  color: var(--accent);
  border-color: var(--accent);
}

.stamp-coffee {
  left: 50%;
  bottom: 16px;
  top: auto;
  transform: translateX(-50%);
  color: #d99a3a;
  border-color: #d99a3a;
}

.side-btn {
  flex: 0 0 auto;
  border: none;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.side-btn:active {
  transform: scale(0.92);
}

@media (hover: hover) {
  .side-btn:hover {
    transform: translateY(-2px);
  }
}

.side-btn-true,
.side-btn-false {
  width: clamp(46px, 13vw, 56px);
  height: clamp(46px, 13vw, 56px);
  border-radius: 50%;
  font-size: clamp(19px, 5.5vw, 23px);
}

.side-btn-true {
  color: var(--gold);
  border-color: rgba(255, 210, 63, 0.35);
}

.side-btn-false {
  color: var(--red);
  border-color: rgba(255, 77, 109, 0.35);
}

.side-btn-share {
  width: clamp(38px, 10vw, 44px);
  height: clamp(38px, 10vw, 44px);
  border-radius: 50%;
  font-size: clamp(15px, 4.5vw, 18px);
  align-self: center;
}

.side-btn-coffee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: clamp(13px, 3.6vw, 15px);
  font-weight: 700;
  color: #d99a3a;
  border-color: rgba(217, 154, 58, 0.35);
  align-self: center;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}

footer p {
  margin: 2px 0;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 10;
  max-width: 90vw;
  text-align: center;
}

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

.legal {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(32px, 8vw, 64px) 20px;
  line-height: 1.6;
}

.legal h1 {
  font-size: clamp(24px, 7vw, 30px);
  margin-bottom: 24px;
}

.legal h2 {
  font-size: clamp(17px, 4.5vw, 20px);
  color: var(--accent-2);
  margin: 32px 0 8px;
}

.legal p {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
}

.legal a {
  color: var(--accent-2);
}

.legal .back {
  display: inline-block;
  margin-top: 32px;
  color: var(--muted);
}
