@font-face {
  font-family: "Noto Sans Local";
  src: url("/fonts/NotoSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Local";
  src: url("/fonts/NotoSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Local";
  src: url("/fonts/NotoSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Local";
  src: url("/fonts/NotoSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader Local";
  src: url("/fonts/Newsreader-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader Local";
  src: url("/fonts/Newsreader-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --fog: #edf2f5;
  --stone: #d8e3ea;
  --panel: rgba(251, 253, 254, 0.92);
  --panel-strong: #ffffff;
  --panel-ink: #102432;
  --muted: #5b6f7f;
  --muted-soft: #7b91a0;
  --line: rgba(16, 36, 50, 0.12);
  --line-strong: rgba(16, 36, 50, 0.22);
  --accent: #2d6f8a;
  --accent-strong: #184f68;
  --accent-soft: rgba(45, 111, 138, 0.12);
  --rust: #b26433;
  --rust-soft: rgba(178, 100, 51, 0.14);
  --exact: #216a57;
  --exact-soft: rgba(33, 106, 87, 0.12);
  --close: #a46a16;
  --close-soft: rgba(164, 106, 22, 0.13);
  --new: #a03f5b;
  --new-soft: rgba(160, 63, 91, 0.12);
  --shadow: 0 24px 70px rgba(20, 43, 61, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans Local", "Noto Sans", "Segoe UI", sans-serif;
  color: var(--panel-ink);
  background:
    radial-gradient(circle at top left, rgba(45, 111, 138, 0.17), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(178, 100, 51, 0.11), transparent 26%),
    linear-gradient(180deg, #f7fafb 0%, var(--fog) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1560px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.8fr);
  gap: 28px;
  align-items: end;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.92), rgba(243, 249, 252, 0.84)),
    linear-gradient(90deg, rgba(45, 111, 138, 0.04), rgba(178, 100, 51, 0.04));
  box-shadow: var(--shadow);
}

.brand-block h1,
.rail-head h2,
.workspace-header h2 {
  margin: 0;
  font-family: "Newsreader Local", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-block h1 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 4vw, 4.9rem);
  line-height: 0.9;
}

.eyebrow,
.rail-label {
  margin: 0 0 10px;
  color: var(--accent-strong);
  letter-spacing: 0.16em;
  font-size: 0.73rem;
  text-transform: uppercase;
}

.topbar-meta {
  display: grid;
  gap: 18px;
}

.topbar-controls {
  display: grid;
  gap: 10px;
  align-content: start;
}

.detail-toggle {
  justify-self: start;
  border: 1px solid rgba(45, 111, 138, 0.18);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  padding: 10px 14px;
}

.topbar-copy,
.dataset-stats,
.summary-value,
.summary-label,
.command-field span,
.command-empty,
.chip-meta,
.result-meta,
.panel-count,
.inspector-note,
.inspector-list,
.empty-panel,
.detail-grid dt,
.detail-grid dd,
.provenance-list,
.selection-inline,
.subtle-text {
  color: var(--muted);
}

.topbar-copy {
  margin: 0;
  max-width: 44ch;
  font-size: 1rem;
  line-height: 1.55;
}

.dataset-stats {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 400px);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.workbench-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.control-rail,
.workspace,
.inspector {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.control-rail {
  display: grid;
  gap: 18px;
  padding: 20px;
  animation: rise-in 360ms ease;
}

.rail-block {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 251, 253, 0.75));
}

.rail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.rail-head h2 {
  font-size: 1.4rem;
  line-height: 1;
}

.command-field {
  display: grid;
  gap: 8px;
}

.command-field input,
.chip-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  color: var(--panel-ink);
  padding: 12px 14px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.command-field input:focus,
.chip-select:focus {
  border-color: rgba(45, 111, 138, 0.45);
  box-shadow: 0 0 0 4px rgba(45, 111, 138, 0.08);
}

.command-results {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.command-results.is-open {
  display: grid;
}

.command-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.command-card.has-warning {
  border-color: rgba(178, 100, 51, 0.26);
}

.command-card:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 111, 138, 0.28);
}

.command-card strong {
  font-weight: 600;
}

.command-card button {
  justify-self: start;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #f8fcfe;
  padding: 8px 12px;
}

.chip-lane {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-card {
  min-width: 250px;
  flex: 1 1 260px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.chip-card.has-warning {
  border-color: rgba(178, 100, 51, 0.28);
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.92), rgba(255, 255, 255, 0.82));
}

.chip-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.chip-title {
  display: grid;
  gap: 4px;
}

.chip-title strong {
  font-size: 0.98rem;
  font-weight: 600;
}

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

.chip-button,
.chip-remove {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 7px 11px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip-remove {
  background: transparent;
  color: var(--muted);
  padding-inline: 0;
}

.chip-warning {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(178, 100, 51, 0.18);
  border-radius: 14px;
  background: rgba(178, 100, 51, 0.08);
  color: var(--panel-ink);
  font-size: 0.9rem;
  line-height: 1.4;
}

.warning-link {
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--rust);
  padding: 0;
  white-space: nowrap;
}

.warning-link-solid {
  padding: 9px 12px;
  background: rgba(178, 100, 51, 0.12);
}

.warning-copy {
  margin: 8px 0 0;
  color: var(--rust);
  line-height: 1.45;
}

.target-card {
  min-width: 100%;
}

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

.summary-block {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(245, 250, 252, 0.78);
}

.summary-action {
  display: grid;
  align-content: start;
  gap: 10px;
}

.compare-button {
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent-strong);
  color: #f4fbfd;
  padding: 12px 16px;
}

.summary-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.summary-value {
  margin: 0;
  line-height: 1.45;
}

.workspace {
  display: grid;
  gap: 18px;
  padding: 22px;
  animation: rise-in 420ms ease;
}

.warning-stack {
  display: none;
  gap: 12px;
}

.warning-stack.is-open {
  display: grid;
}

.selection-warning-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid rgba(178, 100, 51, 0.18);
  border-radius: 18px;
  background: rgba(178, 100, 51, 0.08);
}

.selection-warning-card strong {
  display: block;
  margin-bottom: 6px;
}

.selection-warning-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.workflow-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(246, 251, 253, 0.94), rgba(255, 255, 255, 0.86));
}

.workflow-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.workflow-panel-head h3 {
  margin: 0;
  font-family: "Newsreader Local", Georgia, serif;
  font-size: 1.35rem;
  line-height: 1;
}

.workflow-button {
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--rust-soft);
  color: var(--rust);
  padding: 10px 14px;
}

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

.workflow-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.workflow-card strong {
  font-size: 0.94rem;
}

.workflow-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.workflow-card.is-priority {
  border-color: rgba(160, 63, 91, 0.22);
  background: linear-gradient(180deg, rgba(160, 63, 91, 0.08), rgba(255, 255, 255, 0.86));
}

.workflow-card.is-anchor {
  border-color: rgba(164, 106, 22, 0.2);
}

.workflow-card.is-covered {
  border-color: rgba(33, 106, 87, 0.18);
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.workspace-header h2 {
  font-size: 1.7rem;
  line-height: 1;
}

.workspace-summary {
  max-width: 36ch;
  margin: 0;
  text-align: right;
  color: var(--muted);
}

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

.result-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  overflow: hidden;
}

.result-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.result-panel-head h3 {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.exact-panel .result-panel-head h3,
.status-exact {
  color: var(--exact);
}

.close-panel .result-panel-head h3,
.status-close {
  color: var(--close);
}

.new-panel .result-panel-head h3,
.status-new {
  color: var(--new);
}

.panel-count {
  font-size: 0.86rem;
  font-weight: 600;
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-row {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid rgba(16, 36, 50, 0.08);
  background: transparent;
  text-align: left;
  transition: background-color 140ms ease, transform 140ms ease;
}

.result-row:hover,
.result-row.is-active {
  background: rgba(45, 111, 138, 0.06);
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.phonetic-text {
  font-family: "Noto Sans Local", "Noto Sans", sans-serif;
  font-variant-ligatures: none;
  letter-spacing: 0;
}

.segment-symbol {
  font-size: 1.7rem;
  line-height: 1;
}

.normalized-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16, 36, 50, 0.06);
  color: var(--panel-ink);
  font-size: 0.82rem;
}

.result-meta {
  font-size: 0.88rem;
  line-height: 1.45;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-pill.status-exact {
  background: var(--exact-soft);
}

.status-pill.status-close {
  background: var(--close-soft);
}

.status-pill.status-new {
  background: var(--new-soft);
}

.status-excluded,
.status-pill.status-excluded {
  color: var(--muted-soft);
}

.status-pill.status-excluded {
  background: rgba(16, 36, 50, 0.08);
}

.excluded-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 251, 253, 0.72);
}

.excluded-panel summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
}

.excluded-panel summary::-webkit-details-marker {
  display: none;
}

.result-list-compact .result-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.inspector {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 16px;
  padding: 16px;
  min-height: 72vh;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.inspector-tab {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  padding: 10px 12px;
}

.inspector-tab.is-active {
  border-color: rgba(45, 111, 138, 0.3);
  background: rgba(45, 111, 138, 0.1);
  color: var(--accent-strong);
}

.inspector-tab.is-hidden {
  display: none;
}

.inspector-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  animation: fade-slide 180ms ease;
}

.inspector-panel.is-hidden {
  display: none;
}

.inspector-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
}

.inspector-card h3,
.inspector-card h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.inspector-note,
.empty-panel {
  margin: 0;
  line-height: 1.55;
}

.detail-grid {
  margin: 0;
  display: grid;
  gap: 8px;
}

.detail-grid div {
  display: grid;
  gap: 3px;
}

.detail-grid dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.detail-grid dd {
  margin: 0;
  line-height: 1.45;
}

.inspector-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inspector-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(16, 36, 50, 0.04);
  font-size: 0.83rem;
}

.inspector-segment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.inspector-segment {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(247, 251, 253, 0.92);
}

.inspector-segment strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.provenance-list {
  display: grid;
  gap: 10px;
}

.provenance-source {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(247, 251, 253, 0.9);
}

.command-empty,
.empty-list {
  padding: 6px 0;
  font-size: 0.94rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

  .inspector,
  .control-rail {
    position: static;
  }
}

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

  .brand-block h1 {
    max-width: 15ch;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1560px);
    padding-top: 12px;
  }

  .control-rail,
  .workspace,
  .inspector,
  .topbar {
    border-radius: 20px;
  }

  .rail-summary,
  .inspector-tabs {
    grid-template-columns: 1fr;
  }

  .chip-card {
    min-width: 100%;
  }

  .workspace-header {
    align-items: start;
    flex-direction: column;
  }

  .selection-warning-card,
  .chip-warning {
    flex-direction: column;
  }

  .workflow-panel-head {
    align-items: start;
    flex-direction: column;
  }

  .workspace-summary {
    text-align: left;
  }
}
