/* 모듈 2 Code선 — 지하 환승 통로 · 관제실 (짙은 청록 타일 + 관제 화면) */
:root {
  --tile: #0B2F2B;
  --tile-line: #ffffff10;
  --screen: #061917;
  --bezel: #1E4A44;
  --ink: #E3F4F0;
  --muted: #A9C9C2;
  --teal: #138A7E;
  --teal-hi: #41D3BC;
  --amber: #FFB547;
  --red: #FF7A6B;
  --green: #5BE38F;
  --opus: #1F3A68;
  --sonnet: #D9A21B;
  --enamel: #F7F5EF;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
a { overflow-wrap: anywhere; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font-family: "Pretendard Variable", Pretendard, system-ui, sans-serif; font-weight: 500; line-height: 1.65; font-size: 16px; overflow-x: hidden;
  background-color: var(--tile);
  background-image: linear-gradient(var(--tile-line) 2px, transparent 2px), linear-gradient(90deg, var(--tile-line) 2px, transparent 2px);
  background-size: 56px 28px; }
a { color: var(--teal-hi); }
code { font-family: var(--mono); font-size: .88em; background: #ffffff14; padding: 1px 5px; border-radius: 3px; color: #C8FFF4; word-break: break-all; }
strong { color: #fff; font-weight: 800; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--teal-hi); color: #000; padding: 8px 12px; z-index: 9; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 3px; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; border: 2px solid transparent; }
.btn-teal { background: var(--teal-hi); color: #04211D; }
.btn-teal:hover { background: #7BE6D5; }
.btn-wire { background: transparent; color: var(--ink); border-color: var(--teal-hi); }
.btn-wire:hover { background: #41d3bc22; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }

.lamp { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; vertical-align: -1px; }
.lamp-live { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1.6s infinite; }
.lamp-warn { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.lamp-plan { background: #7DB8FF; box-shadow: 0 0 8px #7DB8FF; }
.lamp-ok { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.lamp-go { background: var(--green); box-shadow: 0 0 8px var(--green); }
.lamp-off { background: #2B3E3B; box-shadow: inset 0 0 0 2px #456; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .lamp-live { animation: none; } }

/* 관제실 머리 */
.ctrl { background: #041311; border-bottom: 4px solid var(--teal); }
.ctrl-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--bezel); }
.ctrl-id { margin: 0; font-family: var(--mono); font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--teal-hi); }
.ctrl-clock { margin: 0; font-family: var(--mono); color: var(--muted); }
.ctrl-clock b { color: var(--amber); font-size: 20px; }
.ctrl-links { display: flex; gap: 8px; flex-wrap: wrap; }
.ctrl-hero { max-width: 1160px; margin: 0 auto; padding: 22px 16px 20px; }
.ctrl-when { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 14px; }
.ctrl-hero h1 { margin: 6px 0; font-size: clamp(28px, 5.4vw, 48px); line-height: 1.2; font-weight: 900; }
.ctrl-unit { margin: 0; color: var(--teal-hi); font-weight: 700; }

main { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.mon-h { font-size: 19px; margin: 0 0 10px; font-weight: 900; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-family: inherit; }
.mon-h::before { content: "▍"; color: var(--teal-hi); }
.mon-h small { font-size: 14px; color: var(--muted); font-weight: 600; }

/* 환승 안내 = 법랑 표지판 */
.transfer { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; margin: 24px 0; align-items: start; }
.enamel { background: var(--enamel); color: #1E2826; border-radius: 6px; padding: 16px 18px; box-shadow: 0 0 0 4px #ffffff22, 0 8px 18px #0006; }
.enamel a { color: #0B5E55; font-weight: 800; }
.enamel strong { color: #0B5E55; }
.enamel h2 { margin: 6px 0; font-size: 18px; }
.enamel p { margin: 0 0 8px; }
.enamel-arrow { font-weight: 900; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 13px; font-weight: 900; }
.dot-w { background: #B13C17; } .dot-c { background: #0B6E64; }
.transfer-map { background: var(--screen); border: 3px solid var(--bezel); border-radius: 8px; padding: 10px; color: var(--muted); }
.minimap { width: 100%; }

/* 관제 수칙 */
.rules-mon { background: #2A1D0A; border: 3px solid var(--amber); border-radius: 8px; padding: 12px 16px; margin: 24px 0; }
.rules-mon h2 { margin: 0 0 6px; font-size: 18px; color: var(--amber); display: flex; align-items: center; gap: 8px; }
.rules-mon ul { margin: 0; padding-left: 20px; }
.rules-mon li { margin: 4px 0; }
.rules-mon strong { color: #FFE2B0; }

/* 관제 입력 */
.input-mon { background: var(--screen); border: 3px solid var(--bezel); border-radius: 8px; padding: 14px; margin: 24px 0; }
.in-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.in-wide { grid-column: 1 / -1; }
.in-row label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--teal-hi); }
.in-row input, textarea { width: 100%; min-width: 0; background: #020B0A; color: #fff; border: 1px solid var(--teal); border-radius: 3px; padding: 10px 12px; font: inherit; font-size: 16px; }
textarea { font-size: 15px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #8FB1AA; opacity: 1; }
.in-row input:focus, textarea:focus { outline: none; border-color: var(--teal-hi); box-shadow: 0 0 0 3px #41d3bc33; }

/* 선로도 */
.track-mon { margin: 24px 0 8px; }
.track-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.stamp-count { margin: 0; font-family: var(--mono); color: var(--green); font-weight: 700; }
.route { overflow-x: auto; background: var(--screen); border: 3px solid var(--bezel); border-radius: 8px; padding: 12px 8px 8px; -webkit-overflow-scrolling: touch; }
.route-list { list-style: none; margin: 0; padding: 0; display: flex; min-width: max-content; position: relative; }
.route-list::before, .route-list::after { content: ""; position: absolute; left: 44px; right: 44px; height: 3px; background: var(--teal); }
.route-list::before { top: 17px; } .route-list::after { top: 27px; }
.stn { position: relative; width: 88px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; padding: 4px 2px; }
.stn-dot { width: 40px; height: 26px; border-radius: 3px; background: #0E2F2B; border: 2px solid var(--teal-hi); position: relative; }
.stn-dot::after { content: ""; position: absolute; right: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: #2B3E3B; }
.route-item.is-optional .stn-dot { border-style: dashed; }
.stn-id { font-family: var(--mono); font-weight: 800; font-size: 14px; color: var(--teal-hi); }
.stn-name { font-size: 12px; line-height: 1.3; text-align: center; color: var(--muted); }
.stn.is-stamped .stn-dot::after { background: var(--green); box-shadow: 0 0 6px var(--green); }
.stn.is-current .stn-dot { background: var(--teal-hi); }
.stn.is-current .stn-name { color: #fff; font-weight: 800; }
.zip-line { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.zip-line a { font-weight: 800; }

/* 관제 화면 벽 */
.console { margin: 18px 0 34px; outline: none; }
.mon { background: var(--screen); border: 3px solid var(--bezel); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; position: relative; min-width: 0;
  background-image: repeating-linear-gradient(0deg, #ffffff05 0 1px, transparent 1px 3px); }
.mon-label { margin: 0 0 8px; font-family: var(--mono); font-size: 13px; color: var(--teal-hi); font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: .03em; }
.mon-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; border-color: var(--teal); }
.ch { font-family: var(--mono); font-weight: 800; color: #04211D; background: var(--teal-hi); padding: 2px 10px; border-radius: 3px; }
.mh-title { margin: 6px 0 2px; font-size: clamp(22px, 3.4vw, 30px); line-height: 1.25; font-weight: 900; }
.mh-sub { margin: 0; color: var(--muted); font-size: 14px; }
.opt { color: var(--amber); }
.signal { list-style: none; margin: 0; padding: 8px 12px; display: flex; gap: 14px; background: #020B0A; border-radius: 6px; border: 1px solid var(--bezel); }
.signal li { display: flex; flex-direction: column; align-items: center; font-weight: 800; font-size: 14px; gap: 2px; }
.signal .lamp { width: 18px; height: 18px; }
.signal small { font-size: 11px; color: var(--muted); font-weight: 600; }
.wall { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; }
.sc-prev { margin: 0; color: var(--muted); }
.sc-arrow { margin: 2px 0; color: var(--teal-hi); text-align: center; }
.sc-now { margin: 0; font-weight: 700; color: #fff; }
.kv { margin: 0; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.kv dd { margin: 0; }
.feat { background: #41d3bc26; color: #C8FFF4; padding: 0 5px; border-radius: 3px; font-weight: 800; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.file { display: flex; flex-direction: column; padding: 9px 12px; border: 1px solid var(--teal-hi); border-radius: 3px; text-decoration: none; color: var(--ink); background: #41d3bc12; }
.file:hover { background: #41d3bc2a; }
.file-label { font-weight: 800; }
.file-label::before { content: "⤓ "; color: var(--teal-hi); }
.file-name { font-size: 12px; color: var(--muted); word-break: break-all; }
.mon-note .note, .note { border-left: 3px solid var(--amber); padding-left: 10px; }
.note p { margin: 4px 0; }
.stamp { width: 100%; min-height: 50px; background: #020B0A; color: var(--muted); border: 2px dashed var(--teal); border-radius: 6px; font: inherit; font-family: var(--mono); font-weight: 700; cursor: pointer; margin-bottom: 12px; }
.stamp.is-on { color: #04211D; background: var(--green); border-style: solid; border-color: var(--green); }
.log-steps summary { cursor: pointer; font-family: var(--mono); color: var(--teal-hi); font-weight: 700; min-height: 40px; padding-top: 4px; }
ul, ol { padding-left: 22px; }

.prompt { background: #020B0A; border: 3px solid var(--teal); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.prompt-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; background: #0E2F2B; padding: 6px 6px 6px 12px; }
.prompt-tag { font-family: var(--mono); font-size: 13px; color: var(--teal-hi); font-weight: 700; }
.copy-btn { min-height: 40px; padding: 6px 16px; border: 0; border-radius: 3px; background: var(--teal-hi); color: #04211D; font: inherit; font-weight: 900; cursor: pointer; }
.copy-btn.is-done { background: var(--green); }
.prompt-text { margin: 0; padding: 14px 14px 14px 34px; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 14.5px; line-height: 1.75; color: #E9FFFA; position: relative; }
.prompt-text::before { content: ">"; position: absolute; left: 14px; top: 14px; color: var(--teal-hi); font-weight: 900; }
.ph { background: #ffb54733; color: #FFE2B0; border-bottom: 2px solid var(--amber); padding: 0 2px; }
.ph.is-filled { background: #5be38f26; color: #C9FAD9; border-bottom-color: var(--green); }
.ph-free { background: #ffffff1a; color: #fff; border-bottom: 2px dotted #fff; }

.mbadge { display: inline-block; font-size: 12px; font-weight: 900; padding: 2px 10px; border-radius: 3px; margin-right: 4px; }
.mbadge-opus { background: var(--opus); color: #fff; box-shadow: 0 0 0 1px #7E9BD1; }
.mbadge-sonnet { background: var(--sonnet); color: #1C1A12; }
.mbadge-none { background: #23403C; color: var(--ink); }

.minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mini-ok { border-color: #2E7D57; }
.mini-warn { border-color: #8A6420; }
.mini ul { margin: 0; }
.cn-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.tbl { overflow-x: auto; }
.tbl table { border-collapse: collapse; }
.tbl td, .tbl th { border: 1px solid var(--bezel); padding: 6px 8px; font-size: 14px; }

.log { background: var(--screen); border: 3px solid var(--bezel); border-radius: 8px; padding: 14px; margin: 34px 0; }
.log-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.log-grid label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: var(--muted); min-width: 0; }
.log-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.save-msg { color: var(--green); font-size: 14px; }

.rules-all { margin: 34px 0; background: #031210cc; border-left: 6px solid var(--teal-hi); padding: 12px 16px; border-radius: 4px; }
.rules-all ol { margin: 0; }
.rules-all li { margin: 6px 0; }
.faq { margin: 34px 0; }
.qa { background: var(--screen); border: 2px solid var(--bezel); border-radius: 6px; margin-bottom: 8px; padding: 0 14px; }
.qa summary { cursor: pointer; font-weight: 800; padding: 10px 0; min-height: 44px; }
.qa p { margin: 0 0 12px; color: var(--ink); }
.foot { background: #041311; border-top: 4px solid var(--teal); }
.foot p { margin: 0; text-align: center; padding: 18px 16px 30px; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .transfer, .wall, .log-grid { grid-template-columns: minmax(0, 1fr); }
  .minis { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .in-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dd { margin-bottom: 6px; }
  .signal { width: 100%; justify-content: space-around; }
}
