:root {
  --bg: #0a0f14;
  --bg-elevated: rgba(14, 22, 31, 0.88);
  --panel-border: rgba(164, 184, 203, 0.14);
  --panel-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --text-primary: #edf3f8;
  --text-secondary: #9eb0c2;
  --accent: #5be3b0;
  --accent-strong: #2ecf96;
  --danger: #ff7c7c;
  --info: #7cc8ff;
  --surface: rgba(23, 35, 48, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(91, 227, 176, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(124, 200, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #091017 0%, #0a0f14 100%);
  color: var(--text-primary);
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  padding: 32px 20px 56px;
}

.layout {
  width: min(100%, var(--container));
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.hero-card,
.panel,
.result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  border-radius: 32px;
  padding: 28px;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(91, 227, 176, 0.1);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.04;
}

.hero-copy p,
.panel-head p,
.helper-text,
.preview-placeholder,
.meta-item span,
.notice,
.copy-feedback,
.result-count,
.json-details summary {
  color: var(--text-secondary);
}

.hero-copy p {
  margin: 0;
  max-width: 720px;
  font-size: 1rem;
  line-height: 1.75;
}

.hero-meta {
  display: grid;
  gap: 16px;
  align-content: start;
}

.meta-item {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-item span,
.meta-item strong {
  display: block;
}

.meta-item strong {
  margin-top: 8px;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.content-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.panel {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2,
.result-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.panel-head p {
  margin: 0;
  line-height: 1.6;
}

.upload-dropzone {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 220px;
  padding: 26px;
  place-items: center;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(124, 200, 255, 0.4);
  background:
    linear-gradient(180deg, rgba(124, 200, 255, 0.06), rgba(91, 227, 176, 0.04)),
    rgba(255, 255, 255, 0.02);
  text-align: center;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.upload-dropzone:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 227, 176, 0.6);
}

.upload-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  font-size: 1.1rem;
  font-weight: 600;
}

.upload-hint {
  max-width: 340px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.actions {
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #08130f;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.helper-text {
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.notice {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.notice-error {
  color: #ffd0d0;
  background: rgba(255, 124, 124, 0.12);
  border: 1px solid rgba(255, 124, 124, 0.18);
}

.notice-info {
  color: #d7efff;
  background: rgba(124, 200, 255, 0.1);
  border: 1px solid rgba(124, 200, 255, 0.18);
}

.preview-panel {
  display: flex;
  flex-direction: column;
}

.preview-shell {
  flex: 1;
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.preview-shell.is-empty {
  border-style: dashed;
}

.preview-shell img {
  width: 100%;
  height: 100%;
  max-height: 580px;
  object-fit: contain;
  display: block;
}

.preview-placeholder {
  padding: 24px;
  text-align: center;
}

.result-section {
  display: grid;
  gap: 22px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 0;
}

.result-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-card {
  border-radius: var(--radius-md);
  padding: 20px;
}

.result-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.raw-lines {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.raw-line-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.raw-line-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.raw-line-index {
  color: var(--accent);
  font-size: 0.88rem;
}

.raw-line-location {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.raw-line-text {
  margin: 0;
  line-height: 1.65;
  color: var(--text-primary);
  word-break: break-word;
}

.plain-text-output,
.raw-json {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(4, 8, 14, 0.6);
  color: var(--text-primary);
}

.plain-text-output {
  min-height: 360px;
  padding: 16px;
  resize: vertical;
  line-height: 1.7;
}

.copy-feedback {
  min-height: 1.2em;
  font-size: 0.92rem;
}

.copy-feedback.is-success {
  color: var(--accent);
}

.copy-feedback.is-error {
  color: var(--danger);
}

.json-details {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
}

.json-details summary {
  cursor: pointer;
}

.raw-json {
  margin: 14px 0 0;
  padding: 16px;
  overflow: auto;
  line-height: 1.6;
}

@media (max-width: 960px) {
  .hero-card,
  .content-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .preview-shell {
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px 14px 32px;
  }

  .hero-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .result-head,
  .result-title-row,
  .raw-line-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
    justify-content: center;
  }
}
