:root {
  --bg: #f4efe5;
  --surface: rgba(255, 252, 246, 0.88);
  --surface-strong: #fffdf8;
  --border: rgba(84, 60, 40, 0.14);
  --text: #2d241d;
  --muted: #7a6656;
  --accent: #c96f3b;
  --accent-dark: #9e4f22;
  --success: #1f8a48;
  --danger: #be3348;
  --warning: #b78313;
  --add: #d4fcbc;
  --remove: #fbb6c2;
  --modify: #fff3b0;
  --shadow: 0 18px 40px rgba(85, 57, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Consolas", "SFMono-Regular", "Liberation Mono", monospace;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 111, 59, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 138, 72, 0.12), transparent 22%),
    linear-gradient(180deg, #f8f3e9 0%, var(--bg) 100%);
}

.page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
}

.subtitle {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 14px 18px;
  margin-bottom: 20px;
}

.option-row,
.action-bar,
.panel-header,
.legend-row {
  display: flex;
  align-items: center;
}

.option-row {
  gap: 18px;
  flex-wrap: wrap;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input {
  accent-color: var(--accent);
}

.input-grid,
.status-grid,
.result-grid {
  display: grid;
  gap: 20px;
}

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

.status-grid {
  grid-template-columns: 1.15fr 0.85fr;
  margin: 20px 0;
}

.input-grid .card,
.result-grid .card,
.status-card {
  padding: 18px;
}

.panel-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.meta,
.hint {
  color: var(--muted);
  font-size: 13px;
}

textarea,
.diff-view {
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(84, 60, 40, 0.12);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

textarea {
  resize: vertical;
}

textarea:focus {
  outline: 2px solid rgba(201, 111, 59, 0.25);
  border-color: rgba(201, 111, 59, 0.45);
}

.action-bar {
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-button {
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #de8a4a 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(201, 111, 59, 0.24);
}

.ghost-button {
  padding: 9px 14px;
  background: rgba(201, 111, 59, 0.08);
  color: var(--accent-dark);
}

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

.status-badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.status-badge.idle {
  color: var(--muted);
  background: rgba(122, 102, 86, 0.14);
}

.status-badge.success {
  color: var(--success);
  background: rgba(31, 138, 72, 0.12);
}

.status-badge.error {
  color: var(--danger);
  background: rgba(190, 51, 72, 0.12);
}

.status-badge.warn {
  color: var(--warning);
  background: rgba(183, 131, 19, 0.12);
}

.status-text {
  margin: 0;
  line-height: 1.65;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.stats div {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
}

.stats dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stats dd {
  margin: 0;
  font-size: 24px;
}

.legend {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.legend.add {
  background: var(--add);
}

.legend.delete {
  background: var(--remove);
}

.legend.modify {
  background: var(--modify);
}

.diff-view {
  margin: 0;
  overflow: auto;
}

.segment-remove {
  background: var(--remove);
}

.segment-add {
  background: var(--add);
}

.segment-modify {
  background: var(--modify);
}

@media (max-width: 980px) {
  .input-grid,
  .status-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .page {
    width: min(100% - 20px, 1280px);
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .stats {
    grid-template-columns: 1fr;
  }

  textarea,
  .diff-view {
    min-height: 240px;
  }
}
