@import url("./base.css");

/* ── 참여코드 뱃지 (발표 화면 상단 고정) ───────────────── */
.join-badge {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border: var(--bd-stage); border-radius: 6px;
  box-shadow: var(--sh-stage); padding: 12px 18px;
}
.join-badge .jb-url { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.join-badge .jb-label { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .1em; }
.code-tiles { display: flex; gap: 6px; }
.code-tiles b {
  font-family: var(--mono); font-size: 38px; font-weight: 700; line-height: 1;
  border: 3px solid var(--ink); border-radius: 4px; padding: 6px 10px; background: var(--paper);
}
.code-tiles b.hit { animation: tilehit .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes tilehit {
  40% { transform: translateY(-12px) rotate(-3deg); background: var(--accent); color: var(--on-accent); }
}
.qr-box { width: 104px; height: 104px; border: 3px solid var(--ink); background: #fff; display: grid; place-items: center; }
.qr-box img, .qr-box canvas { width: 100%; height: 100%; }

/* ── 발표 화면 ────────────────────────────────────────── */
.stage-root {
  position: fixed; inset: 0; background: var(--accent);
  display: flex; flex-direction: column; padding: 22px 26px 18px;
  transition: background .45s ease;
}
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.stage-body {
  flex: 1; margin-top: 18px; min-height: 0;
  background: var(--card); border: var(--bd-stage); border-radius: 6px; box-shadow: var(--sh-stage);
  display: flex; flex-direction: column; padding: 26px 30px; overflow: hidden;
}
.stage-q { font-size: clamp(28px, 3.4vw, 56px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.stage-sub { font-size: clamp(15px, 1.3vw, 22px); color: var(--muted); font-weight: 600; margin-top: 6px; }
.stage-canvas { flex: 1; min-height: 0; margin-top: 20px; overflow: hidden; position: relative; }
.stage-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 14px; color: var(--on-accent); font-weight: 800; font-size: 18px;
}
/* 조작 버튼은 항상 읽히게. 대신 어두운 색으로 눌러 콘텐츠와 경쟁하지 않게 한다. */
.stage-ctrl { display: flex; gap: 8px; align-items: center; }
.stage-ctrl .btn {
  background: var(--ink); color: #fff; border-color: rgba(255,255,255,.35);
  box-shadow: none; opacity: .82; transition: opacity .15s;
}
.stage-ctrl .btn:hover { opacity: 1; transform: translate(-1px,-1px); box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.stage-ctrl .btn[disabled] { opacity: .3; }
.stage-ctrl .btn.go { background: var(--card); color: var(--ink); font-weight: 800; opacity: 1; }
.stage-ctrl .btn.danger { background: #C42348; }

/* 대기 화면 중앙의 큰 시작 버튼 — 하단에서 버튼을 찾게 만들지 않는다 */
.lobby-start {
  border: var(--bd-stage); border-radius: 6px; background: var(--ink); color: #fff;
  padding: 18px 40px; font-size: clamp(20px, 2vw, 30px); font-weight: 800;
  cursor: pointer; box-shadow: var(--sh-stage); margin-top: 8px;
}
.lobby-start:hover { transform: translate(-2px,-2px); box-shadow: 14px 14px 0 var(--ink); }
.lobby-start:active { transform: translate(4px,4px); box-shadow: 4px 4px 0 var(--ink); }
.lobby-hint { color: var(--on-accent); font-weight: 700; opacity: .9; margin-top: 6px; }
.stage-lobby { flex: 1; display: grid; place-items: center; text-align: center; gap: 10px; }
.stage-lobby h2 { font-size: clamp(30px, 4vw, 64px); font-weight: 800; letter-spacing: -.03em; }

/* ── 결과 부품 ───────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars.stage { gap: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 26%) 1fr; gap: 12px; align-items: center; }
.bar-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.bars.stage .bar-label { font-size: clamp(16px, 1.5vw, 26px); }
.bar-track { position: relative; height: 34px; border: var(--bd); border-radius: var(--r); background: var(--paper); overflow: hidden; }
.bars.stage .bar-track { height: 54px; border-width: 4px; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width .45s cubic-bezier(.2,.8,.3,1); }
.bar-val { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-weight: 800; font-size: 14px; mix-blend-mode: difference; color: #fff; }
.bars.stage .bar-val { font-size: 22px; }

.arc-wrap { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; height: 100%; }
.arc { max-height: 100%; }
.arc-legend { display: flex; flex-direction: column; gap: 8px; min-width: 220px; flex: 1; }
.lg-item { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.lg-dot { width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 3px; }

.gauges { display: flex; flex-direction: column; gap: 16px; }
.gg-row { display: grid; grid-template-columns: minmax(100px, 30%) 1fr 64px; gap: 14px; align-items: center; }
.gg-label { font-weight: 700; }
.gauges.stage .gg-label { font-size: clamp(16px, 1.5vw, 26px); }
.gg-track { position: relative; height: 14px; border: var(--bd); border-radius: 999px; background: var(--paper); }
.gauges.stage .gg-track { height: 22px; }
.gg-dot {
  position: absolute; top: 50%; width: 30px; height: 30px; margin-left: -15px;
  transform: translateY(-50%); border: 3px solid var(--ink); border-radius: 50%;
  background: var(--accent); transition: left .45s cubic-bezier(.2,.8,.3,1);
}
.gauges.stage .gg-dot { width: 42px; height: 42px; margin-left: -21px; }
.gg-num { font-weight: 800; text-align: right; }
.gauges.stage .gg-num { font-size: 26px; }

.cloud { position: relative; width: 100%; height: 100%; min-height: 260px; }
.cloud .cw { position: absolute; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; transition: font-size .4s cubic-bezier(.2,.8,.3,1); }
.cloud:not(.stage) .cw { color: var(--ink) !important; }

.notes { column-count: 2; column-gap: 12px; height: 100%; overflow: hidden; }
.notes.stage { column-count: 3; column-gap: 18px; }
.notes.dense { column-count: 4; }
.note { break-inside: avoid; border: var(--bd); border-radius: var(--r); background: var(--paper); padding: 12px 14px; margin-bottom: 12px; }
.notes.stage .note { font-size: clamp(15px, 1.35vw, 24px); font-weight: 600; }
.note-by { margin-top: 6px; color: var(--muted); font-weight: 700; }

/* ── Q&A ─────────────────────────────────────────────── */
.q-list { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.q-item { display: flex; gap: 12px; align-items: flex-start; border: var(--bd); border-radius: var(--r); background: var(--card); padding: 12px 14px; }
.q-item.answered { opacity: .5; }
.q-item.answered .q-text { text-decoration: line-through; }
.q-text { font-weight: 700; flex: 1; }
.stage .q-text { font-size: clamp(16px, 1.5vw, 28px); }
.q-up {
  display: flex; flex-direction: column; align-items: center; min-width: 52px;
  border: var(--bd); border-radius: var(--r); background: var(--paper);
  padding: 4px 6px; font-weight: 800; cursor: pointer;
}
.q-up.on { background: var(--accent); color: var(--on-accent); }
.q-up[disabled] { cursor: default; }
.q-up .n { font-family: var(--mono); font-size: 18px; }

/* ── 학생 화면 ───────────────────────────────────────── */
.stu-root { min-height: 100dvh; background: var(--accent); display: flex; flex-direction: column; transition: background .4s; }
.stu-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--on-accent); font-weight: 800; }
.stu-card {
  flex: 1; margin: 0 12px 12px; background: var(--card); border: var(--bd); border-radius: 6px;
  box-shadow: var(--sh); padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.stu-q { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.stu-sub { color: var(--muted); font-weight: 600; margin-top: 4px; }
.btn.big { padding: 16px; font-size: 17px; width: 100%; }
.opt {
  text-align: left; border: var(--bd); border-radius: var(--r); background: var(--card);
  padding: 15px 16px; font-weight: 700; cursor: pointer; box-shadow: var(--sh-sm);
}
.opt.on { background: var(--accent); color: var(--on-accent); box-shadow: none; transform: translate(3px, 3px); }
.scale-row { display: flex; gap: 8px; }
.scale-b { flex: 1; border: var(--bd); border-radius: var(--r); background: var(--card); padding: 14px 0; font-weight: 800; cursor: pointer; }
.scale-b.on { background: var(--accent); color: var(--on-accent); }
.rank-row { display: flex; align-items: center; gap: 8px; border: var(--bd); border-radius: var(--r); background: var(--card); padding: 10px 12px; font-weight: 700; }
.rank-no { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%; font-size: 13px; }
.done-mark { font-size: 54px; text-align: center; }

/* ── 교사 스튜디오 ───────────────────────────────────── */
.shell { max-width: 1120px; margin: 0 auto; padding: 22px 18px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.slide-item { display: flex; align-items: center; gap: 8px; border: var(--bd); border-radius: var(--r); background: var(--card); padding: 9px 10px; cursor: pointer; }
.slide-item.sel { box-shadow: var(--sh-sm); background: var(--paper); }
.slide-item .ic { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 4px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-card { text-align: left; border: var(--bd); border-radius: var(--r); background: var(--card); padding: 12px; cursor: pointer; box-shadow: var(--sh-sm); }
.type-card:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.type-card .t { font-weight: 800; display: flex; gap: 8px; align-items: center; }
.pad { padding: 18px; }
hr.sep { border: 0; border-top: 2px dashed var(--line); margin: 16px 0; }
