/* 스마트 홈 솔루션 앱 - 스타일 */

:root {
  /* 부천대학교 브랜드 컬러 — 주황 테마 */
  --bg: #f8f4ef;
  --surface: #ffffff;
  --line: #ece3da;
  --text: #241a12;
  --muted: #7a6a5c;
  --primary: #cb5a0f;        /* 주황 (버튼·강조) */
  --primary-dark: #a6470b;   /* 진한 주황 (hover·제목) */
  --primary-soft: #fceadd;   /* 연한 주황 (배경·칩) */
  --accent: #f0a202;
  --danger: #d64545;
  --ok: #2f9e44;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(64, 32, 8, 0.08), 0 1px 2px rgba(64, 32, 8, 0.04);
  --maxw: 880px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕",
    "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 헤더 & 진행바 ---------- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-nav { display: flex; }
.header-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.header-link:hover { border-color: var(--primary); }
.header-link.active { background: var(--primary-soft); border-color: var(--primary); }
.app-header .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header .brand .dot { font-size: 1.2rem; }

.stepbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px 14px;
  display: flex;
  gap: 8px;
}
.stepbar .step {
  flex: 1;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  padding-top: 8px;
  border-top: 3px solid var(--line);
  transition: color .2s, border-color .2s;
}
.stepbar .step.active { color: var(--primary-dark); border-top-color: var(--primary); font-weight: 600; }
.stepbar .step.done { color: var(--primary); border-top-color: var(--primary); }

/* ---------- 레이아웃 ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 160px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 1.25rem; }
.card h3 {
  margin: 24px 0 10px;
  font-size: 1.02rem;
  color: var(--primary-dark);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-soft);
}
.card h3:first-of-type { margin-top: 8px; }
.section-guide { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }

.page-title { font-size: 1.5rem; margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0 0 20px; }

/* ---------- 폼 요소 ---------- */
.field { margin-bottom: 16px; }
.field > label.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 8px;
}
input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
.inline-suffix { display: flex; align-items: center; gap: 8px; }
.inline-suffix input { max-width: 140px; }
.inline-suffix .suffix { color: var(--muted); }

/* 선택형(칩) 버튼 */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.choice-chip:hover { border-color: var(--primary); }
.choice-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* 현재 활동 수준 / 수행도 표 */
.matrix { display: flex; flex-direction: column; gap: 8px; }
.matrix-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdfe;
}
.matrix-row .row-label { flex: 1 1 160px; font-weight: 600; font-size: 0.92rem; }
.matrix-row .choices { flex: 2 1 320px; }

/* 주요구 필터 바 */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.filter-label { font-size: 0.88rem; font-weight: 600; color: var(--primary-dark); }

/* ---------- 공간 아코디언 (양식지 2) ---------- */
.space-block { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.space-head {
  width: 100%;
  text-align: left;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: none;
  padding: 14px 16px;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: inherit;
}
.space-head .count { font-size: 0.8rem; font-weight: 500; color: var(--primary-dark); }
.space-body { padding: 8px 16px 16px; display: none; }
.space-body.open { display: block; }
.task-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 16px 0 8px;
}

/* ---------- 버튼 ---------- */
.actionbar {
  position: fixed;
  bottom: 60px; left: 0; right: 0;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
  z-index: 25;
}

/* 하단 탭바 */
.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
.navtab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  padding: 6px 0;
}
.navtab .navicon { font-size: 1.25rem; line-height: 1; }
.navtab .navlabel { font-size: 0.74rem; font-weight: 600; }
.navtab.active { color: var(--primary-dark); }
.navtab.active .navlabel { font-weight: 700; }
.actionbar .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.btn {
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 스플래시 ---------- */
body.splash-mode .app-header,
body.splash-mode .app-footer,
body.splash-mode .actionbar,
body.splash-mode .bottomnav { display: none !important; }
body.splash-mode main { padding: 0; max-width: 100%; }

.splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  cursor: pointer;
  background: linear-gradient(160deg, #ffe6cf 0%, #fdd9b8 45%, #fbcfa4 100%);
  position: relative;
}
.splash-mid { display: flex; flex-direction: column; align-items: center; }
.splash-icon {
  width: 128px; height: 128px;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(203,90,15,0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
}
.splash-title { font-size: 2.4rem; font-weight: 800; color: var(--primary-dark); margin-top: 26px; }
.splash-sub { font-size: 1rem; font-weight: 700; letter-spacing: 0.35em; color: var(--primary); margin-top: 6px; padding-left: 0.35em; }
.splash-tagline { color: var(--muted); font-weight: 600; margin-top: 14px; }
.splash-touch {
  margin-top: 42px;
  font-size: 1.15rem; font-weight: 700; color: var(--primary-dark);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.splash-ver { position: absolute; bottom: 28px; color: var(--muted); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; }

/* ---------- 더보기 ---------- */
.story-card { padding: 0; overflow: hidden; }
.story-head {
  width: 100%; text-align: left;
  background: #fff; border: none;
  padding: 18px 20px;
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  cursor: pointer; font-family: inherit;
  display: flex; justify-content: space-between; align-items: center;
}
.story-card.open .story-head { border-bottom: 1px solid var(--line); color: var(--primary-dark); }
.story-caret { color: var(--primary); font-weight: 700; }
.story-body { padding: 16px 20px 20px; }
.story-body p { margin: 0 0 12px; line-height: 1.7; color: var(--text); }
.story-body p:first-child { color: var(--primary-dark); font-weight: 700; }
.story-sign { text-align: right; font-weight: 700; color: var(--text); margin-top: 6px; }

.stars { display: flex; gap: 4px; justify-content: center; margin: 6px 0 12px; }
.star {
  background: none; border: none; cursor: pointer;
  font-size: 2rem; line-height: 1; color: #d9dee5; padding: 0 2px;
  font-family: inherit; transition: color .12s, transform .12s;
}
.star:hover { transform: scale(1.1); }
.star.on { color: var(--accent); }

.more-link-card {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 18px;
  cursor: pointer; font-family: inherit;
}
.more-link-card:hover { background: var(--primary-soft); }
.more-link-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.more-link-title { font-weight: 700; }
.more-link-desc { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.more-link-arrow { margin-left: auto; color: var(--muted); font-size: 1.6rem; }

/* 설정 아이콘 카드 */
.setting-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.setting-card.open { border-color: var(--primary); }
.setting-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: none;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.setting-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
  font-weight: 700;
}
.setting-icon.icon-primary { background: var(--primary); }
.setting-icon.icon-gray { background: #8a8078; }
.setting-icon.icon-green { background: #4a9d6d; }
.setting-icon.icon-danger { background: var(--danger); }
.setting-main { display: flex; flex-direction: column; min-width: 0; }
.setting-title { font-weight: 700; color: var(--text); }
.setting-title.danger { color: var(--danger); }
.setting-desc { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.setting-arrow { margin-left: auto; color: var(--muted); font-size: 1.2rem; padding-left: 8px; }
.setting-body { padding: 4px 18px 18px; }
.setting-body p { margin: 0 0 12px; line-height: 1.7; }
.setting-body p:first-child { margin-top: 0; }
.setting-body a { color: var(--primary-dark); }
.copyright-head { color: var(--primary-dark); font-weight: 700; }

/* 평가 기록 목록 */
.record-card {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.record-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
}
.record-main:hover { background: var(--primary-soft); }
.record-top { display: flex; align-items: center; gap: 8px; }
.record-name { font-weight: 700; font-size: 1rem; }
.record-badge {
  font-size: 0.7rem; font-weight: 700;
  color: #fff; background: var(--primary);
  padding: 2px 8px; border-radius: 999px;
}
.record-meta { color: var(--muted); font-size: 0.84rem; margin-top: 4px; }
.record-del {
  flex: 0 0 auto;
  border: none;
  border-left: 1px solid var(--line);
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 16px;
  color: var(--muted);
}
.record-del:hover { background: #fdecec; }

/* 설정 하단 표기 */
.settings-foot { text-align: center; padding: 14px 0 4px; }
.settings-foot-name { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.settings-foot-ver { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

/* ---------- 게임 요소: 성장하는 집 + 홈이 ---------- */
.progress-hero {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, #fff6ec, #ffeede);
  border: 1px solid var(--line);
}
.house-svg { flex: 0 0 auto; }
.house-svg .hpart { animation: pop 0.4s ease; transform-origin: center; }
.ph-msg { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ph-mascot { font-size: 1.8rem; flex: 0 0 auto; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.ph-bubble {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}
.ph-bubble b { color: var(--primary-dark); }
.ph-bubble::before {
  content: ''; position: absolute; left: -7px; top: 16px;
  border: 6px solid transparent; border-right-color: #fff;
}

/* 게임 화면 상단 초기화 버튼 */
.game-topbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.reset-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.reset-chip:hover { border-color: var(--danger); color: var(--danger); }

/* 공간 평가 허브 — 미니 평면도 */
.hub-plan {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "living living"
    "bedroom bath"
    "bedroom entrance";
  gap: 10px;
  margin-top: 12px;
}
.hub-living { grid-area: living; min-height: 96px; }
.hub-bedroom { grid-area: bedroom; min-height: 150px; }
.hub-bathroom { grid-area: bath; }
.hub-entrance { grid-area: entrance; }
.hub-room {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  position: relative;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fbf7f2;
  padding: 14px 10px;
  cursor: pointer;
  font-family: inherit;
  min-height: 84px;
  transition: transform .1s, border-color .1s;
}
.hub-room:hover { border-color: var(--primary); transform: translateY(-1px); }
.hub-room.done { border-color: var(--primary); background: #fdeede; }
.hub-room-icon { font-size: 1.7rem; }
.hub-room-name { font-weight: 700; color: var(--text); }
.hub-room-status { font-size: 0.78rem; color: var(--muted); }
.hub-room-status.lim { color: var(--primary-dark); font-weight: 700; }
.hub-check {
  position: absolute; top: 8px; right: 10px;
  color: #fff; background: var(--primary);
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800;
}
.se-task { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

/* 개인 능력 위저드 (한 질문씩 + 홈스 NPC) */
.pq-top { margin-bottom: 14px; }
.pq-count { font-size: 0.82rem; font-weight: 700; color: var(--primary-dark); }
.pq-progress { height: 8px; background: var(--line); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.pq-progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.3s ease; }
.pq-card { margin-top: 4px; }
.pq-card .choices { gap: 10px; }
.pq-card .choice-chip { padding: 12px 18px; font-size: 0.98rem; }

.npc-row { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0; }
.npc-face { flex: 0 0 auto; font-size: 1.9rem; line-height: 1.1; }
.npc-bubble {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
  line-height: 1.55;
  box-shadow: var(--shadow);
}
.npc-bubble b { color: var(--primary-dark); }
.npc-bubble::before {
  content: ''; position: absolute; left: -7px; top: 14px;
  border: 6px solid transparent; border-right-color: #fff;
}
.npc-tip .npc-bubble { background: #fff8e1; border-color: #ffe082; animation: fadeInUp 0.3s ease; }
.npc-tip .npc-bubble::before { border-right-color: #fff8e1; }

/* 화면 전환 페이드 (D) */
.anim-in { animation: fadeInUp 0.28s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 인트로 ---------- */
.hero { text-align: center; padding: 20px 0 8px; }
.hero .icon { font-size: 3rem; }
.hero h1 { font-size: 1.7rem; margin: 10px 0 6px; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto; }
.flow-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 22px 0; }
.flow-step { background: var(--primary-soft); border-radius: 10px; padding: 14px; text-align: center; }
.flow-step .n { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.flow-step .t { font-weight: 600; margin-top: 8px; font-size: .92rem; }
.flow-step .d { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* ---------- 결과 (솔루션 제안서) ---------- */
/* 사용자 교육 체크리스트 */
.edu-item {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 12px;
  background: #fcfdfe; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; font-family: inherit; font-size: 0.92rem; color: var(--text);
}
.edu-item.done { background: #e6f4ea; border-color: #9bd3ab; }
.edu-check {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 6px;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.8rem;
}
.edu-item.done .edu-check { background: var(--ok); border-color: var(--ok); }
.edu-text { flex: 1; }
.edu-item.done .edu-text { text-decoration: line-through; color: var(--muted); }

/* 주차별 추적 · 전후 비교 */
.track-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.week-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; }
.week-tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-weight: 700; font-size: 0.85rem; padding: 8px 14px; border-radius: 999px;
  cursor: pointer; font-family: inherit;
}
.week-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.track-chart-title { font-weight: 700; color: var(--primary-dark); margin: 16px 0 8px; }
.track-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.8rem; color: var(--muted); }
.track-leg { display: inline-flex; align-items: center; gap: 5px; }

/* 활동별 카드 (모바일 우선) */
.track-item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px; background: #fcfdfe;
}
.track-item.improved { border-color: var(--ok); background: #f0f9f2; }
.track-item-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; }
.track-up { color: var(--ok); font-weight: 800; font-size: 0.82rem; }
.track-cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tcell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tcell-w { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.track-pill {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 30px; padding: 3px 2px; border-radius: 8px;
  font-size: 0.72rem; font-weight: 700; color: #fff; text-align: center;
}
.track-leg .track-pill { width: 16px; min-height: 0; height: 16px; padding: 0; border-radius: 50%; }
.track-pill.lv0 { background: #b7ada0; }
.track-pill.lv1 { background: var(--danger); }
.track-pill.lv2 { background: var(--accent); color: #4a3000; }
.track-pill.lv3 { background: var(--ok); }
.track-pill.lv-empty { background: #f0ece6; color: var(--muted); }

/* 결과 하위 탭 */
.result-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.rtab-btn {
  flex: 1 1 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  text-align: center;
}
.rtab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.rsec-hidden { display: none !important; }

/* 완료 축하 배너 (게임 요소) */
.celebrate {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, #fff1e2, #ffe6cf);
  border: 1.5px solid var(--primary);
}
.celebrate-emoji { font-size: 2.2rem; animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.celebrate-title { font-weight: 800; font-size: 1.15rem; color: var(--primary-dark); }
.celebrate-sub { color: var(--text); font-size: 0.9rem; margin-top: 2px; }

.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 8px 0 4px;
}
.stat {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--primary-dark); }
.stat .lbl { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

/* 스마트 홈 설계도 (평면) */
.floorplan-wrap { margin-top: 8px; }
.floorplan-svg { display: block; width: 100%; max-width: 440px; margin: 0 auto; }
.floorplan-legend { margin-top: 14px; }
.fp-leg-item { padding: 10px 0; border-top: 1px dashed var(--line); }
.fp-leg-item:first-child { border-top: none; }
.fp-leg-room {
  font-weight: 700; color: var(--primary-dark);
  border-left: 4px solid var(--primary); padding-left: 8px; margin-bottom: 4px;
}
.fp-leg-devs { color: var(--text); font-size: 0.92rem; line-height: 1.6; padding-left: 12px; }

.solution-space { margin-bottom: 22px; }
.solution-space > .sp-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
  padding-left: 10px;
  margin: 18px 0 10px;
}
.sol-colhead {
  display: flex;
  justify-content: space-between;
  padding: 0 6px;
  margin: 4px 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.sol-item {
  display: grid;
  grid-template-columns: 1fr auto 1.25fr;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fcfdfe;
}
.sol-item .sol-activity { font-weight: 700; }
.sol-item .sol-task { color: var(--muted); font-size: 0.82rem; margin: 2px 0 6px; }
.sol-arrow { color: var(--primary); font-weight: 800; font-size: 1.4rem; text-align: center; }
@media (max-width: 560px) {
  .sol-item { grid-template-columns: 1fr; gap: 8px; }
  .sol-arrow { transform: rotate(90deg); font-size: 1.1rem; }
  .sol-colhead { display: none; }
}
.badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge-limited-1 { background: #fdecec; color: var(--danger); }
.badge-limited-2 { background: #fff4e0; color: #b26b00; }
.tech-list { margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.tech-opt { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; }
.net-tag {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 2px;
}
.net-wifi { background: var(--primary-soft); color: var(--primary-dark); }
.net-ble { background: #ede7f6; color: #5e35b1; }
.devices { color: var(--text); }

.note {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.88rem;
  margin: 10px 0;
}
.note strong { color: #b26b00; }
.note-danger { background: #fdecec; border-color: #f5b5b5; }
.note-danger strong { color: var(--danger); }
.note-confirm { background: #fff1e2; border: 1.5px solid var(--primary); }
.note-confirm strong { color: var(--primary-dark); }
.note-confirm b { color: var(--primary-dark); }

.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; }

/* 권장 제어 인터페이스 */
.rec-primary {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 8px 16px;
  border-radius: 10px;
}

/* 권장 플랫폼 */
.platform-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.platform-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fcfdfe;
}
.platform-name { font-weight: 700; color: var(--primary-dark); }
.platform-desc { font-size: 0.86rem; color: var(--muted); margin-top: 2px; }

/* 연결 구조 및 구매 안내 */
.hub-need { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hub-need-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.hub-chip {
  display: inline-block; font-weight: 700; font-size: 0.85rem;
  color: #fff; background: var(--primary); padding: 5px 12px; border-radius: 999px;
}
.conn-group {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fcfdfe;
}
.conn-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-icon { font-size: 1.15rem; }
.conn-label { font-weight: 700; }
.conn-tag {
  margin-left: auto; font-size: 0.72rem; font-weight: 700;
  background: #fff4e0; color: #b26b00; padding: 2px 8px; border-radius: 999px;
}
.conn-tag-ok { background: #e6f4ea; color: var(--ok); }
.conn-devs { margin-top: 6px; font-weight: 600; color: var(--text); font-size: 0.92rem; }
.conn-desc { margin-top: 6px; color: var(--muted); font-size: 0.86rem; line-height: 1.6; }

/* 대상자 정보 그리드 */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.profile-cell {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfe;
  font-size: 0.9rem;
}
.profile-cell .pf-label { color: var(--muted); }
.profile-cell .pf-value { font-weight: 600; text-align: right; }

/* 네트워크 적합성 */
/* 주요구 확인 단계 */
.need-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fcfdfe;
}
.need-q { font-size: 0.95rem; margin-bottom: 10px; line-height: 1.6; }
.need-space {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 6px;
  padding: 2px 8px;
  margin-right: 8px;
}

/* 주요구 목록 (제안서) */
.goal-list { margin: 4px 0 0; padding-left: 4px; list-style: none; }
.goal-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-weight: 600;
}
.goal-list li:last-child { border-bottom: none; }
.goal-space {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 6px;
  padding: 2px 8px;
  margin-right: 8px;
}
.goal-tail { color: var(--muted); font-weight: 400; font-size: 0.84rem; }

/* 키트 구성 */
.kit-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.kit-toggle-label { font-size: 0.85rem; color: var(--muted); }
.kit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.kit-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 5px 14px;
  border-radius: 999px;
  color: #fff;
}
.kit-badge.kit-beginner { background: #2f9e44; }
.kit-badge.kit-advanced { background: #5e35b1; }
.kit-auto { font-size: 0.78rem; color: var(--muted); }

.kit-block { margin-top: 16px; }
.kit-block-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--line);
}
.kit-count { color: var(--muted); font-weight: 500; font-size: 0.82rem; }
.kit-empty { color: var(--muted); font-size: 0.86rem; padding: 6px 0; }

.device-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.device-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fcfdfe; }
.device-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.device-name { font-weight: 700; }
.device-count { margin-left: auto; font-size: 0.74rem; color: var(--primary-dark); background: var(--primary-soft); padding: 2px 8px; border-radius: 999px; }
.device-acts { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

/* 근거 출처 */
.app-footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 18px 20px 90px; }
.report-source { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 6px 0 10px; }

.tech-opt.tech-dim { opacity: 0.6; }
.flag-warn {
  font-size: 0.7rem;
  font-weight: 700;
  color: #b26b00;
  background: #fff4e0;
  border-radius: 6px;
  padding: 1px 7px;
  margin-left: 2px;
  align-self: flex-start;
  margin-top: 2px;
}

/* 메타 정보 (의뢰기관) */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* 결과 페이지 인쇄용 요약 헤더 */
.report-meta { font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }
.report-meta b { color: var(--text); }

@media print {
  .app-header, .stepbar, .actionbar, .no-print, .bottomnav { display: none !important; }
  .rsec-hidden { display: block !important; } /* 인쇄 시 모든 탭 내용 표시 */
  .celebrate { display: none !important; }
  main { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; padding: 14px; margin-bottom: 12px; page-break-inside: avoid; }
  .sol-item, .solution-space { page-break-inside: avoid; }
  .rec-primary { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  textarea { border: none; padding: 2px 0; min-height: 0; }
  body { background: #fff; }
}

@media (max-width: 560px) {
  .matrix-row .row-label { flex-basis: 100%; }
}

/* =========================================================
 * 작업수행 분석 · 로우테크 환경수정 · 수행기술 칩
 * =======================================================*/
.sol-wrap { margin-bottom: 12px; }
.sol-wrap .sol-item { margin-bottom: 0; }
.sol-sub {
  font-size: 0.72rem; font-weight: 800; color: var(--primary-dark);
  letter-spacing: 0.02em; margin: 8px 0 2px;
}
.sol-sub:first-child { margin-top: 0; }

.skill-chip {
  display: inline-block; font-size: 0.74rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; margin: 2px 4px 2px 0;
  background: #eef2f6; color: #4a5568; border: 1px solid transparent;
}
.skill-chip.mini { font-size: 0.7rem; padding: 1px 7px; }
.skill-chip.blocked {
  background: #fdecec; color: var(--danger); border-color: #f3c0c0; font-weight: 700;
}

/* 로우테크 항목 */
.lowtech-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.lowtech-item {
  border: 1px solid var(--line); border-left: 3px solid #3a9d6b;
  border-radius: 8px; padding: 8px 10px; background: #f7fcf9;
}
.lt-name { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lt-tag {
  font-size: 0.64rem; font-weight: 800; color: #2f7d55;
  background: #dff2e7; padding: 1px 7px; border-radius: 999px;
}
.lt-flag {
  font-size: 0.64rem; font-weight: 800; color: #fff;
  background: var(--primary); padding: 1px 7px; border-radius: 999px;
}
.lt-why { font-size: 0.82rem; color: var(--muted); margin: 3px 0 5px; }
.lt-supports { display: flex; flex-wrap: wrap; }

/* 공간별 로우테크 카드 */
.lt-space { margin-bottom: 10px; }
.lt-space > .sp-title {
  font-size: 1.02rem; font-weight: 700; color: var(--primary-dark);
  border-left: 4px solid var(--primary); padding-left: 10px; margin: 14px 0 8px;
}
.lowtech-item.lt-hit { border-left-color: var(--primary); background: #fff8f2; }

/* 작업수행 분석 블록 */
.analysis-block {
  border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 10px 10px; padding: 12px 14px; margin-top: -2px;
  background: #f8fafc;
}
.an-head { font-size: 0.8rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 8px; }
.an-steps { display: flex; flex-direction: column; gap: 4px; }
.an-step {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 5px 8px; border-radius: 7px;
}
.an-step.has-block { background: #fef6f6; }
.an-step-no {
  flex: 0 0 auto; width: 18px; height: 18px; line-height: 18px; text-align: center;
  background: var(--primary); color: #fff; border-radius: 50%;
  font-size: 0.68rem; font-weight: 800;
}
.an-step-label { font-size: 0.86rem; font-weight: 600; }
.an-step-skills { display: flex; flex-wrap: wrap; margin-left: auto; }
.an-blocked {
  margin-top: 8px; font-size: 0.84rem; padding: 8px 10px;
  background: #fdecec; border-radius: 8px; color: #7a2020;
}
.an-blocked .an-tail { color: #a05656; font-weight: 400; }
.an-note { margin-top: 8px; font-size: 0.82rem; color: var(--muted); }
@media (max-width: 560px) {
  .an-step-skills { margin-left: 0; width: 100%; }
}

/* 환경 안전·수정 (선택된 항목) */
.envc-item {
  border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fff8f2;
}
.envc-q { font-weight: 700; font-size: 0.9rem; color: var(--primary-dark); }
.envc-tool { font-size: 0.86rem; font-weight: 600; margin: 4px 0 2px; }
.tip-tail { color: var(--primary-dark); font-weight: 700; }

/* =========================================================
 * 낙상위험 모듈
 * =======================================================*/
.fall-badge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fall-badge {
  display: inline-block; font-weight: 800; font-size: 0.92rem;
  padding: 5px 14px; border-radius: 999px; color: #fff;
}
.fall-badge.fall-low { background: #2f9d63; }
.fall-badge.fall-mid { background: #e08a00; }
.fall-badge.fall-high { background: #d64541; }
.fall-engine-note { font-size: 0.72rem; color: var(--muted); }
.fall-rationale { margin: 8px 0 0; font-size: 0.86rem; color: var(--text); }
.fall-score-chip {
  font-size: 0.76rem; font-weight: 700; color: #4a5568;
  background: #eef2f6; padding: 3px 10px; border-radius: 999px;
}
.fall-reasons {
  margin-top: 10px; font-size: 0.84rem; line-height: 1.6;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.fall-sub { font-size: 0.8rem; font-weight: 800; color: var(--primary-dark); margin: 14px 0 6px; }
.fall-bars { display: flex; flex-direction: column; gap: 5px; }
.fall-bar-row { display: flex; align-items: center; gap: 8px; }
.fall-bar-label { flex: 0 0 96px; font-size: 0.78rem; font-weight: 600; text-align: right; }
.fall-bar-track { flex: 1; height: 12px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.fall-bar-fill { height: 100%; background: linear-gradient(90deg, #e08a00, #d64541); border-radius: 999px; }
.fall-bar-fill.zero { background: transparent; }
.fall-bar-score { flex: 0 0 40px; font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.fall-tag {
  font-size: 0.64rem; font-weight: 800; color: #fff;
  background: #d64541; padding: 1px 7px; border-radius: 999px;
}
.fall-mini {
  font-size: 0.66rem; font-weight: 800; color: #a03530;
  background: #fdecec; padding: 1px 7px; border-radius: 999px; margin-left: 4px;
}
.lowtech-item.fall-rec { border-left-color: #d64541; background: #fdf7f7; }
.fall-track-row { margin-bottom: 8px; }
.fall-track-note { margin-top: 10px; }
@media (max-width: 560px) {
  .fall-bar-label { flex-basis: 78px; font-size: 0.72rem; }
}

/* OTPF 근거 표 */
.ref-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 480px; }
.ref-table th, .ref-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.ref-table th { background: #f1f5f9; font-weight: 700; color: var(--primary-dark); }
.ref-table td.ineff { color: var(--danger); }
.ref-bf { margin-top: 10px; font-size: 0.82rem; color: var(--muted); line-height: 1.6; }

/* 임베드 환경 토스트 알림 */
.app-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  max-width: min(86vw, 420px); z-index: 9999;
  background: rgba(40, 36, 32, 0.95); color: #fff;
  font-size: 0.85rem; line-height: 1.5; font-weight: 600;
  padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
