    /* ═══════════════════════════════════════════════════════════════════════
       THEME PALETTES - 4 ACTUALLY DIFFERENT THEMES
       ═══════════════════════════════════════════════════════════════════════ */
    
    /* Theme 1: Midnight Gold (Rich Dark - Purple-Black) */
    :root, [data-theme="midnight-gold"] {
      --bg-primary: #08070a;
      --bg-secondary: #13111a;
      --bg-tertiary: #1e1a28;
      --bg-hover: #28233a;
      --border: #2d2640;
      --border-subtle: #231e32;
      --text-primary: #fffef5;
      --text-secondary: #b8b0c4;
      --text-muted: #6e6680;
      --accent: #f0c655;
      --accent-glow: rgba(240, 198, 85, 0.2);
      --accent-dim: #c9a227;
      --accent-secondary: #e8d5a3;
      --success: #7dd3a0;
      --error: #e87d7d;
      --gradient-start: #f0c655;
      --gradient-end: #c9a227;
      --score-excellent: #f0c655;
      --score-good: #7dd3a0;
      --score-medium: #f0c655;
      --score-low: #e87d7d;
      --shadow: rgba(0, 0, 0, 0.4);
      --input-bg: var(--bg-secondary);
      --modal-bg: #13111a;
      --btn-text: #1a1a1a;
    }
    
    /* Theme 2: Arctic Steel (Cold High-Tech - Blue-Black) */
    [data-theme="arctic-steel"] {
      --bg-primary: #0a0e14;
      --bg-secondary: #0f1820;
      --bg-tertiary: #162230;
      --bg-hover: #1e3040;
      --border: #1e3a50;
      --border-subtle: #152535;
      --text-primary: #e8f4f8;
      --text-secondary: #8aa8b8;
      --text-muted: #506878;
      --accent: #d4a012;
      --accent-glow: rgba(212, 160, 18, 0.2);
      --accent-dim: #b8860b;
      --accent-secondary: #00d4ff;
      --success: #00cc88;
      --error: #ff5566;
      --gradient-start: #d4a012;
      --gradient-end: #b8860b;
      --score-excellent: #00d4ff;
      --score-good: #00cc88;
      --score-medium: #ffaa00;
      --score-low: #ff5566;
      --shadow: rgba(0, 20, 40, 0.5);
      --input-bg: var(--bg-secondary);
      --modal-bg: #0f1820;
      --btn-text: #1a1a1a;
    }
    
    /* Arctic Steel special glow effects */
    [data-theme="arctic-steel"] .panel {
      box-shadow: 0 0 30px rgba(0, 212, 255, 0.03);
    }
    
    [data-theme="arctic-steel"] .panel:hover {
      box-shadow: 0 0 40px rgba(0, 212, 255, 0.06);
    }
    
    /* Theme 3: Violet Noir (Bold AI - Purple-Black) */
    [data-theme="violet-noir"] {
      --bg-primary: #0c0812;
      --bg-secondary: #160f20;
      --bg-tertiary: #221830;
      --bg-hover: #2e2040;
      --border: #3d2860;
      --border-subtle: #2a1c45;
      --text-primary: #f8f5ff;
      --text-secondary: #a89cc4;
      --text-muted: #6e5a8c;
      --accent: #d4a012;
      --accent-glow: rgba(212, 160, 18, 0.2);
      --accent-dim: #b8860b;
      --accent-secondary: #b794f6;
      --success: #6ee7a0;
      --error: #f67878;
      --gradient-start: #d4a012;
      --gradient-end: #b8860b;
      --score-excellent: #b794f6;
      --score-good: #6ee7a0;
      --score-medium: #f6c354;
      --score-low: #f67878;
      --shadow: rgba(20, 0, 40, 0.5);
      --input-bg: var(--bg-secondary);
      --modal-bg: #160f20;
      --btn-text: #1a1a1a;
    }
    
    /* Violet Noir special glow effects */
    [data-theme="violet-noir"] .panel {
      box-shadow: 0 0 30px rgba(183, 148, 246, 0.04);
    }
    
    [data-theme="violet-noir"] .transform-btn {
      box-shadow: 0 4px 20px rgba(212, 160, 18, 0.3), 0 0 40px rgba(183, 148, 246, 0.1);
    }
    
    /* Theme 4: Paper & Ink (Light Professional) */
    [data-theme="paper-ink"] {
      --bg-primary: #f4f2ee;
      --bg-secondary: #ffffff;
      --bg-tertiary: #f9f8f6;
      --bg-hover: #f0eeea;
      --border: rgba(0, 0, 0, 0.08);
      --border-subtle: rgba(0, 0, 0, 0.05);
      --text-primary: #1d1d1f;
      --text-secondary: #6e6e73;
      --text-muted: #98989d;
      --accent: #b8920e;
      --accent-glow: rgba(184, 146, 14, 0.12);
      --accent-dim: #9a7a0c;
      --accent-secondary: #1a8a5c;
      --success: #1a8a5c;
      --error: #d13438;
      --gradient-start: #c9a227;
      --gradient-end: #a6860e;
      --score-excellent: #1a8a5c;
      --score-good: #1a8a5c;
      --score-medium: #b8920e;
      --score-low: #d13438;
      --shadow: rgba(0, 0, 0, 0.06);
      --input-bg: #ffffff;
      --modal-bg: rgba(255, 255, 255, 0.95);
      --btn-text: #ffffff;
    }
    
    /* Paper & Ink - Light mode overrides */
    [data-theme="paper-ink"] body::before {
      opacity: 0.015;
    }
    
    [data-theme="paper-ink"] .panel {
      background: rgba(255, 255, 255, 0.85);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.04);
      border: 1px solid rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .panel:hover {
      box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 12px 40px rgba(0,0,0,0.06);
    }
    
    [data-theme="paper-ink"] .header h1 {
      color: #1d1d1f;
      -webkit-text-fill-color: #1d1d1f;
    }
    
    [data-theme="paper-ink"] .subtitle {
      color: #6e6e73;
    }
    
    [data-theme="paper-ink"] .model-badge {
      background: rgba(255, 255, 255, 0.8);
      backdrop-filter: blur(10px);
      border-color: rgba(0, 0, 0, 0.08);
      color: #6e6e73;
    }
    
    [data-theme="paper-ink"] textarea {
      background: #ffffff;
      color: #1d1d1f;
    }
    
    [data-theme="paper-ink"] textarea::placeholder {
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .output-area {
      background: #f9f8f6;
    }
    
    [data-theme="paper-ink"] .score-preview {
      background: #f9f8f6;
      border-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .output-score {
      background: linear-gradient(135deg, rgba(26, 138, 92, 0.06) 0%, rgba(26, 138, 92, 0.03) 100%);
      border-color: rgba(26, 138, 92, 0.15);
    }
    
    [data-theme="paper-ink"] .transform-btn {
      background: linear-gradient(135deg, #c9a227 0%, #a6860e 100%);
      color: #ffffff;
      box-shadow: 0 2px 8px rgba(184, 146, 14, 0.25), 0 0 0 1px rgba(184, 146, 14, 0.1);
    }
    
    [data-theme="paper-ink"] .transform-btn:hover {
      box-shadow: 0 4px 16px rgba(184, 146, 14, 0.35), 0 0 0 1px rgba(184, 146, 14, 0.15);
    }
    
    [data-theme="paper-ink"] .transform-btn-text {
      color: #ffffff;
    }
    
    [data-theme="paper-ink"] .do-better-btn {
      border-color: rgba(0, 0, 0, 0.12);
    }
    
    [data-theme="paper-ink"] .do-better-btn .do-better-text,
    [data-theme="paper-ink"] .do-better-btn .do-better-subtext {
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .do-better-btn.active {
      background: linear-gradient(135deg, #1a8a5c 0%, #148a50 100%);
      border: none;
      box-shadow: 0 2px 8px rgba(26, 138, 92, 0.3);
    }
    
    [data-theme="paper-ink"] .do-better-btn.active .do-better-text,
    [data-theme="paper-ink"] .do-better-btn.active .do-better-subtext {
      color: #ffffff;
    }
    
    [data-theme="paper-ink"] .copy-btn {
      background: #1d1d1f;
      border-color: #1d1d1f;
      color: #ffffff;
      border-radius: 6px;
    }
    
    [data-theme="paper-ink"] .copy-btn:hover {
      background: #333336;
    }
    
    [data-theme="paper-ink"] .controls {
      background: transparent;
      border-color: transparent;
    }
    
    [data-theme="paper-ink"] select,
    [data-theme="paper-ink"] input {
      background: #ffffff;
      border: 1px solid rgba(0, 0, 0, 0.12);
      color: #1d1d1f;
      border-radius: 8px;
      box-shadow: 0 1px 2px rgba(0,0,0,0.04);
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }
    
    [data-theme="paper-ink"] select:hover,
    [data-theme="paper-ink"] select:focus,
    [data-theme="paper-ink"] input:focus {
      border-color: rgba(184, 146, 14, 0.5);
      box-shadow: 0 0 0 3px rgba(184, 146, 14, 0.1), 0 1px 2px rgba(0,0,0,0.04);
    }
    
    [data-theme="paper-ink"] .metadata {
      background: rgba(255, 255, 255, 0.7);
      backdrop-filter: blur(10px);
      border-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .thread-section {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .thread-message.user {
      background: linear-gradient(135deg, rgba(26, 138, 92, 0.06) 0%, rgba(26, 138, 92, 0.03) 100%);
      color: #1d1d1f;
      border-left-color: #1a8a5c;
    }
    
    [data-theme="paper-ink"] .thread-message.recipient {
      background: #f9f8f6;
      color: #1d1d1f;
      border-left-color: #c9a227;
    }
    
    [data-theme="paper-ink"] .decode-result {
      background: linear-gradient(135deg, #f4f2ee 0%, #f0eeea 100%);
    }
    
    [data-theme="paper-ink"] .decode-title {
      color: #1a8a5c;
    }
    
    [data-theme="paper-ink"] .decode-label {
      color: #c9a227;
    }
    
    [data-theme="paper-ink"] .decode-content {
      color: #1d1d1f;
    }
    
    [data-theme="paper-ink"] .questions-modal {
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(20px);
      border-color: rgba(0, 0, 0, 0.08);
      box-shadow: 0 24px 80px rgba(0,0,0,0.12);
    }
    
    [data-theme="paper-ink"] .footer {
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .footer a {
      color: #1a8a5c;
    }
    
    /* Theme Switcher */
    .theme-switcher {
      position: fixed;
      top: calc(56px + 1rem);
      right: 1rem;
      z-index: 100;
      display: flex;
      gap: 0.5rem;
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 0.5rem;
      box-shadow: 0 4px 20px var(--shadow);
    }
    
    .theme-btn {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      border: 2px solid transparent;
      cursor: pointer;
      transition: all 0.2s ease;
      position: relative;
    }
    
    .theme-btn:hover {
      transform: scale(1.1);
    }
    
    .theme-btn.active {
      border-color: var(--accent);
      box-shadow: 0 0 12px var(--accent-glow);
    }
    
    .theme-btn[data-theme="midnight-gold"] {
      background: linear-gradient(135deg, #08070a 0%, #13111a 50%, #f0c655 100%);
    }
    
    .theme-btn[data-theme="arctic-steel"] {
      background: linear-gradient(135deg, #0a0e14 0%, #162230 50%, #00d4ff 100%);
    }
    
    .theme-btn[data-theme="violet-noir"] {
      background: linear-gradient(135deg, #0c0812 0%, #221830 50%, #b794f6 100%);
    }
    
    .theme-btn[data-theme="paper-ink"] {
      background: linear-gradient(135deg, #f4f2ee 0%, #ffffff 50%, #c9a227 100%);
    }
    
    .theme-btn::after {
      content: attr(title);
      position: absolute;
      bottom: -32px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      font-size: 0.625rem;
      padding: 0.25rem 0.5rem;
      border-radius: 4px;
      white-space: nowrap;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
      border: 1px solid var(--border);
    }
    
    .theme-btn:hover::after {
      opacity: 1;
    }
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    html {
      font-size: 16px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }
    
    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--bg-primary);
      color: var(--text-primary);
      min-height: 100vh;
      line-height: 1.6;
      overflow-x: hidden;
    }
    
    /* Subtle grain texture */
    body::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
      opacity: 0.03;
      pointer-events: none;
      z-index: 0;
    }
    
    /* Container */
    .container {
      position: relative;
      z-index: 1;
      max-width: 1400px;
      margin: 0 auto;
      padding: 1.5rem 2rem;
    }
    
    /* Header */
    .header {
      text-align: center;
      margin-bottom: 1.5rem;
      animation: fadeInDown 0.8s ease-out;
    }
    
    .logo {
      display: inline-flex;
      align-items: center;
      gap: 0.75rem;
      margin-bottom: 1.5rem;
    }
    
    .logo-icon {
      width: 48px;
      height: 48px;
      background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: 'Instrument Serif', serif;
      font-size: 1.5rem;
      font-weight: 400;
      color: var(--bg-primary);
      box-shadow: 0 4px 24px var(--accent-glow);
    }
    
    .logo-text {
      font-family: 'Playfair Display', Georgia, serif !important;
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--text-primary);
    }
    
    h1 {
      font-family: 'Instrument Serif', serif;
      font-size: clamp(2.5rem, 5vw, 4rem);
      font-weight: 400;
      letter-spacing: -0.02em;
      margin-bottom: 1rem;
      background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    
    .subtitle {
      font-size: 1.125rem;
      color: var(--text-muted);
      max-width: 600px;
      margin: 0 auto;
    }
    
    .subtitle em {
      font-family: 'Instrument Serif', serif;
      font-style: italic;
      color: var(--accent);
    }
    
    .model-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      margin-top: 1rem;
      padding: 0.375rem 0.875rem;
      background: var(--bg-tertiary);
      border: 1px solid var(--border);
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--text-secondary);
    }
    
    .model-badge .pulse {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--success);
      animation: pulse-glow 2s ease-in-out infinite;
    }
    
    @keyframes pulse-glow {
      0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
      50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
    }
    
    /* Main grid */
    .main-grid {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      gap: 1rem;
      margin-bottom: 2rem;
      animation: fadeInUp 0.8s ease-out 0.2s both;
      align-items: stretch;
    }
    
    .transform-btn-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
    }
    
    @keyframes softGlow {
      0%, 100% {
        box-shadow: 0 4px 15px rgba(212, 160, 18, 0.2);
      }
      50% {
        box-shadow: 0 4px 25px rgba(212, 160, 18, 0.4), 0 0 40px rgba(212, 160, 18, 0.15);
      }
    }
    
    .transform-btn {
      background: linear-gradient(135deg, #d4a012 0%, #b8860b 100%);
      border: none;
      border-radius: 10px;
      padding: 1rem 0.75rem;
      cursor: pointer;
      transition: all 0.3s ease;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.125rem;
      animation: softGlow 3s ease-in-out infinite;
    }
    
    .transform-btn:hover {
      background: linear-gradient(135deg, #e4b022 0%, #c8960b 100%);
      transform: scale(1.05);
      animation: none;
      box-shadow: 0 6px 25px rgba(212, 160, 18, 0.5);
    }
    
    .transform-btn:active {
      transform: scale(0.98);
    }
    
    .transform-btn:disabled {
      background: linear-gradient(135deg, #555 0%, #444 100%);
      cursor: not-allowed;
      transform: none;
      animation: none;
      box-shadow: none;
    }
    
    .transform-btn-text {
      font-size: 0.75rem;
      font-weight: 700;
      color: #1a1a1a;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      line-height: 1.2;
    }
    
    /* Do Better Button */
    .do-better-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.125rem;
      background: transparent;
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 10px;
      padding: 0.75rem 0.625rem;
      cursor: not-allowed;
      transition: all 0.4s ease;
      opacity: 0.4;
    }
    
    .do-better-btn .do-better-text,
    .do-better-btn .do-better-subtext {
      color: rgba(255, 255, 255, 0.4);
      transition: color 0.4s ease;
    }
    
    /* Ghost glow animation when inactive */
    @keyframes ghostGlow {
      0%, 100% {
        border-color: rgba(255, 255, 255, 0.15);
      }
      50% {
        border-color: rgba(255, 255, 255, 0.3);
      }
    }
    
    .do-better-btn:not(.active) {
      animation: ghostGlow 3s ease-in-out infinite;
    }
    
    /* Active state - purple gradient */
    .do-better-btn.active {
      background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
      border: none;
      cursor: pointer;
      opacity: 1;
      box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
      animation: none;
    }
    
    .do-better-btn.active .do-better-text {
      color: #ffffff;
    }
    
    .do-better-btn.active .do-better-subtext {
      color: rgba(255, 255, 255, 0.7);
    }
    
    .do-better-btn.active:hover {
      background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
      transform: scale(1.05);
      box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    }
    
    .do-better-btn.active:active {
      transform: scale(0.98);
    }
    
    .do-better-btn:disabled {
      background: linear-gradient(135deg, #555 0%, #444 100%);
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
      opacity: 0.7;
    }
    
    .do-better-text {
      font-size: 0.6875rem;
      font-weight: 700;
      color: #ffffff;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      line-height: 1.2;
    }
    
    .do-better-subtext {
      font-size: 0.5625rem;
      font-weight: 500;
      color: rgba(255,255,255,0.7);
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }
    
    /* Do Better Questions Modal */
    .questions-modal-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(4px);
      z-index: 1000;
      align-items: center;
      justify-content: center;
      animation: fadeIn 0.2s ease;
    }
    
    .questions-modal-overlay.visible {
      display: flex;
    }
    
    .questions-modal {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 1.5rem;
      width: 90%;
      max-width: 480px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
      animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
      from {
        opacity: 0;
        transform: translateY(20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    
    .questions-modal-header {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 1.25rem;
    }
    
    .questions-modal-icon {
      font-size: 1.5rem;
    }
    
    .questions-modal-title {
      font-size: 1.125rem;
      font-weight: 600;
      color: var(--text-primary);
    }
    
    .question-item {
      margin-bottom: 1rem;
    }
    
    .question-item label {
      display: block;
      font-size: 0.875rem;
      color: var(--text-secondary);
      margin-bottom: 0.5rem;
      line-height: 1.4;
    }
    
    .question-input {
      width: 100%;
      padding: 0.75rem 1rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: 0.9375rem;
      font-family: inherit;
      transition: border-color 0.2s ease;
    }
    
    .question-input:focus {
      outline: none;
      border-color: var(--accent);
    }
    
    .questions-actions {
      display: flex;
      gap: 0.75rem;
      margin-top: 1.5rem;
    }
    
    .questions-skip-btn {
      flex: 1;
      padding: 0.75rem 1rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: transparent;
      color: var(--text-secondary);
      font-size: 0.875rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    
    .questions-skip-btn:hover {
      background: var(--bg-hover);
      color: var(--text-primary);
    }
    
    .questions-submit-btn {
      flex: 1;
      padding: 0.75rem 1rem;
      border: none;
      border-radius: 8px;
      background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
      color: white;
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    
    .questions-submit-btn:hover {
      background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    }
    
    @media (max-width: 900px) {
      .main-grid {
        grid-template-columns: 1fr;
      }
      
      .transform-btn-container {
        order: 1;
        flex-direction: row;
        justify-content: center;
      }
      
      .transform-btn {
        flex-direction: row;
        width: auto;
        flex: 1;
        padding: 0.875rem;
        gap: 0.5rem;
      }
      
      .do-better-btn {
        flex: 1;
      }
      
      #outputPanel {
        order: 2;
      }
    }
    
    /* Panels */
    .panel {
      background: var(--bg-secondary);
      border: 1px solid var(--border-subtle);
      border-radius: 16px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }
    
    .panel:hover {
      border-color: var(--border);
    }
    
    .panel.active {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px var(--accent), 0 8px 32px var(--accent-glow);
    }
    
    .panel-header {
      padding: 1.25rem 1.5rem;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--bg-tertiary);
    }
    
    .panel-title {
      font-size: 0.75rem;
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    
    .panel-title .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent);
    }
    
    .panel-badge {
      font-size: 0.6875rem;
      font-weight: 500;
      padding: 0.25rem 0.625rem;
      border-radius: 999px;
      background: var(--bg-hover);
      color: var(--text-muted);
      border: 1px solid var(--border);
    }
    
    .panel-body {
      flex: 1;
      padding: 0;
      position: relative;
    }
    
    /* Textareas */
    textarea {
      width: 100%;
      height: 320px;
      padding: 1.5rem;
      background: transparent;
      border: none;
      outline: none;
      resize: none;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.9375rem;
      line-height: 1.7;
      color: var(--text-primary);
    }
    
    textarea::placeholder {
      color: var(--text-muted);
    }
    
    .output-area {
      width: 100%;
      height: 320px;
      padding: 1.5rem;
      overflow-y: auto;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.9375rem;
      line-height: 1.7;
      color: var(--text-primary);
      white-space: pre-wrap;
    }
    
    .output-area.empty {
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      font-style: italic;
    }
    
    .output-area.loading {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 1rem;
    }
    
    /* Loading animation */
    .loader {
      display: flex;
      gap: 6px;
    }
    
    .loader span {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent);
      animation: pulse 1.4s ease-in-out infinite;
    }
    
    .loader span:nth-child(2) { animation-delay: 0.2s; }
    .loader span:nth-child(3) { animation-delay: 0.4s; }
    
    @keyframes pulse {
      0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
      }
      40% {
        transform: scale(1);
        opacity: 1;
      }
    }
    
    .loading-text {
      font-size: 0.875rem;
      color: var(--text-muted);
    }
    
    .pass-indicator {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.75rem;
      color: var(--accent);
      margin-top: 0.5rem;
    }
    
    /* Controls */
    .controls {
      animation: fadeInUp 0.8s ease-out 0.4s both;
    }
    
    .controls-row {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;
      align-items: flex-end;
      justify-content: space-between;
      margin-bottom: 1.5rem;
    }
    
    .control-group {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }
    
    .control-label {
      font-size: 0.6875rem;
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-muted);
    }
    
    select {
      appearance: none;
      background: var(--bg-tertiary);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.625rem 2.5rem 0.625rem 1rem;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.875rem;
      color: var(--text-primary);
      cursor: pointer;
      transition: border-color 0.2s ease;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 0.75rem center;
    }
    
    select:hover, select:focus {
      border-color: var(--accent);
      outline: none;
    }
    
    /* Generate button */
    .generate-btn {
      background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
      border: none;
      border-radius: 10px;
      padding: 0.75rem 2rem;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.9375rem;
      font-weight: 600;
      color: var(--bg-primary);
      cursor: pointer;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
      box-shadow: 0 4px 16px var(--accent-glow);
    }
    
    .generate-btn:hover:not(:disabled) {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px var(--accent-glow);
    }
    
    .generate-btn:active:not(:disabled) {
      transform: translateY(0);
    }
    
    .generate-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    
    /* Metadata display */
    .metadata {
      background: var(--bg-secondary);
      border: 1px solid var(--border-subtle);
      border-radius: 12px;
      padding: 1.25rem 1.5rem;
      margin-top: 1.5rem;
      display: none;
      animation: fadeInUp 0.4s ease-out;
    }
    
    .metadata.visible {
      display: block;
    }
    
    .metadata-title {
      font-size: 0.6875rem;
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 1rem;
    }
    
    .metadata-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 1.5rem 3rem;
    }
    
    .metadata-item {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
    }
    
    .metadata-label {
      font-size: 0.75rem;
      color: var(--text-muted);
    }
    
    .metadata-value {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.875rem;
      color: var(--accent);
    }
    
    .metadata-value.success {
      color: var(--success);
    }
    
    /* Footer */
    .footer {
      text-align: center;
      margin-top: 4rem;
      padding-top: 2rem;
      border-top: 1px solid var(--border-subtle);
      animation: fadeInUp 0.8s ease-out 0.6s both;
    }
    
    .footer p {
      font-size: 0.8125rem;
      color: var(--text-muted);
    }
    
    .footer a {
      color: var(--accent);
      text-decoration: none;
      transition: color 0.2s ease;
    }
    
    .footer a:hover {
      color: var(--gradient-end);
    }
    
    /* Animations */
    @keyframes fadeInDown {
      from {
        opacity: 0;
        transform: translateY(-20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    
    @keyframes fadeInUp {
      from {
        opacity: 0;
        transform: translateY(20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    
    /* Scrollbar */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    
    ::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
      background: var(--text-muted);
    }
    
    /* Error state */
    .error-message {
      color: var(--error);
      font-size: 0.875rem;
      padding: 1rem;
      text-align: center;
    }
    
    /* Copy button */
    .copy-btn {
      position: absolute;
      top: 0.75rem;
      right: 0.75rem;
      background: var(--accent-secondary);
      border: 1px solid var(--accent-secondary);
      border-radius: 6px;
      padding: 0.5rem 1rem;
      font-size: 0.75rem;
      font-weight: 600;
      color: #ffffff;
      cursor: pointer;
      transition: all 0.2s ease;
      opacity: 1;
    }
    
    .panel-body:hover .copy-btn {
      opacity: 1;
    }
    
    .copy-btn:hover {
      filter: brightness(1.2);
      color: #ffffff;
    }
    
    .copy-btn.copied {
      background: var(--success);
      color: var(--bg-primary);
      border-color: var(--success);
    }
    
    /* Score Preview */
    .score-preview {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.75rem 1rem;
      margin-top: 0.75rem;
      background: var(--bg-tertiary);
      border-radius: 8px;
      border: 1px solid var(--border);
    }
    
    .score-number {
      font-size: 1.5rem;
      font-weight: 700;
      min-width: 3rem;
      text-align: center;
      color: var(--text-muted);
    }
    
    .score-number.score-low { color: var(--score-low); }
    .score-number.score-medium { color: var(--score-medium); }
    .score-number.score-good { color: var(--score-good); }
    .score-number.score-excellent { color: var(--score-excellent); }
    
    .score-feedback {
      font-size: 0.8125rem;
      color: var(--text-secondary);
      line-height: 1.4;
    }
    
    /* Output Score */
    .output-score {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      padding: 0.75rem 1rem;
      margin-top: 0.75rem;
      background: linear-gradient(135deg, rgba(13, 148, 136, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
      border-radius: 8px;
      border: 1px solid rgba(13, 148, 136, 0.3);
    }
    
    .output-score.visible {
      display: flex;
    }
    
    .output-score-number {
      font-size: 1.75rem;
      font-weight: 700;
      color: #0d9488;
    }
    
    .output-score-number.score-low { color: var(--score-low); }
    .output-score-number.score-medium { color: var(--score-medium); }
    .output-score-number.score-good { color: var(--score-good); }
    .output-score-number.score-excellent { color: var(--score-excellent); }
    
    .output-score-label {
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-muted);
    }
    
    /* ═══════════════════════════════════════════════════════════════════════
       TAB NAVIGATION
       ═══════════════════════════════════════════════════════════════════════ */
    .tab-nav {
      display: flex;
      justify-content: center;
      gap: 0.5rem;
      margin-bottom: 2rem;
    }
    
    .tab-btn {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.75rem 1.5rem;
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text-secondary);
      font-size: 0.875rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    
    .tab-btn:hover {
      background: var(--bg-tertiary);
      color: var(--text-primary);
    }
    
    .tab-btn.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #1a1a1a;
      font-weight: 600;
    }
    
    .tab-btn .tab-icon {
      font-size: 1rem;
    }
    
    .tab-btn .tab-badge {
      background: rgba(0,0,0,0.2);
      padding: 0.125rem 0.5rem;
      border-radius: 10px;
      font-size: 0.6875rem;
      font-weight: 600;
    }
    
    .tab-btn.active .tab-badge {
      background: rgba(0,0,0,0.3);
    }
    
    /* Tab Content */
    .tab-content {
      display: none;
    }
    
    .tab-content.active {
      display: block;
      animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    
    /* ═══════════════════════════════════════════════════════════════════════
       CONVERSATION TAB - Two Column Layout
       ═══════════════════════════════════════════════════════════════════════ */
    .conversation-two-col {
      display: grid;
      grid-template-columns: 1fr 400px;
      gap: 1.5rem;
      min-height: 550px;
    }
    
    @media (max-width: 1000px) {
      .conversation-two-col {
        grid-template-columns: 1fr;
      }
    }
    
    /* Left Column */
    .conversation-left {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }
    
    /* Input Panel at Top */
    .thread-input-panel {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
    }
    
    .thread-input-header {
      padding: 0.75rem 1rem;
      background: var(--bg-tertiary);
      border-bottom: 1px solid var(--border);
      font-size: 0.8125rem;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    
    .thread-input-body {
      padding: 1rem;
      display: flex;
      gap: 0.75rem;
      align-items: flex-end;
    }
    
    .thread-input-textarea {
      flex: 1;
      padding: 0.75rem 1rem;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: 0.9375rem;
      font-family: inherit;
      resize: none;
      min-height: 44px;
      max-height: 100px;
    }
    
    .thread-input-textarea:focus {
      outline: none;
      border-color: var(--accent-secondary);
    }
    
    .thread-input-textarea::placeholder {
      color: var(--text-muted);
    }
    
    .thread-decode-btn {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.75rem 1.25rem;
      background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
      border: none;
      border-radius: 10px;
      color: white;
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
    }
    
    .thread-decode-btn:hover {
      filter: brightness(1.1);
      transform: translateY(-1px);
    }
    
    .thread-decode-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
    }
    
    /* Thread History Panel */
    .thread-history-panel {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 300px;
    }
    
    .thread-history-header {
      padding: 0.75rem 1rem;
      background: var(--bg-tertiary);
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .thread-history-title {
      font-size: 0.8125rem;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    
    .thread-header-actions {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    
    .thread-context-badge {
      font-size: 0.6875rem;
      color: var(--text-muted);
      background: var(--bg-primary);
      padding: 0.25rem 0.5rem;
      border-radius: 10px;
      border: 1px solid var(--border-subtle);
    }
    
    .thread-clear-btn {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-muted);
      padding: 0.25rem 0.5rem;
      border-radius: 6px;
      font-size: 0.6875rem;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    
    .thread-clear-btn:hover {
      background: var(--bg-hover);
      color: var(--text-primary);
    }
    
    .thread-messages {
      flex: 1;
      overflow-y: auto;
      padding: 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    
    .thread-empty-state {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      text-align: center;
      padding: 2rem;
    }
    
    .thread-empty-icon {
      font-size: 2rem;
      margin-bottom: 0.5rem;
      opacity: 0.5;
    }
    
    .thread-empty-text {
      font-size: 0.875rem;
      margin-bottom: 0.25rem;
    }
    
    .thread-empty-hint {
      font-size: 0.75rem;
    }
    
    /* Right Column - Decode Panel */
    .conversation-right {
      position: sticky;
      top: 1rem;
      height: fit-content;
    }
    
    .decode-sticky-panel {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
    }
    
    .decode-sticky-header {
      padding: 0.75rem 1rem;
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(79, 70, 229, 0.1) 100%);
      border-bottom: 1px solid rgba(99, 102, 241, 0.2);
      font-size: 0.875rem;
      font-weight: 600;
      color: #a78bfa;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    
    .decode-sticky-body {
      padding: 1rem;
      min-height: 200px;
    }
    
    .decode-empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      text-align: center;
      padding: 2rem;
      min-height: 150px;
    }
    
    .decode-empty-icon {
      font-size: 2rem;
      margin-bottom: 0.5rem;
      opacity: 0.5;
    }
    
    .decode-empty-text {
      font-size: 0.875rem;
      margin-bottom: 0.25rem;
    }
    
    .decode-empty-hint {
      font-size: 0.75rem;
    }
    
    /* Decode Content */
    .decode-section {
      margin-bottom: 1rem;
    }
    
    .decode-section:last-child {
      margin-bottom: 0;
    }
    
    .decode-section-label {
      font-size: 0.625rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--accent-secondary);
      margin-bottom: 0.375rem;
    }
    
    .decode-section-content {
      font-size: 0.8125rem;
      color: var(--text-primary);
      line-height: 1.5;
    }
    
    .decode-approach-box {
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
      border: 1px solid rgba(99, 102, 241, 0.2);
      border-radius: 8px;
      padding: 0.75rem;
      margin-top: 1rem;
    }
    
    .decode-approach-box .decode-section-label {
      color: #a78bfa;
    }
    
    /* Thread Messages */
    .thread-message {
      padding: 0.75rem 1rem;
      border-radius: 10px;
      border-left: 3px solid;
    }
    
    .thread-message.user {
      background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
      border-left-color: var(--accent-secondary);
    }
    
    .thread-message.recipient {
      background: var(--bg-tertiary);
      border-left-color: var(--accent);
    }
    
    .thread-message-label {
      font-size: 0.625rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.375rem;
    }
    
    .thread-message.user .thread-message-label {
      color: var(--accent-secondary);
    }
    
    .thread-message.recipient .thread-message-label {
      color: var(--accent);
    }
    
    .thread-message-content {
      font-size: 0.8125rem;
      line-height: 1.5;
      color: var(--text-primary);
      white-space: pre-wrap;
    }
    
    .thread-expand {
      margin-top: 0.5rem;
      font-size: 0.75rem;
      color: var(--accent-secondary);
      cursor: pointer;
    }
    
    .thread-expand:hover {
      text-decoration: underline;
    }

    /* Thread Section - HIDE OLD (replaced by tab) */
    .thread-section {
      display: none !important;
    }
    
    /* Thread Messages in Conversation Tab */
    .thread-message {
      padding: 1rem 1.25rem;
      border-radius: 12px;
      border-left: 4px solid;
    }
    
    .thread-message.user {
      background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
      border-left-color: var(--accent-secondary);
    }
    
    .thread-message.recipient {
      background: var(--bg-tertiary);
      border-left-color: var(--accent);
    }
    
    .thread-message-label {
      font-size: 0.6875rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.5rem;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .thread-message.user .thread-message-label {
      color: var(--accent-secondary);
    }
    
    .thread-message.recipient .thread-message-label {
      color: var(--accent);
    }
    
    .thread-message-content {
      font-size: 0.9375rem;
      line-height: 1.6;
      color: var(--text-primary);
      white-space: pre-wrap;
    }
    
    .thread-expand {
      margin-top: 0.75rem;
      font-size: 0.8125rem;
      color: var(--accent-secondary);
      cursor: pointer;
    }
    
    .thread-expand:hover {
      text-decoration: underline;
    }
    
    .thread-section.visible {
      display: block;
      animation: fadeInUp 0.5s ease-out;
    }
    
    .thread-section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 1rem 1.5rem;
      background: var(--bg-tertiary);
      border-bottom: 1px solid var(--border);
    }
    
    .thread-section-title {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 1rem;
      font-weight: 600;
      color: var(--text-primary);
    }
    
    .thread-icon {
      font-size: 1.25rem;
    }
    
    .thread-count {
      font-weight: 400;
      color: var(--text-muted);
      font-size: 0.875rem;
    }
    
    .thread-content {
      padding: 1.5rem;
    }
    
    .thread-history {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      margin-bottom: 1.5rem;
      max-height: 400px;
      overflow-y: auto;
    }
    
    .thread-reply-section {
      background: var(--bg-tertiary);
      border-radius: 12px;
      padding: 1.25rem;
      border: 1px solid var(--border);
    }
    
    .thread-message {
      padding: 1rem;
      margin-bottom: 0.75rem;
      border-radius: 8px;
      font-size: 0.8125rem;
      line-height: 1.6;
      white-space: pre-wrap;
      word-wrap: break-word;
      max-height: 200px;
      overflow-y: auto;
    }
    
    .thread-message.user {
      background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
      color: #e2e8f0;
      margin-left: 1rem;
      border-left: 3px solid #0d9488;
    }
    
    .thread-message.recipient {
      background: var(--bg-tertiary);
      color: var(--text-primary);
      margin-right: 1rem;
      border-left: 3px solid #6366f1;
    }
    
    .thread-message-label {
      font-size: 0.6875rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.5rem;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .thread-message.user .thread-message-label {
      color: #0d9488;
    }
    
    .thread-message.recipient .thread-message-label {
      color: #818cf8;
    }
    
    .thread-message-content {
      font-size: 0.8125rem;
      line-height: 1.7;
      white-space: pre-wrap;
    }
    
    .thread-expand {
      margin-top: 0.5rem;
      font-size: 0.75rem;
      color: #0d9488;
      cursor: pointer;
      font-weight: 500;
    }
    
    .thread-expand:hover {
      text-decoration: underline;
    }
    
    .thread-add-label {
      font-size: 0.8125rem;
      color: var(--text-secondary);
      margin-bottom: 0.5rem;
    }
    
    .their-reply-input {
      width: 100%;
      min-height: 80px;
      padding: 0.75rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: 0.875rem;
      font-family: inherit;
      resize: vertical;
      margin-bottom: 0.75rem;
    }
    
    .their-reply-input:focus {
      outline: none;
      border-color: var(--accent);
    }
    
    .decode-btn {
      background: #6366f1;
      color: white;
      border: none;
      border-radius: 8px;
      padding: 0.625rem 1rem;
      font-size: 0.8125rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    
    .decode-btn:hover {
      background: #4f46e5;
    }
    
    .decode-btn:disabled {
      background: var(--bg-hover);
      color: var(--text-muted);
      cursor: not-allowed;
    }
    
    .decode-result {
      margin-top: 1rem;
      padding: 1rem;
      background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
      border-radius: 8px;
      display: none;
    }
    
    .decode-result.visible {
      display: block;
    }
    
    .decode-title {
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: #a5b4fc;
      margin-bottom: 0.75rem;
    }
    
    .decode-section {
      margin-bottom: 0.75rem;
    }
    
    .decode-section:last-child {
      margin-bottom: 0;
    }
    
    .decode-label {
      font-size: 0.6875rem;
      font-weight: 600;
      color: #818cf8;
      margin-bottom: 0.25rem;
    }
    
    .decode-content {
      font-size: 0.8125rem;
      color: #e0e7ff;
      line-height: 1.5;
    }
    
    .thread-empty {
      text-align: center;
      color: var(--text-muted);
      font-size: 0.8125rem;
      padding: 1rem;
      font-style: italic;
    }
    
    .thread-clear-btn {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-muted);
      padding: 0.375rem 0.75rem;
      border-radius: 6px;
      font-size: 0.75rem;
      cursor: pointer;
      margin-left: 0.5rem;
    }
    
    .thread-clear-btn:hover {
      background: var(--bg-hover);
      color: var(--text-primary);
    }
    /* ═══════════════════════════════════════════════════════════════════════
       v5.6 ADDITIONS - Progress Stepper, History, Usage, Mobile, Editable
       ═══════════════════════════════════════════════════════════════════════ */
    
    /* Progress Stepper */
    .progress-stepper {
      display: none;
      padding: 1rem 1.5rem;
      border-top: 1px solid var(--border-subtle);
      background: var(--bg-tertiary);
    }
    
    .progress-stepper.visible {
      display: flex;
      align-items: center;
      gap: 0.25rem;
      flex-wrap: wrap;
    }
    
    .step-item {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      padding: 0.25rem 0.625rem;
      border-radius: 6px;
      font-size: 0.6875rem;
      font-weight: 600;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      transition: all 0.3s ease;
      background: var(--bg-hover);
      color: var(--text-muted);
    }
    
    .step-item.active {
      background: var(--accent-glow);
      color: var(--accent);
      animation: stepPulse 1.5s ease-in-out infinite;
    }
    
    .step-item.done {
      background: rgba(125, 211, 160, 0.15);
      color: var(--success);
    }
    
    .step-icon {
      font-size: 0.75rem;
      width: 16px;
      text-align: center;
    }
    
    .step-connector {
      width: 16px;
      height: 1px;
      background: var(--border);
      flex-shrink: 0;
    }
    
    .step-connector.done {
      background: var(--success);
    }
    
    @keyframes stepPulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.6; }
    }
    
    /* Score Button (replaces auto-score) */
    .score-btn {
      position: absolute;
      right: 1rem;
      bottom: 4.5rem;
      background: var(--bg-hover);
      border: 1px solid var(--border);
      color: var(--text-secondary);
      font-size: 0.6875rem;
      font-weight: 600;
      padding: 0.375rem 0.75rem;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s ease;
      font-family: 'DM Sans', sans-serif;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      z-index: 2;
    }
    
    .score-btn:hover {
      background: var(--accent-glow);
      color: var(--accent);
      border-color: var(--accent-dim);
    }
    
    .score-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
    
    /* Editable Output */
    .output-area[contenteditable="true"] {
      cursor: text;
      outline: none;
      border: 1px solid transparent;
      border-radius: 4px;
      transition: border-color 0.2s ease;
    }
    
    .output-area[contenteditable="true"]:focus {
      border-color: var(--accent-dim);
    }
    
    .output-area .edit-hint {
      display: block;
      font-size: 0.6875rem;
      color: var(--text-muted);
      font-style: italic;
      margin-top: 0.75rem;
      opacity: 0.6;
    }
    
    /* Usage Counter */
    .usage-bar {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.625rem 1.25rem;
      background: var(--bg-secondary);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      margin-bottom: 1.5rem;
      animation: fadeInUp 0.8s ease-out 0.1s both;
    }
    
    .usage-label {
      font-size: 0.6875rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      white-space: nowrap;
    }
    
    .usage-track {
      flex: 1;
      height: 4px;
      background: var(--bg-hover);
      border-radius: 999px;
      overflow: hidden;
    }
    
    .usage-fill {
      height: 100%;
      background: var(--accent);
      border-radius: 999px;
      transition: width 0.4s ease;
    }
    
    .usage-fill.warning {
      background: var(--error);
    }
    
    .usage-count {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.75rem;
      color: var(--text-secondary);
      white-space: nowrap;
    }
    
    .usage-count.warning {
      color: var(--error);
    }
    
    /* History Drawer */
    .history-toggle {
      position: fixed;
      bottom: 1.5rem;
      right: 1.5rem;
      z-index: 99;
      width: 48px;
      height: 48px;
      border-radius: 14px;
      border: 1px solid var(--border);
      background: var(--bg-secondary);
      color: var(--text-secondary);
      font-size: 1.125rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 20px var(--shadow);
      transition: all 0.2s ease;
    }
    
    .history-toggle:hover {
      background: var(--bg-hover);
      color: var(--accent);
      transform: translateY(-2px);
      box-shadow: 0 6px 24px var(--shadow);
    }
    
    .history-badge {
      position: absolute;
      top: -4px;
      right: -4px;
      min-width: 18px;
      height: 18px;
      border-radius: 999px;
      background: var(--accent);
      color: var(--bg-primary);
      font-size: 0.625rem;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 4px;
    }
    
    .history-badge:empty, .history-badge[data-count="0"] {
      display: none;
    }
    
    .history-drawer-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(3px);
      z-index: 200;
    }
    
    .history-drawer-overlay.visible {
      display: block;
    }
    
    .history-drawer {
      position: fixed;
      top: 0;
      right: 0;
      width: 400px;
      max-width: 90vw;
      height: 100vh;
      background: var(--bg-secondary);
      border-left: 1px solid var(--border);
      z-index: 201;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform 0.3s ease;
      box-shadow: -8px 0 40px var(--shadow);
    }
    
    .history-drawer.open {
      transform: translateX(0);
    }
    
    .history-drawer-header {
      padding: 1.25rem 1.5rem;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--bg-tertiary);
    }
    
    .history-drawer-title {
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    
    .history-drawer-close {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 1.25rem;
      cursor: pointer;
      padding: 0.25rem;
      transition: color 0.2s ease;
    }
    
    .history-drawer-close:hover {
      color: var(--text-primary);
    }
    
    .history-drawer-body {
      flex: 1;
      overflow-y: auto;
      padding: 1rem;
    }
    
    .history-empty {
      text-align: center;
      padding: 3rem 1rem;
      color: var(--text-muted);
      font-size: 0.875rem;
    }
    
    .history-item {
      padding: 1rem;
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      margin-bottom: 0.75rem;
      cursor: pointer;
      transition: all 0.2s ease;
      background: var(--bg-primary);
    }
    
    .history-item:hover {
      border-color: var(--accent-dim);
      background: var(--bg-hover);
    }
    
    .history-item-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0.5rem;
    }
    
    .history-item-scenario {
      font-size: 0.6875rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--accent);
    }
    
    .history-item-time {
      font-size: 0.625rem;
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
    }
    
    .history-item-input {
      font-size: 0.8125rem;
      color: var(--text-muted);
      margin-bottom: 0.375rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    
    .history-item-output {
      font-size: 0.8125rem;
      color: var(--text-primary);
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    
    .history-clear-btn {
      width: 100%;
      padding: 0.625rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: transparent;
      color: var(--text-muted);
      font-size: 0.75rem;
      font-weight: 500;
      cursor: pointer;
      margin-top: 0.5rem;
      transition: all 0.2s ease;
      font-family: 'DM Sans', sans-serif;
    }
    
    .history-clear-btn:hover {
      background: rgba(232, 125, 125, 0.1);
      border-color: var(--error);
      color: var(--error);
    }
    
    /* Error with Retry */
    .error-card {
      text-align: center;
      padding: 1.5rem;
    }
    
    .error-icon {
      font-size: 1.5rem;
      margin-bottom: 0.5rem;
    }
    
    .error-message {
      color: var(--error);
      font-size: 0.875rem;
      margin-bottom: 0.75rem;
      line-height: 1.5;
    }
    
    .retry-btn {
      background: var(--bg-hover);
      border: 1px solid var(--border);
      color: var(--text-secondary);
      padding: 0.5rem 1.25rem;
      border-radius: 8px;
      font-size: 0.8125rem;
      font-weight: 600;
      cursor: pointer;
      font-family: 'DM Sans', sans-serif;
      transition: all 0.2s ease;
    }
    
    .retry-btn:hover {
      background: var(--accent-glow);
      color: var(--accent);
      border-color: var(--accent-dim);
    }
    
    /* ═══════════════════════════════════════════════════════════════════════
       ENHANCED MOBILE RESPONSIVE
       ═══════════════════════════════════════════════════════════════════════ */
    
    @media (max-width: 768px) {
      .container {
        padding: 1.5rem 1rem;
      }
      
      .header {
        margin-bottom: 2rem;
      }
      
      h1 {
        font-size: 2rem;
      }
      
      .subtitle {
        font-size: 0.9375rem;
      }
      
      .theme-switcher {
        top: calc(56px + 0.75rem);
        right: 0.75rem;
        padding: 0.375rem;
        gap: 0.375rem;
      }
      
      .theme-btn {
        width: 26px;
        height: 26px;
      }
      
      .controls-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
      }
      
      .control-group {
        min-width: 0;
      }
      
      .control-group select {
        width: 100%;
        font-size: 0.8125rem;
        padding: 0.5rem 2rem 0.5rem 0.75rem;
      }
      
      textarea {
        height: 200px;
        padding: 1rem;
        font-size: 0.875rem;
      }
      
      .output-area {
        height: auto;
        min-height: 200px;
        padding: 1rem;
        font-size: 0.875rem;
      }
      
      .panel-header {
        padding: 0.875rem 1rem;
      }
      
      .score-preview {
        padding: 0.625rem 1rem;
      }
      
      .score-btn {
        right: 0.75rem;
        bottom: 3.75rem;
      }
      
      .metadata-grid {
        grid-template-columns: 1fr 1fr;
      }
      
      .tab-nav {
        gap: 0.5rem;
      }
      
      .tab-btn {
        font-size: 0.8125rem;
        padding: 0.5rem 0.875rem;
      }
      
      .usage-bar {
        padding: 0.5rem 0.875rem;
        gap: 0.5rem;
      }
      
      .history-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 42px;
        height: 42px;
      }
      
      .copy-btn {
        top: 0.5rem;
        right: 0.5rem;
      }
      
      .transform-btn-container {
        flex-direction: row;
        gap: 0.5rem;
      }
      
      .do-better-btn {
        flex-direction: row;
        padding: 0.625rem 0.875rem;
        gap: 0.375rem;
      }
      
      .progress-stepper {
        padding: 0.75rem 1rem;
        gap: 0.125rem;
      }
      
      .step-item {
        font-size: 0.5625rem;
        padding: 0.1875rem 0.375rem;
      }
      
      .step-connector {
        width: 8px;
      }
    }
    
    @media (max-width: 480px) {
      .container {
        padding: 1rem 0.75rem;
      }
      
      h1 {
        font-size: 1.75rem;
      }
      
      .controls-row {
        grid-template-columns: 1fr;
      }
      
      .main-grid {
        gap: 0.75rem;
      }
      
      .metadata-grid {
        grid-template-columns: 1fr;
      }
      
      .theme-switcher {
        top: calc(56px + 0.5rem);
        right: 0.5rem;
        padding: 0.25rem;
        gap: 0.25rem;
        border-radius: 8px;
      }
      
      .theme-btn {
        width: 22px;
        height: 22px;
        border-radius: 6px;
      }
      
      .logo-text {
        display: none;
      }
    }
    
    /* Paper & Ink overrides for new elements */
    [data-theme="paper-ink"] .usage-bar {
      background: rgba(255, 255, 255, 0.6);
      backdrop-filter: blur(10px);
      border-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .history-toggle {
      background: rgba(255, 255, 255, 0.85);
      backdrop-filter: blur(10px);
      border-color: rgba(0, 0, 0, 0.08);
      box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    }
    
    [data-theme="paper-ink"] .history-drawer {
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(20px);
    }
    
    [data-theme="paper-ink"] .history-drawer-header {
      background: #f9f8f6;
      border-bottom-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .history-item {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .history-item:hover {
      background: #f9f8f6;
      border-color: rgba(184, 146, 14, 0.3);
    }
    
    [data-theme="paper-ink"] .progress-stepper {
      background: #f9f8f6;
      border-top-color: rgba(0, 0, 0, 0.06);
    }
    
    [data-theme="paper-ink"] .step-item {
      background: rgba(0, 0, 0, 0.04);
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .step-item.active {
      background: rgba(184, 146, 14, 0.1);
      color: #b8920e;
    }
    
    [data-theme="paper-ink"] .step-item.done {
      background: rgba(26, 138, 92, 0.08);
      color: #1a8a5c;
    }
    
    [data-theme="paper-ink"] .score-btn {
      background: #ffffff;
      border: 1px solid rgba(0, 0, 0, 0.12);
      color: #6e6e73;
      box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }
    
    [data-theme="paper-ink"] .score-btn:hover {
      background: #ffffff;
      color: #b8920e;
      border-color: rgba(184, 146, 14, 0.4);
      box-shadow: 0 0 0 3px rgba(184, 146, 14, 0.1);
    }
    
    [data-theme="paper-ink"] .retry-btn {
      background: #ffffff;
      border: 1px solid rgba(0, 0, 0, 0.12);
      box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }
    
    [data-theme="paper-ink"] .retry-btn:hover {
      border-color: rgba(184, 146, 14, 0.4);
      color: #b8920e;
    }
    
    [data-theme="paper-ink"] .tab-btn {
      background: rgba(255, 255, 255, 0.6);
      border: 1px solid rgba(0, 0, 0, 0.08);
      color: #6e6e73;
    }
    
    [data-theme="paper-ink"] .tab-btn:hover {
      background: rgba(255, 255, 255, 0.9);
    }
    
    [data-theme="paper-ink"] .tab-btn.active {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.1);
      color: #1d1d1f;
      box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    
    [data-theme="paper-ink"] .panel-header {
      background: #f9f8f6;
      border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    [data-theme="paper-ink"] .panel-badge {
      background: rgba(0, 0, 0, 0.04);
      border-color: rgba(0, 0, 0, 0.06);
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .control-label {
      color: #6e6e73;
    }
    
    [data-theme="paper-ink"] .panel-title .dot {
      background: #c9a227;
    }
    
    [data-theme="paper-ink"] .metadata-title {
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .metadata-label {
      color: #98989d;
    }
    
    [data-theme="paper-ink"] .metadata-value {
      color: #1d1d1f;
    }
    
    [data-theme="paper-ink"] .logo-icon {
      background: linear-gradient(135deg, #c9a227, #a6860e);
      box-shadow: 0 4px 16px rgba(184, 146, 14, 0.2);
    }
    
    [data-theme="paper-ink"] .logo-text {
      color: #1d1d1f;
    }
    
    [data-theme="paper-ink"] .output-score-number {
      color: #1a8a5c;
    }
    
    [data-theme="paper-ink"] .output-score-label {
      color: #6e6e73;
    }

    /* ═══════════════════════════════════════════════════════════════════════
       TOP TOOLBAR & APP LAUNCHER
       ═══════════════════════════════════════════════════════════════════════ */

    .app-toolbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 56px;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      z-index: 1000;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .toolbar-left,
    .toolbar-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .toolbar-center {
      flex: 1;
    }

    .toolbar-btn {
      width: 44px;
      height: 44px;
      border: 1px solid var(--border);
      background: var(--bg-secondary);
      color: var(--text-primary);
      border-radius: 10px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
    }

    .toolbar-btn svg {
      width: 20px;
      height: 20px;
      display: block;
    }

    .toolbar-btn:hover {
      border-color: var(--accent);
    }

    .toolbar-btn:active {
      transform: scale(0.95);
    }

    .toolbar-logo {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .toolbar-logo .logo-icon-img {
      width: 32px;
      height: 32px;
      object-fit: contain;
    }

    .toolbar-logo .logo-text {
      font-family: 'Playfair Display', Georgia, serif !important;
      font-weight: 600;
      font-size: 1.25rem;
      color: var(--text-primary);
    }

    @media (max-width: 600px) {
      .toolbar-logo .logo-text {
        display: none;
      }
    }

    /* App Launcher */
    .app-launcher-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.3);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s ease;
      z-index: 998;
    }

    .app-launcher-overlay.active {
      opacity: 1;
      visibility: visible;
    }

    .app-launcher {
      position: fixed;
      top: 64px;
      left: 16px;
      width: 420px;
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: 0 10px 40px var(--shadow);
      opacity: 0;
      visibility: hidden;
      transform: scale(0.9) translateY(-10px);
      transform-origin: top left;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      z-index: 999;
      overflow: hidden;
      max-height: 80vh;
    }

    .app-launcher.active {
      opacity: 1;
      visibility: visible;
      transform: scale(1) translateY(0);
    }

    .app-launcher-header {
      padding: 16px 20px;
      border-bottom: 1px solid var(--border);
      font-weight: 600;
      font-size: 0.9rem;
      color: var(--text-primary);
    }

    .app-launcher-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      padding: 10px;
      max-height: calc(80vh - 52px);
      overflow-y: auto;
    }

    .app-launcher-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 14px 8px;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.2s ease;
      text-decoration: none;
      color: var(--text-primary);
    }

    .app-launcher-item:hover {
      background: var(--bg-tertiary);
      border-color: var(--border);
    }

    .app-launcher-item.current {
      background: var(--bg-tertiary);
      border-color: var(--accent);
    }

    .app-launcher-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: var(--bg-tertiary);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
      transition: all 0.2s ease;
    }

    .app-launcher-item .app-emoji {
      font-size: 1.35rem;
      line-height: 1;
    }

    .app-launcher-item:hover .app-launcher-icon {
      transform: scale(1.05);
      box-shadow: 0 4px 12px var(--shadow);
    }

    .app-launcher-label {
      font-size: 0.7rem;
      font-weight: 500;
      text-align: center;
      color: var(--text-primary);
      line-height: 1.3;
    }

    @media (max-width: 480px) {
      .app-launcher {
        left: 8px;
        right: 8px;
        width: auto;
      }
      .app-launcher-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    /* Push content below fixed toolbar */
    body {
      padding-top: 56px;
    }
