/* ================================================================
   서울역 업무 지식 아카이브 v2 — 스타일시트
   라이트/다크 테마, PC/모바일 반응형, 인쇄 최적화
   ================================================================ */

:root {
  --bg: #f4f6fa;
  --bg-card: #ffffff;
  --bg-sub: #eef1f6;
  --bg-inset: #f8fafc;
  --text: #1e293b;
  --text-sub: #64748b;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-text: #1d4ed8;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --green: #059669;
  --green-soft: #d1fae5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, .16);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 56px;
  --tabbar-h: 62px;
  --sidebar-w: 264px;
  --font-scale: 1;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-card: #131c2e;
  --bg-sub: #1a2438;
  --bg-inset: #0f1728;
  --text: #e2e8f0;
  --text-sub: #94a3b8;
  --text-faint: #64748b;
  --border: #26334d;
  --border-strong: #395075;
  --accent: #3b82f6;
  --accent-soft: #1e3a5f;
  --accent-text: #7cb0ff;
  --purple: #a78bfa;
  --purple-soft: #312350;
  --rose: #fb7185;
  --rose-soft: #4a1c28;
  --amber: #fbbf24;
  --amber-soft: #443110;
  --green: #34d399;
  --green-soft: #103828;
  --red: #f87171;
  --red-soft: #451717;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: calc(16px * var(--font-scale)); scroll-behavior: smooth; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
img, svg, iframe { max-width: 100%; }
a { color: var(--accent-text); }
button { font-family: inherit; cursor: pointer; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- 레이아웃 ---------- */
#app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
#app-header .brand {
  display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .95rem;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
#app-header .brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 15px; flex: none;
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  min-width: 44px; min-height: 44px; border: none; background: transparent; border-radius: 12px;
  color: var(--text-sub); font-size: 18px; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg-sub); color: var(--text); }

#search-box { position: relative; flex: 1; max-width: 420px; }
#search-input {
  width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-sub); color: var(--text); padding: 0 14px 0 36px; font-size: .88rem;
  outline: none;
}
#search-input:focus { border-color: var(--accent); background: var(--bg-card); }
#search-box .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
#search-results {
  position: absolute; top: 46px; left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); display: none; z-index: 70;
}
#search-results.open { display: block; }
.sr-item { display: block; width: 100%; text-align: left; padding: 11px 14px; border: none; background: none; color: var(--text); border-bottom: 1px solid var(--border); }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item:focus { background: var(--bg-sub); }
.sr-item .sr-sec { font-size: .7rem; color: var(--text-faint); display: block; }
.sr-item mark { background: var(--amber-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

#sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg-card); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 14px 10px 30px; z-index: 50;
}
.nav-group-label { font-size: .68rem; font-weight: 800; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 5px; }
.nav-link {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 12px; min-height: 40px; border: none; background: none; border-radius: 10px;
  color: var(--text-sub); font-size: .86rem; font-weight: 600; text-decoration: none;
}
.nav-link:hover { background: var(--bg-sub); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 800; }
.nav-link .nl-ic { width: 20px; text-align: center; flex: none; }

#main {
  margin-left: var(--sidebar-w); padding: calc(var(--header-h) + 20px) 24px 80px;
  max-width: 1060px;
}
#tabbar { display: none; }

@media (min-width: 901px) {
  body.sidebar-collapsed #sidebar { display: none; }
  body.sidebar-collapsed #main { margin-left: 0; max-width: 1200px; }
}

@media (max-width: 900px) {
  #sidebar { display: none; }
  #sidebar.mobile-open {
    display: block; width: min(82vw, 300px); box-shadow: var(--shadow-lg);
  }
  #sidebar-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 49; display: none; }
  #sidebar-backdrop.show { display: block; }
  #main { margin-left: 0; padding: calc(var(--header-h) + 14px) 14px calc(var(--tabbar-h) + 30px); }
  #app-header .brand span.brand-text { display: none; }
  #tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--bg-card) 92%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); z-index: 60;
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: none; background: none; color: var(--text-faint); font-size: .62rem; font-weight: 700;
    text-decoration: none; min-height: 44px;
  }
  .tab-item .tb-ic { font-size: 19px; }
  .tab-item.active { color: var(--accent-text); }
}

/* ---------- 공통 컴포넌트 ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.card h3 { font-size: 1rem; font-weight: 800; }
.card .sub { color: var(--text-sub); font-size: .82rem; }
.page-title { font-size: 1.45rem; font-weight: 900; letter-spacing: -.02em; margin-bottom: 4px; }
.page-desc { color: var(--text-sub); font-size: .88rem; margin-bottom: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: .7rem; font-weight: 800; background: var(--bg-sub); color: var(--text-sub);
  border: 1px solid var(--border);
}
.chip.blue { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip.rose { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.chip.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.chip.purple { background: var(--purple-soft); color: var(--purple); border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 9px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: .86rem; font-weight: 700;
  text-decoration: none;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-sub); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: .78rem; border-radius: 10px; }

.seg { display: inline-flex; background: var(--bg-sub); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: none; background: none; padding: 8px 14px; min-height: 40px; border-radius: 9px;
  font-size: .8rem; font-weight: 700; color: var(--text-sub);
}
.seg button.active { background: var(--accent); color: #fff; }

.tip-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tip-list li {
  display: flex; gap: 9px; align-items: flex-start; font-size: .86rem;
  background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.tip-list li .tick { color: var(--green); flex: none; margin-top: 1px; }
.tip-list li.bad .tick { color: var(--red); }
.tip-list li.warn .tick { color: var(--amber); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* 용어 툴팁 */
.term {
  border-bottom: 1.5px dotted var(--accent); cursor: help; position: relative; font-weight: 700;
}
.term:hover::after, .term:focus::after {
  content: attr(data-def); position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 40;
  width: max-content; max-width: min(300px, 78vw); background: var(--text); color: var(--bg-card);
  font-size: .74rem; font-weight: 500; line-height: 1.5; padding: 8px 11px; border-radius: 9px;
  box-shadow: var(--shadow-lg); white-space: normal;
}

/* ---------- 유튜브 lite embed ---------- */
.yt-lite {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  background: #000 center/cover no-repeat; border: 1px solid var(--border); cursor: pointer;
  display: block; padding: 0;
}
.yt-lite .yt-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(transparent 60%, rgba(0, 0, 0, .55)); transition: background .2s;
}
.yt-lite:hover .yt-play { background: linear-gradient(rgba(0,0,0,.1) 60%, rgba(0, 0, 0, .6)); }
.yt-lite .yt-play .pbtn {
  width: 64px; height: 44px; background: rgba(220, 38, 38, .92); border-radius: 13px;
  display: grid; place-items: center; color: #fff; font-size: 20px; box-shadow: 0 4px 18px rgba(0,0,0,.4);
}
.yt-lite .yt-title {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px; color: #fff;
  font-size: .8rem; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.8); text-align: left;
}
.yt-lite iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chapter-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* 스틸컷 (오프라인 대비 핵심 장면) */
.stills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.stills[hidden] { display: none; }
.stills img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* 영상 모달 (시어터 모드) */
#video-modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, .88);
  display: none; align-items: center; justify-content: center; padding: 18px;
}
#video-modal.open { display: flex; }
#video-modal .vm-inner { width: min(960px, 100%); }
#video-modal .vm-frame { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 14px; background: #000; }
#video-modal .vm-bar { display: flex; align-items: center; gap: 10px; color: #e2e8f0; margin-bottom: 10px; }
#video-modal .vm-bar h3 { font-size: .95rem; flex: 1; }
#video-modal .vm-next { margin-top: 12px; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
#video-modal .vm-next button {
  flex: none; width: 190px; text-align: left; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 8px; color: #e2e8f0; font-size: .72rem; font-weight: 700;
}
#video-modal .vm-next img { width: 100%; border-radius: 6px; aspect-ratio: 16/9; object-fit: cover; }

/* ---------- 열차 편성도 ---------- */
.train-scroll { overflow-x: auto; padding: 14px 4px; -webkit-overflow-scrolling: touch; }
.train-row { display: flex; align-items: center; gap: 7px; min-width: max-content; padding: 0 6px; }
.train-car {
  width: 74px; min-height: 84px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg-inset); padding: 8px; display: flex; flex-direction: column; justify-content: space-between;
  font-size: .68rem; flex: none; position: relative;
}
.train-car .car-no { font-weight: 900; font-size: .74rem; }
.train-car .car-kind { color: var(--text-faint); font-size: .62rem; }
.train-car.wheel { border-color: var(--accent); background: var(--accent-soft); }
.train-car.wheel .car-kind { color: var(--accent-text); font-weight: 800; }
.train-car.special { border-color: var(--rose); background: var(--rose-soft); }
.train-car.gap { border-style: dashed; opacity: .55; }
.train-car .lift-dot {
  position: absolute; right: 7px; bottom: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft);
}
.train-ev {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .62rem; font-weight: 900; color: var(--green); padding: 0 3px;
}
.train-ev .ev-badge { background: var(--green-soft); border: 1px solid var(--green); padding: 3px 7px; border-radius: 7px; }
.train-compass {
  display: flex; justify-content: space-between; font-size: .7rem; font-weight: 800;
  color: var(--text-sub); padding: 0 8px 6px; border-bottom: 1px dashed var(--border); margin-bottom: 4px;
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .72rem; color: var(--text-sub); margin-top: 10px; }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---------- 지도 ---------- */
.map-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-inset); touch-action: pan-y; }
.map-wrap svg { display: block; width: 100%; height: auto; }
.map-hotspot { cursor: pointer; }
.map-hotspot rect, .map-hotspot circle { transition: all .2s; }
.map-hotspot:hover rect, .map-hotspot.active rect { stroke-width: 3; }
.map-controls { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.route-path { stroke-dasharray: 8 7; animation: dash 1.4s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -30; } }

/* ---------- 쪽지 해부도 ---------- */
.note-paper {
  background: #fffbe8; border: 1px solid #e6d9a8; border-radius: 12px; padding: 18px;
  font-family: "Nanum Pen Script", "Comic Sans MS", cursive, sans-serif; color: #333;
  position: relative; box-shadow: var(--shadow); max-width: 460px; margin: 0 auto;
}
[data-theme="dark"] .note-paper { background: #2e2a1c; border-color: #57503a; color: #eee; }
.note-pin {
  border: 2px solid var(--purple); background: color-mix(in srgb, var(--purple) 12%, transparent);
  border-radius: 8px; padding: 2px 8px; cursor: pointer; font-weight: 900; display: inline-block;
  font-family: inherit; color: inherit; font-size: 1.05rem; min-height: 34px;
}
.note-pin.active { background: var(--purple); color: #fff; }
.note-pin.warn { border-color: var(--red); color: var(--red); }
.note-pin.warn.active { background: var(--red); color: #fff; }

/* ---------- 무전기 ---------- */
.radio-svg-wrap { width: min(260px, 100%); margin: 0 auto; }
.radio-svg-wrap svg { display: block; width: 100%; height: auto; }
.radio-part-btn { cursor: pointer; }
.radio-part-btn rect, .radio-part-btn circle { transition: all .2s; }

/* ---------- 플로우차트 ---------- */
.flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.flow .fstep {
  background: var(--accent-soft); color: var(--accent-text); font-size: .76rem; font-weight: 800;
  border-radius: 10px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 6px;
}
.flow .fstep .fnum {
  background: var(--accent); color: #fff; width: 18px; height: 18px; border-radius: 50%;
  display: inline-grid; place-items: center; font-size: .62rem; flex: none;
}
.flow .farrow { color: var(--text-faint); font-weight: 900; }

/* ---------- 스텝 카드 (시나리오/불일치) ---------- */
.step-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.step-card { background: var(--bg-inset); border: 1px solid var(--border); border-radius: 12px; padding: 13px; font-size: .8rem; }
.step-card .sc-num { font-size: 1.2rem; font-weight: 900; color: var(--accent); }

/* ---------- 체크리스트 ---------- */
.check-item {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px; min-height: 48px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-inset); margin-bottom: 7px;
  cursor: pointer; user-select: none; font-size: .88rem;
}
.check-item input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); flex: none; }
.check-item.done { opacity: .55; text-decoration: line-through; }
.progress-bar { height: 8px; border-radius: 99px; background: var(--bg-sub); overflow: hidden; margin: 8px 0; }
.progress-bar > div { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }

/* ---------- 퀴즈/플래시카드 ---------- */
.quiz-opt {
  display: block; width: 100%; text-align: left; padding: 12px 15px; min-height: 48px; margin-bottom: 8px;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--bg-card);
  font-size: .88rem; font-weight: 600; color: var(--text);
}
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt.correct { border-color: var(--green); background: var(--green-soft); }
.quiz-opt.wrong { border-color: var(--red); background: var(--red-soft); }
.flashcard {
  min-height: 190px; border-radius: 18px; border: 1.5px solid var(--border); background: var(--bg-card);
  display: grid; place-items: center; text-align: center; padding: 24px; cursor: pointer;
  font-size: 1.1rem; font-weight: 800; box-shadow: var(--shadow); user-select: none;
}
.flashcard .fc-hint { display: block; font-size: .68rem; color: var(--text-faint); font-weight: 600; margin-top: 10px; }
.flashcard.back { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

/* ---------- 홈 ---------- */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  border-radius: 20px; color: #fff; padding: 26px 24px; margin-bottom: 18px;
}
.hero h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -.02em; }
.hero p { opacity: .92; font-size: .86rem; margin-top: 5px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px;
  text-decoration: none; color: var(--text); min-height: 84px; display: flex; flex-direction: column; gap: 5px;
  box-shadow: var(--shadow);
}
.quick-card:hover { border-color: var(--accent); }
.quick-card .qc-ic { font-size: 21px; }
.quick-card .qc-t { font-weight: 800; font-size: .84rem; }
.quick-card .qc-d { font-size: .7rem; color: var(--text-sub); }

.banner {
  display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 13px 15px;
  font-size: .84rem; font-weight: 600; margin-bottom: 14px; border: 1px solid;
}
.banner.amber { background: var(--amber-soft); border-color: var(--amber); color: var(--text); }
.banner.blue { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- SOS ---------- */
#sos-btn {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 18px); z-index: 65;
  width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--red); color: #fff;
  font-size: .78rem; font-weight: 900; box-shadow: 0 6px 22px rgba(220, 38, 38, .45);
}
@media (min-width: 901px) { #sos-btn { bottom: 24px; } }
#sos-sheet {
  position: fixed; inset: 0; z-index: 90; background: rgba(2, 6, 23, .55); display: none;
  align-items: flex-end; justify-content: center;
}
#sos-sheet.open { display: flex; }
#sos-sheet .sheet {
  background: var(--bg-card); border-radius: 22px 22px 0 0; width: min(560px, 100%);
  max-height: 82vh; overflow-y: auto; padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0px));
}
.sos-item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  border: 1.5px solid var(--red); background: var(--red-soft); border-radius: 14px;
  padding: 14px; margin-bottom: 9px; font-weight: 800; font-size: .9rem; color: var(--text);
}

/* ---------- 표 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tbl th, .tbl td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--text-faint); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 640px) {
  .tbl.resp thead { display: none; }
  .tbl.resp tr { display: block; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 9px; padding: 6px 10px; background: var(--bg-inset); }
  .tbl.resp td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 5px 0; }
  .tbl.resp td::before { content: attr(data-label); font-weight: 800; color: var(--text-faint); font-size: .72rem; }
}

/* ---------- 달력 ---------- */
.cal-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.cal-head select {
  min-height: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-inset); color: var(--text); font-size: .84rem; font-weight: 800; font-family: inherit;
}
.cal-head .btn[disabled] { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cal-cell {
  aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--border); font-size: .68rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--bg-inset);
}
.cal-cell .cd { font-weight: 800; }
.cal-cell .cs { font-size: .58rem; font-weight: 900; padding: 1px 5px; border-radius: 5px; }
.cal-cell.today { border-color: var(--accent); border-width: 2px; }
.cs.day { background: var(--amber-soft); color: var(--amber); }
.cs.night { background: var(--purple-soft); color: var(--purple); }
.cs.off { background: var(--bg-sub); color: var(--text-faint); }
.cs.rest { background: var(--green-soft); color: var(--green); }

/* ---------- 모달 공통 ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 95; background: rgba(2, 6, 23, .55);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-back.open { display: flex; }
.modal-box {
  background: var(--bg-card); border-radius: 18px; padding: 22px; width: min(440px, 100%);
  max-height: 84vh; overflow-y: auto;
}

/* ---------- 접근성 ---------- */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 인쇄 ---------- */
@media print {
  #app-header, #sidebar, #tabbar, #sos-btn, .yt-actions, .no-print, #search-box { display: none !important; }
  #main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; break-inside: avoid; border-color: #bbb; }
  .yt-lite { display: none; }
  a::after { content: " (" attr(href) ")"; font-size: .7em; color: #555; }
  a[href^="#"]::after { content: ""; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
