:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --light-muted: #64748b;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  --danger: #b91c1c;
  --radius: 14px;
}

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

html {
  scroll-behavior: smooth;
}

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

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0f172a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
}

.trust-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

main {
  flex: 1;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 28px;
}

.route-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.02rem;
  color: var(--muted);
}

.dock-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--surface);
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  margin-bottom: 22px;
}

.dock-tab {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  min-height: 54px;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-decoration: none;
  color: inherit;
}

.dock-tab:hover {
  background: var(--bg);
}

.dock-tab.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.dock-tab-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.dock-tab-sub {
  font-size: 0.78rem;
  opacity: 0.78;
  margin-top: 2px;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

input[type="number"],
select {
  font-size: 0.94rem;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  min-height: 44px;
}

input[type="number"] {
  width: 104px;
}

input[type="range"] {
  min-height: 44px;
  accent-color: var(--accent);
}

.preset-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
}

.preset-btn:hover,
.preset-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 0.88rem;
  color: var(--light-muted);
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-subtle);
}

.btn-download {
  background: var(--success);
}

.btn-download:hover {
  background: #047857;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.result-info {
  max-width: 68%;
  min-width: 0;
}

.result-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}

.stat-good {
  color: var(--success);
  font-weight: 700;
}

.stat-warn {
  color: var(--warning);
  font-weight: 600;
}

.stat-error {
  color: var(--danger);
  font-weight: 600;
}

.disclosure {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.disclosure strong {
  color: #78350f;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: block;
}

a.feature-card:hover {
  border-color: var(--accent);
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--muted);
}

.seo-section {
  margin-top: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.seo-section h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.faq-q {
  font-weight: 700;
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.faq-a {
  font-size: 0.9rem;
  color: var(--muted);
}

.legal {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.legal h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.legal .lede {
  color: var(--muted);
  margin-bottom: 24px;
}

.legal h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 24px 0 8px;
}

.legal p,
.legal li {
  color: var(--muted);
  font-size: 0.96rem;
}

.legal ul {
  padding-left: 1.2em;
  margin: 8px 0 0;
}

.legal li + li {
  margin-top: 6px;
}

.legal a {
  color: var(--accent);
  font-weight: 600;
}

footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-brand strong {
  color: var(--text);
}

.footer-company {
  margin-top: 4px;
  max-width: 520px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent);
}

@media (max-width: 768px) {
  .dock-tabs,
  .features-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 1.65rem;
  }
  .result-info {
    max-width: 100%;
  }
}

/* ---- v2 additions ---- */
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 50; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.range-value { font-weight: 700; min-width: 42px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 700; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
input[type="text"] { font-size: 0.94rem; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); min-height: 44px; width: 170px; }
.more-options { margin: -6px 0 16px; }
.more-options summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.toolbar.sub { border-bottom: none; padding-bottom: 4px; margin-bottom: 4px; }
.hint { font-size: 0.8rem; color: var(--light-muted); }
.disclosure ol { margin: 8px 0 8px 1.2em; }
.disclosure li + li { margin-top: 4px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.batch-summary { margin-right: auto; font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--accent); }
.result-card { flex-wrap: nowrap; align-items: flex-start; }
.result-thumb { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 8px; background: var(--surface-subtle); border: 1px solid var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; color: var(--light-muted); }
.result-thumb.is-pdf { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-info { flex: 1 1 auto; max-width: none; }
.result-cta { flex: 0 0 auto; }
.progress { height: 6px; background: var(--surface-subtle); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; width: 2%; background: var(--accent); transition: width 0.2s ease; }
.result-note { margin-top: 6px; font-size: 0.82rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: 0.78rem; }
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warning-bg); color: var(--warning-text); }
.suggestions { margin: 6px 0 0 1.1em; color: var(--muted); }
.suggestions li + li { margin-top: 2px; }
details.faq-item summary { cursor: pointer; list-style-position: outside; min-height: 32px; }
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); }
dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
dialog h2 { font-size: 1.15rem; margin-bottom: 8px; }
dialog p { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
dialog input[type="password"] { width: 100%; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; min-height: 44px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.features-grid + .features-grid { margin-top: 16px; }
.footer-company a { color: var(--muted); }

@media (max-width: 768px) {
  main { padding: 20px 14px 36px; }
  .workspace { padding: 16px; }
  .nav-wrap { padding: 10px 14px; gap: 8px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav-link { white-space: nowrap; padding: 8px 10px; }
  .trust-badge { font-size: 0.72rem; }
  .toolbar { gap: 12px; }
  .dropzone { padding: 28px 14px; }
  .action-bar .btn { flex: 1 1 auto; }
  .batch-summary { width: 100%; }
  .result-card { flex-wrap: wrap; }
  .result-info { flex-basis: calc(100% - 70px); }
  .result-cta { width: 100%; }
  .result-cta .btn { width: 100%; }
  .seo-section, .legal { padding: 20px 16px; }
}

[hidden] { display: none !important; }

/* ---- round 3 ---- */
.restored-note { font-size: 0.82rem; color: var(--muted); margin: -8px 0 12px; }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 10px 6px; font-size: inherit; min-height: 44px; display: inline-flex; align-items: center; }
.retry-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn-small { min-height: 44px; padding: 6px 14px; font-size: 0.84rem; }
.ios-hint { margin-top: 8px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 auto 22px; max-width: 760px; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; font-size: 0.86rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.steps li::before { content: counter(s); display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; align-items: center; justify-content: center; margin-right: 8px; font-size: 0.78rem; }
@media (max-width: 768px) { .steps { grid-template-columns: 1fr; gap: 6px; } }
