:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --light: #94a3b8;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-dark: #1d4ed8;
  --green: #059669;
  --green-light: #d1fae5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ── Navigation ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.nav-logo svg { color: var(--accent); }

.nav-menu {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-item {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}

.nav-item:hover { color: var(--ink); background: var(--bg); }
.nav-item.active { color: var(--accent); background: var(--accent-light); }

.nav-right { display: flex; align-items: center; gap: 12px; }

.nav-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 999px;
}

.lang-toggle {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.lang-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ── Hero ── */
.hero {
  padding: 64px 24px 32px;
  text-align: center;
}

.hero-inner { max-width: 640px; margin: 0 auto; }

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
}

/* ── Mode Tabs ── */
.mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.mode-tab:hover { color: var(--ink); background: var(--bg); }
.mode-tab.active { color: var(--accent); background: var(--accent-light); font-weight: 600; }
.mode-tab svg { flex-shrink: 0; }

/* ── Mode Panels ── */
.mode-panel { display: none; }
.mode-panel.active { display: block; }

/* ── Translator card ── */
.translator-section { padding: 16px 0 48px; }

.translator-card,
.text-translator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.lang-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.lang-side { flex: 1; }

.lang-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.lang-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  font-family: inherit;
}

.lang-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.swap-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.15s;
}

.swap-btn:hover { background: var(--bg); color: var(--accent); border-color: var(--accent); }

.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.opt label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.opt select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  font-family: inherit;
}

.opt select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ── Text Panels (Google Translate style) ── */
.text-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.text-panel-left,
.text-panel-right {
  display: flex;
  flex-direction: column;
}

.text-panel-left textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  resize: vertical;
  transition: border-color 0.15s;
}

.text-panel-left textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.text-output-box {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  white-space: pre-wrap;
  overflow-y: auto;
}

.text-output-box.loading {
  color: var(--muted);
  font-style: italic;
}

.text-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 0;
}

.char-count {
  font-size: 0.75rem;
  color: var(--light);
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Icon Buttons (speak, mic, copy) ── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }

.icon-btn.active {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-light);
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

.icon-btn-label { white-space: nowrap; }

/* ── Image mode ── */
.img-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  position: relative;
  background: var(--bg);
  margin-bottom: 20px;
  transition: border-color 0.2s, background 0.2s;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-dropzone:hover { border-color: var(--accent); background: var(--accent-light); }

.img-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.img-dropzone.has-image input[type="file"] { display: none; }

#img-preview-container {
  position: relative;
  width: 100%;
}

#img-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.img-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 3;
}

.img-remove-btn:hover { background: var(--red); }

.img-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.img-result-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.img-result-text {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 120px;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--bg);
}

.img-status {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.img-status.error { color: var(--red); }

/* ── Drop zone (documents) ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  position: relative;
  background: var(--bg);
  margin-bottom: 20px;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover { border-color: var(--accent); background: var(--accent-light); }

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-main { font-size: 0.95rem; color: var(--muted); }
.drop-main u { color: var(--accent); cursor: pointer; }
.drop-hint { font-size: 0.8rem; color: var(--light); }

.file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}

/* ── Preview ── */
.preview-header {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.preview-header span { color: var(--accent); font-weight: 500; }

.preview-box {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ── Button ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
  font-family: inherit;
}

.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 4px 16px rgba(37,99,235,0.35); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Progress card ── */
.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.log-box {
  font-family: 'JetBrains Mono', monospace;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 60px;
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.5;
}

.results-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.results-box a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 14px;
  background: var(--accent-light);
  border-radius: 8px;
  transition: background 0.15s;
}

.results-box a:hover { background: #bfdbfe; }

/* ── Docs section ── */
.docs-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.section-header p {
  color: var(--muted);
  font-size: 1rem;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.doc-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; }

.doc-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.doc-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.doc-card p, .doc-card li {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.doc-card ul {
  list-style: none;
  padding: 0;
}

.doc-card li {
  padding: 3px 0;
  padding-left: 16px;
  position: relative;
}

.doc-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
}

.doc-card code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
}

/* ── Changelog ── */
.changelog-section {
  padding: 64px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.timeline { position: relative; padding-left: 32px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.tl-item { position: relative; padding-bottom: 28px; }
.tl-item:last-child { padding-bottom: 0; }

.tl-marker {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
}

.tl-marker.current {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.tl-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tl-version {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.tl-date {
  font-size: 0.8rem;
  color: var(--light);
}

.tl-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green);
  background: var(--green-light);
  padding: 2px 8px;
  border-radius: 999px;
}

.tl-content ul {
  list-style: none;
  padding: 0;
}

.tl-content li {
  font-size: 0.875rem;
  color: var(--muted);
  padding: 2px 0 2px 16px;
  position: relative;
}

.tl-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--light);
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--light);
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover { color: var(--accent); }

/* ── Furigana (Ruby Text) ── */
ruby {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: top;
  line-height: 1;
  margin: 0 0.1em;
}

ruby rt {
  font-size: 0.5em;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 400;
  text-align: center;
  margin-bottom: 0.2em;
  letter-spacing: 0.05em;
}

ruby rb {
  line-height: 1.4;
  font-size: 1em;
}

/* Ruby text for dark backgrounds */
.output-panel ruby rt {
  color: var(--light);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-inner { padding: 0 16px; gap: 16px; }
  .nav-menu { gap: 2px; }
  .nav-item { font-size: 0.8rem; padding: 5px 8px; }
  .hero { padding: 40px 16px 24px; }
  h1 { font-size: 1.5rem; }
  .lang-bar { flex-direction: column; gap: 12px; }
  .swap-btn { align-self: center; }
  .options-row { grid-template-columns: 1fr; }
  .text-panels { grid-template-columns: 1fr; }
  .img-results { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .mode-tab { font-size: 0.8rem; padding: 8px 10px; }
  .nav-user-email { display: none; }
}

/* ══════════════════════════════════════════
   Auth Loading Spinner
   ══════════════════════════════════════════ */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.auth-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════
   Login Page — Professional Two-Panel
   ══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}
.login-bg-shape-1 { width: 600px; height: 600px; background: #2563eb; top: -200px; right: -100px; }
.login-bg-shape-2 { width: 400px; height: 400px; background: #7c3aed; bottom: -150px; left: -100px; }
.login-bg-shape-3 { width: 300px; height: 300px; background: #06b6d4; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.2; }

.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 880px;
  min-height: 520px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
}

/* Left: Brand Panel */
.login-brand {
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  padding: 3rem;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  top: -80px;
  right: -80px;
}
.login-brand::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  bottom: -60px;
  left: -60px;
}

.login-brand-content { position: relative; z-index: 1; }

.login-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: white;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
}

.login-brand-title {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.02em;
}

.login-brand-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  margin: 0 0 2rem 0;
}

.login-features { display: flex; flex-direction: column; gap: 0.75rem; }

.login-feature {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}
.login-feature svg { color: #86efac; flex-shrink: 0; }

/* Right: Form Panel */
.login-form {
  background: white;
  padding: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form-inner { width: 100%; max-width: 320px; }

.login-form-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.375rem 0;
}

.login-form-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 2rem 0;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
}
.login-error svg { flex-shrink: 0; }

.login-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.login-button:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}
.login-button:active { transform: translateY(0); }

.login-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: #d1d5db;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.login-button-signup {
  background: white;
  color: #374151;
  border: 1.5px solid #d1d5db;
}
.login-button-signup:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  color: #111827;
}

.login-info {
  margin: 1.75rem 0 0 0;
  text-align: center;
  font-size: 0.7rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}
.login-info::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") no-repeat center;
}

@media (max-width: 768px) {
  .login-card {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
  .login-brand {
    padding: 2rem;
  }
  .login-brand-desc,
  .login-features { display: none; }
  .login-brand-title { font-size: 1.5rem; margin-bottom: 0; }
  .login-brand {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }
  .login-brand-icon { margin-bottom: 0; }
  .login-form { padding: 2rem; }
}

/* ══════════════════════════════════════════
   Nav User Info
   ══════════════════════════════════════════ */
.nav-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 12px;
  margin-left: 4px;
}

.nav-user-email {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.nav-logout-btn:hover {
  background: var(--red-light);
  color: var(--red);
}

/* ══════════════════════════════════════════
   Convert Mode
   ══════════════════════════════════════════ */
.convert-header {
  margin-bottom: 8px;
}

.convert-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.convert-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   Feedback Section
   ══════════════════════════════════════════ */
.feedback-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.feedback-btn:hover { border-color: var(--accent); color: var(--accent); }

.like-btn.active { color: var(--green); border-color: var(--green); background: var(--green-light); }
.dislike-btn.active { color: var(--red); border-color: var(--red); background: var(--red-light); }

.feedback-btn .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
}

.feedback-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Comments ── */
.comments-section {
  margin-top: 12px;
}

.comment-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.comment-input-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}

.comment-input-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.comment-input-row button {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.comment-input-row button:hover { background: var(--accent-dark); }

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.comment-item .comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--light);
  margin-bottom: 2px;
}

.comment-item .comment-email {
  font-weight: 600;
  color: var(--muted);
}

.comment-item .comment-text {
  flex: 1;
  line-height: 1.5;
}

.comment-item .comment-delete {
  background: none;
  border: none;
  color: var(--light);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  transition: color 0.15s;
}

.comment-item .comment-delete:hover { color: var(--red); }

/* ══════════════════════════════════════════
   Quality Badge
   ══════════════════════════════════════════ */
.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.quality-badge.quality-high { color: var(--green); background: var(--green-light); }
.quality-badge.quality-medium { color: #d97706; background: #fef3c7; }
.quality-badge.quality-low { color: var(--red); background: var(--red-light); }

/* ══════════════════════════════════════════
   Comparison Modal / Panel
   ══════════════════════════════════════════ */
.comparison-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.comparison-modal-inner {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.comparison-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: 16px 16px 0 0;
}

.comparison-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.comparison-close-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.comparison-close-btn:hover { background: var(--red-light); color: var(--red); }

.comparison-stats {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.comparison-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  background: var(--bg);
  border-radius: 10px;
  min-width: 100px;
}

.comparison-stat .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.comparison-stat .stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.comparison-segments {
  padding: 16px 24px 24px;
}

.comparison-file-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin: 16px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.comparison-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg);
}

.comparison-segment:last-child { border-bottom: none; }

.segment-side {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.segment-original {
  background: #f1f5f9;
  border-left: 3px solid var(--light);
}

.segment-translated {
  border-left: 3px solid var(--green);
}

.segment-translated.translated-full { background: #f0fdf4; }
.segment-translated.translated-partial { background: #fefce8; border-left-color: #d97706; }
.segment-translated.translated-none { background: #fef2f2; border-left-color: var(--red); }

.segment-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.segment-type-badge.type-text { color: var(--accent); background: var(--accent-light); }
.segment-type-badge.type-image { color: #7c3aed; background: #ede9fe; }
.segment-type-badge.type-table { color: #0891b2; background: #cffafe; }
.segment-type-badge.type-header { color: #c2410c; background: #fff7ed; }

/* ══════════════════════════════════════════
   History Section
   ══════════════════════════════════════════ */
.history-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  font-size: 0.9rem;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.history-item:hover { box-shadow: var(--shadow); border-color: #cbd5e1; }

.history-item-info { flex: 1; }

.history-item-date {
  font-size: 0.75rem;
  color: var(--light);
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.history-item-files {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.history-item-actions {
  display: flex;
  gap: 8px;
}

.history-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.history-download:hover { background: #bfdbfe; }

.history-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.history-compare-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Responsive additions ── */
@media (max-width: 768px) {
  .comparison-modal { padding: 8px; }
  .comparison-modal-inner { max-height: 95vh; }
  .comparison-segment { grid-template-columns: 1fr; }
  .comparison-stats { flex-direction: column; }
  .history-item { flex-direction: column; align-items: stretch; }
  .history-item-actions { justify-content: flex-end; }
}
