/**
 * styles-core.css
 * Core layout styles: reset, header, modals, main layout, upload, textarea, buttons, split mode, zoom, output panel
 */

    @font-face {
      font-family: 'OpenDyslexic';
      src: url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/woff/OpenDyslexic-Regular.woff') format('woff');
      font-weight: 400;
      font-style: normal;
    }
    @font-face {
      font-family: 'OpenDyslexic';
      src: url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/woff/OpenDyslexic-Bold.woff') format('woff');
      font-weight: 700;
      font-style: normal;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      min-height: 100vh;
      background: linear-gradient(160deg, #0c0c0c 0%, #1a1a1a 40%, #0f0f0f 100%);
      font-family: 'Inter', 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
      color: #f0f0f0;
      overflow-x: hidden;
    }

    body::before {
      content: '';
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
      background-size: 60px 60px;
      pointer-events: none;
      z-index: 0;
    }

    header {
      padding: 0.25rem 1rem;
      border-bottom: 1px solid rgba(255,255,255,0.05);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(12,12,12,0.9);
      backdrop-filter: blur(10px);
      position: relative;
      z-index: 100;
    }

    .header-center-text {
      position: relative;
      text-align: center;
      pointer-events: none;
      padding: 0 1rem;
    }
    .header-center-title {
      font-family: 'DM Sans', sans-serif;
      font-weight: 800;
      letter-spacing: 0.08em;
      font-size: 2.2rem;
      line-height: 1.05;
      background: linear-gradient(90deg, #4ade80, #22c55e, #16a34a);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      text-transform: uppercase;
    }
    .header-center-subtitle {
      margin-top: 0.15rem;
      font-size: 1.1rem;
      color: #a3a3a3;
      letter-spacing: 0.15em;
    }

    @media (max-width: 700px) {
      .header-center-title { font-size: 1.5rem; }
      .header-center-subtitle { font-size: 0.72rem; }
    }

    .inline-upgrade-btn {
      width: 100%;
      padding: 0.85rem 1rem;
      background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
      border: none;
      border-radius: 10px;
      color: #fff;
      font-size: 1rem;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      margin-top: 0.75rem;
      box-shadow: 0 4px 20px rgba(34, 197, 94, 0.25);
      transition: all 0.2s ease;
    }
    .inline-upgrade-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 30px rgba(34, 197, 94, 0.35);
    }

    .logo-section { display: none; }

    .logo {
      width: 28px; height: 28px;
      background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
      border-radius: 5px;
      display: flex; align-items: center; justify-content: center;
      font-weight: 800; font-size: 0.85rem; color: #0a0a0a;
      box-shadow: 0 0 15px rgba(34, 197, 94, 0.25);
      font-family: 'DM Sans', sans-serif;
    }

    .logo-text h1 {
      font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em;
      background: linear-gradient(90deg, #fff, #d4d4d4);
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    }
    .logo-text p { display: none; }

    /* Help Dropdown */
    .help-dropdown-container { position: relative; }

    .help-dropdown-trigger {
      padding: 0.5rem 1rem;
      background: rgba(34, 197, 94, 0.1);
      border: 1px solid rgba(34, 197, 94, 0.25);
      border-radius: 8px;
      color: #4ade80;
      font-size: 0.85rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      transition: all 0.2s ease;
    }

    .help-dropdown-trigger:hover {
      background: rgba(34, 197, 94, 0.2);
      border-color: rgba(34, 197, 94, 0.4);
    }

    .help-dropdown-arrow {
      font-size: 0.7rem;
      transition: transform 0.2s ease;
    }

    .help-dropdown-trigger.open .help-dropdown-arrow {
      transform: rotate(180deg);
    }

    .help-dropdown-menu {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: #1a1a1a;
      border: 1px solid rgba(34, 197, 94, 0.3);
      border-radius: 8px;
      min-width: 260px;
      max-height: 0;
      overflow: hidden;
      opacity: 0;
      transition: all 0.3s ease;
      z-index: 1000;
      box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    }

    .help-dropdown-menu.open {
      max-height: 500px;
      opacity: 1;
    }

    .help-dropdown-item {
      padding: 0.9rem 1rem;
      display: flex;
      align-items: center;
      gap: 0.75rem;
      cursor: pointer;
      transition: all 0.15s ease;
      border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .help-dropdown-item:last-child { border-bottom: none; }
    .help-dropdown-item:hover { background: rgba(34, 197, 94, 0.1); }
    .help-icon { font-size: 1.2rem; width: 30px; text-align: center; }
    .help-info { display: flex; flex-direction: column; }
    .help-title { font-size: 0.95rem; font-weight: 500; color: #f0f0f0; }
    .help-desc { font-size: 0.75rem; color: #a3a3a3; }

    /* Modal Styles */
    .modal-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.8);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 2000;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
    }

    .modal-overlay.visible {
      opacity: 1;
      visibility: visible;
    }

    .modal-content {
      background: #1a1a1a;
      border: 1px solid rgba(34, 197, 94, 0.3);
      border-radius: 12px;
      max-width: 550px;
      width: 90%;
      max-height: 80vh;
      overflow-y: auto;
      padding: 1.75rem;
      transform: scale(0.9);
      transition: transform 0.3s ease;
    }

    .modal-overlay.visible .modal-content {
      transform: scale(1);
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1.25rem;
      padding-bottom: 1rem;
      border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .modal-title {
      font-size: 1.3rem;
      font-weight: 600;
      color: #4ade80;
    }

    .modal-close {
      background: none;
      border: none;
      color: #a3a3a3;
      font-size: 1.5rem;
      cursor: pointer;
      padding: 0.25rem;
      line-height: 1;
      transition: color 0.2s ease;
    }

    .modal-close:hover { color: #f0f0f0; }

    .modal-body {
      color: #d4d4d4;
      font-size: 0.95rem;
      line-height: 1.7;
    }

    .modal-body h3 {
      color: #4ade80;
      font-size: 1rem;
      margin-top: 1.25rem;
      margin-bottom: 0.5rem;
    }

    .modal-body h3:first-child { margin-top: 0; }
    .modal-body p { margin-bottom: 0.75rem; }
    .modal-body a { color: #4ade80; text-decoration: none; }
    .modal-body a:hover { text-decoration: underline; }

    /* Usage Counter */
    .usage-badge {
      padding: 0.4rem 0.8rem;
      background: rgba(251, 191, 36, 0.1);
      border: 1px solid rgba(251, 191, 36, 0.3);
      border-radius: 100px;
      color: #fbbf24;
      font-size: 0.7rem;
      font-weight: 600;
      letter-spacing: 0.05em;
      margin-right: 0.5rem;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .usage-badge:hover { background: rgba(251, 191, 36, 0.2); }
    .usage-badge.premium {
      background: rgba(34, 197, 94, 0.1);
      border-color: rgba(34, 197, 94, 0.3);
      color: #4ade80;
    }
    .usage-badge.warning {
      background: rgba(239, 68, 68, 0.1);
      border-color: rgba(239, 68, 68, 0.3);
      color: #f87171;
    }

    /* Upgrade Modal */
    .upgrade-modal-content {
      background: linear-gradient(160deg, #1a1a1a 0%, #0f1f15 100%);
      border: 1px solid rgba(34, 197, 94, 0.4);
      border-radius: 16px;
      max-width: 480px;
      width: 90%;
      padding: 2rem;
      text-align: center;
    }

    .upgrade-icon { font-size: 4rem; margin-bottom: 1rem; }
    .upgrade-title { font-size: 1.6rem; font-weight: 700; color: #4ade80; margin-bottom: 0.5rem; }
    .upgrade-subtitle { font-size: 1rem; color: #a3a3a3; margin-bottom: 1.5rem; }
    .upgrade-price { font-size: 2.5rem; font-weight: 800; color: #fff; margin-bottom: 0.25rem; }
    .upgrade-price-note { font-size: 0.85rem; color: #a3a3a3; margin-bottom: 1.5rem; }

    .upgrade-features {
      text-align: left;
      background: rgba(0,0,0,0.3);
      border-radius: 10px;
      padding: 1.25rem;
      margin-bottom: 1.5rem;
    }

    .upgrade-feature {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.5rem 0;
      color: #d4d4d4;
      font-size: 0.95rem;
    }

    .upgrade-feature-icon { color: #4ade80; font-size: 1.1rem; }

    .upgrade-btn {
      width: 100%;
      padding: 1rem 2rem;
      background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
      border: none;
      border-radius: 10px;
      color: #fff;
      font-size: 1.1rem;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.2s ease;
      box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
      margin-bottom: 0.75rem;
    }

    .upgrade-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 30px rgba(34, 197, 94, 0.4);
    }

    .upgrade-cancel {
      background: none;
      border: none;
      color: #737373;
      font-size: 0.9rem;
      font-family: inherit;
      cursor: pointer;
      padding: 0.5rem;
    }
    .upgrade-cancel:hover { color: #a3a3a3; }
    .usage-remaining { font-size: 0.85rem; color: #fbbf24; margin-top: 1rem; }

    /* Main Layout */
    main {
      display: grid;
      grid-template-columns: 1fr;
      min-height: calc(100vh - 70px);
      position: relative;
      z-index: 10;
      transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    main.split { grid-template-columns: 1fr; }

    .input-panel {
      padding: 0.4rem 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
      max-width: 900px;
      margin: 0 auto;
      width: 100%;
    }

    main.split .input-panel {
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.3rem;
      max-width: 100%;
      margin: 0;
      padding: 0.25rem 0.5rem;
      border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    main.split .input-panel > * {
      flex: 1 1 auto;
      min-width: 0;
    }
    main.split .input-panel > .recent-files-section {
      flex: 0 1 auto;
      max-width: 200px;
    }
    main.split .input-panel > div:has(.dropdown-container) {
      flex: 0 1 auto;
      max-width: 220px;
    }
    main.split .input-panel > div:has(.upload-area) {
      flex: 1 1 auto;
      max-width: 280px;
    }
    main.split .input-panel .upload-area {
      padding: 0.4rem;
    }
    main.split .input-panel .upload-icon { display: none; }
    main.split .input-panel .upload-hint { display: none; }
    main.split .input-panel .upload-formats { display: none; }
    main.split .input-panel .upload-text { font-size: 0.65rem; margin-bottom: 0; }
    main.split .input-panel .action-btn {
      flex: 0 0 auto;
      padding: 0.5rem 1rem;
      font-size: 0.85rem;
      white-space: nowrap;
    }
    main.split .input-panel .section-label { display: none; }
    main.split .input-panel .file-info-bar { margin-top: 0.3rem; }

    .section-label {
      display: flex;
      align-items: center;
      gap: 0.3rem;
      font-size: 0.62rem;
      color: #d4d4d4;
      margin-bottom: 0.35rem;
      letter-spacing: 0.08em;
      font-weight: 500;
    }

    .dot { width: 6px; height: 6px; border-radius: 50%; }
    .dot.green { background: #22c55e; }
    .dot.orange { background: #f97316; }
    .dot.purple { background: #a855f7; }
    .dot.cyan { background: #06b6d4; }
    .dot.blue { background: #3b82f6; }

    /* Recent Files Section */
    .recent-files-section {
      background: rgba(59, 130, 246, 0.08);
      border: 1px solid rgba(59, 130, 246, 0.2);
      border-radius: 6px;
      padding: 0.6rem 0.75rem;
      display: none;
    }
    .recent-files-section.visible { display: block; }
    .recent-files-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.4rem;
    }
    .recent-files-title {
      font-size: 0.8rem;
      color: #60a5fa;
      font-weight: 500;
    }
    .recent-files-clear {
      background: none;
      border: none;
      color: #6b7280;
      font-size: 0.6rem;
      cursor: pointer;
      padding: 0.15rem 0.4rem;
    }
    .recent-files-clear:hover { color: #f87171; }
    .recent-files-list {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
    }
    .recent-file-item {
      padding: 0.3rem 0.55rem;
      background: rgba(59, 130, 246, 0.15);
      border: 1px solid rgba(59, 130, 246, 0.3);
      border-radius: 4px;
      color: #93c5fd;
      font-size: 0.68rem;
      cursor: pointer;
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      gap: 0.3rem;
    }
    .recent-file-item:hover {
      background: rgba(59, 130, 246, 0.25);
      border-color: rgba(59, 130, 246, 0.5);
    }

    /* Reading Stats Section */
    .reading-stats-section {
      background: rgba(245, 158, 11, 0.08);
      border: 1px solid rgba(245, 158, 11, 0.2);
      border-radius: 5px;
      padding: 0.4rem 0.6rem;
      display: none;
    }
    .reading-stats-section.visible { display: block; }
    .reading-stats-section .section-label { margin-bottom: 0.3rem; font-size: 0.58rem; }
    .reading-stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.4rem;
    }
    @media (max-width: 600px) {
      .reading-stats-grid { grid-template-columns: repeat(2, 1fr); }
    }
    .stat-item {
      text-align: center;
      padding: 0.3rem;
    }
    .stat-value {
      font-size: 1rem;
      font-weight: 700;
      color: #fbbf24;
    }
    .stat-label {
      font-size: 0.6rem;
      color: #a3a3a3;
      letter-spacing: 0.05em;
      margin-top: 0.1rem;
    }
    .stat-highlight {
      background: rgba(168, 85, 247, 0.15);
      border-radius: 6px;
    }
    .stat-highlight .stat-value { color: #c084fc; }

    /* Dropdown */
    .dropdown-container { position: relative; width: 100%; }

    .dropdown-trigger {
      width: 100%;
      padding: 0.45rem 0.7rem;
      background: rgba(0,0,0,0.4);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 5px;
      color: #f0f0f0;
      font-size: 0.78rem;
      font-family: inherit;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: all 0.2s ease;
    }

    .dropdown-trigger:hover { border-color: rgba(34, 197, 94, 0.4); }
    .dropdown-trigger.open { border-color: rgba(34, 197, 94, 0.6); border-radius: 8px 8px 0 0; }

    .dropdown-selected { display: flex; align-items: center; gap: 0.5rem; }
    .dropdown-selected .style-icon { font-size: 0.9rem; }
    .dropdown-selected .style-info { display: flex; flex-direction: column; align-items: flex-start; }
    .dropdown-selected .style-name { font-weight: 600; color: #4ade80; font-size: 0.75rem; }
    .dropdown-selected .style-desc { font-size: 0.62rem; color: #a3a3a3; }

    .dropdown-arrow { transition: transform 0.2s ease; color: #a3a3a3; font-size: 0.7rem; }
    .dropdown-trigger.open .dropdown-arrow { transform: rotate(180deg); }

    .dropdown-menu {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: #1a1a1a;
      border: 1px solid rgba(34, 197, 94, 0.4);
      border-top: none;
      border-radius: 0 0 8px 8px;
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.3s ease, opacity 0.2s ease;
      opacity: 0;
      z-index: 1000;
    }

    .dropdown-menu.open { max-height: 450px; overflow-y: auto; opacity: 1; }

    .dropdown-item {
      padding: 0.55rem 0.85rem;
      display: flex;
      align-items: center;
      gap: 0.6rem;
      cursor: pointer;
      transition: all 0.15s ease;
      border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .dropdown-item:last-child { border-bottom: none; }
    .dropdown-item:hover { background: rgba(34, 197, 94, 0.1); }
    .dropdown-item.selected { background: rgba(34, 197, 94, 0.15); }
    .dropdown-item .style-icon { font-size: 1.1rem; width: 28px; text-align: center; }
    .dropdown-item .style-info { flex: 1; }
    .dropdown-item .style-name { font-size: 0.82rem; font-weight: 500; color: #f0f0f0; }
    .dropdown-item.selected .style-name { color: #4ade80; }
    .dropdown-item .style-desc { font-size: 0.7rem; color: #a3a3a3; margin-top: 0.1rem; }

    /* Upload */
    .upload-area {
      border: 1.5px dashed rgba(255,255,255,0.2);
      border-radius: 5px;
      padding: 0.6rem;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s ease;
      background: rgba(0,0,0,0.2);
    }

    .upload-area:hover { border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.05); }
    .upload-area.dragover { border-color: #22c55e; background: rgba(34, 197, 94, 0.1); }
    .upload-icon { font-size: 1.2rem; margin-bottom: 0.15rem; }
    .upload-text { font-size: 0.72rem; color: #d4d4d4; margin-bottom: 0.1rem; }
    .upload-hint { font-size: 0.62rem; color: #a3a3a3; }
    .upload-formats { display: flex; justify-content: center; gap: 0.3rem; margin-top: 0.35rem; flex-wrap: wrap; }
    .format-badge { padding: 0.12rem 0.35rem; background: rgba(255,255,255,0.08); border-radius: 3px; font-size: 0.58rem; color: #d4d4d4; }
    .file-input { position: fixed; left: -9999px; }

    .file-info-bar {
      display: none;
      align-items: center;
      justify-content: space-between;
      padding: 0.5rem 0.75rem;
      background: rgba(34, 197, 94, 0.1);
      border: 1px solid rgba(34, 197, 94, 0.25);
      border-radius: 5px;
      margin-top: 0.5rem;
    }

    .file-info-bar.visible { display: flex; }
    .file-info-details { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: #4ade80; overflow: hidden; min-width: 0; }
    .file-info-details #fileName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .file-remove { background: none; border: none; color: #f87171; cursor: pointer; font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 4px; flex-shrink: 0; white-space: nowrap; }
    .file-remove:hover { background: rgba(239, 68, 68, 0.15); }

    /* Textarea */
    .textarea-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
    .header-buttons { display: flex; gap: 0.6rem; }

    .small-text-btn {
      padding: 0.3rem 0.55rem;
      background: transparent;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 4px;
      color: #a3a3a3;
      font-size: 0.65rem;
      cursor: pointer;
      font-family: inherit;
      letter-spacing: 0.08em;
      transition: all 0.15s ease;
    }

    .small-text-btn:hover { border-color: rgba(255,255,255,0.35); color: #e5e5e5; }

    .input-area { display: none; }

    #inputText {
      flex: 1;
      min-height: 140px;
      padding: 0.85rem;
      background: rgba(0,0,0,0.5);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 6px;
      color: #e5e5e5;
      font-size: 0.9rem;
      font-family: 'Inter', 'DM Sans', Arial, sans-serif;
      line-height: 1.65;
      resize: none;
      outline: none;
      transition: all 0.2s ease;
    }

    #inputText:focus { border-color: rgba(34, 197, 94, 0.4); box-shadow: 0 0 30px rgba(34, 197, 94, 0.08); }
    #inputText::placeholder { color: #737373; }

    .input-stats { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: 0.7rem; color: #a3a3a3; }
    .size-warning { color: #f87171; }
    .size-ok { color: #4ade80; }

    /* Action Button */
    .action-btn {
      padding: 0.6rem 1rem;
      background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
      border: none;
      border-radius: 5px;
      color: #0a0a0a;
      font-size: 0.95rem;
      font-weight: 700;
      font-family: 'DM Sans', 'Inter', Arial, sans-serif;
      letter-spacing: 0.08em;
      cursor: pointer;
      box-shadow: 0 4px 25px rgba(34, 197, 94, 0.35);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      transition: all 0.2s ease;
    }

    .action-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 30px rgba(34, 197, 94, 0.45); }
    .action-btn:disabled { background: linear-gradient(135deg, #404040 0%, #333 100%); color: #888; cursor: not-allowed; box-shadow: none; transform: none; }

    /* Action Stats Row - button + reading stats side by side */
    .action-stats-row {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      width: 100%;
    }
    .action-stats-row .action-btn {
      flex-shrink: 0;
    }
    .action-stats-row .reading-stats-section {
      flex: 1;
      max-width: 480px;
      padding: 0.3rem 0.5rem;
    }
    .action-stats-row .reading-stats-grid {
      gap: 0.2rem;
    }
    .action-stats-row .stat-value {
      font-size: 0.85rem;
    }
    .action-stats-row .stat-item {
      padding: 0.15rem;
    }
    .action-stats-row .stat-label {
      font-size: 0.5rem;
    }

    /* Customize panel when in input panel */
    .input-panel > .customize-panel {
      display: none;
      max-width: 600px;
    }
    .input-panel > .customize-panel.visible {
      display: block;
    }

    /* Toggles bar when in input panel */
    .input-panel > .output-toggles-bar {
      display: none;
    }
    .input-panel > .output-toggles-bar.visible {
      display: flex;
    }

    /* Output header when in input panel */
    .input-panel > .output-header {
      display: none;
      max-width: 600px;
    }
    .input-panel > .output-header.visible {
      display: flex;
    }

    /* Reading stats when direct child of input panel */
    .input-panel > .reading-stats-section {
      display: none;
    }
    .input-panel > .reading-stats-section.visible {
      display: block;
    }
    main.split .input-panel > .reading-stats-section {
      flex: 1 1 auto;
      max-width: 400px;
      padding: 0.3rem 0.5rem;
    }
    main.split .input-panel > .reading-stats-section .stat-value {
      font-size: 0.85rem;
    }
    main.split .input-panel > .reading-stats-section .stat-item {
      padding: 0.15rem;
    }
    main.split .input-panel > .reading-stats-section .stat-label {
      font-size: 0.5rem;
    }
    main.split .input-panel > .reading-stats-section .reading-stats-grid {
      gap: 0.2rem;
    }

    /* Split mode overrides for action row */
    main.split .action-stats-row {
      flex: 0 0 auto;
      width: auto;
      min-width: 0;
    }
    main.split .input-panel > .customize-panel {
      flex: 0 1 auto;
      max-width: 500px;
      position: relative;
      z-index: 100;
    }
    main.split .input-panel > .customize-panel .customize-content.open {
      position: absolute;
      top: 100%;
      left: 0;
      min-width: 580px;
      background: rgba(20, 20, 20, 0.97);
      border: 1px solid rgba(34, 197, 94, 0.3);
      border-radius: 0 0 6px 6px;
      padding: 0.6rem;
      z-index: 101;
      max-height: 60vh;
      overflow-y: auto;
    }
    main.split .input-panel > .output-toggles-bar {
      flex: 0 1 auto;
    }
    main.split .input-panel > .output-header {
      flex: 0 1 auto;
    }

    /* Bionic slider when in input panel */
    .input-panel > .bionic-slider-container {
      display: none;
      max-width: 400px;
    }
    .input-panel > .bionic-slider-container.visible {
      display: flex;
    }

    /* Hide textarea in split mode */
    main.split .input-panel > .input-area {
      display: none;
    }

    /* Zoom Controls */
    .zoom-controls {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      padding: 0.3rem 0;
    }
    .zoom-btn {
      padding: 0.25rem 0.6rem;
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 4px;
      color: #e5e5e5;
      font-size: 0.75rem;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .zoom-btn:hover {
      background: rgba(255,255,255,0.15);
      border-color: rgba(255,255,255,0.25);
    }
    .zoom-level {
      font-size: 0.7rem;
      color: #a3a3a3;
      min-width: 40px;
      text-align: center;
    }

    .spinner {
      width: 18px; height: 18px;
      border: 2px solid transparent;
      border-top-color: currentColor;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Output Panel */
    .output-panel {
      padding: 0.25rem 1rem;
      background: rgba(255,255,255,0.01);
      display: none;
      flex-direction: column;
      gap: 0.3rem;
      animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      overflow-y: auto;
    }

    .output-panel.visible { display: flex; }
    @keyframes slideIn { from { opacity: 0; transform: translateX(25px); } to { opacity: 1; transform: translateX(0); } }

    /* Output panel child ordering */
    .output-panel > .bionic-slider-container { order: 1; }
    .output-panel > .compare-container { order: 2; }
    .output-panel > .zoom-controls { order: 2; }
    .output-panel > .preview-wrapper { order: 2; }
    .output-panel > .output-stats { order: 3; }

    /* ============================================
       MOBILE RESPONSIVE — Core Layout
       ============================================ */

    /* Tablets and small laptops */
    @media (max-width: 900px) {
      .preview-container {
        width: 100%;
        min-height: auto;
        padding: 20mm 15mm;
      }
      .preview-wrapper {
        padding: 0.75rem;
      }
    }

    /* Mobile phones — landscape and large phones */
    @media (max-width: 768px) {
      header {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.25rem 0.5rem;
      }
      .header-center-text {
        order: -1;
        width: 100%;
        padding: 0.15rem 0;
      }
      .header-center-title {
        font-size: 1.3rem;
      }
      .header-center-subtitle {
        font-size: 0.65rem !important;
      }
      .input-panel {
        padding: 0.4rem 0.5rem;
      }
      .preview-container {
        width: 100%;
        min-height: auto;
        padding: 12mm 8mm;
      }
      .preview-wrapper {
        padding: 0.5rem;
        max-height: calc(100vh - 220px);
      }
      .action-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
      }
      .modal-content {
        width: 95%;
        padding: 1.25rem;
      }
      .upgrade-modal-content {
        width: 95%;
        padding: 1.25rem;
      }
      .help-dropdown-menu {
        min-width: 220px;
        right: -0.5rem;
      }
      .usage-badge {
        font-size: 0.6rem;
        padding: 0.3rem 0.5rem;
      }
      .zoom-controls {
        flex-wrap: wrap;
        gap: 0.3rem;
      }
      .action-stats-row {
        flex-direction: column;
        gap: 0.4rem;
      }
      .action-stats-row .action-btn {
        width: 100%;
      }
      .action-stats-row .reading-stats-section {
        max-width: 100%;
      }
    }

    /* Small mobile phones */
    @media (max-width: 480px) {
      header {
        padding: 0.2rem 0.4rem;
      }
      .header-center-title {
        font-size: 1.1rem;
      }
      .header-center-subtitle {
        font-size: 0.55rem !important;
      }
      .preview-container {
        padding: 8mm 5mm;
        border-radius: 0;
      }
      .preview-wrapper {
        padding: 0.25rem;
        border-radius: 4px;
      }
      .input-panel {
        padding: 0.3rem 0.4rem;
        gap: 0.3rem;
      }
      .upload-area {
        padding: 0.5rem;
      }
      .upload-text {
        font-size: 0.65rem;
      }
      .upload-hint {
        font-size: 0.55rem;
      }
      .dropdown-trigger {
        font-size: 0.72rem;
        padding: 0.4rem 0.55rem;
      }
      .file-info-bar {
        flex-direction: column;
        gap: 0.3rem;
        align-items: flex-start;
      }
      .modal-content {
        width: 98%;
        padding: 1rem;
        max-height: 85vh;
      }
      .upgrade-modal-content {
        width: 98%;
        padding: 1rem;
      }
      .upgrade-price {
        font-size: 2rem;
      }
      .upgrade-title {
        font-size: 1.3rem;
      }
      .help-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 70vh;
      }
      .help-dropdown-menu.open {
        max-height: 70vh;
      }
    }
