:root{
  --bg:#f6f8fa; --card:#fff; --line:#d0d7de; --text:#1f2328; --muted:#656d76;
  --accent:#1f6feb; --accent-d:#1a5fd0;
}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  background:var(--bg);color:var(--text);line-height:1.5}
.hidden{display:none !important}
.muted{color:var(--muted)}
.small{font-size:.85em}
code{background:#eef1f4;padding:1px 5px;border-radius:4px;font-size:.88em}

.topbar{display:flex;justify-content:space-between;align-items:center;padding:12px 20px;
  background:#0d1117;color:#fff}
.brand{font-weight:700;letter-spacing:.2px}
.userbadge{background:#21262d;padding:5px 12px;border-radius:20px;font-size:.9em}

.card{max-width:560px;margin:40px auto;background:var(--card);border:1px solid var(--line);
  border-radius:14px;padding:32px}
.center{text-align:center}
.card h1{font-size:1.4rem;margin:0 0 8px}
.field{display:block;text-align:left;margin:18px 0}
.field>span{display:block;font-weight:600;margin-bottom:6px}
input[type=text]{width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:9px;font-size:1rem}
input[type=text]:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px #1f6feb22}
.radios{display:flex;gap:10px;flex-wrap:wrap}
.radio{display:flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:9px;
  padding:10px 14px;cursor:pointer;flex:1;justify-content:center}
.radio:has(input:checked){border-color:var(--accent);background:#1f6feb11;font-weight:600}

button{cursor:pointer;font-size:1rem;border-radius:9px;border:1px solid transparent;padding:11px 16px}
button:disabled{opacity:.5;cursor:not-allowed}
.primary{background:var(--accent);color:#fff;width:100%;font-weight:600}
.primary:hover:not(:disabled){background:var(--accent-d)}
.ghost{background:#fff;border:1px solid var(--line);color:var(--text);padding:7px 12px;font-size:.9em}
.ghost:hover{background:#f0f3f6}
.error{color:#cf222e;margin-top:12px;min-height:1.2em;font-size:.9em}
.regbox{margin-top:14px;background:#fff8e6;border:1px solid #e7d9a8;border-radius:10px;padding:14px;text-align:left}
.regbox p{margin:0 0 10px}
.regbtns{display:flex;gap:8px}
.regbtns .primary{width:auto;flex:1}

/* 모달 */
.modal{position:fixed;inset:0;background:#00000066;display:flex;align-items:center;justify-content:center;padding:16px;z-index:50}
.modal-box{background:#fff;border-radius:16px;max-width:600px;width:100%;padding:28px;max-height:90vh;overflow:auto}
.modal-box h2{margin:0 0 14px}
.tut{padding-left:20px;margin:0 0 16px}
.tut li{margin:10px 0}
.examples{color:var(--muted);font-size:.9em;background:#f6f8fa;border-radius:8px;padding:6px 10px;margin-top:4px}
/* 튜토리얼 — 컴팩트 2열 */
.tut-box{max-width:1320px}
.tut-title{margin:0 0 16px;text-align:center}
.tut-cols{display:grid;grid-template-columns:1fr 1fr;gap:24px}
@media(max-width:680px){.tut-cols{grid-template-columns:1fr;gap:6px}}
.tut-sec{font-weight:700;margin:2px 0 10px;color:var(--accent);border-bottom:2px solid #1f6feb33;padding-bottom:5px}
.tut-steps{display:flex;flex-direction:column;gap:10px;margin-bottom:18px}
.tut-step{display:flex;gap:10px;align-items:flex-start}
.snum{flex:none;width:22px;height:22px;border-radius:50%;background:var(--accent);color:#fff;
  font-size:.78rem;font-weight:700;display:flex;align-items:center;justify-content:center;margin-top:1px}
.cap-list{list-style:none;padding:0;margin:0 0 12px}
.cap-list li{padding:7px 2px;border-bottom:1px solid #00000010;line-height:1.45}
.cap-list li:last-child{border-bottom:none}
.cap-hl{background:#eef6ff;border:1px solid #9fc6f5;border-radius:9px;padding:9px 11px;font-size:.88rem}
.tut-note{margin:12px 0 0}
.legend.compact{padding:10px 12px;margin:0}
.legend.compact .legend-item{margin:5px 0}
.tut-sec-full{margin-top:16px}
.tut-foot{display:flex;gap:10px;align-items:center;margin-top:8px}
.tut-foot .ghost{flex:none;white-space:nowrap}
.tut-foot .primary{width:auto;flex:1}

/* 가이드 투어 — 스포트라이트 온보딩 (코치마크) */
.tour{position:fixed;inset:0;z-index:1000}
.tour-catch{position:absolute;inset:0;cursor:not-allowed;z-index:1001}   /* 페이지 클릭 차단 */
.tour-spot{position:fixed;border-radius:10px;pointer-events:none;z-index:1001;
  box-shadow:0 0 0 3px var(--accent), 0 0 0 9999px rgba(13,17,23,.66);
  transition:top .22s,left .22s,width .22s,height .22s}
.tour-pop{position:fixed;background:#fff;border-radius:14px;padding:16px 18px 14px;
  box-shadow:0 14px 44px rgba(0,0,0,.38);z-index:1002}
.tour-no{font-size:.78rem;font-weight:700;color:var(--accent);margin-bottom:6px}
.tour-h{font-size:1.06rem;font-weight:700;margin-bottom:7px}
.tour-h .muted{font-weight:500}
.tour-b{font-size:.92rem;color:#2a2f36;line-height:1.6}
.tour-b b{color:var(--accent)}
.tour-acts{display:flex;align-items:center;gap:8px;margin-top:15px}
.tour-acts .tour-sp{flex:1}
.tour-acts .ghost{padding:6px 12px;font-size:.85em}
.tour-acts .primary{width:auto;padding:8px 18px;font-size:.92rem}
.tour-arrow{position:absolute;width:14px;height:14px;background:#fff;transform:rotate(45deg);
  box-shadow:0 14px 44px rgba(0,0,0,.10)}
.tour-arrow.arr-bottom{top:-7px}      /* 말풍선이 대상 아래 → 화살표는 위쪽 모서리 */
.tour-arrow.arr-top{bottom:-7px}
.tour-arrow.arr-right{left:-7px}      /* 말풍선이 대상 오른쪽 → 화살표는 왼쪽 모서리 */
.tour-arrow.arr-left{right:-7px}

/* 설정값 후보 가이드 (튜토리얼 + 모달 공용) */
.settings-guide{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:8px}
@media(max-width:680px){.settings-guide{grid-template-columns:1fr}}
.sg-card{border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:#fbfcfd}
.sg-h{font-weight:700;margin-bottom:6px}
.sg-item{display:flex;gap:8px;align-items:baseline;padding:3px 0;flex-wrap:wrap}
.sg-name{flex:none;min-width:84px;color:var(--muted);font-size:.86rem;font-weight:600}
.sg-vals{display:flex;flex-wrap:wrap;gap:4px;align-items:baseline}
.sg-chip{background:#eef1f4;border-radius:6px;padding:2px 7px;font-size:.82rem}
.sg-range{font-size:.86rem;font-weight:600}
.sg-note{margin-left:2px}

.cap-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:8px 0 4px}
@media(max-width:560px){.cap-grid{grid-template-columns:1fr}}
.cap-card{border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:#fbfcfd}
.cap-card.hl{grid-column:1/-1;background:#eef6ff;border-color:#9fc6f5}
.cap-h{font-weight:700;margin-bottom:4px}
.cap-ex{color:var(--muted);font-size:.87rem;line-height:1.7}
.legend{background:#f6f8fa;border-radius:10px;padding:14px;margin:14px 0}
.legend-title{font-weight:700;margin-bottom:8px}
.legend-item{display:flex;align-items:baseline;gap:8px;margin:6px 0}
.dot{width:10px;height:10px;border-radius:50%;display:inline-block;flex:none;position:relative;top:1px}

/* 테스트 화면 — 좌(대화/입력) ‖ 우(집상태) 동일 높이, 내부 스크롤 */
#test{max-width:1560px;margin:18px auto;padding:0 16px}
.test-grid{display:grid;grid-template-columns:1fr 820px;gap:16px;height:84vh}
.col-conv{display:flex;flex-direction:column;min-height:0;height:100%}
.col-conv #chat{flex:1;min-height:200px;max-height:none}   /* 대화내역: 최소 높이 보장 + 컬럼 채움 */
.col-conv .eval-area,.col-conv #inputRow{flex:none}        /* 평가영역/입력: 하단 고정 */
/* 평가영역(점수→코멘트→후보→제출): 내부 스크롤로 대화창을 가리지 않게 높이 제한 */
.eval-area{display:flex;flex-direction:column;max-height:46vh;overflow:auto;margin-top:10px}
.eval-area .rate{margin-top:0}
.col-home{background:var(--card);border:1px solid var(--line);border-radius:12px;
  padding:12px 14px;display:flex;flex-direction:column;min-height:0;height:100%}
.home-title-row{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}
.col-home .home-title{font-weight:700}
/* 방 카드 3열 (공용/기타 카드는 .room.globals 가 grid-column:1/-1 로 전체폭) */
.col-home .homestate{flex:1;min-height:0;overflow:auto;grid-template-columns:1fr 1fr 1fr;gap:8px}
@media(max-width:1200px){
  .test-grid{grid-template-columns:1fr;height:auto}
  .col-conv,.col-home{height:auto}
  .col-conv #chat{min-height:0;max-height:50vh}
  .eval-area{max-height:none}
  .col-home .homestate{max-height:48vh}
}
@media(max-width:700px){.col-home .homestate{grid-template-columns:1fr 1fr}}
@media(max-width:460px){.col-home .homestate{grid-template-columns:1fr}}
.testbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.scenario{font-weight:700}
.testbar-actions{display:flex;gap:8px}
.chat{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:16px;
  min-height:300px;max-height:56vh;overflow:auto}
.bubble{max-width:78%;padding:10px 14px;border-radius:14px;margin:8px 0;white-space:pre-wrap;word-break:break-word}
.bubble.user{background:var(--accent);color:#fff;margin-left:auto;border-bottom-right-radius:4px}
.bubble.sys{background:#eef1f4;color:var(--text);margin-right:auto;border-bottom-left-radius:4px}
.bubble.sys.loading{opacity:.6}
.sys.note{background:#fff8e6;border:1px dashed #d4a72c;color:#7a5b00;max-width:100%;text-align:center;font-size:.92em}
.fb{font-size:1.02rem}
.detail{margin-top:8px;font-size:.85em;color:var(--muted)}
.detail summary{cursor:pointer}
.detail div{margin-top:4px}
.ratetag{margin-top:8px;font-size:.82em;color:var(--muted);display:flex;align-items:center;gap:6px;border-top:1px solid #00000014;padding-top:6px}

.rate{background:#fffdf5;border:1px solid #e7d9a8;border-radius:12px;padding:14px;margin-top:12px}
.rate-q{font-weight:600;margin-bottom:10px}
.rate-btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
@media(max-width:560px){.rate-btns{grid-template-columns:1fr}}
.ratebtn{background:#fff;border:1.5px solid var(--line);text-align:left;display:flex;align-items:center;gap:8px;font-size:.92rem;padding:11px 13px}
.ratebtn:hover:not(:disabled){border-color:var(--rc);background:#fafbfc}
.ratebtn.selected{border-color:var(--rc);background:#fff;box-shadow:0 0 0 2px var(--rc) inset;font-weight:700}
.comment{margin-top:10px}
.comment.required{border-color:#cf222e;box-shadow:0 0 0 3px #cf222e22}
.rate-submit{margin-top:10px}

/* 말투 안내 메시지 */
.tone-note{background:#eef6ff;border:1px solid #9fc6f5;border-radius:9px;padding:8px 11px;
  font-size:.85rem;color:#1c3b5a;line-height:1.5;margin-bottom:10px}

/* 평가 기준 예시(범례) */
.legend-ex{margin:1px 0 11px 18px;font-size:.83rem;color:#3a4046;line-height:1.5}
.legend-ex b{color:var(--text);font-weight:600}
.ex-req{background:#cf222e;color:#fff;border-radius:6px;padding:1px 6px;font-size:.72rem;font-weight:700;margin-left:4px}

/* FS 응답 후보 선택 */
.cands{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin-top:10px}
.cands.note-only{background:#f6f8fa;border-style:dashed}
.cand-h{font-weight:700;margin-bottom:8px}
.cand-list{display:flex;flex-direction:column;gap:8px}
.cand{display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:left;width:100%;
  background:#fbfcfd;border:1.5px solid var(--line);border-radius:10px;padding:9px 12px}
.cand:hover{border-color:var(--accent);background:#fafbff}
.cand.selected{border-color:var(--accent);background:#fff;box-shadow:0 0 0 2px var(--accent) inset}
.cand-no{font-size:.74rem;font-weight:700;color:var(--accent)}
.cand-txt{font-size:.95rem;color:var(--text)}
.cand-none{font-size:.88rem;color:var(--muted)}

.inputrow{display:flex;gap:8px;margin-top:12px}
.inputrow input{flex:1}
.inputrow .primary{width:auto;padding:11px 22px}
.danger{background:#fff;border:1px solid #e5969b;color:#cf222e;padding:7px 12px;font-size:.9em}
.danger:hover{background:#fff0f0}

/* 집 상태 패널 */
.homewrap{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 14px;margin-bottom:10px}
.homewrap>summary{cursor:pointer;font-weight:700}
.homestate{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px;margin-top:10px}
.room{border:1px solid var(--line);border-radius:10px;padding:10px;background:#fbfcfd}
/* 공용/기타: 3열에서 마지막 방(화장실) 우측 2칸을 채움. (열수 부족하면 자동 클램프) */
.room.globals{grid-column:span 2;background:#f6f8fa}
.roomhead{font-weight:700;display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px}
.devs{display:flex;flex-wrap:wrap;gap:6px}
.dev{display:inline-flex;align-items:center;gap:5px;font-size:.82rem;border:1px solid var(--line);
  border-radius:8px;padding:4px 8px;background:#fff}
.dev.on{border-color:#2da44e;background:#eafbf0}
.dev.off{opacity:.6}
.dev .devname{font-weight:600}
.dev .devstate{font-size:.72rem;font-weight:700;color:#1a7f37}
.dev.off .devstate{color:var(--muted)}
.dev .devfeat{color:var(--muted);font-size:.74rem}

/* 관리자 */
.admin{max-width:1100px;margin:18px auto;padding:0 16px}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:14px 0}
.statcard{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:16px;text-align:center}
.statcard .num{font-size:1.8rem;font-weight:800}
.statcard .lbl{color:var(--muted);font-size:.85em;margin-top:4px}
table{width:100%;border-collapse:collapse;background:var(--card);border:1px solid var(--line);border-radius:10px;overflow:hidden}
th,td{padding:8px 10px;border-bottom:1px solid var(--line);text-align:left;font-size:.88rem;vertical-align:top}
th{background:#f6f8fa;font-weight:700}
tr:last-child td{border-bottom:none}
.pill{display:inline-block;padding:2px 8px;border-radius:20px;color:#fff;font-size:.78rem;white-space:nowrap}
.score-badge{display:inline-block;background:#eef1f4;color:#3a4046;border-radius:6px;padding:1px 6px;font-size:.74rem;font-weight:700}
.filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:10px 0}
.filters select,.filters input{padding:7px 10px;border:1px solid var(--line);border-radius:8px}
a.ghost{text-decoration:none;display:inline-block}

/* 개별 기록 카드 + prompt */
.rec{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px;margin:10px 0}
.rec-ignored{opacity:.5}
.rec-admin{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:10px;padding-top:9px;border-top:1px dashed #00000018}
.rec-admin .ig-lbl{display:flex;align-items:center;gap:5px;font-size:.85rem;white-space:nowrap;color:var(--muted)}
.rec-admin .ig-cmt{flex:1;min-width:200px;padding:6px 9px;border:1px solid var(--line);border-radius:8px;font-size:.88rem}
.rec-admin .ig-save{flex:none}
.rec-admin select{padding:5px 8px;border:1px solid var(--line);border-radius:8px;font-size:.85rem}
.ov-wrap{display:inline-flex;align-items:center;gap:4px}
.statcard-live .num{color:var(--accent)}
.rec-head{display:flex;align-items:center;gap:10px;margin-bottom:8px;flex-wrap:wrap}
.rec-meta{color:var(--muted);font-size:.85rem}
.rec-row{margin:4px 0;font-size:.92rem}
.rec-row b{display:inline-block;min-width:120px;color:var(--muted);font-weight:600}
.rec-prompts{margin-top:8px}
.rec-prompts>summary{cursor:pointer;font-weight:600;color:var(--accent)}
.pblock{margin:8px 0;border-left:3px solid var(--line);padding-left:10px}
.ptitle{font-weight:700;font-size:.85rem;margin-bottom:4px}
.ppre{background:#0d1117;color:#e6edf3;border-radius:8px;padding:10px;font-size:.78rem;
  white-space:pre-wrap;word-break:break-word;max-height:340px;overflow:auto;margin:0}

/* 테스터 명단 관리 */
.rosterwrap{margin-top:24px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 16px}
.rosterwrap>summary{cursor:pointer}
.roster-add{display:flex;gap:10px;align-items:flex-start;margin:10px 0}
.roster-add textarea{flex:1;padding:10px;border:1px solid var(--line);border-radius:9px;font-family:inherit;font-size:.95rem;resize:vertical}
.roster-list{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.rchip{display:inline-flex;align-items:center;gap:6px;background:#eef1f4;border-radius:20px;padding:5px 6px 5px 12px;font-size:.9rem}
.rdel{background:#d0d7de;border:none;color:#fff;width:18px;height:18px;border-radius:50%;
  font-size:.8rem;line-height:1;padding:0;display:flex;align-items:center;justify-content:center}
.rdel:hover{background:#cf222e}
