/* =====================================================================
 *  styles.css — Smart Elevator Nudge UX
 *  "Obsidian Console" — 프리미엄 다크 관제 테마
 *  (글래스모피즘 · 딥블랙 팔레트 · 플래티넘/골드 포인트 · 소프트 글로우)
 * ===================================================================== */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #162134;
  --bg-2: #223048;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-grad-a: rgba(255, 255, 255, 0.07);
  --panel-grad-b: rgba(255, 255, 255, 0.025);
  --panel-solid: #1a2435;
  --panel-2: rgba(255, 255, 255, 0.075);
  --line: rgba(170, 196, 224, 0.16);
  --line-strong: rgba(170, 196, 224, 0.28);
  --text: #eef3fa;
  --muted: #9aabc0;
  --accent: #5aa0f0;
  --elev: #5aa0f0;
  --stair: #2fd6a0;
  --warn: #e6b45c;
  --gold: #e9cd94;
  --danger: #f08a8a;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-panel: 0 20px 48px -20px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo",
    "Malgun Gothic", "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  letter-spacing: -0.01em;
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(53, 230, 173, 0.14) 0%, transparent 52%),
    radial-gradient(1000px 680px at 12% 8%, rgba(107, 179, 255, 0.16) 0%, transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(233, 205, 148, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 상단바 ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(27, 39, 60, 0.75), rgba(27, 39, 60, 0.48));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 15px; }
.logo {
  font-size: 26px; width: 48px; height: 48px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--elev), var(--stair));
  border-radius: 14px; color: #06101d; font-weight: 900;
  box-shadow: 0 8px 26px -6px rgba(52, 230, 173, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand h1 {
  font-size: 19px; font-weight: 800; letter-spacing: -0.4px; color: #f2f6fc;
}
.brand p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.topnav { display: flex; gap: 4px; margin-left: auto; margin-right: 16px; }
.topnav a {
  font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 600;
  padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
  transition: color .2s, background .2s, border-color .2s;
}
.topnav a:hover { color: var(--text); background: var(--panel-2); }
.topnav a.active {
  color: #06101d; font-weight: 700;
  background: linear-gradient(145deg, var(--elev), var(--stair));
  box-shadow: 0 6px 18px -6px rgba(52, 230, 173, 0.5);
}
.top-status { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12px; color: var(--muted); font-weight: 500;
  background: var(--panel); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip b { color: var(--text); margin-left: 4px; font-weight: 700; }

/* ---------------- 레이아웃 ---------------- */
.layout {
  display: grid; grid-template-columns: 364px 1fr 344px;
  gap: 18px; padding: 20px; align-items: start;
  max-width: 1760px; margin: 0 auto;
}
.col { display: flex; flex-direction: column; gap: 18px; }
.col-center { position: sticky; top: 86px; }

.panel {
  background: linear-gradient(165deg, var(--panel-grad-a), var(--panel-grad-b));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  box-shadow: var(--shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
}
.panel h2 {
  font-size: 14px; font-weight: 700; margin-bottom: 14px; letter-spacing: -0.2px;
  display: flex; align-items: center; gap: 7px;
}

/* ---------------- 폼 ---------------- */
label { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select, input[type="range"] { width: 100%; }
select {
  margin-top: 6px; padding: 10px 11px; border-radius: var(--radius-sm);
  background: rgba(13, 21, 35, 0.6); color: var(--text);
  border: 1px solid var(--line); font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
select:hover { border-color: var(--line-strong); }
select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 179, 255, 0.18);
}
.ctl { margin-bottom: 15px; }
.ctl-row { display: flex; gap: 8px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 5px; margin-top: 10px;
  border-radius: 999px; background: var(--line-strong);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: linear-gradient(145deg, var(--elev), var(--stair)); cursor: pointer;
  box-shadow: 0 2px 8px -1px rgba(52, 230, 173, 0.6);
}

.subhead {
  display: flex; justify-content: space-between; align-items: center;
  margin: 18px 0 4px; font-size: 12px; color: var(--text); font-weight: 600;
}
.hint { font-size: 11px; color: var(--muted); margin-bottom: 9px; }
.link-btn {
  background: none; border: none; color: var(--accent);
  font-size: 12px; cursor: pointer; font-weight: 600; font-family: inherit;
  transition: opacity .15s;
}
.link-btn:hover { opacity: .75; }

/* ---------------- 정차 그리드 ---------------- */
.stop-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px;
  max-height: 168px; overflow-y: auto; padding: 2px;
}
.stop-cell {
  padding: 8px 0; font-size: 11px; border-radius: 8px; cursor: pointer;
  background: rgba(13, 21, 35, 0.5); color: var(--muted);
  border: 1px solid var(--line); transition: all .14s; font-family: inherit;
}
.stop-cell:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.stop-cell.on {
  background: linear-gradient(145deg, rgba(107, 179, 255, 0.32), rgba(107, 179, 255, 0.16));
  color: #fff; border-color: var(--accent); font-weight: 700;
  box-shadow: 0 4px 14px -6px rgba(107, 179, 255, 0.6);
}

/* ---------------- 액션 버튼 ---------------- */
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.btn {
  padding: 13px; border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; font-weight: 800; color: #06101d; font-family: inherit;
  transition: transform .12s, filter .12s, box-shadow .2s; letter-spacing: -0.2px;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn-elev {
  background: linear-gradient(135deg, #ffd27a, var(--warn));
  box-shadow: 0 10px 24px -10px rgba(255, 196, 87, 0.6);
}
.btn-stair {
  background: linear-gradient(135deg, #5cf0c2, var(--stair));
  box-shadow: 0 10px 24px -10px rgba(52, 230, 173, 0.6);
}
.btn-ghost {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); flex: 1; box-shadow: none;
}
.btn-ghost:hover { border-color: var(--line-strong); }
.btn.flash { animation: flash .4s; }
@keyframes flash { 0% { filter: brightness(1.9); } 100% { filter: brightness(1); } }

/* ---------------- 넛지 카드 ---------------- */
.nudge-card {
  display: flex; gap: 13px; padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); margin-bottom: 15px; align-items: flex-start;
  transition: background .35s, border-color .35s, box-shadow .35s;
}
.nudge-icon { font-size: 24px; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .4)); }
.nudge-head { font-weight: 700; font-size: 14.5px; margin-bottom: 5px; letter-spacing: -0.2px; }
.nudge-msg { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.level-neutral { background: rgba(150, 180, 214, 0.07); }
.level-stair, .level-stair-strong {
  background: linear-gradient(135deg, rgba(52, 230, 173, 0.16), rgba(52, 230, 173, 0.05));
  border-color: rgba(52, 230, 173, 0.4);
}
.level-stair-strong {
  box-shadow: 0 0 0 1px rgba(52, 230, 173, 0.4) inset, 0 12px 30px -14px rgba(52, 230, 173, 0.5);
}
.level-stair .nudge-head, .level-stair-strong .nudge-head { color: var(--stair); }
.level-elevator {
  background: linear-gradient(135deg, rgba(255, 196, 87, 0.14), rgba(255, 196, 87, 0.04));
  border-color: rgba(255, 196, 87, 0.38);
}
.level-elevator .nudge-head { color: var(--warn); }

/* ---------------- 비교 카드 ---------------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.cmp-card {
  background: rgba(13, 21, 35, 0.45); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px; transition: all .25s;
}
.cmp-title { font-size: 11px; color: var(--muted); font-weight: 500; }
.cmp-time { font-size: 28px; font-weight: 800; margin: 5px 0; letter-spacing: -1px;
  font-variant-numeric: tabular-nums; }
.cmp-meta { font-size: 10.5px; color: var(--muted); line-height: 1.45; }
#cardElevator .cmp-time { color: var(--elev); }
#cardStair .cmp-time { color: var(--stair); }
.cmp-card.win { transform: translateY(-3px); }
#cardElevator.win {
  border-color: var(--elev);
  box-shadow: 0 0 0 1px var(--elev) inset, 0 14px 30px -16px rgba(107, 179, 255, 0.6);
}
#cardStair.win {
  border-color: var(--stair);
  box-shadow: 0 0 0 1px var(--stair) inset, 0 14px 30px -16px rgba(52, 230, 173, 0.6);
}

.delta-badge {
  margin-top: 11px; text-align: center; font-size: 13px; font-weight: 800;
  padding: 10px; border-radius: var(--radius-sm); letter-spacing: -0.2px;
}
.delta-badge.stair { background: rgba(52, 230, 173, 0.14); color: var(--stair); }
.delta-badge.elevator { background: rgba(255, 196, 87, 0.14); color: var(--warn); }
.energy-line { margin-top: 11px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.energy-line b { color: var(--stair); font-weight: 700; }

/* ---------------- 통계 ---------------- */
.stat-panel { position: relative; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.stat {
  padding: 10px 4px; border-radius: var(--radius-sm);
  background: rgba(13, 21, 35, 0.4); border: 1px solid var(--line);
}
.stat b {
  display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums; color: var(--stair);
}
.stat span { font-size: 10.5px; color: var(--muted); }

/* ---------------- 승강로 ---------------- */
.panel-shaft { height: calc(100vh - 124px); display: flex; flex-direction: column; }
.shaft-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tag {
  font-size: 11px; color: var(--muted); background: var(--panel-2);
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); font-weight: 500;
}
#shaft {
  flex: 1; width: 100%; border-radius: 12px;
  background:
    radial-gradient(600px 400px at 50% 0%, rgba(107, 179, 255, 0.08), transparent 70%),
    #101b2c;
  border: 1px solid var(--line);
}
.legend {
  display: flex; gap: 15px; flex-wrap: wrap; margin-top: 10px;
  font-size: 11px; color: var(--muted);
}
.legend i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  margin-right: 5px; vertical-align: middle; }
.dot.up { background: var(--warn); }
.dot.down { background: var(--elev); }
.dot.car { background: #5a96dc; }
.dot.open { background: var(--stair); }
.dot.stop { background: var(--warn); border-radius: 1px; }

/* ---------------- 로그 ---------------- */
.panel-log { display: flex; flex-direction: column; }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.log {
  height: 300px; overflow-y: auto; background: rgba(11, 18, 30, 0.55);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  font-family: "Consolas", "D2Coding", ui-monospace, monospace; font-size: 11px; line-height: 1.75;
}
.log-line { white-space: nowrap; }
.log-t { color: #607b9c; }
.log-tag {
  display: inline-block; min-width: 48px; text-align: center;
  padding: 1px 6px; border-radius: 5px; margin: 0 5px; font-size: 10px; font-weight: 600;
  background: rgba(27, 41, 66, 0.8); color: #9fc0e6;
}
.log-hall .log-tag { background: rgba(255, 196, 87, 0.2); color: var(--warn); }
.log-car .log-tag { background: rgba(107, 179, 255, 0.2); color: var(--elev); }
.log-stop .log-tag { background: rgba(150, 180, 214, 0.2); color: #b8cfe6; }
.log-nudge .log-tag, .log-decision .log-tag { background: rgba(52, 230, 173, 0.2); color: var(--stair); }
.log-nudge, .log-decision { color: #cfeee0; }
.log-scan .log-tag { background: rgba(160, 120, 255, 0.2); color: #b39dff; }

.note {
  font-size: 11px; color: var(--muted); line-height: 1.7;
  border-left: 2px solid var(--line-strong); padding-left: 12px;
}

/* ---------------- 반응형 ---------------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .col-center { position: static; }
  .panel-shaft { height: 70vh; }
}

/* ---------------- 스크롤바 ---------------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb {
  background: #2a3b54; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #38506f; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
