:root {
  --pass: #ff4d6d;
  --correct: #2ec4b6;
  --ink: #22223b;
  --card-bg: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #ff9a5a 0%, #ff5f9e 45%, #8b5cf6 100%);
  background-attachment: fixed;
  overflow: hidden;
}

.app {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.screen {
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ---- Start screen ---- */
.title {
  font-size: clamp(1.4rem, 8.5vw, 4.5rem);
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
  letter-spacing: 1px;
  white-space: nowrap;
}

.tagline {
  font-size: clamp(1rem, 4.5vw, 1.35rem);
  color: #fff;
  max-width: 22ch;
  line-height: 1.4;
}

.instructions {
  font-size: clamp(0.8rem, 3.2vw, 1.25rem);
  color: #fff2e6;
  background: rgba(34, 22, 45, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 20px 22px;
  max-width: 34ch;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

/* Roomier layout on desktops / wide screens */
@media (min-width: 600px) {
  #start-screen {
    max-width: 720px;
  }

  .instructions {
    max-width: 56ch;
    padding: 28px 36px;
  }
}

.big-btn {
  font-family: inherit;
  font-size: clamp(1.5rem, 7vw, 2rem);
  font-weight: bold;
  color: var(--ink);
  background: #ffd166;
  border: none;
  border-radius: 999px;
  padding: 18px 56px;
  cursor: pointer;
  box-shadow: 0 6px 0 #d9a520;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #d9a520;
}

/* ---- Play screen ---- */
#play-screen {
  justify-content: space-between;
  padding: 8px 0;
}

.hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  font-size: clamp(1.1rem, 5vw, 1.5rem);
  font-weight: bold;
}

.timer {
  font-size: clamp(2rem, 11vw, 3rem);
  min-width: 2.5ch;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}

.timer.low {
  color: #fff2b0;
  animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
  50% { transform: scale(1.12); }
}

.score { display: flex; align-items: center; gap: 4px; }
.correct-score { color: #d6fff9; }
.pass-score { color: #ffd6df; }

.card-area {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.card {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 3 / 4;
  max-height: 100%;
  background: var(--card-bg);
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  will-change: transform;
}

.card:active { cursor: grabbing; }

.card-text {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: bold;
  line-height: 1.25;
}

.swipe-label {
  position: absolute;
  top: 24px;
  font-size: clamp(1.2rem, 6vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 2px;
  padding: 6px 16px;
  border-radius: 12px;
  border: 4px solid currentColor;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.swipe-label--pass {
  left: 20px;
  color: var(--pass);
  transform: rotate(-14deg);
}

.swipe-label--correct {
  right: 20px;
  color: var(--correct);
  transform: rotate(14deg);
}

.actions {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 8px 0;
}

.action-btn {
  width: clamp(64px, 20vw, 80px);
  height: clamp(64px, 20vw, 80px);
  border-radius: 50%;
  border: none;
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.action-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.pass-btn { background: var(--pass); }
.correct-btn { background: var(--correct); }

.hint {
  color: #fff;
  opacity: 0.9;
  font-size: clamp(0.8rem, 3.5vw, 1rem);
}

/* ---- Results screen ---- */
.results-title {
  font-size: clamp(2rem, 9vw, 3rem);
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

.results-lists {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  overflow: hidden;
}

.results-col {
  flex: 1;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.col-head {
  font-size: clamp(0.95rem, 4vw, 1.2rem);
  margin-bottom: 10px;
}

.correct-head { color: var(--correct); }
.pass-head { color: var(--pass); }

.phrase-list {
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  font-size: clamp(0.8rem, 3.5vw, 1rem);
}

.phrase-list li {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  line-height: 1.3;
}

.phrase-list li:last-child { border-bottom: none; }

.phrase-list .empty {
  color: #888;
  font-style: italic;
  border-bottom: none;
}
