:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei",
    "Noto Sans CJK TC", sans-serif;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #647089;
  --line: #dce4f2;
  --primary: #285bd6;
  --primary-dark: #1f45a6;
  --danger: #c73535;
  --success: #178047;
  --warning: #a86400;
  --shadow: 0 20px 60px rgba(31, 51, 96, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(40, 91, 214, 0.16), transparent 36rem),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.85rem 1.3rem;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    opacity 0.16s ease;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

code {
  border-radius: 0.45rem;
  background: #edf2ff;
  color: #234cb8;
  padding: 0.12rem 0.35rem;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 0.7rem;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1.02;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  margin-bottom: 0.45rem;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}

.hero-text,
.panel p,
.hero-card span,
.file-meta,
.drop-zone small {
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  max-width: 760px;
  font-size: 1.05rem;
  margin-bottom: 0;
}

.hero-card,
.panel,
.result-card {
  border: 1px solid rgba(220, 228, 242, 0.9);
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  padding: 1.3rem;
}

.hero-card strong,
.hero-card span {
  display: block;
}

.hero-card strong {
  margin-bottom: 0.4rem;
}

.panel {
  padding: clamp(1rem, 3vw, 2rem);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 1.5rem;
  align-items: center;
}

.login-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.password-row {
  display: flex;
  gap: 0.7rem;
}

.password-row input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.85rem 1rem;
}

.message {
  min-height: 1.4rem;
  margin: 0.8rem 0 0;
}

.hidden {
  display: none !important;
}

.toolbar,
.actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  background: #f2f5fb;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 0.45rem;
  min-height: 220px;
  border: 2px dashed #aab9da;
  border-radius: 1.2rem;
  background: #f8fbff;
  cursor: pointer;
  margin: 1.3rem 0;
  padding: 1.5rem;
  text-align: center;
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: #eef4ff;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #e7eeff;
  color: var(--primary);
  font-size: 2rem;
  font-weight: 300;
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.batch-summary {
  border-radius: 1rem;
  background: #edf4ff;
  color: #24416f;
  margin-top: 1.2rem;
  padding: 1rem;
}

.results {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.result-card {
  padding: 1rem;
}

.result-header {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.preview {
  width: 96px;
  height: 96px;
  border-radius: 1rem;
  background: #edf1f8;
  object-fit: cover;
}

.file-meta {
  font-size: 0.9rem;
  margin-bottom: 0.55rem;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.32rem 0.7rem;
}

.status-pill.success {
  background: #eaf8f0;
  color: var(--success);
}

.status-pill.warning {
  background: #fff3df;
  color: var(--warning);
}

.status-pill.error {
  background: #ffecec;
  color: var(--danger);
}

.progress-bar {
  height: 0.55rem;
  border-radius: 999px;
  background: #e8edf7;
  margin: 1rem 0;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #63a4ff);
  transition: width 0.25s ease;
}

.result-body {
  color: #263247;
  line-height: 1.65;
}

.summary-box,
.token-box,
.diff-list,
.process-list,
.raw-box {
  border-radius: 1rem;
  background: #f7f9fd;
  margin-top: 0.8rem;
  padding: 0.9rem;
}

.summary-box strong {
  display: block;
  margin-bottom: 0.35rem;
}

.error-body {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.match {
  color: var(--success);
}

.mismatch {
  color: var(--danger);
}

.uncertain {
  color: var(--warning);
}

.diff-list ul,
.process-list ol {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
}

.diff-list li + li,
.process-list li + li {
  margin-top: 0.55rem;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.token-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.token-grid strong {
  font-size: 1.05rem;
}

.raw-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.5rem 0 0;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 1rem, 1120px);
    padding: 1rem 0;
  }

  .hero,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .hero-card {
    order: -1;
  }

  .toolbar,
  .password-row {
    align-items: stretch;
    flex-direction: column;
  }

  .result-header {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .preview {
    width: 72px;
    height: 72px;
  }

  .token-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
