:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --panel: #ffffff;
  --ink: #1e1c17;
  --muted: #5d5a52;
  --accent: #295b52;
  --accent-soft: #d7e5df;
  --border: #ded8cc;
  --shadow: 0 20px 40px rgba(23, 20, 12, 0.08);
  --radius: 18px;

  --left: #1d4e89;
  --left-soft: #e2ecf7;
  --left-muted: #6b8eb3;
  --right: #8a2d3c;
  --right-soft: #f5e2e5;
  --right-muted: #b36b78;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Candara", sans-serif;
  background: radial-gradient(circle at top, #fbf8f0 0%, #f1eadc 55%, #ebe3d2 100%);
  color: var(--ink);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.language-switcher {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.language-switcher a {
  color: var(--accent);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.language-switcher a:hover {
  background: var(--accent-soft);
  text-decoration: underline;
}

.language-switcher .current {
  color: var(--ink);
  padding: 4px 8px;
  background: var(--accent-soft);
  border-radius: 6px;
}

.lang-separator {
  color: var(--border);
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
  justify-content: space-between;
  padding: 28px;
  border-radius: 26px;
  background: linear-gradient(120deg, #fffaf2, #f2f7f4);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.hero-main {
  flex: 1 1 320px;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 0 1 220px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
}

h1 {
  font-size: 36px;
  margin: 0 0 12px;
}

.subtitle {
  max-width: 520px;
  color: var(--muted);
  margin: 0;
}

.hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  font-size: 14px;
  font-style: italic;
}

.hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--muted);
  color: var(--panel);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.status {
  display: grid;
  gap: 14px;
  min-width: 220px;
}

.status-block {
  background: var(--panel);
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
}

.status-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.status-value {
  font-size: 16px;
  font-weight: 600;
}

main {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.card-header p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 22px rgba(41, 91, 82, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: none;
}

.uploader {
  display: grid;
  gap: 12px;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  border-radius: 16px;
  border: 2px dashed #c9c0b0;
  background: #faf6ee;
  cursor: pointer;
  text-align: center;
  min-height: 110px;
}

.dropzone strong {
  display: block;
  font-size: 16px;
}

.dropzone span {
  color: var(--muted);
  font-size: 13px;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #eef4f1;
}

.error {
  color: #912c2c;
  background: #f8e6e6;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e8c7c7;
  margin: 0;
}

.hidden {
  display: none;
}

.dashboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.dashboard-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fbfaf7;
  outline: none;
}

.dashboard-item:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.dashboard-item.dragging {
  opacity: 0.4;
}

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

.btn.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.icon:hover {
  background: #f3e6e6;
  color: #912c2c;
  border-color: #e8c7c7;
  transform: none;
}

.btn.icon.delete:hover {
  background: #912c2c;
  color: white;
  border-color: #912c2c;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  border-radius: 6px;
  touch-action: none;
}

.drag-handle:hover,
.drag-handle:active {
  background: var(--accent-soft);
  color: var(--accent);
}

.drag-handle[draggable="true"] {
  -webkit-user-drag: element;
}

.dashboard-item {
  cursor: grab;
  min-width: 0;
}

.dashboard-item.dragging {
  cursor: grabbing;
}

.dashboard-item .drag-handle {
  cursor: inherit;
}

.dashboard-item .title {
  font-weight: 600;
}

.dashboard-item .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.dashboard-item .items-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  width: 100%;
  display: block;
}

.drop-indicator {
  height: 4px;
  margin: 4px 0;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
}

.badge {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 18px;
}

.compare-inputs {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}

.compare-inputs > div:first-child .input-label {
  color: var(--left);
}

.compare-inputs > div:last-child .input-label {
  color: var(--right);
}

.compare-inputs > div:first-child .dropzone {
  border-color: var(--left-muted);
  background: var(--left-soft);
}

.compare-inputs > div:first-child .dropzone strong {
  color: var(--left);
}

.compare-inputs > div:first-child .dropzone span {
  color: var(--left-muted);
}

.compare-inputs > div:first-child .dropzone.dragover {
  border-color: var(--left);
  background: #d2e2f3;
}

.compare-inputs > div:last-child .dropzone {
  border-color: var(--right-muted);
  background: var(--right-soft);
}

.compare-inputs > div:last-child .dropzone strong {
  color: var(--right);
}

.compare-inputs > div:last-child .dropzone span {
  color: var(--right-muted);
}

.compare-inputs > div:last-child .dropzone.dragover {
  border-color: var(--right);
  background: #f3d2d7;
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.compare-area {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fbfaf7;
  padding: 14px;
  min-height: 120px;
}

.compare-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 10px;
}

.compare-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1.5fr) minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: start;
  padding: 10px 8px;
  border-bottom: 1px solid #e8e0d1;
  grid-template-areas:
    "handle title details choice actions"
    ". diff diff diff diff";
}

.compare-row.row-left {
  background: rgba(29, 78, 137, 0.06);
}

.compare-row.row-right {
  background: rgba(138, 45, 60, 0.06);
}

.compare-row.row-both {
  background: rgba(90, 70, 110, 0.06);
}

.compare-row.row-equal {
  background: transparent;
}

.compare-row.row-selected-left {
  background: rgba(29, 78, 137, 0.09);
}

.compare-row.row-selected-right {
  background: rgba(138, 45, 60, 0.09);
}

.compare-row .compare-handle {
  grid-area: handle;
  margin-top: 2px;
}

.compare-row .compare-title-cell {
  grid-area: title;
  min-width: 0;
}

.compare-row .compare-details-cell {
  grid-area: details;
  min-width: 0;
}

.compare-row .compare-choice-cell {
  grid-area: choice;
  min-width: 0;
}

.compare-row .compare-actions-cell {
  grid-area: actions;
  min-width: 0;
}

.compare-row .compare-diff-cell {
  grid-area: diff;
}

.compare-row .compare-diff-cell.hidden {
  display: none;
}

.compare-row:last-child {
  border-bottom: none;
}

.compare-row.dragging {
  opacity: 0.4;
}

.compare-area .drop-indicator {
  height: 4px;
  margin: 4px 0;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
}

.compare-title {
  font-weight: 600;
}

.compare-meta {
  font-size: 12px;
  color: var(--muted);
}

.compare-meta .status-both,
.compare-details-cell.status-both {
  color: #5a6b4a;
}

.compare-meta .status-equal,
.compare-details-cell.status-equal {
  color: #3a7a4a;
  font-weight: 600;
}

.compare-meta .status-different,
.compare-details-cell.status-different {
  color: #8a6a2a;
  font-weight: 600;
}

.compare-meta .status-left,
.compare-details-cell.status-left,
.compare-meta .details-left {
  color: var(--left);
  font-weight: 600;
}

.compare-meta .status-right,
.compare-details-cell.status-right,
.compare-meta .details-right {
  color: var(--right);
  font-weight: 600;
}

.compare-meta .status-duplicate {
  color: #8a6a2a;
  font-weight: 600;
}

.compare-meta .status-separator {
  color: var(--muted);
}

.choice {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.choice button,
.choice label {
  font-size: 12px;
}

.choice button {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.choice button.active {
  background: var(--accent);
  color: white;
}

.choice.equal {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.compare-choice-cell.choice .use-left {
  border-color: var(--left);
  color: var(--left);
}

.compare-choice-cell.choice .use-left.active {
  background: var(--left);
  color: white;
}

.compare-choice-cell.choice .use-right {
  border-color: var(--right);
  color: var(--right);
}

.compare-choice-cell.choice .use-right.active {
  background: var(--right);
  color: white;
}

.compare-choice-cell.choice .keep-both {
  border-color: #7a5a8a;
  color: #7a5a8a;
}

.compare-choice-cell.choice .keep-both.active {
  background: #7a5a8a;
  color: white;
}

.diff-toggle {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: none;
  white-space: nowrap;
}

.diff-panel {
  grid-area: diff;
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  max-height: 320px;
  overflow: auto;
}

.diff-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.diff-list li {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fbfaf7;
}

.diff-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--muted);
  word-break: break-all;
}

.diff-values {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--ink);
  white-space: pre-wrap;
  text-align: right;
  flex-shrink: 0;
}

.diff-changed .diff-values {
  color: #8a5a00;
}

.diff-added .diff-values {
  color: #1e6b1e;
}

.diff-removed .diff-values {
  color: #912c2c;
}

.merge-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 720px) {
  .hero {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .dashboard-item {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "handle content actions"
      ". content .";
  }

  .dashboard-item .drag-handle {
    grid-area: handle;
  }

  .dashboard-item > div:not(.item-actions) {
    grid-area: content;
  }

  .dashboard-item .item-actions {
    grid-area: actions;
  }

  .dashboard-item .badge {
    display: none;
  }

  .compare-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "handle title actions"
      ". details actions"
      ". choice ."
      ". diff diff";
  }

  .compare-row .compare-handle {
    grid-area: handle;
  }

  .compare-row .compare-title-cell {
    grid-area: title;
  }

  .compare-row .compare-details-cell {
    grid-area: details;
  }

  .compare-row .compare-choice-cell {
    grid-area: choice;
  }

  .compare-row .compare-actions-cell {
    grid-area: actions;
  }

  .compare-row .compare-diff-cell {
    grid-area: diff;
  }

  .choice {
    justify-content: flex-start;
  }
}
