:root {
  --bg: #fff8e7;
  --card: #ffffff;
  --ink: #2b2b3a;
  --muted: #6b6b80;
  --accent: #ff7a59;
  --accent-ink: #ffffff;
  --line: #e9e0cc;
  --danger: #d6455d;
  --ok: #2f8f55;
  --ok-bg: #e6f5ec;
  --bad-bg: #fdeaee;
  /* 아래 시스템 버튼 자리. 튜튜키즈 앱(mobile/App.tsx)은 웹뷰를 화면 맨 아래까지 펴고 이 값을 앱이 아는 높이로 넣는다(11-05: 앱과 웹이 둘 다 띄워 메뉴 밑이 한 칸 비었음) */
  --inset-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b26;
    --card: #272736;
    --ink: #f2f2f7;
    --muted: #a5a5bb;
    --line: #3a3a4e;
    --ok: #6fd39a;
    --ok-bg: #1f3a2b;
    --bad-bg: #4a2430;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Noto Sans KR", sans-serif;
  font-size: 18px;
  line-height: 1.4;
}
header { padding: 16px; font-size: 1.5rem; font-weight: 700; }
main { padding: 0 16px 32px; max-width: 960px; margin: 0 auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--line); }
.card .title { padding: 12px 14px 16px; font-weight: 600; }
/* 부모가 아이에게 연 채널의 영상(하나씩 등록하지 않은 것): 제목 아래 채널 이름 */
.card .title:has(+ .from) { padding-bottom: 4px; }
.card .from { padding: 0 14px 14px; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
/* 안내 문장은 한글 단어 중간에서 줄이 바뀌지 않게 한다(영상 제목은 공백 없는 경우가 있어 제외) */
.empty, .panel > p, .msg, .hint { word-break: keep-all; }
.hint { color: var(--muted); font-size: 0.9rem; }
ul.hint { padding-left: 1.2em; }
/* 연결 코드·초대 코드: 다른 기기에 옮겨 적기 좋게 크게 */
.code { margin: 12px 0 4px; font-size: 2rem; font-weight: 800; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.item .meta .c.wrap { white-space: normal; }
select { min-height: 48px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 0.95rem; }

/* 부모 화면: 퀴즈 검토 */
.quiz-video { display: flex; gap: 12px; align-items: center; }
.quiz-video img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.quiz-video .thumb { position: relative; flex: none; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; }
.quiz-video .t { font-weight: 600; overflow-wrap: anywhere; }
.quiz-how { margin: 8px 0; padding-left: 1.2em; }
.quiz-q { border-top: 1px solid var(--line); padding: 14px 0; display: grid; gap: 8px; }
.quiz-label { display: grid; gap: 6px; font-weight: 700; }
.quiz-choice { display: flex; gap: 10px; align-items: flex-start; }
.quiz-choice input[type=radio] { width: 22px; height: 22px; margin-top: 13px; flex: none; accent-color: var(--accent); }
.quiz-choice-col { flex: 1; min-width: 0; display: grid; gap: 2px; }
.quiz-choice-col input { width: 100%; }
.q-why { color: var(--muted); font-size: 0.8rem; }
.q-evidence { font-size: 0.9rem; color: var(--muted); }
.q-evidence a { color: var(--ink); }
.q-evidence .q-time { width: 90px; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 1rem; }
#quizAdd { justify-self: start; margin-bottom: 8px; }

/* 아이 화면: 포인트와 보상 */
.points { font: inherit; font-size: 1.1rem; font-weight: 800; color: var(--ink); background: var(--card); border: 2px solid var(--accent); border-radius: 999px; padding: 4px 14px; min-height: 44px; cursor: pointer; }
.card .tag { position: absolute; top: 10px; right: 10px; padding: 4px 12px; border-radius: 999px; font-size: 1rem; font-weight: 800; background: #2f9e5b; color: #fff; }
.card .tag.locked { background: rgba(0, 0, 0, 0.72); }
.card .tag.fresh { right: auto; left: 10px; background: var(--accent); color: var(--accent-ink); }
.toast { position: fixed; z-index: 30; left: 16px; right: 16px; margin-inline: auto; width: fit-content; word-break: keep-all; text-align: center; bottom: calc(16px + var(--inset-bottom)); margin-block: 0; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 1.05rem; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
input[type=number] { flex: 0 1 110px; min-height: 48px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 1rem; }
.ledger { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 2px; }
/* 🎟 이용권 사기: 상품 줄, 토스 결제위젯 칸(위젯은 흰 바탕이라 어두운 화면에서도 흰 칸에 둔다) */
.products { display: grid; gap: 8px; margin: 8px 0; }
.product { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.product span { min-width: 0; overflow-wrap: anywhere; }
.pay-box { margin-top: 10px; padding: 8px 0 12px; background: #fff; border-radius: 12px; }
.pay-box .row { padding: 0 12px; }
.ledger .plus { color: #2f9e5b; font-weight: 700; }
.ledger .minus { color: var(--danger); font-weight: 700; }
.ledger .zero { color: var(--muted); font-weight: 700; }

/* 아이 화면: 퀴즈 풀기 */
.cell { display: grid; gap: 8px; align-content: start; }
.cell .quiz-go { min-height: 52px; font-size: 1.05rem; }
/* 🤖 아이 AI 질문하기: 버튼 질문 칩 + 글 칸 + 답(크게, 소리로도 읽음) */
.cell .ask-go { margin-top: 6px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-form input { flex: 1 1 160px; min-width: 0; }
.ask-answer { margin: 0; font-size: 1.15rem; line-height: 1.6; white-space: pre-line; min-height: 1.6em; }
.ask-answer:empty { display: none; }
.quiz-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; padding: 16px; }
.quiz-box { width: 100%; max-width: 520px; background: var(--card); color: var(--ink); border-radius: 18px; padding: 18px; display: grid; gap: 12px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.quiz-question { font-size: 1.25rem; font-weight: 700; margin: 0; word-break: keep-all; }
.quiz-choices { display: grid; gap: 10px; }
.quiz-choices button { min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 1.1rem; text-align: left; padding: 8px 14px; cursor: pointer; }
.quiz-choices button.right { border-color: #2f9e5b; background: #e5f6ec; color: #1d5e37; }
.quiz-choices button.wrong { border-color: var(--danger); opacity: 0.6; }
.quiz-choices button { display: flex; align-items: center; gap: 12px; }
.quiz-choices .num { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--line); font-weight: 800; font-size: 1rem; }
.quiz-choices button.speaking { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.35); }
/* 읽는 3초·다시 보기 전에는 보기를 흐리게(누를 수 없음) */
.quiz-choices.waiting button:not(.right):not(.wrong) { opacity: 0.55; cursor: default; }
.quiz-tools { display: flex; gap: 8px; flex: none; }
.quiz-tools button { white-space: nowrap; }
.quiz-progress { min-width: 0; }
.quiz-tools .quiz-voice { padding: 0 14px; font-size: 1.2rem; }
.quiz-feedback { font-size: 1.05rem; min-height: 1.5em; margin: 0; }

textarea { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 0.9rem; padding: 8px; }

.overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10;
  display: none;
  flex-direction: column;
}
.overlay.open { display: flex; }
.overlay .bar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 8px; }
.overlay .ptitle {
  flex: 1; min-width: 0; color: #fff; font-size: 0.95rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.overlay .close {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  min-height: 52px;
  padding: 0 24px;
  font-size: 1.1rem;
  font-weight: 700;
}
.overlay .stage { flex: 1; position: relative; }
.overlay .stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* 부모 화면 */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=text], input[type=password], input[type=url], input[type=email] {
  flex: 1 1 200px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
}
button.primary, button.ghost {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 10px;
  border: 0;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { color: var(--danger); }
.msg { margin-top: 8px; min-height: 1.4em; color: var(--muted); }
.panel .msg:empty { margin-top: 0; min-height: 0; } /* 안내가 없을 때 칸 아래 빈 줄을 없앤다 */
/* PIN 두 칸은 나란히, 저장은 그 아래 전체 폭 */
#pinForm { display: grid; grid-template-columns: 1fr 1fr; }
#pinForm input { min-width: 0; }
#pinForm button { grid-column: 1 / -1; }
/* 포인트 설정: 지금 점수 크게, [점수][메모] 아래 [+ 추가][− 차감] */
.points-now { font-size: 1.1rem; margin-bottom: 10px; }
.points-now strong { font-size: 2rem; color: var(--accent); margin: 0 2px; }
.points-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.points-form input { width: 100%; min-width: 0; }
/* 🎁 보상: 아이는 보상마다 모인 만큼 막대, 부모는 한 줄 목록 */
.reward-total { display: block; font-size: 1.3rem; margin-bottom: 4px; }
.reward-list { display: grid; gap: 12px; margin-top: 12px; }
.reward { display: grid; gap: 8px; padding: 14px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); }
.reward.ready { border-color: var(--accent); }
.reward-head { display: flex; justify-content: space-between; gap: 12px; font-size: 1.15rem; font-weight: 800; }
.reward-head div:first-child { min-width: 0; overflow-wrap: anywhere; }
.reward-note { color: var(--muted); font-weight: 700; }
.meter { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.reward-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.reward-row > span { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
#rewardForm #rewardCost { flex: 0 0 90px; width: 90px; }
.ledger { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.ledger li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.95rem; }
.ledger li .what { min-width: 0; overflow-wrap: anywhere; }
.ledger li > span:last-child { flex: none; }
/* 영상 목록 버튼은 한 줄로: 종류·퀴즈·🗑 */
#list .item .actions { flex-wrap: nowrap; }
#list .item .actions select, #list .item .actions button { min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
#list .item .actions .icon-btn { font-size: 1.05rem; }
.msg.err { color: var(--danger); }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.item img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.item .thumb { position: relative; flex: none; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; }
.item .thumb::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.6rem;
  text-shadow: 0 0 8px #000;
}
.item .t.playable { cursor: pointer; }
.item .meta { flex: 1; min-width: 0; }
/* 부모 화면 목록: YouTube 제목이 길어서 2줄까지만 보여 준다(전체 제목은 미리 재생 화면 위에 나온다) */
.item .meta .t {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.item .meta .c { color: var(--muted); font-size: 0.85rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.item .actions button { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
/* 등록 버튼 + 종류 선택 묶음(검색 결과·저장한 채널 카드·추천) */
.register { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 등록 종류 추천("💡 보상 영상 같아요 · 1분 이하 · '동요'"): 버튼 줄 아래 한 줄. 목록(.actions)에서는 묶음을 풀어 추천 줄이 맨 뒤(📺 채널 저장 다음)로 가게 */
.suggest { flex-basis: 100%; font-size: 0.8rem; color: var(--muted); word-break: keep-all; }
.suggest-reward { color: var(--accent); }
.item .actions .register { display: contents; }
.item .actions .suggest { order: 99; }
.register select { min-height: 44px; padding: 0 8px; font-size: 0.9rem; }
.card .register select, .card .register button { min-height: 40px; font-size: 0.85rem; }
#addForm select { min-height: 48px; }
/* 맞춤 추천 이유 줄, 아이 설정 폼(칩) */
.item .reason { font-size: 0.85rem; color: var(--ok); margin: 2px 0 4px; }
#kidForm { display: grid; gap: 10px; }
#kidForm label { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
#kidForm .chips { display: flex; flex-wrap: wrap; gap: 6px; }
#kidForm label.chip { display: inline-flex; gap: 4px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 0.9rem; cursor: pointer; }
#kidForm label.chip:has(input:checked) { border-color: var(--accent); font-weight: 700; }
#kidForm label.chip input { margin: 0; }
.badge.lead { margin: 0 6px 0 0; vertical-align: 1px; }
/* staging(ENV=staging)에서만 서버가 모든 화면 맨 위에 붙이는 띠 */
.env-banner { position: sticky; top: 0; z-index: 40; padding: 6px max(12px, env(safe-area-inset-left, 0px)); background: #ffd84d; color: #3a2e00; font-weight: 800; font-size: 0.9rem; text-align: center; }
.env-banner a { color: inherit; text-decoration: underline; white-space: nowrap; }
header.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
header.bar .tabs-end { font-size: 1rem; font-weight: 400; }
header.bar .tabs-end a { color: var(--ink); text-underline-offset: 3px; }
header.bar .acct { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
header.bar .tabs-end a, header.bar .tabs-end button { white-space: nowrap; }
@media (max-width: 480px) {
  .item img { width: 112px; }
}
/* 휴대폰: 썸네일 옆 좁은 칸에 버튼이 세로로 쌓이지 않게, 버튼 줄은 썸네일·제목 아래 전체 폭으로 */
@media (max-width: 560px) {
  .item:has(> .thumb, > img) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; }
  .item:has(> .thumb, > img) > .meta { display: contents; }
  .item:has(> .thumb, > img) > .thumb, .item:has(> .thumb, > img) > img { grid-row: 1 / 3; align-self: start; }
  .item:has(> .thumb, > img) .meta .t, .item:has(> .thumb, > img) .meta .c { grid-column: 2; }
  .item:has(> .thumb, > img) .actions { grid-column: 1 / -1; }
}
/* 아래 메뉴 막대(아이·부모 공용): 화면 맨 아래에 고정, 엄지로 누르기 좋게 크게. 영상 재생·퀴즈 창(z-index 10 이상)이 위를 덮는다 */
.bottom-nav {
  position: fixed;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px calc(6px + var(--inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}
.bottom-nav button {
  position: relative;
  flex: 1 1 0;
  max-width: 200px;
  min-height: 58px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.bottom-nav .ico { font-size: 1.5rem; line-height: 1; }
.bottom-nav button[aria-current="page"], .bottom-nav button[aria-selected="true"] { color: var(--accent); background: rgba(255, 122, 89, 0.12); }
.bottom-nav .badge { position: absolute; top: 4px; left: calc(50% + 10px); margin: 0; background: var(--danger); color: #fff; }
/* 메뉴 막대에 가리지 않게 아래 여백 */
body.has-nav main, #admin { padding-bottom: calc(84px + var(--inset-bottom)); }
body.has-nav .toast { bottom: calc(86px + var(--inset-bottom)); }
.pane-title { margin: 4px 0 12px; font-size: 1.15rem; }

/* 부모 화면 ☰ 메뉴 */
header.bar .bar-title { min-width: 0; }
.menu-wrap { position: relative; margin-left: auto; }
.menu-btn { min-width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-size: 1.4rem; cursor: pointer; }
.menu {
  position: absolute;
  z-index: 9;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  display: grid;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 1rem;
  font-weight: 400;
}
.menu .acct { margin: 4px 10px 6px; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.menu button, .menu a { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu button:hover, .menu a:hover { background: var(--bg); }
.tabs-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tabs-end button { min-height: 48px; padding: 0 14px; }
.badge { display: inline-block; font-size: 0.8rem; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); margin-left: 6px; }
.hidden { display: none !important; }
/* 부모 검색 탭: 추천 영상 열기 버튼(검색 칸 바로 아래 한 줄) */
.catalog-open { display: block; width: 100%; margin-top: 10px; text-align: center; }
/* 퀴즈 초안: 영상으로 바로 만들기(큰 버튼), 자막 붙여 넣기(PC)는 접는 칸 */
.quiz-video-gen { width: 100%; margin-top: 8px; }
.quiz-paste { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
/* 학습지 사진·PDF에서 글자 읽기: 파일 고르기 칸을 버튼처럼 */
.quiz-file { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.file-pick { display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-weight: 700; cursor: pointer; }
.quiz-paste > summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 6px 0; }
/* 부모 화면 머리줄 🎟 AI 이용권(누르면 이용권 화면), 초안을 만든 뒤 이용권 차감 안내 */
.credit-chip { min-height: 44px; margin-right: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; }
.credit-note { margin: 6px 0 2px; padding: 8px 12px; border-radius: 10px; background: #e5f6ec; color: #1d5e37; font-weight: 700; font-size: 0.95rem; }
/* AI 초안 피드백 👍👎: 한 줄에 물음 + 칩 둘, 👎면 아래 줄에 이유 칩 */
.feedback { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.feedback .chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.feedback .msg { flex-basis: 100%; margin-top: 0; font-size: 0.9rem; }
/* 등록된 영상 안에서 찾기(아이·부모 공용): 글자 칸 + 채널 칩(칩이 많으면 옆으로 넘김) */
.vfilter { display: grid; gap: 8px; margin-bottom: 12px; }
.vfilter input[type=text] { width: 100%; }
.vfilter .chips { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 4px; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 0.95rem; white-space: nowrap; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
/* 저장한 채널 머리줄: 이름·정보와 "채널 빼기"(좁으면 줄바꿈) */
.channel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.channel-head > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.channel-head .hint { margin: 2px 0 0; }
.channel-head button { flex: none; min-height: 40px; padding: 0 12px; }
/* 👶 아이에게 열기(채널 단위 승인)와 점수: 좁으면 줄바꿈 */
.kid-open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.kid-open select { min-height: 40px; }
.kid-open .hint { margin: 0; }
.channel-add summary { cursor: pointer; color: var(--muted); font-size: 0.95rem; padding: 4px 0; }
.channel-add form { margin-top: 8px; }
/* 저장한 채널: 채널마다 영상 카드를 한 줄로 놓고 옆으로 넘겨 본다(채널이 늘어도 화면이 길어지지 않게) */
.h-scroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; padding-bottom: 8px; }
.h-card { flex: 0 0 152px; min-width: 0; display: flex; flex-direction: column; gap: 6px; scroll-snap-align: start; }
.h-card .thumb { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; }
.h-card .thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.h-card .thumb::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 1.4rem; text-shadow: 0 0 8px #000; }
.h-card .t { font-weight: 600; font-size: 0.9rem; line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; cursor: pointer; }
.h-card .tags { min-height: 1.5em; font-size: 0.8rem; }
.h-card button { min-height: 40px; margin-top: auto; }
/* 운영자 화면(PC 기준): 통계 표가 넓어서 화면 폭을 더 쓴다. body에는 class를 달지 않는다(staging 띠를 <body> 바로 뒤에 넣음) */
main.wide { max-width: 1400px; }
/* 데이터 그리드(grid.js): 찾기·개수·쪽수, 표는 옆으로 넘겨 보고 첫 칸(이름)은 붙어 있다 */
.dgrid-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.dgrid-bar input { flex: 1 1 220px; min-height: 40px; }
.dgrid-bar select { min-height: 40px; }
.dgrid-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; }
.dgrid table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.85rem; }
.dgrid th, .dgrid td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; background: var(--card); }
.dgrid thead { position: sticky; top: 0; z-index: 3; }
.dgrid th { font-weight: 700; color: var(--muted); background: var(--bg); }
.dgrid th.group { text-align: center; color: var(--ink); border-left: 1px solid var(--line); }
.dgrid th button { all: unset; cursor: pointer; display: block; }
.dgrid th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.dgrid .num { text-align: right; font-variant-numeric: tabular-nums; }
.dgrid th.num button { text-align: right; width: 100%; }
/* 첫 칸(이름)은 옆으로 넘겨도 붙어 있다. 머리는 첫 줄의 첫 칸만(둘째 줄 첫 칸은 묶음 안의 칸이라 제외) */
.dgrid thead tr:first-child > th:first-child, .dgrid tbody td:first-child, .dgrid tfoot td:first-child { position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
.dgrid tbody tr:hover td { background: var(--bg); }
.dgrid td.ok { color: var(--ok); background: var(--ok-bg); font-weight: 700; }
.dgrid td.bad { color: var(--danger); background: var(--bad-bg); font-weight: 700; }
.dgrid td .badge { font-size: 0.72rem; }
.dgrid td .toggle { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0 6px 0 0; }
.dgrid tr.detail td { white-space: normal; background: var(--bg); position: static; }
.dgrid tr.detail .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dgrid tr.detail .actions button { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.dgrid tfoot td { font-weight: 700; border-bottom: 0; background: var(--bg); }
.dgrid td.empty { text-align: center; padding: 24px; }
.dgrid-pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
.dgrid-pager button.ghost { min-height: 36px; padding: 0 12px; }
.dgrid-pager button:disabled { opacity: 0.4; cursor: default; }
/* 칸 안의 입력·버튼(운영자 가입 표의 승인·취소)은 행 높이에 맞게 작게 */
.dgrid td .actions { display: inline-flex; align-items: center; gap: 6px; }
.dgrid td input[type=text] { flex: none; width: 150px; min-height: 34px; font-size: 0.85rem; }
.dgrid td button.primary, .dgrid td button.ghost { min-height: 34px; padding: 0 12px; font-size: 0.85rem; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.tone-ok { color: var(--ok); font-weight: 700; }
.tone-bad { color: var(--danger); font-weight: 700; }

/* 📊 활동 기록: 위에 통계 타일, 아래 풀기마다 한 줄(펼치면 문제별 고른 보기) */
.act-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; min-width: 0; display: grid; gap: 2px; }
.stat .label { font-size: 0.85rem; color: var(--muted); }
.stat strong { font-size: 1.5rem; color: var(--accent); line-height: 1.2; }
.stat .sub { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.stat .meter { height: 8px; margin: 4px 0 2px; }
.attempts { display: grid; margin-top: 4px; }
.attempt { border-top: 1px solid var(--line); padding: 8px 0; }
.attempt summary { cursor: pointer; list-style: none; display: grid; gap: 2px; }
.attempt summary::-webkit-details-marker { display: none; }
.attempt .head { overflow-wrap: anywhere; }
.attempt .head::before { content: '▸ '; color: var(--muted); }
.attempt[open] .head::before { content: '▾ '; }
.attempt .meta { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.attempt .meta.warn { color: var(--danger); }
.attempt .q { margin: 8px 0 0 14px; font-size: 0.95rem; overflow-wrap: anywhere; }
.attempt .q .picks { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

/* 📝 파일럿 설문(/survey): 우리 안 + 고르기 문항 */
.survey { max-width: 640px; }
.survey-intro { margin: 0 0 12px; font-weight: 700; }
.survey-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.survey-shot { margin: 0; display: grid; gap: 4px; min-width: 0; }
.survey-shot img { width: 100%; border: 1px solid var(--line); border-radius: 10px; display: block; background: var(--line); }
.survey-shot figcaption { font-size: 0.8rem; }
.survey-addons { display: grid; gap: 10px; }
.survey-addon { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.survey-addon-tag { font-size: 0.8rem; color: var(--muted); }
.survey-addon .hint { margin: 2px 0 0; }
.survey-num { display: grid; grid-template-columns: minmax(0, 1fr) 7em auto; gap: 8px; align-items: center; }
.survey-num input { min-height: 44px; width: 100%; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; text-align: right; }
.survey-num .unit { color: var(--muted); }
.survey-num .lab, .survey-q-text, .survey-addon { word-break: keep-all; overflow-wrap: anywhere; }
.survey-q { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0; display: grid; gap: 6px; min-width: 0; }
.survey-q-text { font-weight: 700; padding: 0; margin-bottom: 4px; }
.survey-opt { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.survey-opt input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.survey-opt span { min-width: 0; overflow-wrap: anywhere; }
.survey-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 122, 89, 0.25); }
.survey-q textarea { margin-top: 4px; }
/* 운영자 화면 설문 결과: 문항마다 보기별 고른 수 막대 */
.survey-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.survey-count { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.survey-count strong { font-size: 0.95rem; }
.survey-bar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 2em; gap: 8px; align-items: center; font-size: 0.85rem; }
.survey-bar .lab { overflow-wrap: anywhere; }
.survey-bar .track { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.survey-bar .fill { display: block; height: 100%; background: var(--accent); }
.survey-bar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.survey-comment { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* 🎟 이용권 돌려받기(퀴즈 검토 칸, 공개 안 한 🎬 초안) */
.feedback .refund { flex-basis: 100%; display: grid; gap: 4px; justify-items: start; border-top: 1px dashed var(--line); padding-top: 8px; }
.feedback .refund .hint { margin: 0; }
.survey-stat { font-size: 0.85rem; overflow-wrap: anywhere; }
