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

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #dce0e6;
  --text: #1a1d23;
  --text-dim: #6b7280;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --error: #ef4444;
  --header-bg: #1e293b;
  --header-text: #f1f5f9;
  --panel-header: #f8fafc;
  --textarea-bg: #fafbfc;
  --hover: #f1f5f9;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  user-select: none;
}
.header-title { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.header-sub { font-size: 13px; color: #94a3b8; }

.container {
  flex: 1;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  min-height: 0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.panel-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--panel-header);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.panel-bar select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  min-width: 120px;
}

.panel-bar select:focus { outline: none; border-color: var(--primary); }

textarea {
  flex: 1;
  padding: 12px;
  border: none;
  resize: none;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.55;
  background: var(--textarea-bg);
  color: var(--text);
  min-height: 300px;
  tab-size: 2;
}

textarea:focus { outline: none; }
textarea[readonly] { background: #f8f9fb; cursor: default; }

.panel-status {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  background: var(--panel-header);
  min-height: 22px;
}

.center-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  flex-shrink: 0;
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--primary); }
.btn:active { transform: scale(0.97); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-convert {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.btn-convert:hover { background: var(--primary-hover); }
.btn-convert:disabled { opacity: 0.5; cursor: not-allowed; }

.file-label { font-size: 12px; color: var(--text-dim); }
.file-link { color: var(--primary); cursor: pointer; text-decoration: underline; }
.file-link:hover { color: var(--primary-hover); }
#fileInput { display: none; }

.footer {
  padding: 8px 24px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer .error { color: var(--error); }
.footer .success { color: var(--success); }

@media (max-width: 800px) {
  .container { flex-direction: column; }
  .center-col { flex-direction: row; padding: 8px 0; }
  textarea { min-height: 200px; }
}
