:root {
  color-scheme: light dark;
  --bg: #f4f2eb;
  --panel: #fffef9;
  --ink: #202d35;
  --muted: #5b696e;
  --line: #d6dbd5;
  --accent: #16635c;
  --soft: #e0ede5;
  --warn: #a14b25;
  font-family: Inter, "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
body.dark {
  --bg: #16242b;
  --panel: #1e3038;
  --ink: #edf0e9;
  --muted: #b5c2c4;
  --line: #496069;
  --accent: #9fd4bc;
  --soft: #284b47;
  --warn: #ffc398;
  color-scheme: dark;
}
body.large {
  font-size: 1.25rem;
}
header,
main,
footer {
  max-width: 1720px;
  margin: auto;
  padding: 24px 36px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
h1 {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -1px;
  margin: 8px 0;
}
h1 span {
  font:
    13px ui-monospace,
    monospace;
  letter-spacing: 0;
  color: var(--muted);
}
h2 {
  font-size: clamp(23px, 2.2vw, 34px);
  font-weight: 550;
  line-height: 1.45;
  letter-spacing: -0.8px;
}
h3 {
  font-size: 1.05em;
  font-weight: 650;
}
p {
  line-height: 1.75;
}
.eyebrow {
  font:
    12px ui-monospace,
    monospace;
  letter-spacing: 2px;
  color: var(--accent);
}
.intro {
  display: flex;
  gap: 40px;
  justify-content: space-between;
  align-items: center;
}
.intro > p {
  max-width: 260px;
  color: var(--muted);
  font-size: 14px;
}
.tools,
.loadbar,
.view-tools {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
button,
select,
input,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 12px;
  max-width: 100%;
}
button,
select {
  cursor: pointer;
}
button:hover,
button[aria-current="page"],
button.active {
  border-color: var(--accent);
  background: var(--soft);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
svg [tabindex]:focus-visible {
  outline: 3px solid var(--warn);
  outline-offset: 3px;
}
label {
  display: flex;
  gap: 6px;
  flex-direction: column;
  font-size: 0.85em;
  color: var(--muted);
}
input[type="file"] {
  max-width: 230px;
  font-size: 12px;
}
input[type="range"] {
  width: 100px;
  padding: 0;
  accent-color: var(--accent);
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
input[type="number"] {
  width: 110px;
}
#message {
  min-height: 1.4em;
  color: var(--warn);
  font-size: 0.9em;
  margin: 12px 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin-bottom: 24px;
  background: var(--panel);
}
.stat {
  padding: 16px 22px;
  border-right: 1px solid var(--line);
}
.stat small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}
.stat strong {
  font:
    20px ui-monospace,
    monospace;
}
nav {
  display: flex;
  gap: 4px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  margin: 20px 0;
}
nav button {
  white-space: nowrap;
  border-radius: 0;
  border: 0;
  background: none;
  padding: 14px 18px;
  font-size: 14px;
}
nav button[aria-current="page"] {
  border-bottom: 3px solid var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: 210px minmax(260px, 1fr) minmax(340px, 1fr);
  background: var(--panel);
  border: 1px solid var(--line);
}
aside {
  border-right: 1px solid var(--line);
  padding: 18px;
  min-width: 0;
}
aside label {
  margin: 16px 0;
}
#tree {
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
#object-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 440px;
  overflow: auto;
}
#object-list button {
  text-align: left;
  font-size: 12px;
}
#object-list small {
  display: block;
  color: var(--muted);
}
.scene {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}
.view-tools {
  gap: 12px;
  align-items: flex-start;
  font-size: 12px;
}
.view-tools label {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}
svg {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg);
  margin: 20px 0;
  border: 1px solid var(--line);
}
svg .shape {
  fill: #a5c6b8;
  stroke: #416b63;
  stroke-width: 1.3;
  cursor: pointer;
}
svg .selected {
  fill: #dda66f;
  stroke: #954b23;
  stroke-width: 2;
}
svg .opening {
  fill: var(--bg);
  stroke: var(--warn);
  stroke-dasharray: 4 3;
  pointer-events: none;
}
svg text {
  fill: var(--ink);
  font:
    12px ui-monospace,
    monospace;
}
#scene-caption {
  font:
    13px ui-monospace,
    monospace;
  line-height: 1.7;
}
.details {
  padding: 20px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.details h2 {
  font-size: 24px;
  margin-top: 0;
}
.details dl {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  font-size: 13px;
}
.details dt {
  color: var(--muted);
}
.details dd {
  margin: 0;
}
.table-wrap {
  overflow: auto;
  max-width: 100%;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    12px/1.7 ui-monospace,
    monospace;
  padding: 12px;
  background: var(--bg);
  max-height: 360px;
  overflow: auto;
}
summary {
  cursor: pointer;
  color: var(--accent);
  padding: 8px 0;
  font-size: 0.85em;
}
.quiet {
  color: var(--muted);
  font-size: 12px;
}
.reading {
  max-width: 780px;
  padding: 20px 0 40px;
  margin: auto;
}
.reading h3 {
  margin-top: 36px;
}
.diagnostics {
  margin: 24px 0;
  padding: 18px;
  border-top: 1px solid var(--line);
}
.badge {
  display: inline-block;
  padding: 3px 7px;
  background: var(--soft);
  font:
    11px ui-monospace,
    monospace;
  border-radius: 3px;
}
.badge.FAIL {
  background: #f2d6c7;
  color: #66311c;
}
.badge.UNDETERMINED {
  background: #eee0b8;
  color: #59451d;
}
footer {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
a {
  color: var(--accent);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 190px 1fr;
  }
  .details {
    grid-column: 1/-1;
    border-top: 1px solid var(--line);
  }
  .scene {
    border-right: 0;
  }
}
@media (max-width: 640px) {
  header,
  main,
  footer {
    padding: 18px 16px;
  }
  header {
    align-items: flex-start;
    gap: 12px;
  }
  .tools {
    gap: 4px;
    justify-content: flex-end;
  }
  .tools button {
    font-size: 11px;
    padding: 7px;
  }
  .intro {
    display: block;
  }
  .intro > p {
    max-width: none;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat {
    padding: 12px;
  }
  .stat strong {
    font-size: 15px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  aside {
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  #tree {
    display: none;
  }
  #object-list {
    flex-direction: row;
    max-height: 120px;
    overflow: auto;
  }
  #object-list button {
    min-width: 140px;
  }
  aside label {
    display: inline-flex;
    max-width: 47%;
    margin: 8px 0;
  }
  .scene {
    padding: 12px;
  }
  h1 {
    font-size: 24px;
  }
  .intro h2 {
    font-size: 25px;
  }
  .loadbar > label {
    width: 100%;
  }
  .loadbar select {
    width: 100%;
  }
  .details {
    padding: 16px;
  }
  .table-wrap {
    margin: 0 -4px;
  }
  .stats .stat:nth-child(2) {
    border-right: 0;
  }
  nav {
    margin-top: 14px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
}
@media print {
  header .tools,
  .loadbar,
  nav,
  .view-tools,
  button {
    display: none !important;
  }
  main > section[hidden] {
    display: block !important;
  }
  body {
    color: #000;
    background: #fff;
  }
  .workspace {
    display: block;
  }
  .details,
  section {
    break-inside: avoid;
  }
  svg {
    max-height: 300px;
  }
  footer {
    margin-top: 24px;
  }
}
svg .shape.void {
  fill: none;
  stroke: var(--warn);
  stroke-dasharray: 4 3;
}
.details table {
  min-width: 470px;
}
.scene {
  align-self: start;
  position: sticky;
  top: 12px;
}
.details td:first-child {
  min-width: 185px;
}
.details td:nth-child(2) {
  min-width: 105px;
}
@media (max-width: 640px) {
  .scene {
    position: static;
    order: 0;
  }
  .workspace aside {
    order: 1;
  }
  .details {
    order: 2;
  }
  .intro {
    margin-bottom: 16px;
  }
  .intro h2 {
    font-size: 23px;
  }
  .intro > p {
    font-size: 12px;
  }
}
.work-panel {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.rule-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 24px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}
.form-grid input:not([type="checkbox"]),
.form-grid select {
  width: 100%;
}
textarea {
  width: 100%;
  font:
    13px/1.5 ui-monospace,
    monospace;
}
.work-panel pre {
  max-width: 650px;
}
.work-panel table {
  min-width: 580px;
}
.work-panel button {
  margin: 6px 3px;
}
#evidence-card {
  margin-top: 24px;
}
@media (max-width: 800px) {
  .rule-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .work-panel {
    padding: 16px;
  }
  .panel-heading {
    display: block;
  }
}
@media (max-width: 400px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
.interpretation {
  max-width: 780px;
  margin: 32px auto 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.interpretation p {
  line-height: 1.9;
}
.interpretation input[type="range"] {
  width: 100%;
}
output {
  display: block;
  font:
    18px ui-monospace,
    monospace;
  padding: 16px 0;
}
body.dark footer img {
  content: url("aileelab-wordmark-dark.svg");
}
@media print {
  body.dark {
    --bg: #fff;
    --panel: #fff;
    --ink: #000;
    --muted: #333;
    --line: #ccc;
    --accent: #000;
    --soft: #eee;
  }
  body.dark footer img {
    content: url("aileelab-wordmark.svg");
  }
}
svg .shape.space {
  fill: none;
  stroke: var(--accent);
  stroke-dasharray: 3 6;
  stroke-width: 0.7;
  pointer-events: stroke;
}
.stat {
  min-width: 0;
  overflow-wrap: anywhere;
}
svg .shape.occluder {
  fill-opacity: 0.12;
  stroke-opacity: 0.25;
}
svg .selection-outline {
  pointer-events: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}
.decision {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  margin: 18px 0;
}
.rule-sentence {
  font-size: 1.08em;
  line-height: 1.8;
}
#rule-preview {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
}
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.record-table table,
.value-table table {
  width: 100%;
  table-layout: fixed;
}
.record-table td,
.value-table td {
  overflow-wrap: anywhere;
}
#overview-content .quiet {
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .overview-grid {
    display: block;
  }
  .value-table table,
  .value-table tbody,
  .value-table tr,
  .value-table td {
    display: block;
  }
  .value-table thead {
    display: none;
  }
  .value-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: bold;
    color: var(--muted);
  }
  .value-table tr {
    border-bottom: 2px solid var(--line);
    margin-bottom: 16px;
  }
}
@media print {
  .raw-view {
    display: none;
  }
}
.work-panel .value-table table,
.work-panel .record-table table,
.rule-layout table,
.overview-grid table {
  min-width: 0;
  table-layout: fixed;
}
.rule-layout td,
.overview-grid td {
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  #inspection-results table,
  #inspection-results tbody,
  #inspection-results tr,
  #inspection-results td {
    display: block;
    min-width: 0;
  }
  #inspection-results thead {
    display: none;
  }
  #inspection-results td::before {
    content: attr(data-label);
    display: block;
    font-weight: bold;
    color: var(--muted);
  }
  #inspection-results tr {
    border-bottom: 2px solid var(--line);
  }
}
.property-record {
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--line);
}
.property-record h4 {
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.details .property-record table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}
.details .property-record td {
  min-width: 0;
  overflow-wrap: anywhere;
}
.details .property-record td:first-child {
  width: 30%;
}
.details .property-record pre {
  max-width: 100%;
}
.decision .table-wrap table {
  min-width: 0;
  table-layout: fixed;
}
.decision td {
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .decision .table-wrap table,
  .decision .table-wrap tbody,
  .decision .table-wrap tr,
  .decision .table-wrap td {
    display: block;
  }
  .decision .table-wrap thead {
    display: none;
  }
  .decision .table-wrap td::before {
    content: attr(data-label);
    display: block;
    font-weight: bold;
    color: var(--muted);
  }
}
