/* 학생 화면. 휴대폰 세로가 먼저다. */
.app { max-width: 560px; margin: 0 auto; padding: 14px 14px 28px; min-height: 100dvh; display: flex; flex-direction: column; gap: 12px; }
.center { text-align: center; }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.byeori { display: block; object-fit: contain; }
.byeori.big { width: 132px; height: 132px; margin: 6px auto 0; }
.byeori.small { width: 56px; height: 56px; }
.byeori.mini { width: 30px; height: 30px; flex: none; }

.join, .start { display: flex; flex-direction: column; gap: 14px; }
.hello { font-family: var(--hand); font-size: 26px; line-height: 1.3; text-align: center; margin: 0; }
.row { display: flex; flex-direction: column; gap: 6px; }
.row > label { font-weight: 700; font-size: 15px; }
.hint { font-size: 13px; color: var(--blush-ink); margin: 0; }
.errs { margin: 0; padding: 0; list-style: none; color: var(--blush-ink); font-size: 14px; display: grid; gap: 4px; }
.btn.wide { width: 100%; }
.btn.tiny { min-height: 34px; padding: 4px 12px; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--star); border-color: var(--star-deep); color: var(--star-ink); font-weight: 700; }
.chip:disabled { opacity: .5; cursor: default; }
.chip em { font-style: normal; font-size: 12px; margin-left: 6px; color: var(--muted); }
.chip.big { min-height: 48px; font-size: 17px; background: var(--tile-butter); border-color: transparent; }

.top { display: flex; align-items: center; gap: 10px; }
.top .btn { flex: none; }
.title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.title strong { font-size: 16px; }
.lights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.light { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); font-size: 11px; line-height: 1.2; text-align: center; color: var(--muted); }
.light .num { font-family: var(--num); font-size: 18px; font-weight: 800; }
.light.done { background: var(--tile-lilac); border-color: transparent; color: var(--lilac-ink); }
.light.now { background: var(--star); border-color: var(--star-deep); color: var(--star-ink); font-weight: 700; box-shadow: var(--shadow-sm); }

.desk { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-md); }
.talk { display: flex; flex-direction: column; gap: 10px; min-height: 180px; max-height: 52dvh; overflow-y: auto; padding-right: 2px; }
.mark { align-self: center; font-size: 12px; color: var(--muted); background: var(--tile-butter); border-radius: 999px; padding: 3px 12px; }
.mark .num { margin-right: 6px; }
.line { display: flex; gap: 6px; align-items: flex-end; }
.line.me { flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble { max-width: 84%; padding: 10px 14px; border-radius: 18px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.line.bot .bubble { background: var(--tile-butter); border-bottom-left-radius: 6px; }
.line.me .bubble { background: var(--tile-lilac); border-bottom-right-radius: 6px; }
.bubble.wait { color: var(--muted); font-size: 14px; }
.into { border: 0; background: none; color: var(--lilac-ink); font: inherit; font-size: 13px; text-decoration: underline; padding: 2px 4px; cursor: pointer; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice { margin: 0; color: var(--blush-ink); background: var(--tile-blush); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.notice:empty { display: none; }
.compose { display: flex; gap: 8px; align-items: flex-end; }
.say { flex: 1; min-height: 48px; max-height: 120px; resize: none; }
.nextrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nextrow .hint { color: var(--muted); }
.next { flex: none; }

.card.mine { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 2px dashed var(--star-deep); }
.card.mine h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.draft { min-height: 96px; resize: vertical; font-size: 17px; line-height: 1.5; }
.cardfoot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.count { font-family: var(--num); font-weight: 700; }
.count.over { color: var(--blush-ink); }

/* R단계부터: 대화 창은 회색으로 잠기고 짧게 접힌다. 입력 칸과 보내기 단추는 화면에 없다. */
.chat.locked { background: var(--surface-2); box-shadow: none; border: 1.5px dashed var(--line-strong); }
.chat.locked .talk { min-height: 0; max-height: 22dvh; filter: grayscale(1); opacity: .5; }
.lock { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px 10px; border-radius: 16px; background: var(--tile-lilac); color: var(--lilac-ink); }
.lock strong { font-size: 30px; line-height: 1.1; }

/* 문제 다시 읽기: 내 문제 카드를 크게 */
.card.mine.reading { border-style: solid; border-width: 3px; }
.card.mine.reading .draft { font-size: 22px; line-height: 1.6; min-height: 132px; }
.readrow { display: flex; flex-direction: column; gap: 8px; }
.readrow .btn { white-space: normal; text-align: center; line-height: 1.3; padding: 10px 18px; }
.readdone { margin: 0; text-align: center; font-weight: 700; color: var(--lilac-ink); background: var(--tile-lilac); border-radius: 12px; padding: 8px 12px; }
.readrow .errs:empty, .rform .errs:empty, .kwork .errs:empty { display: none; }

/* 내 힘으로 풀어 보기, 핵심 개념, 올린 뒤 */
.card.work { padding: 16px 14px; }
.rwork, .rform, .kwork, .donework { display: flex; flex-direction: column; gap: 12px; }
.rwork h2, .kwork h2, .donework h2 { margin: 0; font-size: 26px; line-height: 1.25; }
.rwork > p { margin: 0; }
.rform .row > span { font-weight: 700; font-size: 15px; }
.rform textarea, .kwork textarea { resize: vertical; line-height: 1.5; }
.part { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.part legend { padding: 0; margin-bottom: 6px; font-weight: 700; font-size: 15px; }
.part p { margin: 0; }
.ansrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.ansline { display: flex; gap: 8px; flex: 2 1 180px; min-width: 0; }
.mini { display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-width: 0; font-size: 13px; color: var(--muted); }
.ansrow > .mini { flex: 1 1 90px; }
.mini .field { min-width: 0; font-size: 18px; color: var(--ink); }
.tick { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border-radius: 14px; background: var(--surface-2); font-size: 16px; cursor: pointer; }
.tickbox { width: 24px; height: 24px; flex: none; accent-color: var(--lilac-ink); }
.ticks { display: flex; flex-direction: column; gap: 8px; }
.rules { margin: 0; padding: 10px 12px 10px 30px; border-radius: 14px; background: var(--tile-butter); display: grid; gap: 4px; font-size: 15px; line-height: 1.45; }
.donework { align-items: stretch; text-align: center; }
.gist { background: var(--tile-butter); border-radius: 16px; padding: 12px 14px; text-align: left; }
.gist p { margin: 0; line-height: 1.6; }
.gist p + p { margin-top: 4px; font-size: 16px; }
.state { margin: 0; font-weight: 700; padding: 10px 12px; border-radius: 14px; background: var(--tile-lilac); color: var(--lilac-ink); }

@media (min-width: 900px) {
  .app { max-width: 1040px; }
  .desk { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); align-items: start; }
  .talk { max-height: 60dvh; }
  .card.mine { position: sticky; top: 14px; }
  /* R단계부터는 잠긴 대화를 왼쪽에 좁게, 다시 읽기와 풀어 보기를 오른쪽에 넓게 */
  .desk.solo { grid-template-columns: minmax(240px, .8fr) minmax(0, 1.6fr); }
  .desk.solo .chat { grid-column: 1; grid-row: 1 / span 2; }
  .desk.solo .card.mine, .desk.solo .card.work { grid-column: 2; }
  .desk.solo .card.mine { position: static; }
  .chat.locked .talk { max-height: 50dvh; }
}

/* ---- 탭과 문제 보드(과제 10) ---- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.tab { min-height: 40px; border: 0; border-radius: 999px; background: transparent; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.boardbox { display: flex; flex-direction: column; gap: 12px; }
.boardlist { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .boardlist { grid-template-columns: 1fr 1fr; } }
.pcard { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.pcard.good { border-color: var(--star-deep); }
.pcard.open { background: var(--bg-alt); }
.pcard .btn { align-self: flex-start; }
.ptags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.6; }
.tag.good { background: var(--star); color: var(--star-ink); font-weight: 700; }
.tag.book { background: var(--tile-lilac); color: var(--lilac-ink); }
.tag.warn { background: var(--tile-blush); color: var(--blush-ink); font-weight: 700; }
.ptext { margin: 0; font-size: 18px; line-height: 1.6; white-space: pre-wrap; }
.pby { margin: 0; }
.pchoices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pinput { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pinput .field { width: 110px; flex: none; }
.pinput label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.punit { font-weight: 700; }
.pback { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1.5px dashed var(--line-strong); }
.pback p { margin: 0; }
.pres { font-weight: 800; }
.pres.ok { color: var(--live); }
.pres.no { color: var(--blush-ink); }
.minebox { display: flex; flex-direction: column; gap: 8px; }
.minebox h2 { font-size: 16px; margin: 0; }
.pcard.mine { background: var(--surface-2); box-shadow: none; }
.pstate { margin: 0; font-size: 14px; color: var(--ink-2); }
.pnote, .tnote2 { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--tile-blush); color: var(--blush-ink); font-size: 14px; }
.boardlist.big { grid-template-columns: 1fr 1fr; gap: 14px; }
.boardlist.big .ptext { font-size: 24px; }
.gamego { background: var(--star); color: var(--star-ink); }
