:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-strong: #f0f2f4;
  --ink: #17181c;
  --muted: #69707d;
  --line: #d7dbe0;
  --line-strong: #b8bec8;
  --accent: #b42318;
  --accent-strong: #7a1b13;
  --button-hover: #2b2d33;
  --button-quiet-hover: #eef0f2;
  --teal: #0f766e;
  --gold: #946000;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  background: var(--button-hover);
  border-color: var(--button-hover);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 16px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

.title-note {
  color: var(--muted);
  font-size: clamp(12px, 1.7vw, 15px);
  font-weight: 750;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  min-height: calc(100svh - 128px);
  flex: 1;
}

.input-surface,
.report-surface {
  padding: clamp(18px, 3vw, 34px);
}

.input-surface {
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.report-surface {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-head,
.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-head p,
.report-header p,
.report-root.empty p {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.45;
}

.analyze-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.analyze-form label,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.command-row input {
  min-height: 42px;
  padding: 0 12px;
}

.secondary-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.secondary-actions button,
#copy-json {
  min-height: 36px;
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.secondary-actions button:hover:not(:disabled),
#copy-json:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--button-quiet-hover);
  color: var(--ink);
}

.loading-track {
  position: relative;
  height: 4px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
}

.loading-track[hidden] {
  display: none;
}

.loading-bar {
  position: absolute;
  inset: 0;
  width: 38%;
  background: var(--accent);
  animation: loading-slide 980ms ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(280%);
  }
}

.job-status {
  margin-top: 14px;
  min-height: 42px;
  padding: 11px 12px;
  border-left: 3px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--muted);
  line-height: 1.35;
}

.job-status[data-state="running"] {
  border-left-color: var(--gold);
  color: #604000;
}

.job-status[data-state="complete"] {
  border-left-color: var(--teal);
  color: #0b4f49;
}

.job-status[data-state="failed"] {
  border-left-color: var(--accent);
  color: var(--accent-strong);
}

.report-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.record-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.table-section {
  border: 1px solid var(--line);
  background: #ffffff;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.report-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #ffffff;
}

.report-table th,
.report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.25;
}

.report-table th:last-child,
.report-table td:last-child {
  border-right: 0;
}

.report-table tbody tr:last-child td {
  border-bottom: 0;
}

.report-table th {
  color: var(--muted);
  background: #fbfbf9;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

.table-list {
  margin: 0;
  padding-left: 15px;
  font-weight: 750;
}

.table-list li {
  margin: 0 0 3px;
  overflow-wrap: anywhere;
}

.table-list li:last-child {
  margin-bottom: 0;
}

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

.identity-list li {
  margin: 0 0 7px;
  overflow-wrap: anywhere;
}

.identity-list li:last-child {
  margin-bottom: 0;
}

.identity-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.player-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.player-tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 5px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  background: #fff7f6;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.player-id-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.player-id-text {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.group-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.group-cell strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-id-button,
.copy-group-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
}

.copy-id-button {
  width: 22px;
  height: 22px;
  padding: 0;
}

.copy-group-button {
  flex: 0 0 auto;
  gap: 5px;
  min-height: 26px;
  padding: 0 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.copy-id-button:hover,
.copy-group-button:hover,
.copy-id-button:focus-visible,
.copy-group-button:focus-visible {
  border-color: var(--line-strong);
  background: var(--button-quiet-hover);
  color: var(--ink);
}

.lucide-copy {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.level-label {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.evidence-points {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink);
  font-weight: 750;
}

.evidence-points li {
  margin: 2px 0;
}

.warning-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.warning-list p {
  margin: 0;
}

.site-footer {
  padding: 14px clamp(18px, 4vw, 42px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
  line-height: 1.4;
}

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

  .input-surface {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

}

@media (max-width: 620px) {
  .topbar,
  .section-head,
  .report-header {
    align-items: stretch;
    flex-direction: column;
  }

  .command-row,
  .player-row,
  .evidence-row {
    grid-template-columns: 1fr;
  }

  .record-summary {
    font-size: 14px;
  }
}
