/* ───────────────────────── 디자인 시스템 ─────────────────────────
   카툰 스타일: 선명한 원색 + 굵은 남색 테두리 + 아래로 떨어지는 딱딱한 그림자.
   · 색     : 팀 색(오렌지/블루)과 강조색(노랑)만 원색으로 쓰고, 바탕은 짙은 보라
   · 테두리 : 모든 패널·버튼에 --ink 색 3~4px
   · 그림자 : 흐림 없이 아래로만 (0 Npx 0 --ink) → 눌리는 버튼 느낌
   · 글자   : 페이퍼로지(Paperlogy). 제목·숫자는 Black(900) + 남색 외곽선, 버튼·HUD 는 Bold(700), 긴 설명은 Medium(500)
   3D 화면(js/render.js)의 색도 같은 팔레트를 쓴다(js/config.js 의 TEAMS). */
@font-face { font-family: "Paperlogy"; font-weight: 500; font-style: normal; font-display: swap; src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-5Medium.woff2") format("woff2"); }
@font-face { font-family: "Paperlogy"; font-weight: 700; font-style: normal; font-display: swap; src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2") format("woff2"); }
@font-face { font-family: "Paperlogy"; font-weight: 900; font-style: normal; font-display: swap; src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-9Black.woff2") format("woff2"); }

:root {
  --ink: #1b1436;         /* 테두리 · 그림자 */
  --bg: #1d1650;          /* 가장 뒤 바탕 */
  --panel: #2c2378;       /* 카드 */
  --panel-2: #3a2f96;     /* 카드 안의 칸 */
  --field: #1a1348;       /* 입력칸 */
  --text: #ffffff;
  --sub: #c3bcf2;
  --o: #ff8a1f;
  --o-2: #ffb347;
  --o-light: #ffd9a8;
  --b: #3d7bff;
  --b-2: #6aa2ff;
  --b-light: #c6d8ff;
  --yellow: #ffd21f;
  --yellow-2: #ffec6e;
  --pink: #ff4fa3;
  --mint: #5cf2b0;
  --ok: #9dffb0;
  --bad: #ff8fa3;
  --stroke: 3px;
  --r: 18px;
  --drop: 0 5px 0 var(--ink);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --display: "Paperlogy", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --round: "Paperlogy", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--round);
  font-weight: 700;
  overflow: hidden;
  overscroll-behavior: none;
  word-break: keep-all;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 굵은 외곽선 글자 */
.roomcode, .score b, .clock, .bignum, .final, .resscore, .card.result h1, .banner, .float {
  font-family: var(--display);
  font-weight: 900;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink);
}

/* ───────── 공통 화면(첫 화면 · 대기실 · 결과) ───────── */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(20px + var(--sab)) calc(16px + var(--sal));
  overflow-y: auto;
  background:
    repeating-conic-gradient(from 0deg at 50% 38%, rgba(255, 255, 255, 0.045) 0 9deg, transparent 9deg 18deg),
    radial-gradient(70vmax 70vmax at 6% 8%, rgba(255, 138, 31, 0.55), transparent 62%),
    radial-gradient(70vmax 70vmax at 96% 94%, rgba(61, 123, 255, 0.6), transparent 62%),
    linear-gradient(160deg, #3a1f8f, var(--bg) 70%);
  z-index: 20;
}
.screen.dim { background: rgba(20, 13, 60, 0.74); backdrop-filter: blur(3px); }

.card {
  width: min(100%, 520px);
  background: linear-gradient(180deg, #3b309c, var(--panel) 42%);
  border: 4px solid var(--ink);
  border-radius: 28px;
  padding: 22px 22px 24px;
  box-shadow: 0 10px 0 var(--ink), 0 26px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* 큰 모달: 첫 화면 · 대기실 · 결과 */
.card.lobby { width: min(100%, 1180px); gap: 14px; padding: 24px 30px 22px; }
.card.result { width: min(100%, 940px); padding: 24px 32px 26px; }
.sec { margin: 6px 0 0; font-size: 19px; font-weight: 900; color: var(--yellow); display: flex; align-items: baseline; gap: 10px; }
.sec:first-child { margin-top: 0; }
.sec small { font-size: 14.5px; font-weight: 500; color: var(--sub); }

/* ───────── 첫 화면: 영화 포스터 ─────────
   뒤쪽 3D 장면(poster.js)은 경기 캔버스에 그린다. 장면이 뜨기 전이나 3D 를 못 쓰는 기기에서는 .screen 배경이 보인다.
   #pst-stage 는 보이지 않는 칸: 3D 장면이 이 칸 안에 들어오도록 카메라가 맞춘다. */
#home.poster { padding: 0; place-items: stretch; overflow-x: hidden; }
body.poster-live #home.poster { background: transparent; }
.pst-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 72%, rgba(9, 5, 28, 0.82)),
    linear-gradient(90deg, rgba(12, 7, 36, 0.62), transparent 46%),
    radial-gradient(75% 65% at 0% 0%, rgba(12, 7, 36, 0.78), transparent 72%),
    radial-gradient(55% 45% at 96% 6%, rgba(255, 138, 31, 0.32), transparent 72%),
    radial-gradient(55% 50% at 4% 96%, rgba(61, 123, 255, 0.3), transparent 72%),
    radial-gradient(150% 110% at 55% 45%, transparent 58%, rgba(8, 4, 24, 0.8));
}
/* 위에서 내리꽂는 무대 조명 줄기 */
.pst-fx::before {
  content: "";
  position: absolute;
  inset: -10% -20% 25% -20%;
  background: conic-gradient(from 168deg at 68% -6%, transparent 0deg, rgba(255, 236, 200, 0.12) 4deg 7deg, transparent 10deg 15deg, rgba(255, 236, 200, 0.09) 17deg 21deg, transparent 24deg 30deg, rgba(190, 220, 255, 0.1) 32deg 35deg, transparent 38deg 44deg, rgba(255, 236, 200, 0.07) 46deg 50deg, transparent 53deg);
  -webkit-mask-image: linear-gradient(180deg, #000 10%, transparent 92%);
  mask-image: linear-gradient(180deg, #000 10%, transparent 92%);
  mix-blend-mode: screen;
  transform-origin: 68% 0;
  animation: rays 11s ease-in-out infinite alternate;
}
@keyframes rays { from { transform: rotate(-2.5deg); opacity: 0.75; } to { transform: rotate(2.5deg); opacity: 1; } }

.pst {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "head stage" "ticket stage" "bill bill";
  column-gap: 3vw;
  row-gap: 16px;
  padding: calc(20px + var(--sat)) calc(3.5vw + var(--sar)) calc(14px + var(--sab)) calc(3.5vw + var(--sal));
}
.pst-head { grid-area: head; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.pst-stage { grid-area: stage; justify-self: stretch; align-self: stretch; min-height: 220px; pointer-events: none; }
.pst .ticket { grid-area: ticket; align-self: start; }
.pst-bill { grid-area: bill; }

.pst-kicker {
  margin: 0 0 4px 0.2em;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(14px, 1.45vw, 20px);
  letter-spacing: 0.34em;
  color: #ffe1b8;
  text-shadow: 0 2px 0 var(--ink), 0 0 18px rgba(255, 160, 60, 0.5);
}
/* 제목: 두꺼운 먹 테두리 + 아래로 쌓인 그림자(뒷장) 위에 그라데이션 글자(앞장) */
.pst-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--display);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.045em;
  transform: rotate(-4deg) skewX(-6deg);
  transform-origin: left center;
  margin-top: 14px;
}
.pst-title span {
  position: relative;
  display: block;
  width: fit-content;
  isolation: isolate;
  padding: 0 0.06em;
  color: var(--ink);
  -webkit-text-stroke: 0.17em var(--ink);
  text-shadow: 0 0.05em 0 var(--ink), 0 0.1em 0 var(--ink), 0 0.15em 0 var(--ink), 0 0.24em 0.3em rgba(0, 0, 0, 0.55);
}
/* 앞장: 같은 자리에 그라데이션 글자를 겹친다 */
.pst-title span::after {
  content: attr(data-t);
  position: absolute;
  inset: 0;
  padding: inherit;
  z-index: 1;
  color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: none;
  background-image: var(--fill);
  -webkit-background-clip: text;
  background-clip: text;
}
.pst-title .w1 {
  font-size: clamp(76px, 11.6vw, 176px);
  --fill: linear-gradient(180deg, #fff6c8 0%, #ffd23a 26%, #ff9a26 60%, #e8560a 100%);
  animation: plop 0.75s cubic-bezier(0.2, 1.6, 0.4, 1) 0.1s both;
}
.pst-title .w2 {
  font-size: clamp(60px, 8.9vw, 134px);
  margin: -0.02em 0 0 0.4em;
  --fill: linear-gradient(180deg, #f2fbff 0%, #9fe0ff 28%, #4c8dff 64%, #2547d0 100%);
  animation: plop 0.75s cubic-bezier(0.2, 1.6, 0.4, 1) 0.3s both;
}
@keyframes plop { from { transform: translateY(-0.5em) scale(1.3); opacity: 0; } 60% { opacity: 1; } }
/* 글자에서 흘러내리는 잉크 방울 */
.drip {
  position: absolute;
  z-index: 2;
  top: 0.74em;
  width: 0.12em;
  height: 0.16em;
  border: 0.03em solid var(--ink);
  border-top: 0;
  border-radius: 0 0 0.06em 0.06em;
  background: var(--dc, #ff8a1f);
  animation: drip var(--dd, 4.2s) cubic-bezier(0.5, 0, 0.8, 0.6) var(--dl, 0s) infinite;
}
.drip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.06em;
  width: 0.15em;
  height: 0.17em;
  margin-left: -0.075em;
  border: 0.03em solid var(--ink);
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--dc, #ff8a1f);
  box-sizing: border-box;
  animation: dripfall var(--dd, 4.2s) ease-in var(--dl, 0s) infinite;
}
@keyframes drip { 0% { height: 0.08em; } 72% { height: 0.34em; } 78%, 100% { height: 0.12em; } }
@keyframes dripfall { 0%, 72% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(0.9em); opacity: 0; } }
.w1 .drip { --dc: #ef6a12; }
.w2 .drip { --dc: #2f5fe0; top: 0.72em; }
.drip.d1 { left: 19%; --dd: 3.8s; --dl: -1.2s; }
.drip.d2 { left: 54%; --dd: 5.1s; --dl: -3.4s; height: 0.22em; }
.drip.d3 { left: 83%; --dd: 4.4s; --dl: -0.4s; }
.drip.d4 { left: 31%; --dd: 4.8s; --dl: -2.2s; }
.drip.d5 { left: 76%; --dd: 3.9s; --dl: -0.9s; }

.pst-sub { margin: 20px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: clamp(15px, 1.35vw, 18px); font-weight: 700; color: #e9e5ff; }
.pst-sub .vs-o, .pst-sub .vs-b { padding: 2px 13px 3px; border-radius: 999px; border: 2.5px solid var(--ink); color: #fff; box-shadow: 0 3px 0 var(--ink); text-shadow: 0 1px 0 var(--ink); font-weight: 900; }
.pst-sub .vs-o { background: var(--o); }
.pst-sub .vs-b { background: var(--b); }
.pst-sub .pvs { font-family: var(--display); font-weight: 900; font-style: italic; font-size: 1.35em; color: var(--yellow); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.pst-sub .pst-max { flex-basis: 100%; color: var(--sub); font-weight: 500; text-shadow: 0 1px 0 var(--ink); }
.pst-head .modechip { display: none; } /* 학생 화면은 입장권 딱지가 '학생 입장권'으로 바뀐다 */

/* 입장권: 로그인 · 닉네임 · 방 코드 */
.ticket {
  position: relative;
  width: min(100%, 470px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 22px 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(62, 50, 162, 0.97), rgba(40, 31, 112, 0.97));
  border: 4px solid var(--ink);
  box-shadow: 0 8px 0 var(--ink), 0 26px 50px rgba(0, 0, 0, 0.45);
}
.ticket-tag { position: absolute; top: -17px; left: 20px; padding: 3px 14px 4px 16px; border-radius: 10px; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-family: var(--display); font-weight: 900; font-size: 15px; letter-spacing: 0.3em; transform: rotate(-3deg); }
.ticket .homelinks { margin-top: 2px; padding-top: 12px; border-top: 3px dashed rgba(195, 188, 242, 0.28); }
.ticket .msg:empty { display: none; }
.trailerbtn { font: inherit; font-weight: 800; font-size: 16px; line-height: 20px; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 12px; border-radius: 999px; border: 2.5px solid var(--ink); background: linear-gradient(180deg, #ffffff, #ddd5ff); box-shadow: 0 3px 0 var(--ink); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.trailerbtn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.trailerbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.trailerbtn i { flex: none; width: 0; height: 0; border-left: 9px solid var(--pink); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

/* 포스터 맨 아래: 제작진 글씨 */
.pst-bill { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.bill-credits { margin: 0; max-width: 900px; font-size: 13px; line-height: 1.7; font-weight: 500; color: rgba(233, 229, 255, 0.78); letter-spacing: 0.05em; word-break: keep-all; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.bill-credits span { display: inline-block; margin: 0 7px 0 16px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.24em; color: rgba(233, 229, 255, 0.5); }
.bill-credits span:first-child { margin-left: 0; }
.bill-now { margin: 0; flex: none; }
.bill-now b { display: inline-block; padding: 5px 14px 6px; border: 2.5px solid rgba(255, 210, 31, 0.85); border-radius: 6px; color: var(--yellow); font-family: var(--display); font-weight: 900; font-size: 15px; letter-spacing: 0.26em; transform: rotate(-2deg); text-shadow: 0 2px 0 var(--ink); box-shadow: 0 0 22px rgba(255, 210, 31, 0.2); }

/* 예고편 창 */
.card.trailercard { width: min(100%, 860px, calc((100vh - 360px) * 1.6 + 52px)); min-width: min(100%, 520px); gap: 12px; }
.trailerhead { display: flex; align-items: center; justify-content: space-between; }
.trailerhead h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 24px; letter-spacing: 0.3em; color: var(--yellow); }
.xbtn { font: inherit; font-size: 20px; font-weight: 900; width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--ink); background: var(--panel-2); color: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.xbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* 세로 화면 · 좁은 화면: 제목 → 장면 → 입장권 → 제작진 순서로 쌓는다 */
@media (max-width: 860px), (orientation: portrait) {
  .pst { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(170px, 1fr) auto auto; grid-template-areas: "head" "stage" "ticket" "bill"; justify-items: center; row-gap: 12px; padding-top: calc(16px + var(--sat)); }
  .pst-head { align-items: center; text-align: center; }
  .pst-kicker { margin-left: 0.22em; font-size: 13px; letter-spacing: 0.22em; padding: 0 56px; }
  .pst-title { align-items: center; transform-origin: center; }
  .pst-title .w1 { font-size: min(23vw, 150px); }
  .pst-title .w2 { font-size: min(17vw, 112px); margin-left: 0.3em; }
  .pst-stage { min-height: 150px; }
  .pst-sub { justify-content: center; margin-top: 14px; }
  .pst-head .modechip { align-self: center; }
  .pst-bill { flex-direction: column; align-items: center; text-align: center; }
  .bill-credits { display: none; }
}
@media (max-height: 720px) and (orientation: landscape) {
  .pst-title .w1 { font-size: clamp(56px, 8vw, 110px); }
  .pst-title .w2 { font-size: clamp(46px, 6.2vw, 86px); }
  .pst-sub { margin-top: 10px; }
  .bill-credits { display: none; }
}
/* 로그인한 선생님: 입장권(이름 · 방 만들기 · 문제 관리 · 방 코드)이 길어서 제목을 줄이고 문구 한 줄을 뺀다 */
@media (orientation: landscape) and (min-width: 861px) {
  body.teacher-in .pst-kicker, body.teacher-in .pst-sub .pst-max { display: none; }
  body.teacher-in .pst-title .w1 { font-size: clamp(60px, 8.4vw, 128px); }
  body.teacher-in .pst-title .w2 { font-size: clamp(48px, 6.4vw, 98px); }
  body.teacher-in .pst-sub { margin-top: 14px; }
  body.teacher-in .ticket { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .pst-fx::before, .drip, .drip::after { animation: none; }
}

/* 예고편 창: 실제 경기 장면(짧은 영상)과 한 줄 설명 */
.home-show { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.show-frame { position: relative; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink); background: #e9e4ff; }
.show-frame video { display: block; width: 100%; height: 100%; object-fit: cover; }
.show-step { position: absolute; right: 10px; top: 10px; padding: 2px 11px 3px; border-radius: 999px; background: rgba(27, 20, 54, 0.78); color: #fff; font-size: 14px; font-weight: 700; }
.show-text { min-height: 118px; } /* 장면마다 글 길이가 달라도 카드 높이가 그대로이게 */
.show-text h2 { margin: 0 0 4px; font-family: var(--display); font-size: 27px; font-weight: 900; color: var(--yellow); letter-spacing: -0.3px; }
.show-text p { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.5; color: #e9e5ff; word-break: keep-all; text-wrap: pretty; }
.show-chips { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 7px; }
.show-chips li { display: flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border-radius: 999px; background: var(--field); border: 2px solid var(--ink); font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; }
.show-chips .ic { position: relative; flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--ink); overflow: hidden; }
.show-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.show-tab { font: inherit; font-size: 15px; font-weight: 700; color: var(--sub); background: transparent; border: 0; padding: 8px 2px 4px; cursor: pointer; position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.show-tab::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; border-radius: 3px; background: var(--field); }
.show-tab i { position: absolute; left: 0; top: 0; height: 5px; width: 0; border-radius: 3px; background: var(--yellow); }
.show-tab.on { color: #fff; }
.show-tab.done i { width: 100%; background: #8f86cf; }
.show-tab:hover { color: #fff; }
.home-show .keys { font-size: 14px; line-height: 1.6; }
.homelinks { display: flex; justify-content: center; align-items: center; gap: 10px 22px; flex-wrap: wrap; }
/* 틸더스 게임체험: 작은 알약 버튼(누르면 봇과 바로 10 vs 10) */
.trialbtn { font: inherit; font-weight: 800; font-size: 16px; line-height: 20px; color: #fff; display: inline-flex; align-items: center; gap: 8px; padding: 7px 8px 7px 13px; border-radius: 999px; border: 2.5px solid var(--ink); background: linear-gradient(180deg, #5a4bd1, #3f32a8); box-shadow: 0 3px 0 var(--ink); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.trialbtn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.trialbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.trialbtn i { flex: none; width: 0; height: 0; border-left: 10px solid var(--yellow); border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent; }
.trialbtn em { font-style: normal; font-size: 12.5px; line-height: 16px; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--yellow); }
.btn.login { font-size: 30px; padding: 18px 18px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.gmark { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--ink); border: 3px solid var(--ink); font-family: var(--display); font-size: 24px; font-weight: 900; text-shadow: none; line-height: 1; }


.tag-line { margin: 2px 0 4px; text-align: center; color: var(--sub); font-size: 17px; font-weight: 500; line-height: 1.5; text-wrap: balance; white-space: pre-line; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 16.5px; color: var(--sub); }
input, select {
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: var(--stroke) solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 20px;
  outline: none;
  min-width: 0;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.3);
  -webkit-user-select: text;
  user-select: text;
}
input:focus, select:focus { border-color: var(--yellow); }
input::placeholder { color: #8f86cf; }
#code { text-transform: uppercase; letter-spacing: 4px; text-align: center; flex: 1; }
#code::placeholder { letter-spacing: 0; }

/* 버튼: 누르면 아래로 쑥 들어간다 */
.btn {
  font-family: var(--round);
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  background: linear-gradient(180deg, #6657e0, #4a3cc0);
  border: var(--stroke) solid var(--ink);
  border-radius: 16px;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: var(--drop), inset 0 2px 0 rgba(255, 255, 255, 0.28);
  text-shadow: 0 2px 0 rgba(27, 20, 54, 0.55);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.28); }
.btn:disabled { filter: saturate(0.3) brightness(0.8); cursor: default; }
.btn:disabled:active { transform: none; box-shadow: var(--drop); }
.btn.primary { background: linear-gradient(180deg, var(--yellow-2), var(--yellow) 45%, #ffa51f); color: var(--ink); font-size: 27px; font-weight: 900; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5); padding: 13px 18px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--sub); font-size: 18.5px; text-shadow: none; }
.btn.ghost:active { transform: none; box-shadow: none; }
.joinrow { display: flex; gap: 8px; }
.msg { min-height: 22px; margin: 0; text-align: center; font-size: 16.5px; font-weight: 500; color: var(--bad); }
.msg.info { color: var(--sub); }

kbd { font: inherit; font-weight: 700; font-size: 14.5px; padding: 1px 7px; border-radius: 7px; background: #fff; color: var(--ink); box-shadow: 0 2px 0 #b8b0e8; }
/* 아이템 그림(이모지 대신 도형으로 그린다) */
.ic.it-cap { background: #ff5fa2; border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%; }
.ic.it-cap::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; transform: translate(-50%, -50%); background: linear-gradient(#fff, #fff) center / 100% 4px no-repeat, linear-gradient(#fff, #fff) center / 4px 100% no-repeat; }
.ic.it-splash { background: radial-gradient(circle, #fff 0 16%, #22d3ee 18% 44%, #a5f3fc 46% 58%, #0e9fc0 60%); border-radius: 50%; }
.ic.it-speed { background: #a3e635; }
.ic.it-speed::after { content: ""; position: absolute; inset: 2px 5px; background: #fff; clip-path: polygon(52% 0, 100% 0, 62% 42%, 96% 42%, 22% 100%, 44% 56%, 6% 56%); }
.ic.it-mega { background: radial-gradient(circle at 36% 30%, #e9c7ff 0 14%, #b25cff 16%); border-radius: 50%; box-shadow: 0 0 0 2px #ffd21f inset; }
.ic.it-shield { background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0 44%, #5cf2b0 46% 62%, #12b981 64%); border-radius: 50%; }
.ic.it-quiz { background: #ffd21f; }
.ic.it-quiz::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 19px; line-height: 1; color: #6d28d9; }
.ic.geyser { background: radial-gradient(circle, #fff 0 14%, #5fd0ff 16% 40%, #24306e 42% 62%, #8fb4ff 64%); border-radius: 50%; }
.ic.belt { background: repeating-linear-gradient(135deg, #2c3168 0 5px, #ffe14d 5px 9px); }
.ic.ice { background: linear-gradient(135deg, #e8fbff, #9fe6ff); }
.ic.bush { background: radial-gradient(circle at 35% 35%, #63e79a, #1fb163); border-radius: 50%; }
.ic.portal { background: radial-gradient(circle, #231a5c 35%, #ff4fd8 40%); border-radius: 50%; }
.ic.refill { background: radial-gradient(circle, #fff 22%, #35e8ff 26%); border-radius: 50%; }
.keys { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.7; color: var(--sub); text-align: center; }
.keys b { color: #fff; font-weight: 700; }

/* ───────── 선생님 로그인 ───────── */
.linkbtn { font: inherit; font-weight: 700; font-size: 16px; color: var(--sub); background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; text-decoration-color: rgba(195, 188, 242, 0.45); }
.linkbtn:hover { color: #fff; }
.linkbtn.center { align-self: center; }
a.linkbtn { display: inline-block; }
.teacherlogin { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.teacherlogin .note { margin: 0; text-align: center; font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--sub); }
.modechip { align-self: center; margin: -4px 0 0; padding: 3px 14px 4px; border-radius: 999px; background: var(--mint); color: var(--ink); border: 2px solid var(--ink); font-size: 16px; font-weight: 900; }
.teacherbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 14px; background: rgba(27, 20, 54, 0.55); border: 2px solid var(--ink); }
.tb-who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tb-who b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-role { flex: none; font-size: 13.5px; padding: 1px 9px; border-radius: 999px; background: var(--mint); color: var(--ink); border: 2px solid var(--ink); }
.teacheracts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.btn.small { font-size: 15.5px; padding: 6px 12px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.28); }
.btn.danger { background: linear-gradient(180deg, #8c4fa0, #6b3a86); }
.btn.danger.sure { background: linear-gradient(180deg, #ff6f8f, #e0325a); }

/* ───────── 대기실 ───────── */
.lobbyhead { display: flex; align-items: center; gap: 18px; }
.lobbyhead .lobbyinfo { margin-left: auto; }
.codebox { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 16px; }
.roomlink { flex-basis: 100%; font-size: 15px; font-weight: 500; color: var(--sub); word-break: break-all; -webkit-user-select: text; user-select: text; }
/* 초대 QR (누르면 크게) */
.qrbox { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 6px 4px; border-radius: 14px; background: #fff; border: var(--stroke) solid var(--ink); box-shadow: 0 4px 0 var(--ink); cursor: pointer; font: inherit; font-size: 12.5px; color: var(--ink); }
.qrbox canvas { width: 94px; height: 94px; display: block; image-rendering: pixelated; }
.qrbox:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.card.qrcard { width: min(100%, 720px); align-items: center; text-align: center; gap: 14px; }
.qrcard canvas { width: min(64vh, 82vw, 560px); height: min(64vh, 82vw, 560px); border-radius: 18px; border: var(--stroke) solid var(--ink); image-rendering: pixelated; background: #fff; }
.qrcode-text { display: flex; align-items: baseline; gap: 14px; }
.qrcode-text b { font-family: var(--display); font-weight: 900; font-size: 64px; letter-spacing: 10px; color: var(--yellow); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); line-height: 1.1; }
.roomlink.big { font-size: 19px; color: #fff; }
.quizopt select[hidden] { display: none; }
.quizinfo { display: flex; align-items: center; min-height: 52px; padding: 0 14px; border-radius: 14px; background: var(--field); border: var(--stroke) solid var(--ink); color: #fff; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: 17px; color: var(--sub); }
.roomcode { font-size: 76px; letter-spacing: 10px; line-height: 1.05; color: var(--yellow); }
.lobbyinfo { display: flex; align-items: center; gap: 16px; }
.lobbycount { margin: 0; display: flex; align-items: baseline; gap: 7px; font-size: 18px; color: var(--sub); white-space: nowrap; }
.lobbycount b { font-size: 34px; font-weight: 900; color: #fff; }
.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.vs { align-self: center; font-family: var(--display); font-weight: 900; font-size: 34px; color: #fff; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); transform: rotate(-6deg); }
.team { background: var(--field); border: var(--stroke) solid var(--ink); border-radius: 20px; padding: 0 12px 12px; min-height: clamp(200px, 36vh, 340px); overflow: hidden; display: flex; flex-direction: column; }
.team h2 { margin: 0 -12px 12px; padding: 10px 16px; font-family: var(--round); font-weight: 900; font-size: 25px; color: var(--ink); border-bottom: var(--stroke) solid var(--ink); display: flex; align-items: baseline; justify-content: space-between; }
.team.t0 h2 { background: linear-gradient(180deg, var(--o-2), var(--o)); }
.team.t1 h2 { background: linear-gradient(180deg, var(--b-2), var(--b)); color: #fff; }
.team h2 b { font-size: 19px; opacity: 0.85; }
.team ul { list-style: none; margin: 0; padding: 0 2px 2px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; flex: 1; min-height: 0; overflow-y: auto; }
.team li { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 19px; line-height: 24px; padding: 7px 11px; border-radius: 13px; background: var(--panel-2); border: 2.5px solid var(--ink); color: var(--text); box-shadow: 0 3px 0 var(--ink); }
.team li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.team li.me { background: var(--yellow); color: var(--ink); }
.team li.bot { color: var(--sub); background: #322889; }
/* 인원이 많을 때(한 팀 15명 이상): 줄 높이를 줄이고, 그래도 넘치면 목록 안에서 스크롤 → 시작 버튼은 늘 화면 안에 */
.teams.dense .team h2 { margin-bottom: 8px; }
.teams.dense .team ul { gap: 6px; max-height: max(160px, calc(100vh - 424px)); }
.teams.dense .team li { font-size: 17px; line-height: 20px; padding: 4px 10px; gap: 8px; }
.teams.dense .drop { width: 13px; height: 17px; }
.team li.empty { grid-column: 1 / -1; background: none; border-color: transparent; box-shadow: none; color: #8f86cf; font-weight: 500; justify-content: center; padding: 26px 0; }
/* 팀 색 물방울(캐릭터 표시) */
.drop { flex: none; display: inline-block; width: 15px; height: 19px; border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%; border: 2.5px solid var(--ink); background: var(--o); }
.team.t1 .drop, .award.t1 .drop { background: var(--b-2); }
/* 방장 · 봇 · 자리 비움 표시(글자 딱지) */
.bdg { flex: none; margin-left: auto; font-style: normal; font-size: 13.5px; line-height: 18px; padding: 1px 8px; border-radius: 999px; border: 2px solid var(--ink); background: #55499f; color: #fff; white-space: nowrap; }
.bdg + .bdg { margin-left: 0; }
.bdg.host { background: var(--pink); }
.bdg.self { background: var(--ink); color: var(--yellow); }
.bdg.away { background: #6d6a86; }
.lobbyfoot { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: end; }
.opts { display: grid; grid-template-columns: 0.8fr 1fr 1.4fr; gap: 10px; }
.opts label { min-width: 0; }
.opts select { width: 100%; }
.opts label { display: flex; flex-direction: column; gap: 6px; font-size: 16.5px; color: var(--sub); }
.actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.tip { margin: 0; display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 14px; background: rgba(27, 20, 54, 0.5); border: 2px solid var(--ink); font-size: 16.5px; font-weight: 500; color: #ddd7ff; min-height: 44px; }
.tip b { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--mint); color: var(--ink); font-size: 14px; font-weight: 700; }
.tip span.in { animation: tipin 0.35s; }
@keyframes tipin { from { opacity: 0; transform: translateY(6px); } }
.btn.big { font-size: 31px; padding: 15px 18px; }

/* ───────── 결과 ───────── */
.card.result { text-align: center; }
.card.result h1 { font-size: 58px; margin: 0; transform: rotate(-2deg); }
.resscore { font-size: 104px; line-height: 1.05; display: flex; justify-content: center; gap: 20px; }
/* 이번 경기의 주인공들 */
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.award { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 8px 10px; border-radius: 16px; border: var(--stroke) solid var(--ink); background: var(--field); box-shadow: 0 4px 0 var(--ink); min-width: 0; }
.award.me { background: #4a3a12; border-color: var(--yellow); }
.aw-title { font-size: 14.5px; font-weight: 900; padding: 1px 11px; border-radius: 999px; background: var(--yellow); color: var(--ink); }
.aw-name { display: flex; align-items: center; gap: 7px; max-width: 100%; font-size: 20px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aw-val { font-size: 15px; font-weight: 500; color: var(--sub); }
.resscore span { color: #fff; }
.t0 { color: var(--o); }
.t1 { color: var(--b-2); }
.rank { width: 100%; border-collapse: collapse; font-size: 19px; font-variant-numeric: tabular-nums; }
.rank th { color: var(--sub); font-weight: 500; font-size: 15.5px; padding: 4px 6px; }
.rank td { padding: 6px; border-top: 2px solid rgba(27, 20, 54, 0.55); }
.rank td:first-child, .rank th:first-child { text-align: left; }
.rank tr.me td { color: var(--yellow); background: rgba(255, 255, 255, 0.07); }
#result:not(.quiz) .qcol { display: none; }
.rank i { display: inline-block; width: 13px; height: 13px; border-radius: 50%; margin-right: 8px; border: 2px solid var(--ink); vertical-align: -1px; }

/* ───────── 경기 중 HUD ───────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-variant-numeric: tabular-nums; }
#hud > * { position: absolute; }
#labels { inset: 0; overflow: hidden; }

/* 캐릭터 머리 위 이름표와 떠오르는 글자 */
.tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 9px 2px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-size: 15px;
  line-height: 19px;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 0 var(--ink);
  will-change: transform;
}
.tag.t0 { background: var(--o); }
.tag.t1 { background: var(--b); }
.tag.me { background: var(--yellow); color: var(--ink); text-shadow: none; font-size: 16.5px; }
.float { position: absolute; left: 0; top: 0; font-size: 32px; white-space: nowrap; -webkit-text-stroke-width: 5px; will-change: transform, opacity; }

.scorebar {
  top: calc(8px + var(--sat));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  min-width: 330px;
  border: var(--stroke) solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--drop);
  overflow: hidden;
  background: var(--ink);
}
.score { display: flex; align-items: center; gap: 8px; padding: 4px 14px 5px; }
.score.t0 { background: linear-gradient(180deg, var(--o-2), var(--o)); }
.score.t1 { background: linear-gradient(180deg, var(--b-2), var(--b)); justify-content: flex-end; }
.score b { font-size: 40px; line-height: 1.1; color: #fff; -webkit-text-stroke-width: 5px; text-shadow: 0 3px 0 var(--ink); }
.score .tname { font-size: 17.5px; font-weight: 900; color: var(--ink); }
.score.t1 .tname { color: #fff; }
.clock { font-size: 30px; color: var(--yellow); padding: 4px 14px 0; background: var(--panel); display: grid; place-items: center; border-left: var(--stroke) solid var(--ink); border-right: var(--stroke) solid var(--ink); -webkit-text-stroke-width: 4px; text-shadow: 0 2px 0 var(--ink); min-width: 92px; }
.clock.hurry { color: var(--bad); animation: hurry 0.5s infinite alternate; }
@keyframes hurry { to { transform: scale(1.12); } }
.inkbar { grid-column: 1 / -1; height: 9px; background: #4a4388; display: flex; justify-content: space-between; border-top: var(--stroke) solid var(--ink); }
.inkbar i { display: block; height: 100%; width: 0; transition: width 0.4s; }
#ink0 { background: var(--o); }
#ink1 { background: var(--b); }
/* 지금 땅을 더 넓게 칠한 팀(이대로 끝나면 보너스 점수를 받는다) */
.inklead { grid-column: 1 / -1; padding: 2px 10px 3px; text-align: center; font-size: 14.5px; line-height: 1.25; background: var(--ink); border-top: var(--stroke) solid var(--ink); white-space: nowrap; }
.inklead.t0 { color: var(--o-2); }
.inklead.t1 { color: var(--b-2); }

.iconbtn {
  top: calc(10px + var(--sat));
  left: calc(10px + var(--sal));
  width: 46px;
  height: 46px;
  border-radius: 15px;
  border: var(--stroke) solid var(--ink);
  background: linear-gradient(180deg, #6657e0, #4a3cc0);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--text);
  font-size: 22px;
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}
.iconbtn i { display: block; width: 20px; height: 3.5px; border-radius: 2px; background: #fff; }
.iconbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.menu {
  top: calc(66px + var(--sat));
  left: calc(10px + var(--sal));
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--drop);
  pointer-events: auto;
  z-index: 2;
}
.menu button { font: inherit; font-size: 18px; color: var(--text); background: var(--panel-2); border: 2px solid var(--ink); border-radius: 11px; padding: 9px 14px; cursor: pointer; text-align: left; }
.menu button.danger { color: var(--bad); }

.feed {
  top: calc(68px + var(--sat));
  left: calc(10px + var(--sal));
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 16px;
  max-width: 46vw;
}
.feed li { padding: 3px 10px 4px; border-radius: 11px; background: rgba(27, 20, 54, 0.82); border: 2px solid var(--ink); width: fit-content; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; animation: feedin 0.2s; }
.feed li.old { opacity: 0; transition: opacity 0.6s; }
.feed .n0 { color: var(--o-2); }
.feed .n1 { color: var(--b-2); }
.feed .vb { font-style: normal; font-size: 0.82em; margin: 0 6px; padding: 0 7px 1px; border-radius: 999px; background: #fff; color: var(--ink); vertical-align: 1px; }
.feed .vb.plain { background: none; color: #ddd7ff; padding: 0; margin: 0 0 0 6px; font-size: 1em; vertical-align: 0; }
.feed li.hot { border-color: var(--yellow); }
.feed li.hot .vb { color: var(--yellow); font-weight: 900; }
@keyframes feedin { from { transform: translateX(-10px); opacity: 0; } }

#minimap {
  top: calc(10px + var(--sat));
  right: calc(10px + var(--sar));
  width: 168px;
  height: 168px;
  border-radius: 16px;
  border: var(--stroke) solid var(--ink);
  box-shadow: var(--drop);
  background: var(--ink);
}

/* 작게 튀어나오며 나타나기(잉크 칩 · 강화 딱지) */
@keyframes gaugein { from { opacity: 0; transform: translateX(-50%) scale(0.9); } }

.loadout {
  bottom: calc(12px + var(--sab));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 16px 7px;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--drop);
}
.pips { display: flex; gap: 7px; }
.pip { width: 25px; height: 31px; border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%; background: #4a4388; border: 2.5px solid var(--ink); position: relative; overflow: hidden; }
.pip i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--pip, #fff); box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.35); }
.ups { display: flex; gap: 14px; font-size: 16px; color: var(--sub); white-space: nowrap; }
/* 문제를 쓰는 판: 다음 충전 문제까지 남은 풍선 수 */
.up-quiz { color: #ffe68a; }
.up-quiz.soon { color: var(--yellow); animation: hurry 0.5s infinite alternate; }
.loadout.locked .pips { opacity: 0.35; filter: grayscale(0.8); }
.loadout.locked .up-quiz { color: var(--ink); background: var(--yellow); border-radius: 999px; padding: 0 9px; }
/* 발밑 잉크 안내: 우리 색 = 이득, 상대 색 = 손해 */
.inkchip { position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%); padding: 3px 13px 4px; border-radius: 999px; border: var(--stroke) solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: 15.5px; white-space: nowrap; animation: gaugein 0.14s; }
.inkchip.own { background: var(--mint); color: var(--ink); }
.inkchip.foe { background: var(--pink); color: #fff; text-shadow: 0 1px 0 var(--ink); }

.banner {
  top: 22%;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  padding: 8px 20px 9px;
  border-radius: 18px;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  box-shadow: var(--drop);
  font-size: 27px;
  text-align: center;
  white-space: nowrap;
  max-width: 94vw;
  -webkit-text-stroke-width: 4px;
  text-shadow: 0 2px 0 var(--ink);
}
.banner.trap { color: #bfe9ff; }
.banner.dead { color: var(--bad); }
.bignum {
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-3deg);
  font-size: clamp(96px, 24vw, 190px);
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke-width: 14px;
  text-shadow: 0 10px 0 var(--ink);
  animation: pop 0.28s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop { from { transform: translate(-50%, -50%) rotate(-3deg) scale(0.4); opacity: 0; } }
.toast {
  bottom: calc(214px + var(--sab));
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 18px 8px;
  border-radius: 999px;
  background: #fff;
  border: var(--stroke) solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  font-size: 21.5px;
  white-space: nowrap;
}

.netlost {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--sab));
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 16px;
  border-radius: 14px;
  border: var(--stroke) solid var(--ink);
  background: #5a1730;
  color: var(--bad);
  font-size: 17.5px;
}

/* 첫 화면 · 대기실의 소리 버튼 */
.soundbtn {
  position: fixed;
  top: calc(10px + var(--sat));
  right: calc(10px + var(--sar));
  z-index: 30;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  border: var(--stroke) solid var(--ink);
  background: linear-gradient(180deg, #6657e0, #4a3cc0);
  box-shadow: 0 4px 0 var(--ink);
  font-size: 21px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.soundbtn svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.soundbtn .spk { fill: #fff; stroke-width: 1.4; }
.soundbtn .cross { display: none; stroke: var(--bad); }
.soundbtn.off .wave { display: none; }
.soundbtn.off .cross { display: block; }
.soundbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* ───────── 문제 관리(선생님) ───────── */
.card.quizmgr { width: min(100%, 1180px); max-height: calc(100vh - 32px); gap: 12px; padding: 22px 26px 24px; }
.qm-head { display: flex; align-items: center; justify-content: space-between; }
.qm-head h2 { margin: 0; font-size: 32px; font-weight: 900; color: var(--yellow); }
.qm-cols { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 22px; min-height: 0; overflow: auto; }
.qm-list, .qm-edit { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#qm-sets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#qm-sets li { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border-radius: 14px; background: var(--field); border: var(--stroke) solid var(--ink); }
#qm-sets li.on { border-color: var(--yellow); }
#qm-sets li.empty { justify-content: center; color: #8f86cf; font-weight: 500; padding: 22px; }
.qm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qm-info b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-info span { font-size: 14px; font-weight: 500; color: var(--sub); }
.qm-help { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.55; color: #ddd7ff; }
.qm-help b { color: var(--yellow); }
.qm-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.qm-tools .btn { font-size: 17px; padding: 9px 14px; }
#qm-text { font: inherit; font-weight: 500; font-size: 15.5px; line-height: 1.5; color: var(--text); background: var(--field); border: var(--stroke) solid var(--ink); border-radius: 14px; padding: 10px 12px; resize: vertical; min-height: 140px; outline: none; tab-size: 18; white-space: pre; overflow: auto; -webkit-user-select: text; user-select: text; }
#qm-text:focus { border-color: var(--yellow); }
.qm-preview { font-size: 15px; font-weight: 500; color: var(--sub); }
.qm-preview p { margin: 0 0 6px; }
.qm-count { color: #fff; font-weight: 700; }
.qm-items { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 5px; }
.qm-items li { line-height: 1.45; }
.qm-items .q { color: #fff; margin-right: 6px; }
.qm-items .a { display: inline-block; margin: 1px 4px 1px 0; padding: 0 8px; border-radius: 999px; background: #4a3cc0; font-size: 13.5px; }
.qm-items .a.ok { background: var(--mint); color: var(--ink); }
.qm-errors { margin: 6px 0 0; padding-left: 20px; color: var(--bad); }

/* ───────── 경기 중 문제 카드 ───────── */
/* PC: 화면 아래쪽(풍선 개수 표시 바로 위)에 크게. 열려 있는 동안 화면이 살짝 내려가 내 캐릭터는 카드 위에 보인다 */
.quizcard {
  left: 50%;
  bottom: calc(110px + var(--sab));
  transform: translateX(-50%);
  width: min(1040px, 94vw);
  padding: 16px 22px 18px;
  border-radius: 26px;
  background: linear-gradient(180deg, #3b309c, var(--panel));
  border: 4px solid var(--ink);
  box-shadow: 0 6px 0 var(--ink), 0 18px 40px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 3;
}
#hud.quizzing .inkchip { display: none; }
/* 갇혔을 때: 풀고 싶으면 누르는 탈출 문제 버튼(안 눌러도 된다) */
.escbtn {
  left: 50%;
  bottom: calc(118px + var(--sab));
  transform: translateX(-50%);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #4aa8ff, #2a6fd6);
  border: 4px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 0 0 4px rgba(127, 220, 255, 0.35);
  cursor: pointer;
  white-space: nowrap;
  z-index: 3;
  animation: escin 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.escbtn b { padding: 3px 12px; border-radius: 999px; background: #7fdcff; color: var(--ink); border: 2px solid var(--ink); font-weight: 900; }
.escbtn kbd { font: inherit; font-weight: 900; min-width: 34px; padding: 2px 8px; border-radius: 9px; background: var(--ink); color: var(--yellow); text-align: center; }
.escbtn:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.escbtn.touch kbd { display: none; }
@keyframes escin { from { transform: translateX(-50%) translateY(24px) scale(0.9); opacity: 0; } }
.quizcard.in { animation: quizin 0.28s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes quizin { from { transform: translateX(-50%) translateY(30px) scale(0.92); opacity: 0; } }
.quizcard.escape { border-color: #2a6fd6; box-shadow: 0 6px 0 #173d80, 0 0 0 4px rgba(127, 220, 255, 0.35), 0 18px 40px rgba(0, 0, 0, 0.35); }
.quizcard.good { border-color: var(--mint); }
.quizcard.bad { animation: quizshake 0.35s; }
@keyframes quizshake { 25% { transform: translateX(calc(-50% - 9px)); } 75% { transform: translateX(calc(-50% + 9px)); } }
.qc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qc-kind { font-size: 18px; font-weight: 900; padding: 3px 14px; border-radius: 999px; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); }
.quizcard.escape .qc-kind { background: #7fdcff; }
.qc-hint { font-size: 18px; color: var(--sub); white-space: nowrap; }
.qc-q { margin: 0; font-size: 32px; font-weight: 900; line-height: 1.32; color: #fff; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
.qc-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qc-choices.n3 { grid-template-columns: 1fr 1fr 1fr; }
.qc-choice { font: inherit; font-weight: 700; font-size: 24px; line-height: 1.3; text-align: left; display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 18px; border-radius: 18px; color: #fff; background: linear-gradient(180deg, #6657e0, #4a3cc0); border: var(--stroke) solid var(--ink); box-shadow: 0 4px 0 var(--ink); cursor: pointer; word-break: keep-all; overflow-wrap: anywhere; }
.qc-choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qc-num { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--ink); color: var(--yellow); font-size: 20px; }
.qc-choices.ox .qc-choice { justify-content: center; font-family: var(--display); font-size: 52px; font-weight: 900; min-height: 90px; }
.qc-choices.ox .qc-num { display: none; }
.qc-choice.right { background: linear-gradient(180deg, #9dffcf, var(--mint)); color: var(--ink); }
.qc-choice.wrong { background: linear-gradient(180deg, #ff9fb3, #ff4f73); }
.qc-choice.answer { outline: 4px solid var(--mint); outline-offset: -2px; }
.qc-time { height: 10px; border-radius: 5px; background: #241c66; overflow: hidden; }
.qc-time i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--yellow), var(--o)); transition: width 0.2s linear; }
.quizcard.escape .qc-time i { background: linear-gradient(90deg, #bfe9ff, #3d9bff); }
.quizcard.reload { border-color: var(--yellow); }
.quizcard.reload .qc-kind { background: var(--mint); }
.quizcard.reload .qc-time { display: none; }
.qc-exp { margin: 0; padding: 9px 16px; border-radius: 14px; background: rgba(27, 20, 54, 0.6); font-size: 20px; font-weight: 500; line-height: 1.45; color: #e9e5ff; word-break: keep-all; overflow-wrap: anywhere; }
.qm-items .e { display: block; font-size: 13.5px; color: #b8b0ee; margin-top: 2px; }
.feed li.quiz .vb { color: var(--ink); background: var(--yellow); }

/* 한 번 쓰면 사라지는 아이템(왕풍선 · 방울 방패) */
.buffs { display: flex; gap: 7px; }
.buff { padding: 2px 11px 3px; border-radius: 999px; border: 2.5px solid var(--ink); font-size: 15px; white-space: nowrap; animation: gaugein 0.16s; }
.buff.mega { background: #b25cff; color: #fff; text-shadow: 0 1px 0 var(--ink); }
.buff.shield { background: var(--mint); color: var(--ink); }
.buff.mega.gold { background: linear-gradient(180deg, #ffe066, #ffb703); color: var(--ink); text-shadow: none; }

/* 손맛: 내가 가두거나 터뜨리면 화면 가장자리가 팀 색으로 번쩍 */
#edgeflash { inset: 0; pointer-events: none; opacity: 0; --c: 255, 255, 255; box-shadow: inset 0 0 70px 16px rgba(var(--c), 0.8); }
#edgeflash.go { animation: edgeflash 0.45s ease-out; }
#edgeflash.go.strong { animation-duration: 0.65s; box-shadow: inset 0 0 120px 34px rgba(var(--c), 0.9); }
@keyframes edgeflash { from { opacity: 1; } to { opacity: 0; } }
/* 마지막 10초: 가장자리가 심장 박동처럼 붉게 뛴다 */
#hud.last10 #edgeflash:not(.go) { --c: 255, 79, 115; animation: finalbeat 1s ease-out infinite; }
@keyframes finalbeat { 0% { opacity: 0.6; } 35%, 100% { opacity: 0; } }

/* 마지막 10초: 큰 숫자가 캐릭터 아래쪽에 쿵 하고 떴다가 옅어진다(내 캐릭터 · 위쪽 알림을 가리지 않게) */
.final { top: 56%; left: 50%; transform: translate(-50%, -50%); font-size: clamp(80px, 16vw, 140px); line-height: 1; color: #fff; -webkit-text-stroke-width: 12px; text-shadow: 0 8px 0 var(--ink); opacity: 0.3; }
.final.red { color: #ff4f73; }
.final.go { animation: finalpop 1s ease-out forwards; }
@keyframes finalpop {
  0% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(0.94); opacity: 1; }
  24% { transform: translate(-50%, -50%) scale(1.04); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.28; }
}

/* 대시: PC 는 아래 막대의 작은 딱지, 모바일은 오른쪽 둥근 버튼. 다시 쓸 수 있을 때까지 차오른다 */
.dashchip { --cd: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; border-radius: 999px; color: #9a92d8; background: linear-gradient(90deg, rgba(255, 255, 255, 0.16) calc((1 - var(--cd)) * 100%), rgba(255, 255, 255, 0.04) 0); }
.dashchip kbd { font: inherit; font-size: 12.5px; line-height: 18px; padding: 0 6px; border-radius: 7px; background: var(--ink); color: #9a92d8; }
.dashchip.ready { color: var(--ink); background: var(--mint); }
.dashchip.ready kbd { color: var(--mint); }
.dashchip.off { opacity: 0.4; }
.dashbtn {
  --cd: 0;
  right: calc(22px + var(--sar));
  bottom: calc(160px + var(--sab));
  width: 78px;
  height: 78px;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 var(--ink);
  border: 4px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  background: conic-gradient(rgba(27, 20, 54, 0.7) calc(var(--cd) * 360deg), transparent 0), linear-gradient(180deg, #8f7bff, #5a46d6);
  z-index: 3;
}
.dashbtn.ready { color: var(--ink); text-shadow: none; background: linear-gradient(180deg, #b6ffdc, var(--mint)); box-shadow: 0 5px 0 var(--ink), 0 0 0 4px rgba(92, 242, 176, 0.35); }
.dashbtn.off { opacity: 0.45; }
.dashbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

/* 교실 화면(관전): 내 캐릭터 정보는 감추고, 점수판을 크게 */
.watchhint { bottom: calc(14px + var(--sab)); left: 50%; transform: translateX(-50%); padding: 6px 16px 7px; border-radius: 999px; background: rgba(27, 20, 54, 0.82); border: 2px solid var(--ink); color: #e9e5ff; font-size: 16px; white-space: nowrap; }
body.watching #loadout, body.watching #banner, body.watching #btn-escape, body.watching #quiz, body.watching #btn-dash, body.watching #minimap, body.watching #toast { display: none !important; }
body.watching .scorebar { transform: translateX(-50%) scale(1.3); transform-origin: top center; }
body.watching .feverchip { top: calc(136px + var(--sat)); }
body.watching .tag { font-size: 12.5px; line-height: 16px; padding: 1px 7px; }
body.watching #lobby .lobbyfoot, body.watching #btn-start, body.watching #btn-copy { display: none; }

/* 화면 가운데 위쪽의 큰 알림(연속 기록 · 더블 가둠 · 피버 타임) */
.announce {
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 22px 8px;
  border-radius: 999px;
  background: rgba(27, 20, 54, 0.86);
  border: var(--stroke) solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  font-family: var(--display);
  font-weight: 900;
  font-size: 30px;
  white-space: nowrap;
  max-width: 94vw;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.announce.in { animation: announce 0.3s cubic-bezier(0.2, 1.5, 0.4, 1); }
.announce.t0 { color: var(--o-2); }
.announce.t1 { color: var(--b-2); }
.announce.hot { color: var(--yellow); border-color: var(--yellow); }
.announce.gold { color: #ffd23a; border-color: #ffc21a; box-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(255, 194, 26, 0.45); }
@keyframes announce { from { transform: translateX(-50%) scale(0.5); opacity: 0; } }

/* 피버 타임: 점수판 아래 딱지 + 달아오르는 화면 가장자리 */
.feverchip {
  top: calc(104px + var(--sat));
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 16px 4px;
  border-radius: 999px;
  border: var(--stroke) solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  background: linear-gradient(180deg, #ff8ac4, var(--pink) 55%, #e02a84);
  color: #fff;
  font-size: 18.5px;
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 0 2px 0 var(--ink);
  animation: feverchip 0.45s infinite alternate;
}
@keyframes feverchip { to { transform: translateX(-50%) scale(1.07); } }
#feverfx { inset: 0; opacity: 0; transition: opacity 0.5s; box-shadow: inset 0 0 0 5px rgba(255, 210, 31, 0.8), inset 0 0 90px 24px rgba(255, 79, 163, 0.55); }
#hud.fever #feverfx { opacity: 1; animation: feverfx 0.9s ease-in-out infinite alternate; }
@keyframes feverfx { from { opacity: 0.45; } to { opacity: 1; } }
#hud.fever .clock { color: var(--pink); animation: hurry 0.45s infinite alternate; }

/* 물방울에 갇혔을 때 */
#hud.uw .banner { animation: bob 1.5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateX(-50%) rotate(1.5deg) translateY(5px); } }
/* 물속 화면 효과(셰이더)를 쓸 수 없는 기기에서만 켜지는 간단한 물빛 막 */
#underwater {
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s;
  background: radial-gradient(ellipse at 50% 45%, rgba(60, 170, 255, 0.14) 30%, rgba(25, 100, 230, 0.5) 78%, rgba(10, 55, 180, 0.82) 100%);
  box-shadow: inset 0 0 0 6px rgba(205, 240, 255, 0.6), inset 0 0 70px 20px rgba(120, 210, 255, 0.5);
  border-radius: 9% / 12%;
}
#underwater.on { opacity: 1; }

/* 작은 화면(휴대폰) */
@media (max-width: 720px), (max-height: 480px) {
  #minimap { width: 112px; height: 112px; border-radius: 13px; }
  .scorebar { min-width: 236px; }
  .score { padding: 2px 10px 3px; }
  .score b { font-size: 31px; }
  .score .tname { display: none; }
  .clock { font-size: 24px; min-width: 72px; padding: 3px 8px 0; }
  .feed { font-size: 14px; max-width: 44vw; }
  .loadout { padding: 6px 12px; }
  .pip { width: 21px; height: 26px; }
  .banner { font-size: 20px; top: 19%; }
  .toast { font-size: 18px; }
  .ups { font-size: 14.5px; gap: 10px; }
  .inkchip { font-size: 14px; }
  .inklead { font-size: 13px; }
  .card, .card.lobby, .card.result { padding: 18px 16px 20px; border-radius: 24px; }
  .announce { font-size: 22px; top: 33%; }
  .feverchip { font-size: 15.5px; top: calc(86px + var(--sat)); }
  .buff { font-size: 13.5px; }
  .tag { font-size: 13.5px; line-height: 17px; padding: 1px 7px 1px; }
  .tag.me { font-size: 14.5px; }
  .float { font-size: 26px; }
  .btn { font-size: 20px; }
  .btn.primary { font-size: 24px; }
  .rank { font-size: 16.5px; }
  .btn.login { font-size: 25px; padding: 14px 14px; }
  .show-text h2 { font-size: 23px; }
  .show-text p { font-size: 16px; }
  .show-tab { font-size: 13px; }
}
/* 키가 낮은 노트북 화면: 문제 카드를 조금 줄인다 */
@media (max-height: 780px) and (min-width: 721px) {
  .quizcard { bottom: calc(104px + var(--sab)); padding: 12px 18px 14px; gap: 9px; }
  .qc-q { font-size: 26px; }
  .qc-choice { font-size: 20px; min-height: 58px; padding: 8px 14px; }
  .qc-num { width: 30px; height: 30px; font-size: 17px; }
  .qc-exp { font-size: 17px; }
}

/* 좁은 화면: 모달 안을 한 줄로 쌓는다 */
@media (max-width: 980px) {
  .qm-cols { grid-template-columns: minmax(0, 1fr); }
  .opts { grid-template-columns: 1fr 1fr; }
  .opts .quizopt { grid-column: 1 / -1; }
  .card.lobby { width: min(100%, 760px); }
  .roomcode { font-size: 58px; letter-spacing: 8px; }
  .codebox { flex-direction: column; gap: 0; }
  .lobbyfoot { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .team { min-height: 170px; }
  .team ul, .teams.dense .team ul { max-height: 34vh; }
}
@media (max-width: 720px) {
  .show-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 4px; }
  .show-text h2 { font-size: 22px; }
  .show-text p { font-size: 15.5px; }
  .btn.login { font-size: 24px; padding: 14px 12px; gap: 10px; }
  .gmark { width: 34px; height: 34px; font-size: 20px; }
  .escbtn { bottom: calc(94px + var(--sab)); font-size: 15px; gap: 8px; padding: 7px 12px 7px 7px; }
  .quizcard { bottom: auto; top: calc(118px + var(--sat)); padding: 10px 12px 12px; gap: 7px; border-radius: 18px; }
  .qc-q { font-size: 19px; }
  .qc-choices, .qc-choices.n3 { grid-template-columns: 1fr 1fr; gap: 6px; }
  .qc-choice { font-size: 16px; min-height: 46px; padding: 6px 9px; gap: 7px; }
  .qc-choices.long { grid-template-columns: 1fr; gap: 5px; }
  .qc-choices.long .qc-choice { min-height: 40px; padding: 5px 9px; font-size: 15.5px; }
  .qc-num { width: 22px; height: 22px; font-size: 13px; }
  .qc-hint { font-size: 13.5px; }
  .qc-kind { font-size: 15px; padding: 2px 12px; }
  .qc-exp { font-size: 14px; padding: 5px 9px; }
  .ups { gap: 9px; font-size: 14px; }
  .qrbox canvas { width: 76px; height: 76px; }
  .lobbyhead { gap: 10px; }
  .roomlink { display: none; }
  .qrcode-text b { font-size: 46px; }
  .teams { grid-template-columns: 1fr 1fr; gap: 8px; }
  .vs { display: none; }
  .team { padding: 0 8px 10px; }
  .team h2 { margin: 0 -8px 9px; padding: 8px 10px; font-size: 19px; }
  .team h2 b { font-size: 15.5px; }
  .team ul { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .team li { font-size: 16.5px; padding: 5px 8px; gap: 7px; }
  .bdg { font-size: 12.5px; padding: 0 6px; }
  .lobbyhead { align-items: flex-end; }
  .lobbyinfo { flex-direction: column; align-items: flex-end; gap: 6px; }
  .lobbycount b { font-size: 24px; }
  .lobbyinfo .btn { font-size: 17px; padding: 9px 12px; }
  .tip { font-size: 14.5px; gap: 8px; padding: 8px 10px; align-items: flex-start; }
  .tip b { font-size: 12.5px; }
  .btn.big { font-size: 26px; padding: 13px 16px; }
  .card.result h1 { font-size: 40px; }
  .resscore { font-size: 72px; }
  .awards { grid-template-columns: 1fr 1fr; gap: 7px; }
  .aw-name { font-size: 17px; }
  .rank th:last-child, .rank td:last-child { display: none; }
}
@media (max-width: 720px) and (orientation: portrait) {
  /* 세로 화면: 점수판 아래에 알림 목록과 미니맵, 그 아래에 안내 띠 */
  #minimap { top: calc(100px + var(--sat)); }
  .feed { top: calc(100px + var(--sat)); }
  .banner { top: calc(232px + var(--sat)); white-space: normal; text-wrap: balance; width: max-content; line-height: 1.25; }
}
@media (max-height: 480px) {
  .feed { display: none; }
  .screen { place-items: start center; }
}

/* 세로가 짧은 화면: 결과 카드가 한 화면에 들어오게 */
@media (max-height: 800px) {
  .card.result { gap: 8px; padding-top: 16px; padding-bottom: 18px; }
  .card.result h1 { font-size: 40px; }
  .resscore { font-size: 66px; }
  .rank td { padding: 3px 6px; }
  .rank { font-size: 17.5px; }
  .award { padding: 6px 8px 7px; }
  .card.lobby { gap: 10px; padding-top: 16px; padding-bottom: 14px; }
  .roomcode { font-size: 60px; }
  .team { min-height: clamp(170px, 34vh, 300px); }
  .btn.big { font-size: 27px; padding: 12px 18px; }
  .show-text { min-height: 108px; }
  .show-text p { font-size: 16.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* 가로로 눕힌 휴대폰: 문제 카드를 아래쪽에 낮고 넓게 */
@media (max-height: 480px) and (orientation: landscape) {
  .escbtn { top: auto; bottom: calc(10px + var(--sab)); font-size: 14px; padding: 5px 10px 5px 5px; }
  .quizcard { top: auto; bottom: calc(6px + var(--sab)); width: min(820px, 76vw); padding: 7px 12px 9px; gap: 5px; border-radius: 16px; }
  .qc-q { font-size: 17px; }
  .qc-kind { font-size: 13px; padding: 1px 10px; }
  .qc-hint { font-size: 13px; }
  .qc-choices, .qc-choices.n3 { grid-template-columns: 1fr 1fr; gap: 5px; }
  .qc-choices.long { grid-template-columns: 1fr 1fr; }
  .qc-choice, .qc-choices.long .qc-choice { font-size: 14.5px; min-height: 34px; padding: 3px 9px; gap: 7px; border-radius: 11px; }
  .qc-num { width: 22px; height: 22px; font-size: 12.5px; border-radius: 7px; }
  .qc-choices.ox .qc-choice { font-size: 30px; min-height: 44px; }
  .qc-exp { font-size: 13.5px; padding: 4px 9px; }
}
