:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --left: #e11d48;
  --left-soft: #ffe4e6;
  --right: #2563eb;
  --right-soft: #dbeafe;
  --shadow-card: 0 18px 42px rgba(15, 23, 42, 0.11), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius-xl: 24px;
  --radius-lg: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 14%, rgba(225, 29, 72, 0.08), transparent 36%),
    radial-gradient(circle at 88% 18%, rgba(37, 99, 235, 0.09), transparent 38%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- HOME SCREEN --- */
#screen-home {
  justify-content: space-between;
  padding-top: 24px;
}

.home-card {
  margin: auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 24px 30px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.brand-split {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.pill {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 6px 11px;
  border-radius: 999px;
}

.pill--left {
  background: var(--left-soft);
  color: var(--left);
}

.pill--right {
  background: var(--right-soft);
  color: var(--right);
}

.pill-vs {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.home-title {
  margin: 0 0 12px;
  font-size: clamp(2.5rem, 9vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(110deg, var(--left) 0%, #7c3aed 50%, var(--right) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-subtitle {
  margin: 0 0 28px;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.home-footer {
  margin-top: 24px;
  padding: 0 8px;
  text-align: center;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* --- BUTTONS --- */
.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-lg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--large {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.06rem;
}

.btn--primary {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn--left {
  flex: 1;
  background: var(--left-soft);
  color: var(--left);
  border: 1.5px solid rgba(225, 29, 72, 0.25);
  padding: 15px 14px;
  font-size: 0.98rem;
}

.btn--left:hover:not(:disabled) {
  background: #fecdd3;
}

.btn--right {
  flex: 1;
  background: var(--right-soft);
  color: var(--right);
  border: 1.5px solid rgba(37, 99, 235, 0.25);
  padding: 15px 14px;
  font-size: 0.98rem;
}

.btn--right:hover:not(:disabled) {
  background: #bfdbfe;
}

.btn--next {
  width: 100%;
  margin-top: 12px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  font-size: 0.94rem;
}

.btn-icon {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.error-banner {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* --- GAME SCREEN --- */
#screen-game {
  gap: 14px;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-wrap {
  flex: 1;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.progress-brand {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.progress-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 8.33%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--left), var(--right));
  transition: width 0.25s ease;
}

.card-stage {
  position: relative;
  flex: 1;
  min-height: 290px;
  max-height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
  user-select: none;
}

.card-underlay,
.swipe-card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-underlay {
  transform: scale(0.95) translateY(10px);
  opacity: 0.65;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.swipe-card {
  z-index: 2;
  box-shadow: var(--shadow-card);
  cursor: grab;
  touch-action: none;
  will-change: transform;
  outline: none;
}

.swipe-card--animating {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

.swipe-card:active {
  cursor: grabbing;
}

.swipe-stamp {
  position: absolute;
  top: 20px;
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  border: 3px solid currentColor;
  opacity: 0;
  pointer-events: none;
}

.swipe-stamp--left {
  right: 20px;
  color: var(--left);
  background: rgba(255, 228, 230, 0.92);
  transform: rotate(10deg);
}

.swipe-stamp--right {
  left: 20px;
  color: var(--right);
  background: rgba(219, 234, 254, 0.92);
  transform: rotate(-10deg);
}

.card-category {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.card-word {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
}

.card-hint {
  position: absolute;
  bottom: 18px;
  left: 16px;
  right: 16px;
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- FEEDBACK PANEL --- */
.feedback-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  animation: popIn 0.18s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-headline {
  margin: 0 0 12px;
  font-size: 0.97rem;
  font-weight: 700;
  line-height: 1.38;
  text-align: center;
}

.split-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.split-bar__left {
  background: var(--left);
  transition: width 0.35s ease;
}

.split-bar__right {
  background: var(--right);
  transition: width 0.35s ease;
}

.feedback-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.stat-left {
  color: var(--left);
}

.stat-total {
  color: var(--text-muted);
  font-weight: 600;
}

.stat-right {
  color: var(--right);
}

.feedback-note {
  margin: 8px 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 4px;
}

/* --- SUMMARY SCREEN --- */
#screen-summary {
  gap: 14px;
  padding-top: 8px;
}

.summary-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.summary-kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.summary-title {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.summary-subtitle {
  margin: 0 0 18px;
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.conformity-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.conformity-main {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
}

.conformity-ratio {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.summary-actions {
  display: flex;
  gap: 10px;
}

.summary-actions .btn {
  flex: 1;
  padding: 13px 14px;
  font-size: 0.92rem;
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}

.summary-item__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.summary-item__label {
  font-weight: 700;
  font-size: 0.96rem;
}

.summary-item__cat {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
}

.choice-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
}

.choice-badge--left {
  background: var(--left-soft);
  color: var(--left);
}

.choice-badge--right {
  background: var(--right-soft);
  color: var(--right);
}

.summary-item__bar {
  display: flex;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  margin-bottom: 6px;
}

.summary-item__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

@media (max-width: 380px) {
  .summary-actions {
    flex-direction: column;
  }
}
