:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --primary: #111827;
  --primary-2: #2563eb;
  --accent: #7c3aed;
  --ok: #059669;
  --danger: #dc2626;
  --shadow: 0 24px 70px rgba(17, 24, 39, 0.10);
  --radius: 22px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.16), transparent 34rem),
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.14), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 36%);
}
button, textarea { font: inherit; }
button { border: 0; }

.app {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}
.subtitle {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}
.hero-card {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(255,255,255,.58));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card span {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.78rem;
  font-weight: 800;
}
.hero-card strong {
  display: block;
  margin-top: 16px;
  font-size: 1.4rem;
}
.hero-card p { margin: 10px 0 0; color: var(--muted); line-height: 1.6; }

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(12px);
}
.mode-tabs button {
  min-height: 46px;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  transition: 160ms ease;
}
.mode-tabs button:hover { background: #f3f4f6; color: var(--text); }
.mode-tabs button[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(17,24,39,.18);
}

.session-guide {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 0 0 16px;
  padding: 18px 20px;
  border: 1px solid rgba(147, 197, 253, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.9)),
    radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 20rem);
  box-shadow: 0 18px 55px rgba(37, 99, 235, 0.12);
  backdrop-filter: blur(16px);
}
.session-guide-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: #dbeafe;
  font-size: 1.45rem;
}
.session-guide h2 {
  margin: 0 0 6px;
  color: #1e3a8a;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.session-guide p {
  margin: 0;
  color: #1f2937;
  line-height: 1.65;
}
.session-guide a {
  color: #2563eb;
  font-weight: 900;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.session-guide a:hover { text-decoration: underline; }

.grid {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 16px;
}
.panel {
  border: 1px solid rgba(229,231,235,.92);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.input-panel, .output-panel, .results-panel { padding: 18px; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 1.18rem; letter-spacing: -0.02em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }

.dropzone {
  display: grid;
  place-items: center;
  min-height: 238px;
  padding: 24px;
  border: 1.5px dashed #c7d2fe;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8faff, #ffffff);
  text-align: center;
  transition: 160ms ease;
}
.dropzone.dragover {
  border-color: var(--primary-2);
  background: #eff6ff;
  transform: translateY(-1px);
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: #111827;
  color: #fff;
  font-size: 1.6rem;
}
.dropzone h3 { margin: 5px 0; font-size: 1.1rem; }
.dropzone p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.between { justify-content: space-between; margin-top: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: 150ms ease;
}
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:not(:disabled):hover { background: #000; transform: translateY(-1px); }
.button.ghost { border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); }
.button.ghost:not(:disabled):hover { border-color: var(--line-strong); background: #f9fafb; }
.button.text { background: transparent; color: var(--muted); }
.button.text:hover { color: var(--danger); background: #fef2f2; }

.paste-label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}
.session-tip {
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
  color: #1e3a8a;
  font-size: .92rem;
  line-height: 1.6;
}
.session-tip strong { color: #1d4ed8; }
.session-tip a {
  color: #2563eb;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.session-tip a:hover { text-decoration: underline; }
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  outline: none;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}
textarea:focus { border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
#paste-input { min-height: 210px; padding: 14px; }
.output { min-height: 530px; padding: 14px; background: #0b1020; color: #dbeafe; border-color: #111827; }
.output::placeholder { color: #64748b; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.stats article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 12px 40px rgba(17,24,39,.06);
}
.stats span { display: block; font-size: 2rem; font-weight: 900; letter-spacing: -0.05em; }
.stats p { margin: 2px 0 0; color: var(--muted); font-weight: 700; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .82rem; background: #f9fafb; }
td { font-size: .92rem; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: .78rem;
  font-weight: 800;
}
.issues { margin-top: 14px; }
.issues summary { cursor: pointer; color: var(--muted); font-weight: 900; }
.issues ul { margin: 10px 0 0; padding-left: 20px; color: var(--danger); line-height: 1.55; }
.issues span, .muted { color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translate(-50%, 16px);
  padding: 12px 16px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  font-weight: 800;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-type="error"] { background: var(--danger); }

@media (max-width: 920px) {
  .hero, .grid { grid-template-columns: 1fr; }
  .mode-tabs { grid-template-columns: repeat(2, 1fr); }
  .output { min-height: 360px; }
}
@media (max-width: 560px) {
  .app { width: min(100vw - 18px, 1240px); padding-top: 18px; }
  .mode-tabs, .stats { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
  h1 { font-size: 2.3rem; }
}
