:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: #181a18;
  background: #f4f5ef;
  --paper: #fcfdf8;
  --border: #dce0d4;
  --muted: #545c52;
  --screen: #151a19;
  --ink: #edf0e8;
  --lime: #d2f86d;
  --accent: #48691b;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #608522; outline-offset: 3px; }
.viewer :focus-visible { outline-color: var(--lime); }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; }

.shell { width: min(100% - 6rem, 82rem); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--border); }
.masthead-inner { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand, .revision { display: flex; align-items: center; gap: .65rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; letter-spacing: .105em; font-size: .82rem; }
.brand-mark { display: flex; align-items: center; justify-content: center; gap: .16rem; width: 1.9rem; height: 1.9rem; border-radius: .4rem; background: #20251d; }
.brand-mark i { width: .38rem; height: .86rem; background: var(--lime); transform: skewX(-20deg); border-radius: 1px; }
.brand-mark i + i { background: #f4f6ea; }
.revision { color: var(--muted); white-space: nowrap; }
.revision span { width: 1px; height: .8rem; background: #a1a899; }

.intro { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-block: 2.25rem 1.6rem; }
.eyebrow { display: flex; align-items: center; gap: .6rem; margin: 0 0 .5rem; color: var(--accent); font-size: .9rem; font-weight: 750; }
.eyebrow::before { content: ""; width: 1.15rem; height: 2px; background: currentColor; }
h1 { margin: 0; font-size: clamp(3.4rem, 6vw, 6.05rem); line-height: .94; letter-spacing: -.078em; font-weight: 790; }
h1 span { color: #688d27; }
.intro-copy { margin: 0 0 .16rem; color: var(--muted); line-height: 1.65; word-break: keep-all; }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) 19.5rem; gap: 1rem; align-items: stretch; }
.viewer { min-width: 0; overflow: hidden; background: var(--screen); color: var(--ink); border: 1px solid #202725; border-radius: .95rem; display: flex; flex-direction: column; box-shadow: 0 12px 36px #222a2118; }
.viewer-header { display: flex; gap: .25rem; padding: .65rem .8rem; background: #1b211e; border-bottom: 1px solid #343d34; z-index: 1; }
.viewer-header button { padding: .55rem .78rem; min-height: 2.5rem; display: inline-flex; gap: .4rem; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: .42rem; white-space: nowrap; color: #bbc4ba; background: transparent; font-size: .92rem; font-weight: 650; }
.viewer-header button:hover { background: #292f28; color: #fff; }
.viewer-header button[aria-pressed="true"] { color: #182008; background: var(--lime); border-color: #dbfb8e; }
.viewer-header .icon { width: 1.1rem; height: 1.1rem; }
.scene { position: relative; isolation: isolate; flex: 1; min-height: clamp(22rem, 35vw, 33rem); display: grid; place-items: center; background: radial-gradient(ellipse at 50% 44%, #2d3831, #181f1c 68%, #151a19); }
.scene::before { position: absolute; inset: 0; pointer-events: none; content: ""; background-image: linear-gradient(#b0d1b510 1px, transparent 1px), linear-gradient(90deg, #b0d1b510 1px, transparent 1px); background-size: 32px 32px; background-position: center; mask-image: radial-gradient(ellipse, #000 30%, transparent 93%); z-index: -1; }
.scene-status { position: absolute; top: .9rem; left: 1rem; z-index: 1; display: inline-flex; align-items: center; gap: .48rem; color: #dae3d6; font-size: .82rem; font-weight: 650; background: #172019db; border: 1px solid #63705d66; padding: .32rem .54rem; border-radius: .34rem; pointer-events: none; }
.scene-status > span:first-child { width: .38rem; height: .38rem; background: var(--lime); border-radius: 50%; }
.scene canvas { width: 100%; height: 100%; position: absolute; inset: 0; cursor: grab; touch-action: none; }
.scene canvas:active { cursor: grabbing; }
.scene canvas:focus-visible { outline-offset: -3px; }
.viewer-error { color: #e7edde; margin: 1.5rem; padding: .75rem 1rem; background: #252d25; border-radius: .45rem; z-index: 1; }
.module-labels { position: absolute; bottom: .85rem; inset-inline: 1rem; display: flex; justify-content: space-between; pointer-events: none; }
.module-labels > span { display: flex; align-items: center; gap: .45rem; color: #cbd5c8; font-size: .82rem; }
.module-labels b { display: grid; place-items: center; width: 1.38rem; height: 1.38rem; border-radius: .25rem; color: var(--lime); background: #212c1e; border: 1px solid #778759; font: 700 .78rem ui-monospace, monospace; }
.viewer-footer { padding: .45rem .72rem .45rem .95rem; display: flex; justify-content: space-between; align-items: center; gap: .55rem; min-height: 3rem; background: #1b211e; border-top: 1px solid #343d34; }
#orbit-help { display: flex; align-items: center; gap: .45rem; color: #bdc8b9; font-size: .82rem; }
#orbit-help .icon { color: #abd66b; }
.touch-hint { display: none; }
.separator { margin-inline: .28rem; }
.camera-tools { display: flex; align-items: center; gap: .22rem; }
.camera-tools button { min-height: 2rem; min-width: 2rem; display: flex; justify-content: center; align-items: center; gap: .3rem; background: transparent; color: #dce6d7; border: 1px solid #4b574b; border-radius: .35rem; font-size: .8rem; padding: .2rem .4rem; white-space: nowrap; }
.camera-tools button:hover { background: #313d2e; color: white; }
.camera-tools .icon { width: .98rem; height: .98rem; }

.inspector { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: .95rem; background: var(--paper); overflow: hidden; }
.section { padding: 1.17rem 1.1rem; }
.section + .section { border-top: 1px solid var(--border); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.section h2, .section label { font-size: .98rem; font-weight: 760; margin: 0; }
.state-chip { background: #e9f2d7; color: #3d571e; border-radius: .3rem; padding: .23rem .45rem; font-size: .79rem; font-weight: 720; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .18rem; padding: .2rem; border-radius: .53rem; background: #edf0e7; }
.segmented button { min-height: 2.24rem; display: flex; justify-content: center; align-items: center; gap: .35rem; border: 1px solid transparent; border-radius: .38rem; color: #4c5648; background: transparent; font-size: .9rem; font-weight: 670; white-space: nowrap; }
.segmented button:hover { color: #20291c; }
.segmented button[aria-pressed="true"] { background: white; color: #263515; border-color: #dce3d3; box-shadow: 0 1px 2px #222a2010; }
.segmented .icon { width: 1rem; height: 1rem; }
.section-copy { margin: .7rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.55; word-break: keep-all; overflow-wrap: break-word; }
.gap-section output { font: 700 .87rem ui-monospace, SFMono-Regular, monospace; color: var(--accent); }
.gap-section input { width: 100%; height: 1.3rem; margin: 0; accent-color: #526f2c; cursor: ew-resize; }
.range-labels { color: var(--muted); font-size: .81rem; display: flex; justify-content: space-between; }
.detail-section { flex: 1; }
.detail-section .section-heading { margin-bottom: .5rem; }
.layer-list { margin: 0; }
.layer-list div { display: flex; justify-content: space-between; align-items: center; gap: .45rem; min-height: 2.35rem; border-bottom: 1px solid #e8ebe2; }
.layer-list div:last-child { border-bottom: 0; }
.layer-list dt, .layer-list dd { font-size: .86rem; }
.layer-list dt { display: flex; align-items: center; gap: .55rem; font-weight: 690; }
.layer-list dd { color: var(--muted); margin: 0; text-align: right; }
.swatch { display: inline-block; width: .66rem; height: .66rem; flex: none; border: 1px solid #1d29123b; border-radius: .18rem; background: #94a1a4; }
.swatch-cap { background: #d7ddce; }
.swatch-top { background: #85918f; }
.swatch-switch { background: #e3c285; }
.swatch-pcb { background: #488454; }
.swatch-bottom { background: #67716e; }
.swatch-trace { background: #c99c51; }

.specifications { display: grid; grid-template-columns: repeat(4, 1fr); margin: 1rem 0 0; background: var(--paper); border: 1px solid var(--border); border-radius: .75rem; }
.specifications div { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .86rem 1rem; }
.specifications div + div { border-left: 1px solid var(--border); }
.specifications dt { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.specifications dd { margin: 0; font-size: .85rem; white-space: nowrap; }
.specifications b { font: 750 1.03rem ui-monospace, SFMono-Regular, monospace; }
.footnote { color: var(--muted); font-size: .8rem; line-height: 1.5; padding: 1rem 0 1.35rem; }

@media (pointer: coarse) {
  .desktop-hint { display: none; }
  .touch-hint { display: inline; }
}
@media (max-width: 1110px) {
  .shell { width: calc(100% - 3rem); }
  .studio { grid-template-columns: minmax(0, 1fr) 17rem; gap: .75rem; }
  .specifications div { padding-inline: .7rem; }
}
@media (max-width: 825px) {
  .shell { width: calc(100% - 2rem); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .scene { min-height: clamp(20rem, 59vw, 30rem); }
  .inspector { display: grid; grid-template-columns: 1fr 1fr; }
  .section + .section { border-top: 0; }
  #gap-section, #pcb-section { border-left: 1px solid var(--border); }
  .section.detail-section { grid-column: 1 / -1; border-top: 1px solid var(--border); }
  #module-section[hidden] ~ .detail-section { border-top: 0; }
  .layer-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.25rem; }
  .layer-list div:nth-last-child(-n+2) { border-bottom: 0; }
  .specifications div { display: block; }
  .specifications dd { margin-top: .3rem; }
}
@media (max-width: 510px) {
  .masthead-inner { min-height: 3.45rem; }
  .intro { display: block; margin-block: 1.55rem 1.13rem; }
  .intro-copy { margin-top: .7rem; }
  .wide-break { display: none; }
  .viewer-header { justify-content: space-between; gap: .1rem; padding: .45rem .36rem; }
  .viewer-header button { gap: .22rem; padding-inline: .27rem; font-size: .82rem; }
  .viewer-header .icon { width: .88rem; height: .88rem; }
  .scene { min-height: clamp(17.5rem, 68vw, 22rem); }
  .section { padding: .92rem .78rem; }
  .section-copy { font-size: .85rem; }
  .segmented button { padding-inline: .1rem; gap: .16rem; font-size: .84rem; }
  .segmented .icon { width: .9rem; height: .9rem; }
  #orbit-help { font-size: .76rem; }
  #orbit-help > .icon, #reset span { display: none; }
  .viewer-footer { padding-inline: .55rem; }
  .layer-list { column-gap: .8rem; }
  .layer-list dd, .layer-list dt { font-size: .78rem; }
  .layer-list dt { gap: .3rem; }
  .specifications { grid-template-columns: 1fr 1fr; }
  .specifications div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .specifications div:nth-child(odd) { border-left: 0; }
}
@media (max-width: 355px) {
  .viewer-header .icon { display: none; }
  .layer-list { display: block; }
  .layer-list div:nth-last-child(2) { border-bottom: 1px solid #e8ebe2; }
}
