/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c28;
  --border: rgba(255,255,255,0.08);
  --action: #f97316;
  --action-light: #fb923c;
  --verite: #8b5cf6;
  --verite-light: #a78bfa;
  --gold: #f59e0b;
  --text: #f8f8ff;
  --text-muted: rgba(248,248,255,0.45);
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Inter', sans-serif;
}

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ── Background Orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: drift 12s ease-in-out infinite alternate;
}

.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #f97316, transparent);
  top: -100px; left: -100px;
  animation-duration: 14s;
}

.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #8b5cf6, transparent);
  bottom: -80px; right: -80px;
  animation-duration: 18s;
  animation-delay: -6s;
}

.orb-3 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, #f59e0b, transparent);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 22s;
  animation-delay: -10s;
  opacity: 0.1;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.1); }
}

/* ── App Layout ── */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Header ── */
.header {
  text-align: center;
  padding-top: 8px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 14px;
}

.badge-dot {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.header-title {
  font-size: 40px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--verite-light), var(--action-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ── Score Bar ── */
.score-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  gap: 0;
}

.score-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-item:last-child { justify-content: flex-end; }

.score-icon { font-size: 18px; }

.score-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
}

.score-num {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

#score-action .score-num { color: var(--action-light); }
#score-verite .score-num { color: var(--verite-light); }

.score-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 16px;
}

/* ── Card Stack ── */
.card-area {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
}

.card-stack {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 0;
}

.card-bg {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.card-bg-3 {
  background: var(--surface);
  transform: rotate(4deg) translateY(6px);
  opacity: 0.4;
}

.card-bg-2 {
  background: var(--surface);
  transform: rotate(-2deg) translateY(3px);
  opacity: 0.65;
}

.card-main {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow:
    0 4px 6px rgba(0,0,0,0.3),
    0 20px 60px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
}

/* ── Card States ── */
.card-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  gap: 20px;
}

#state-idle {
  background: linear-gradient(145deg, var(--surface2), var(--surface));
}

#state-spinning {
  gap: 0;
  padding: 0;
}

#state-spinning.action-spin {
  background: linear-gradient(145deg, #1a0e06, #2d1408, #1a0e06);
  border: 1px solid rgba(249,115,22,0.3);
}

#state-spinning.verite-spin {
  background: linear-gradient(145deg, #0f0a1e, #1e1035, #0f0a1e);
  border: 1px solid rgba(139,92,246,0.3);
}

#state-result {
  gap: 20px;
}

#state-result.action-card {
  background: linear-gradient(145deg, #1a0e06, #2d1408, #1a0e06);
  border: 1px solid rgba(249,115,22,0.3);
}

#state-result.verite-card {
  background: linear-gradient(145deg, #0f0a1e, #1e1035, #0f0a1e);
  border: 1px solid rgba(139,92,246,0.3);
}

.card-logo {
  font-size: 52px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 20px rgba(245,158,11,0.4));
}

.card-prompt {
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  line-height: 1.5;
  color: var(--text-muted);
}

.card-prompt strong { color: var(--text); font-weight: 700; }

.card-hint {
  position: absolute;
  bottom: 24px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.03em;
  opacity: 0.6;
}

/* ── Slot Machine ── */

.slot-window {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: transparent;
  border: none;
}

.slot-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  will-change: transform;
}

.slot-item {
  width: 100%;
  height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  color: var(--text);
  opacity: 0.7;
  transition: opacity 0.1s;
}

.slot-item.center-item {
  opacity: 1;
  font-weight: 800;
  font-size: 16px;
}

.slot-mask {
  position: absolute;
  left: 0; right: 0;
  height: 60px;
  pointer-events: none;
  z-index: 2;
}

.slot-mask-top {
  top: 0;
  background: linear-gradient(to bottom, var(--surface2) 0%, transparent 100%);
}

.action-spin .slot-mask-top {
  background: linear-gradient(to bottom, #1a0e06 0%, transparent 100%);
}
.verite-spin .slot-mask-top {
  background: linear-gradient(to bottom, #0f0a1e 0%, transparent 100%);
}

.slot-mask-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--surface2) 0%, transparent 100%);
}

.action-spin .slot-mask-bottom {
  background: linear-gradient(to top, #1a0e06 0%, transparent 100%);
}
.verite-spin .slot-mask-bottom {
  background: linear-gradient(to top, #0f0a1e 0%, transparent 100%);
}

.slot-center-line {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 80px;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  border-top: 2px solid;
  border-bottom: 2px solid;
}

.action-spin .slot-center-line {
  border-color: rgba(249,115,22,0.6);
  background: rgba(249,115,22,0.06);
}
.verite-spin .slot-center-line {
  border-color: rgba(139,92,246,0.6);
  background: rgba(139,92,246,0.06);
}

/* ── Result State ── */
.card-type-badge {
  padding: 6px 18px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#state-result.action-card .card-type-badge {
  background: rgba(249,115,22,0.2);
  border: 1px solid rgba(249,115,22,0.4);
  color: var(--action-light);
}

#state-result.verite-card .card-type-badge {
  background: rgba(139,92,246,0.2);
  border: 1px solid rgba(139,92,246,0.4);
  color: var(--verite-light);
}

.card-text {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  letter-spacing: -0.01em;
  flex: 1;
  display: flex;
  align-items: center;
}

.card-next-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.card-next-btn:hover, .card-next-btn:active {
  background: rgba(255,255,255,0.13);
  transform: scale(1.03);
}

/* ── Result appear animation ── */
@keyframes resultAppear {
  0%   { opacity: 0; transform: scale(0.88) translateY(12px); }
  60%  { opacity: 1; transform: scale(1.03) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

#state-result.visible .card-text {
  animation: resultAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Action Buttons ── */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}

.btn:active::before { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }

.btn-action {
  background: linear-gradient(135deg, #c2410c, #f97316);
  box-shadow: 0 8px 32px rgba(249,115,22,0.35), 0 2px 8px rgba(249,115,22,0.2);
}

.btn-verite {
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  box-shadow: 0 8px 32px rgba(139,92,246,0.35), 0 2px 8px rgba(139,92,246,0.2);
}

.btn-icon { font-size: 26px; }

.btn-label {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.btn-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
}

/* ── History Strip ── */
.history-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.history-strip::-webkit-scrollbar { display: none; }

.history-empty {
  font-size: 12px;
  color: var(--text-muted);
  width: 100%;
  text-align: center;
  padding: 6px 0;
}

.history-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-chip.action {
  background: rgba(249,115,22,0.15);
  border: 1px solid rgba(249,115,22,0.25);
  color: var(--action-light);
}

.history-chip.verite {
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.25);
  color: var(--verite-light);
}

/* ── Reset Button ── */
.reset-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
}

.reset-btn:hover, .reset-btn:active {
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
  background: rgba(255,255,255,0.04);
}


/* ── Ripple effect ── */
@keyframes ripple {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

.ripple {
  position: absolute;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ── Safe areas for modern phones ── */
@supports (padding: max(0px)) {
  .app {
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* ── Larger screens ── */
@media (min-width: 480px) {
  .header-title { font-size: 48px; }
  .card-text { font-size: 24px; }
}
