/* =====================================================
   Squabblify — App Styles
   Mobile-first, dark theme with yellow/orange accents
   ===================================================== */

/* =====================================================
   Design Tokens
   ===================================================== */
:root {
  --yellow: #eab308;
  --orange: #f97316;
  --grad: linear-gradient(135deg, #eab308, #f97316);
  --grad-btn: linear-gradient(135deg, #eab308 0%, #f97316 100%);
  --bg: #111008;
  --bg-dark: #0c0b02;
  --card: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(234, 179, 8, 0.5);
  --text: #f0ece0;
  --text-dim: #c0baa8;
  --muted: #555;
  --muted2: #888;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --font-display: 'Nunito', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --glow: 0 0 20px rgba(234, 179, 8, 0.15);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =====================================================
   Screen System
   ===================================================== */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* =====================================================
   Utility helpers
   ===================================================== */
.hidden { display: none !important; }

/* =====================================================
   Typography
   ===================================================== */
.logo-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.logo-text-sm {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.25rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-emoji {
  font-size: 2.2rem;
  display: inline-block;
}

.logo-sub {
  color: var(--muted2);
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.05em;
}

/* =====================================================
   Spinner
   ===================================================== */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 24px auto 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =====================================================
   Splash Screen
   ===================================================== */
#screen-splash {
  justify-content: center;
  align-items: center;
  background: var(--bg-dark);
}

.splash-inner {
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

.splash-logo {
  font-size: 4rem;
  margin-bottom: 8px;
  animation: bounce 1s ease infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

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

/* =====================================================
   Auth Screen
   ===================================================== */
#screen-auth {
  justify-content: flex-start;
  padding: 0;
}

.auth-wrap {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-tagline {
  text-align: center;
  color: var(--muted2);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* =====================================================
   Tab Bars
   ===================================================== */
.tab-bar {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--muted2);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--grad-btn);
  color: #000;
  font-weight: 700;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* =====================================================
   Auth Forms
   ===================================================== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-group.half {
  flex: 1;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

.form-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* =====================================================
   Buttons
   ===================================================== */
.btn-primary {
  padding: 14px 24px;
  background: var(--grad-btn);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary.btn-block { width: 100%; }

.btn-primary.btn-big {
  padding: 18px 24px;
  font-size: 1.1rem;
  border-radius: var(--radius);
}

.btn-ghost {
  padding: 13px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost:hover { background: var(--card-hover); border-color: rgba(255,255,255,0.14); }
.btn-ghost.btn-block { width: 100%; }

.btn-ghost-sm {
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted2);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 8px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--yellow);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}

/* Button spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* =====================================================
   Home Screen
   ===================================================== */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
  flex-shrink: 0;
}

.home-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
}

.credit-badge {
  background: var(--card);
  border: 1px solid var(--border-active);
  border-radius: 24px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--yellow);
}

.credit-count {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
}

.credit-label {
  color: var(--muted2);
  font-weight: 400;
}

.credit-badge.is-pro {
  background: linear-gradient(135deg, rgba(234,179,8,0.15), rgba(249,115,22,0.15));
  border-color: var(--yellow);
}

.credit-badge.is-pro::before {
  content: '⭐ PRO';
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--yellow);
}

.home-body {
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.home-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.8rem;
  line-height: 1.2;
  color: var(--text);
  text-align: center;
  margin-top: 8px;
}

.mode-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.mode-card:hover {
  background: var(--card-hover);
  border-color: rgba(234,179,8,0.3);
}

.mode-card.active {
  background: linear-gradient(135deg, rgba(234,179,8,0.12), rgba(249,115,22,0.12));
  border-color: var(--yellow);
  box-shadow: var(--glow);
}

.mode-icon { font-size: 1.5rem; }
.mode-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.mode-desc { font-size: 0.72rem; color: var(--muted2); text-align: center; }

.names-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.vs-divider {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--yellow);
  padding-bottom: 12px;
  flex-shrink: 0;
}

.alert-warn, .alert-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-warn {
  background: rgba(234,179,8,0.1);
  border: 1px solid rgba(234,179,8,0.3);
  color: #fde047;
}

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}

.alert-link {
  background: none;
  border: none;
  color: var(--yellow);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* =====================================================
   Voice Screen
   ===================================================== */
.voice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  flex-shrink: 0;
}

.voice-steps {
  display: flex;
  gap: 8px;
  align-items: center;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: all 0.3s;
}

.step-dot.active {
  background: var(--yellow);
  width: 24px;
  border-radius: 4px;
}

.voice-step {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 40px;
  gap: 16px;
  animation: slideIn 0.3s ease;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.voice-step.active {
  display: flex;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(15px); }
  to   { opacity: 1; transform: translateX(0); }
}

.voice-step-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  text-align: center;
  color: var(--text);
}

.voice-step-sub {
  color: var(--muted2);
  font-size: 0.9rem;
  text-align: center;
  margin-top: -8px;
}

/* Mic Button */
.mic-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--grad-btn);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s;
  box-shadow: 0 6px 24px rgba(234,179,8,0.3);
  margin: 8px 0;
}

.mic-btn:hover { transform: scale(1.05); }
.mic-btn:active { transform: scale(0.95); }

.mic-btn.recording {
  animation: pulse 1s ease infinite;
}

.mic-icon {
  font-size: 2.2rem;
  position: relative;
  z-index: 2;
}

.mic-ripple {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--yellow);
  opacity: 0;
  animation: ripple 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(234,179,8,0.3), 0 0 0 0 rgba(234,179,8,0.4); }
  50% { box-shadow: 0 6px 24px rgba(234,179,8,0.3), 0 0 0 20px rgba(234,179,8,0); }
}

@keyframes ripple {
  0%   { opacity: 0; transform: scale(1); }
  30%  { opacity: 0.6; }
  100% { opacity: 0; transform: scale(1.8); }
}

.transcript-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 72px;
  display: flex;
  align-items: center;
}

.transcript-text {
  color: var(--muted2);
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.5;
}

.transcript-text.has-text {
  color: var(--text);
  font-style: normal;
}

.voice-btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.voice-btn-row .btn-ghost { flex: 0 0 auto; }
.voice-btn-row .btn-primary { flex: 1; }

.btn-settle {
  background: linear-gradient(135deg, #f97316, #ef4444);
  font-size: 1rem;
}

/* =====================================================
   Loading Screen
   ===================================================== */
#screen-loading {
  justify-content: center;
  align-items: center;
  background: var(--bg-dark);
}

.loading-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-logo {
  font-size: 4rem;
  animation: wobble 0.8s ease infinite alternate;
}

@keyframes wobble {
  from { transform: rotate(-8deg) scale(1); }
  to   { transform: rotate(8deg) scale(1.1); }
}

.loading-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-sub {
  color: var(--muted2);
  font-size: 0.9rem;
}

/* Wave Bars */
.wave-bars {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 40px;
  margin-top: 8px;
}

.wave-bars .bar {
  width: 5px;
  border-radius: 3px;
  background: var(--grad-btn);
  animation: wave 1.2s ease-in-out infinite;
}

.wave-bars .bar:nth-child(1) { animation-delay: 0s;    height: 16px; }
.wave-bars .bar:nth-child(2) { animation-delay: 0.1s;  height: 28px; }
.wave-bars .bar:nth-child(3) { animation-delay: 0.2s;  height: 40px; }
.wave-bars .bar:nth-child(4) { animation-delay: 0.3s;  height: 28px; }
.wave-bars .bar:nth-child(5) { animation-delay: 0.4s;  height: 16px; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.3); opacity: 0.4; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.wave-bars-sm {
  display: flex;
  gap: 3px;
  align-items: center;
  height: 24px;
}

.wave-bars-sm .bar {
  width: 3px;
  border-radius: 2px;
  background: var(--grad-btn);
  animation: wave 1s ease-in-out infinite;
}

.wave-bars-sm .bar:nth-child(1) { animation-delay: 0s;   height: 8px; }
.wave-bars-sm .bar:nth-child(2) { animation-delay: 0.1s; height: 14px; }
.wave-bars-sm .bar:nth-child(3) { animation-delay: 0.2s; height: 20px; }
.wave-bars-sm .bar:nth-child(4) { animation-delay: 0.3s; height: 14px; }
.wave-bars-sm .bar:nth-child(5) { animation-delay: 0.4s; height: 8px; }

/* =====================================================
   Result Screen
   ===================================================== */
.result-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 20px 60px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  animation: fadeInUp 0.4s ease;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 8px;
  flex-shrink: 0;
}

.result-header-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.result-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.result-summary {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.result-verdict {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.result-advice {
  border-color: rgba(234,179,8,0.2);
  background: linear-gradient(135deg, rgba(234,179,8,0.05), rgba(249,115,22,0.05));
}

.result-advice p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.voice-playback-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-play-voice {
  flex-shrink: 0;
  padding: 12px 20px;
  background: var(--card);
  border: 1px solid var(--border-active);
  border-radius: 30px;
  color: var(--yellow);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-play-voice:hover { background: rgba(234,179,8,0.1); }

.winner-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(234,179,8,0.15), rgba(249,115,22,0.15));
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 0 24px rgba(234,179,8,0.1);
}

.winner-trophy { font-size: 1.6rem; }

.winner-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.winner-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.3rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: auto;
}

.sides-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.side-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-a { border-top: 3px solid var(--yellow); }
.side-b { border-top: 3px solid var(--orange); }

.side-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  color: var(--text);
}

.side-section { display: flex; flex-direction: column; gap: 6px; }

.side-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.side-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-list li {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.4;
  padding-left: 14px;
  position: relative;
}

.side-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--yellow);
}

.upsell-card {
  background: linear-gradient(135deg, rgba(234,179,8,0.1), rgba(249,115,22,0.1));
  border: 1px solid rgba(234,179,8,0.3);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upsell-icon { font-size: 1.8rem; flex-shrink: 0; }

.upsell-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upsell-text strong {
  font-size: 0.9rem;
  color: var(--text);
}

.upsell-text span {
  font-size: 0.78rem;
  color: var(--muted2);
}

.upsell-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.credits-remaining-note {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted2);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =====================================================
   History Screen
   ===================================================== */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.history-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text);
}

.pro-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 32px;
  text-align: center;
}

.pro-gate-icon { font-size: 3rem; }

.pro-gate h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
}

.pro-gate p {
  color: var(--muted2);
  font-size: 0.9rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 10px;
}

.history-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.history-item:hover {
  background: var(--card-hover);
  border-color: rgba(234,179,8,0.2);
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.history-item-topic {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}

.history-item-mode {
  font-size: 1rem;
  flex-shrink: 0;
}

.history-item-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.history-item-winner {
  font-size: 0.78rem;
  color: var(--yellow);
  font-weight: 600;
}

.history-item-date {
  font-size: 0.75rem;
  color: var(--muted2);
  margin-left: auto;
}

.history-item-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.history-item-detail.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

.history-item-detail p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.history-loading {
  text-align: center;
  padding: 30px;
  color: var(--muted2);
  font-size: 0.9rem;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 32px;
  text-align: center;
  color: var(--muted2);
  font-size: 2rem;
}

.history-empty p {
  font-size: 0.9rem;
}

/* =====================================================
   Paywall Bottom Sheet
   ===================================================== */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
}

.paywall-overlay.visible { opacity: 1; }

.paywall-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 101;
  background: #1a1806;
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.1, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.paywall-sheet.visible { transform: translateY(0); }

.paywall-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.paywall-inner {
  padding: 16px 20px 40px;
}

.paywall-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.paywall-header h3 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--text);
}

.paywall-close {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Credit packs */
.pack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.pack-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.pack-card:hover { border-color: rgba(234,179,8,0.4); }

.pack-card.selected {
  border-color: var(--yellow);
  background: linear-gradient(135deg, rgba(234,179,8,0.1), rgba(249,115,22,0.1));
  box-shadow: var(--glow);
}

.pack-card.popular {
  border-color: var(--yellow);
}

.pack-popular-badge, .plan-popular-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--grad-btn);
  color: #000;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.pack-label {
  font-size: 0.72rem;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pack-credits {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  color: var(--text);
}

.pack-price {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pack-per {
  font-size: 0.68rem;
  color: var(--muted);
}

/* Plans */
.plan-perks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.perk-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 500;
}

.plan-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.plan-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-card.popular { border-color: var(--yellow); }

.plan-card.selected {
  border-color: var(--yellow);
  background: linear-gradient(135deg, rgba(234,179,8,0.1), rgba(249,115,22,0.1));
  box-shadow: var(--glow);
}

.plan-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.plan-price {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.plan-price span {
  font-size: 0.75rem;
  -webkit-text-fill-color: var(--muted2);
  color: var(--muted2);
}

.plan-note {
  font-size: 0.72rem;
  color: var(--muted);
}

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* =====================================================
   Media Queries
   ===================================================== */
@media (min-width: 600px) {
  .home-title { font-size: 2.2rem; }
  .auth-wrap { padding-top: 60px; }
  .sides-grid { gap: 14px; }
  .pack-grid, .plan-cards { gap: 14px; }
}

@media (max-width: 340px) {
  .mode-name { font-size: 0.75rem; }
  .mode-icon { font-size: 1.2rem; }
  .pack-credits { font-size: 0.85rem; }
  .plan-price { font-size: 1.2rem; }
}
