:root {
    --primary: #007aff;
    --primary-hover: #0056b3;
    --bg: #f2f2f7;
    --card-bg: #ffffff;
    --text: #1c1c1e;
    --text-sub: #8e8e93;
    --border: #e5e5ea;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --cyber-glow: 0 0 10px rgba(0, 122, 255, 0.4);
  }
  
  * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 16px;
    background: var(--bg);
    color: var(--text);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .app-header {
    text-align: center;
    margin-bottom: 16px;
  }
  
  .app-header h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
  }
  
  /* Tab Switching */
  .tab-container {
    display: flex;
    background: #e3e3e8;
    border-radius: var(--radius);
    padding: 3px;
    margin-bottom: 16px;
  }
  
  .tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .tab-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }
  
  /* Input Areas */
  #drop-zone {
    border: 2px dashed #c7c7cc;
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
  }
  
  #drop-zone.hover {
    border-color: var(--primary);
    background: #eef6ff;
  }
  
  #drop-zone p {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
  }
  
  #drop-zone small {
    color: var(--text-sub);
    font-size: 12px;
  }
  
  #file-input { display: none; }
  
  #paste-section {
    display: none;
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  
  #paste-input {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    outline: none;
    background: #fafafa;
  }
  
  #paste-input:focus {
    border-color: var(--primary);
    background: #fff;
  }
  
  #btn-paste-parse {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
  }
  
  /* Row Settings */
  .row-settings {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    background: var(--card-bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  
  .row-setting-item {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .row-setting-item label {
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  
  .row-setting-item input {
    padding: 8px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    outline: none;
    font-weight: 600;
    background: #fafafa;
  }
  
  /* Viewer Container */
  #viewer {
    display: none;
    margin-top: 16px;
  }
  
  /* 檔名顯示 Badge 樣式 */
  #file-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--border);
  }
  
  .file-icon {
    font-size: 14px;
  }
  
  #file-name-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .search-box { margin-bottom: 12px; }
  
  .search-box input {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: var(--card-bg);
    box-shadow: var(--shadow);
  }
  
  /* 單行分頁 Controls */
  .pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    gap: 8px;
  }
  
  .page-center-group {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    background: #1c1c1e;
    color: #00f0ff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    flex-shrink: 0;
  }
  
  .icon-btn:active:not(:disabled) {
    transform: scale(0.92);
    box-shadow: var(--cyber-glow);
    background: var(--primary);
    color: #fff;
  }
  
  .icon-btn:disabled {
    background: #e5e5ea;
    color: #a1a1a6;
    cursor: not-allowed;
    box-shadow: none;
  }
  
  .icon-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }
  
  #page-info {
    font-weight: 700;
    font-size: 15px;
    font-family: monospace;
    letter-spacing: 1px;
    color: var(--text);
    white-space: nowrap;
  }
  
  /* 輕量跳頁輸入框 */
  .jump-box {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f2f2f7;
    padding: 3px 3px 3px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: border-color 0.2s ease;
  }
  
  .jump-box:focus-within {
    border-color: var(--primary);
    background: #fff;
  }
  
  .jump-box input {
    width: 42px;
    padding: 2px 0;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    outline: none;
    color: var(--text);
  }
  
  .jump-box input::-webkit-outer-spin-button,
  .jump-box input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
  }
  .jump-box input[type=number] {
    -moz-appearance: textfield;
    appearance: none;
  }
  
  .jump-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #1c1c1e;
    color: #30d158;
    box-shadow: none;
  }
  
  .jump-btn svg {
    width: 15px;
    height: 15px;
  }
  
  /* 資料區獨立 Scrollbar */
  #form-container {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
    border-radius: var(--radius);
  }
  
  #form-container::-webkit-scrollbar {
    width: 6px;
  }
  
  #form-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
  }
  
  #form-container::-webkit-scrollbar-thumb {
    background: #c7c7cc;
    border-radius: 10px;
  }
  
  #form-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
  }
  
  /* Card Style */
  .field-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    transition: transform 0.1s ease, border-color 0.2s ease;
  }
  
  .field-card:active {
    transform: scale(0.98);
    border-color: var(--primary);
    background: #f8fbfd;
  }
  
  .field-label {
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
  }
  
  .field-value {
    font-size: 15px;
    color: var(--text);
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.4;
  }
  
  /* Toast Notification */
  #toast {
    visibility: hidden;
    min-width: 160px;
    background-color: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(10px);
    color: #fff;
    text-align: center;
    border-radius: 20px;
    padding: 10px 18px;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  
  #toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }