/* ============================================
   UI/UX REVERSE ENGINEER — DESIGN SYSTEM
   Dark Premium Glassmorphism Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==================== CSS TOKENS ==================== */
:root {
  /* Backgrounds — warm dark, not cold blue */
  --bg-deep:       #080810;
  --bg-base:       #0d0d15;
  --bg-surface:    #111119;
  --bg-elevated:   #18181f;
  --glass:         rgba(255, 255, 255, 0.035);
  --glass-border:  rgba(255, 255, 255, 0.07);
  --glass-hover:   rgba(255, 255, 255, 0.06);

  /* Primary — indigo, bukan neon violet */
  --indigo:        #6366f1;
  --indigo-light:  #818cf8;
  --indigo-dark:   #4f46e5;
  --indigo-glow:   rgba(99, 102, 241, 0.18);

  /* Accent — sky blue, bukan neon cyan */
  --sky:           #0ea5e9;
  --sky-light:     #38bdf8;
  --sky-glow:      rgba(14, 165, 233, 0.12);

  /* Semantic */
  --green:         #22c55e;
  --amber:         #f59e0b;
  --red:           #ef4444;
  --rose:          #f43f5e;

  /* Text */
  --text-primary:  #f4f4f6;
  --text-secondary:#9898a6;
  --text-muted:    #52525e;
  --text-accent:   #818cf8;

  /* Gradients — muted, bukan neon */
  --grad-primary:  linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
  --grad-subtle:   linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(14,165,233,0.06) 100%);
  --grad-mesh:     radial-gradient(ellipse at 15% 40%, rgba(99,102,241,0.07) 0%, transparent 55%),
                   radial-gradient(ellipse at 85% 20%, rgba(14,165,233,0.05) 0%, transparent 55%),
                   radial-gradient(ellipse at 50% 90%, rgba(99,102,241,0.04) 0%, transparent 50%);

  /* Spacing */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* Radius */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Shadows — subtler, no heavy neon glow */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 24px rgba(99,102,241,0.15), 0 0 48px rgba(99,102,241,0.06);
  --shadow-sky:  0 0 16px rgba(14,165,233,0.1);

  /* Transitions */
  --ease-out:  cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-in:   cubic-bezier(0.4, 0.0, 1, 1);
  --ease-both: cubic-bezier(0.4, 0.0, 0.2, 1);
  --t-fast: 150ms;
  --t-base: 250ms;
  --t-slow: 400ms;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ==================== ANIMATED BACKGROUND ==================== */
.bg-mesh {
  position: fixed;
  inset: 0;
  background: var(--bg-deep);
  z-index: -2;
}

.bg-mesh::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-mesh);
  animation: meshPulse 8s ease-in-out infinite alternate;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  animation: orbFloat 12s ease-in-out infinite;
}
.bg-orb-1 {
  width: 600px; height: 600px;
  background: rgba(99,102,241,0.045);
  top: -150px; left: -150px;
  animation-delay: 0s;
}
.bg-orb-2 {
  width: 400px; height: 400px;
  background: rgba(14,165,233,0.03);
  bottom: 100px; right: -100px;
  animation-delay: -4s;
}
.bg-orb-3 {
  width: 280px; height: 280px;
  background: rgba(99,102,241,0.025);
  top: 50%; left: 50%;
  animation-delay: -8s;
}

@keyframes meshPulse {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.05); }
  66%  { transform: translate(-20px, 30px) scale(0.95); }
}

/* ==================== LAYOUT ==================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==================== HEADER / NAV ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--sp-4) 0;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(8, 8, 16, 0.85);
  border-bottom: 1px solid var(--glass-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
  transition: transform var(--t-base) var(--ease-both), box-shadow var(--t-base) var(--ease-both);
}
.logo:hover .logo-icon {
  transform: rotate(-8deg) scale(1.1);
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo-text span { 
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 0 4px var(--sky);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.85); }
}

/* ==================== HERO ==================== */
.hero {
  padding: var(--sp-20) 0 var(--sp-12);
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--sp-6);
  animation: fadeInDown 0.6s var(--ease-out) both;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: var(--sp-5);
  animation: fadeInDown 0.6s var(--ease-out) 0.1s both;
}
.hero-title .gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--sp-8);
  line-height: 1.7;
  font-weight: 400;
  animation: fadeInDown 0.6s var(--ease-out) 0.2s both;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== INPUT SECTION ==================== */
.input-section {
  padding-bottom: var(--sp-8);
}

.input-card {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg);
  transition: border-color var(--t-base) var(--ease-both);
  animation: fadeInDown 0.6s var(--ease-out) 0.3s both;
}
.input-card:focus-within {
  border-color: rgba(99,102,241,0.3);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(99,102,241,0.08);
}

.input-row {
  display: flex;
  gap: var(--sp-3);
  align-items: stretch;
}

.url-input-wrapper {
  flex: 1;
  position: relative;
}

.url-input-icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
  transition: color var(--t-base);
  z-index: 1;
}

.url-input {
  width: 100%;
  height: 56px;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 0 var(--sp-4) 0 calc(var(--sp-4) + 26px);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: all var(--t-base) var(--ease-both);
}
.url-input::placeholder { color: var(--text-muted); }
.url-input:focus {
  border-color: var(--indigo);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.url-input:focus + .url-input-icon,
.url-input-wrapper:focus-within .url-input-icon {
  color: var(--indigo-light);
}

.model-select {
  height: 56px;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 0 var(--sp-4);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  transition: all var(--t-base) var(--ease-both);
  min-width: 160px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.model-select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.model-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.analyze-btn {
  height: 56px;
  padding: 0 var(--sp-8);
  background: var(--grad-primary);
  border: none;
  border-radius: var(--r-lg);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  transition: all var(--t-base) var(--ease-both);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}
.analyze-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.08), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s var(--ease-both);
}
.analyze-btn:hover::before { transform: translateX(100%); }
.analyze-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}
.analyze-btn:active { transform: translateY(0); }
.analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.analyze-btn:disabled::before { display: none; }

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-spinner.active { display: block; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== MAIN LAYOUT ==================== */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-6);
  padding-bottom: var(--sp-12);
  align-items: start;
}

/* ==================== WORKSPACE ==================== */
.workspace-card {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.workspace-header {
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.02);
}

.workspace-tabs {
  display: flex;
  gap: var(--sp-1);
  background: var(--bg-surface);
  border-radius: var(--r-md);
  padding: 3px;
}

.workspace-tab {
  padding: var(--sp-2) var(--sp-4);
  border-radius: calc(var(--r-md) - 2px);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-both);
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
}
.workspace-tab:hover { color: var(--text-secondary); }
.workspace-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.stats-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.stats-badge span { color: var(--sky-light); }

/* ==================== WORKSPACE BODY ==================== */
.workspace-body {
  position: relative;
  min-height: 500px;
}

.workspace-panel {
  display: none;
  height: 100%;
}
.workspace-panel.active { display: block; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-20) var(--sp-8);
  text-align: center;
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--r-xl);
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: var(--sp-6);
  animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--sp-2);
  color: var(--text-primary);
}
.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

/* ==================== RENDERED OUTPUT ==================== */
.rendered-output {
  padding: var(--sp-8);
  font-size: 14px;
  line-height: 1.8;
}

.rendered-output h1 {
  font-size: 1.6em;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--glass-border);
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.rendered-output h2 {
  font-size: 1.15em;
  font-weight: 700;
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.rendered-output h3 {
  font-size: 1em;
  font-weight: 600;
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-2);
  color: var(--indigo-light);
}
.rendered-output p {
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}
.rendered-output ul, .rendered-output ol {
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-3);
}
.rendered-output li {
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
}
.rendered-output li strong { color: var(--text-primary); }
.rendered-output strong { color: var(--text-primary); font-weight: 600; }
.rendered-output code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--sky-light);
  border: 1px solid var(--glass-border);
}
.rendered-output pre {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  overflow-x: auto;
  margin: var(--sp-4) 0;
}
.rendered-output pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.7;
}
.rendered-output table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-4) 0;
  font-size: 13px;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.rendered-output th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
.rendered-output td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.rendered-output tr:last-child td { border-bottom: none; }
.rendered-output tr:hover td { background: rgba(255,255,255,0.02); }
.rendered-output hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: var(--sp-8) 0;
}

/* ==================== RAW OUTPUT ==================== */
.raw-output {
  padding: var(--sp-6);
}

.raw-textarea {
  width: 100%;
  min-height: 600px;
  background: var(--bg-deep);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
  resize: vertical;
  outline: none;
  transition: border-color var(--t-base);
}
.raw-textarea:focus { border-color: rgba(99,102,241,0.3); }

/* ==================== THINKING PANEL ==================== */
.thinking-panel {
  margin: var(--sp-4) var(--sp-6);
  background: rgba(99,102,241,0.04);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: none;
}
.thinking-panel.visible { display: block; }
.thinking-header {
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.thinking-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo-light);
  font-family: 'JetBrains Mono', monospace;
}
.thinking-toggle {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform var(--t-fast);
}
.thinking-panel.open .thinking-toggle { transform: rotate(180deg); }
.thinking-body {
  display: none;
  padding: var(--sp-4);
  border-top: 1px solid rgba(99,102,241,0.15);
}
.thinking-panel.open .thinking-body { display: block; }
.thinking-body p {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ==================== WORKSPACE FOOTER ==================== */
.workspace-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.01);
}

.action-group {
  display: flex;
  gap: var(--sp-3);
}

.btn-action {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-both);
}
.btn-action:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}
.btn-action:active { transform: translateY(0); }
.btn-action.copied {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.3);
  color: var(--green);
}
.btn-action svg { width: 14px; height: 14px; }

/* Download Dropdown */
.download-wrapper {
  position: relative;
}
.download-dropdown {
  position: absolute;
  bottom: calc(100% + var(--sp-2));
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition: all var(--t-base) var(--ease-out);
  z-index: 50;
}
.download-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.download-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: none;
  width: 100%;
  font-family: 'Inter', sans-serif;
  text-align: left;
}
.download-item:hover {
  background: var(--glass);
  color: var(--text-primary);
}
.download-item .item-ext {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-weight: 700;
}
.ext-md { background: rgba(124,58,237,0.2); color: var(--violet-light); }
.ext-txt { background: rgba(6,182,212,0.15); color: var(--cyan-light); }

.token-info {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}
.token-chip {
  padding: 2px 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.token-chip .val { color: var(--cyan-light); font-weight: 600; }

/* ==================== SIDEBAR ==================== */
.sidebar { display: flex; flex-direction: column; gap: var(--sp-4); }

.sidebar-card {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.sidebar-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sidebar-title .icon { font-size: 16px; }
.sidebar-action {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
  transition: color var(--t-fast);
  padding: 0;
}
.sidebar-action:hover { color: var(--red); }

/* ==================== HISTORY LIST ==================== */
.history-list { padding: var(--sp-2) 0; }

.history-empty {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
}
.history-empty p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--glass-hover); }

.history-favicon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.history-favicon img { width: 100%; height: 100%; object-fit: cover; }

.history-info { flex: 1; min-width: 0; }
.history-url {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: 2px;
}
.history-meta .model-tag {
  font-family: 'JetBrains Mono', monospace;
  color: var(--violet-light);
}

.history-del {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--t-fast);
  font-size: 14px;
  flex-shrink: 0;
}
.history-item:hover .history-del { opacity: 1; }
.history-del:hover { background: rgba(239,68,68,0.15); color: var(--red); }

/* ==================== TIPS CARD ==================== */
.tips-list { padding: var(--sp-4) var(--sp-5); }
.tip-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.tip-item:last-child { border-bottom: none; }
.tip-icon { font-size: 16px; flex-shrink: 0; line-height: 1.5; }
.tip-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.tip-text strong { color: var(--text-secondary); }

/* ==================== STATUS BAR ==================== */
.status-bar {
  padding: var(--sp-2) var(--sp-6);
  background: rgba(255,255,255,0.01);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  display: none;
}
.status-bar.visible { display: flex; }
.status-bar.loading { border-top-color: rgba(124,58,237,0.3); }
.status-bar.error { border-top-color: rgba(239,68,68,0.3); color: var(--red); }
.status-bar.success { border-top-color: rgba(16,185,129,0.3); color: var(--green); }

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-bar.loading .status-dot {
  background: var(--violet);
  animation: pulse 1s ease-in-out infinite;
}

/* Loading shimmer */
.shimmer-lines {
  padding: var(--sp-8);
  display: none;
}
.shimmer-lines.visible { display: block; }
.shimmer-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-3);
  animation: shimmer 1.5s infinite;
}
.shimmer-line.w-60 { width: 60%; }
.shimmer-line.w-80 { width: 80%; }
.shimmer-line.w-40 { width: 40%; }
.shimmer-line.w-90 { width: 90%; }
@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transform: translateX(120%);
  transition: transform var(--t-base) var(--ease-out);
  pointer-events: all;
  max-width: 320px;
}
.toast.show { transform: translateX(0); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }
.toast.info { border-color: rgba(99,102,241,0.3); }

/* ==================== NEW ANALYSIS BUTTON (header) ==================== */
.btn-new-analysis {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-both);
  white-space: nowrap;
}
.btn-new-analysis:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}
.btn-new-analysis svg { flex-shrink: 0; }

/* ==================== LIMIT BADGE ==================== */
.limit-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--r-full);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  transition: all var(--t-base);
  min-height: 28px;
}
.limit-badge.limit-exceeded {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--red);
}
.limit-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--indigo-light);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}
.limit-dot.limit-empty {
  background: var(--red);
  animation: none;
}
.limit-text { color: inherit; }

/* ==================== INPUT CARD ROW WRAP ==================== */
.input-card .input-row {
  margin-bottom: var(--sp-3);
}
.input-card .limit-badge {
  margin-top: 0;
  align-self: flex-start;
}

/* ==================== STREAMING CURSOR ==================== */
.stream-cursor {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}
.stream-cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--indigo-light);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
  border-radius: 1px;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ==================== FOOTER ==================== */
.site-footer {
  margin-top: auto;
  padding: var(--sp-6) 0;
  border-top: 1px solid var(--glass-border);
  text-align: center;
}
.footer-text {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.footer-text a {
  color: var(--violet-light);
  text-decoration: none;
}
.footer-text a:hover { text-decoration: underline; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--glass-border); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
  }
}

@media (max-width: 768px) {
  .input-row { flex-direction: column; }
  .model-select { min-width: unset; }
  .analyze-btn { width: 100%; justify-content: center; }
  .workspace-footer { flex-direction: column; gap: var(--sp-3); align-items: stretch; }
  .action-group { justify-content: center; }
  .hero-title { font-size: 2rem; }
  .sidebar { grid-template-columns: 1fr; }
  .header-badge { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 var(--sp-4); }
  .input-card { padding: var(--sp-5); }
  .hero { padding: var(--sp-12) 0 var(--sp-8); }
}
