/* 퍼즐헌트 TOP — 하늘색 배경 + 흰 판 (원본 유니티 화면 톤), 분류마다 문제 그림 배경색 */
:root {
  --sky1: #2e9be6;
  --sky2: #79d0fa;
  --sky3: #dff5ff;
  --panel: #ffffff;
  --ink: #1d2742;
  --muted: #6a7896;
  --line: #e3eaf4;
  --soft: #f2f6fc;
  --primary: #3b7cf5;
  --primary-d: #2a62d8;
  --gold: #f6c443;
  --gold-d: #d9a21c;
  --ok: #20b26b;
  --bad: #ec4646;
  --magenta: #d6409f;
  --teal: #13a8a0;
  --radius: 18px;
  --shadow: 0 6px 22px rgba(20, 60, 120, 0.14);
  --font: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  --display: 'Jua', 'Noto Sans KR', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
input { user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.noscript { padding: 40px; text-align: center; font-size: 18px; }


/* ---------------------------------------------------------------- 공통 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border: 0; border-radius: 12px;
  font-family: var(--display); font-size: 17px; line-height: 1.1; white-space: nowrap;
  background: var(--soft); color: var(--ink);
  transition: transform .12s, box-shadow .12s, background .12s, filter .12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { color: #fff; background: linear-gradient(180deg, #5a95ff, var(--primary-d)); box-shadow: 0 4px 0 #1f4fb5, 0 8px 18px rgba(42, 98, 216, .3); }
.btn.primary:active:not(:disabled) { box-shadow: 0 2px 0 #1f4fb5; }
.btn.danger { color: #fff; background: linear-gradient(180deg, #ff6b6b, #d93b3b); box-shadow: 0 3px 0 #a92727; }
.btn.ghost { background: var(--soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.lg { min-height: 54px; padding: 12px 34px; font-size: 21px; border-radius: 16px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 15px; border-radius: 10px; }
.btn:disabled { opacity: .45; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 50%; background: var(--soft); color: var(--ink); font-size: 18px;
}
.icon-btn:hover { background: #e4ecf8; }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 9px;
  padding: 7px 14px; font-family: var(--display); font-size: 16px; color: var(--muted);
}
.seg button small { font-family: var(--font); font-size: 12px; font-weight: 700; opacity: .8; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(20, 60, 120, .14); }
.seg button.on small { color: var(--primary); }
.seg.small button { padding: 6px 12px; font-size: 15px; }
.seg .ico { color: var(--ok); }

.ribbon {
  display: inline-block; align-self: center; position: relative;
  padding: 9px 42px 11px; margin: 0 auto 4px;
  font-family: var(--display); font-size: 30px; letter-spacing: .04em; color: #fff;
  background: linear-gradient(180deg, #5aa2ff, #2c6be0);
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}
.ribbon.teal { background: linear-gradient(180deg, #2fd0c4, #0f978f); }
.ribbon.magenta { background: linear-gradient(180deg, #f065c0, #b7298a); }

.boot { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: #fff; font-family: var(--display); font-size: 18px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 본 화면 */
.hub { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; color: #fff; }
.team-pill { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; color: #fff; text-shadow: 0 2px 0 rgba(0, 40, 90, .25); }
.team-pill .lbl { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--gold); color: #5a3d00; text-shadow: none; }
.team-pill b { font-family: var(--display); font-weight: 400; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 3px 10px rgba(10, 60, 120, .18); font-size: 14px;
}
.stat-pill b { font-family: var(--display); font-weight: 400; font-size: 18px; }
.stat-pill .lbl { color: var(--muted); font-weight: 700; font-size: 13px; }
.stat-pill.clock b { font-variant-numeric: tabular-nums; min-width: 4.6em; }
.stat-pill .ico { color: var(--primary); }
.stat-pill.team:hover { background: #fff; }

.panels {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, .8fr) minmax(270px, .95fr);
  gap: 14px; padding: 0 14px 14px; min-height: 0;
}
.panel { min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; }

/* 문제판 */
.qgrid { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(9, minmax(34px, 1fr)); gap: 6px; overflow: auto; }
.qrow { display: grid; grid-template-columns: 92px repeat(8, minmax(0, 1fr)); gap: 6px; }
.qcat { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 15px; color: color-mix(in srgb, var(--cat) 80%, #000); }
.qcat img { width: 24px; height: 24px; object-fit: contain; }
.qrow.locked .qcat { filter: grayscale(1); opacity: .55; }
.qcell {
  position: relative; min-width: 0; display: grid; place-content: center; justify-items: center; gap: 1px;
  border: 0; border-radius: 10px; font-family: var(--display); font-size: clamp(13px, 1.25vw, 17px);
  color: color-mix(in srgb, var(--cat) 75%, #000);
  background: color-mix(in srgb, var(--cat) 12%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cat) 32%, #fff), 0 2px 0 color-mix(in srgb, var(--cat) 25%, #fff);
  transition: transform .1s, box-shadow .1s;
}
.qcell:hover:not(:disabled) { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--cat), 0 4px 10px color-mix(in srgb, var(--cat) 35%, transparent); }
.qcell.done { color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 82%, #fff), var(--cat)); box-shadow: 0 2px 0 color-mix(in srgb, var(--cat) 70%, #000); }
.qcell .qid { line-height: 1; }
.qcell.done .qid { font-size: .72em; opacity: .85; }
.qcell .clear { font-size: .7em; letter-spacing: .06em; line-height: 1; }
.qcell.off { color: #a7b0c2; background: #f1f3f7; box-shadow: inset 0 0 0 2px #e6e9f0; }
.qcell .mark { position: absolute; width: 9px; height: 9px; border-radius: 50%; }
.qcell .mark.tip { top: 4px; right: 4px; background: var(--gold); box-shadow: 0 0 0 2px #fff; }
.qcell .mark.phone { bottom: 4px; right: 4px; width: 7px; height: 11px; border-radius: 2px; background: none; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .7; }
.qcell .mark.game { top: 4px; right: 4px; width: 8px; height: 8px; background: #7b5ce6; box-shadow: 0 0 0 2px #fff; }
.round-info p { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.round-info p.all { color: var(--ok); }

/* 진행 현황 */
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.total { display: grid; justify-items: center; padding: 8px 4px; border-radius: 12px; background: var(--soft); }
.total span { font-size: 12px; font-weight: 700; color: var(--muted); }
.total b { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.15; }
.total small { font-size: 12px; color: var(--muted); }
.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 24px 82px 1fr 32px; align-items: center; gap: 6px; font-size: 13px; }
.bar img { width: 24px; height: 24px; object-fit: contain; }
.bar-name { font-family: var(--display); font-size: 14px; color: color-mix(in srgb, var(--cat) 80%, #000); }
.bar-num { font-family: var(--display); font-size: 14px; text-align: right; color: var(--muted); }
.bar-track { position: relative; height: 12px; border-radius: 99px; background: #edf1f7; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); border-radius: inherit; background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 70%, #fff), var(--cat)); transition: width .5s cubic-bezier(.2, .8, .3, 1.2); }
.bar.full .bar-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .85) 50%, transparent 70%); background-size: 250% 100%; animation: shiny 3s ease-in-out infinite; }
.bar.full .bar-num { color: var(--cat); }
@keyframes shiny { 0% { background-position: 150% 0; } 35%, 100% { background-position: -100% 0; } }
.game-btn { width: 100%; justify-content: flex-start; gap: 10px; min-height: 52px; background: linear-gradient(180deg, #a48bff, #6d4fe0); color: #fff; box-shadow: 0 3px 0 #4f35b5; }
.game-btn img { width: 30px; height: 30px; filter: brightness(0) invert(1); }
.game-btn span { font-size: 18px; }
.game-btn small { margin-left: auto; font-family: var(--font); font-size: 12px; opacity: .85; }
.feed-head h3 { margin: 4px 0 0; font-family: var(--display); font-weight: 400; font-size: 17px; }
.feed { flex: 1; min-height: 60px; overflow: auto; margin: 0; padding: 0; list-style: none; display: grid; align-content: start; gap: 4px; }
.feed li { display: flex; align-items: baseline; gap: 6px; padding: 5px 8px; border-radius: 8px; font-size: 13px; background: var(--soft); }
.feed li time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.feed li .who { font-weight: 700; max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed li .what { flex: 1; }
.feed li em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #fff; color: var(--primary); }
.feed li.main em { color: var(--ok); }
.feed li.final { background: #fff4d1; font-weight: 700; }
.feed li.empty { color: var(--muted); justify-content: center; background: none; }

/* 퍼즐판 */
.piece-count { font-family: var(--display); font-size: 16px; color: var(--muted); }
.board-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.board {
  position: relative; display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  border-radius: 10px; overflow: hidden; touch-action: none;
  background: #0d1033 url(../assets/board/poster.webp) center / 100% 100% no-repeat;
  box-shadow: 0 0 0 4px var(--gold), 0 0 0 7px #fff3c4, 0 10px 26px rgba(20, 40, 90, .35);
}
.board::before { content: ''; position: absolute; inset: 0; background: rgba(8, 10, 40, .42); pointer-events: none; transition: opacity 1s; }
.board.finished::before { opacity: 0; }
.cell { position: relative; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1); }
.board.finished .cell { box-shadow: none; }
.piece {
  position: absolute; inset: 0; cursor: grab;
  background-image: url(../assets/board/pieces.webp); background-size: 900.9% 903.23%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 1px 3px rgba(0, 0, 0, .35);
}
.board.finished .piece { cursor: default; box-shadow: none; }
.plabel {
  position: absolute; right: 1px; bottom: 1px; padding: 0 3px; border-radius: 4px;
  font-family: var(--display); font-size: clamp(8px, .75vw, 11px); line-height: 1.35; color: #fff; background: rgba(0, 0, 0, .5);
  pointer-events: none;
}
.board.finished .plabel { opacity: 0; transition: opacity .8s; }
.cell.sel { z-index: 2; box-shadow: 0 0 0 3px var(--gold), 0 0 14px 3px rgba(246, 196, 67, .8); }
.cell.over { z-index: 2; box-shadow: inset 0 0 0 3px #fff, 0 0 12px rgba(255, 255, 255, .8); }
.cell.dragging .piece { opacity: .3; }
.cell.remote { animation: remote 1.4s ease; }
@keyframes remote { 0%, 60% { box-shadow: inset 0 0 0 3px #4ee6ff, 0 0 12px #4ee6ff; z-index: 2; } 100% { box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1); } }
.cell[data-who]::after {
  content: attr(data-who); position: absolute; left: 50%; top: -4px; transform: translate(-50%, -100%); z-index: 5;
  padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; color: #003; background: #4ee6ff; pointer-events: none;
}
.cell.new .piece { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(.2); opacity: 0; } 100% { transform: none; opacity: 1; } }
.blank-letter {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-size: clamp(16px, 2.6vw, 34px); color: #fff;
  text-shadow: 0 0 10px #c4a6ff, 0 0 20px #8b5cf6; animation: letterIn 1.2s ease both;
}
@keyframes letterIn { from { opacity: 0; transform: scale(2.2); } to { opacity: 1; transform: none; } }
.board-done { display: none; }
.piece.ghost { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; border-radius: 3px; box-shadow: 0 10px 24px rgba(0, 0, 0, .45), 0 0 0 2px #fff; }
.final-btn { width: 100%; min-height: 54px; font-size: 20px; color: #fff; background: linear-gradient(180deg, #f06cc6, var(--magenta)); box-shadow: 0 4px 0 #9b2271; }
.final-btn small { font-family: var(--font); font-size: 12px; opacity: .9; }
.final-btn.locked { color: #7d879c; background: #edf0f5; box-shadow: inset 0 0 0 2px #dfe4ec; cursor: default; }
.final-btn.locked:hover { transform: none; }
.final-btn.done { background: linear-gradient(180deg, #ffd766, var(--gold-d)); color: #4a3200; box-shadow: 0 4px 0 #a67a0a; }

.mobile-nav { display: none; }

/* ---------------------------------------------------------------- 창 */
#layer { position: relative; z-index: 50; }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(8, 18, 40, .55); backdrop-filter: blur(2px); opacity: 0; transition: opacity .2s; }
.modal-panel {
  position: relative; max-width: 100%; max-height: 100%; overflow: auto; border-radius: 22px; background: #fff;
  box-shadow: 0 24px 60px rgba(0, 20, 60, .35); opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .2s, transform .22s cubic-bezier(.2, .9, .3, 1.1);
}
.modal.on .modal-back { opacity: 1; }
.modal.on .modal-panel { opacity: 1; transform: none; }
.modal-panel.small { width: min(440px, 100%); padding: 22px; }
.dialog { display: flex; flex-direction: column; gap: 14px; }
.dialog-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 23px; text-align: center; }
.dialog-text { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; text-align: center; }
.dialog-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dialog-actions .btn { min-width: 110px; }
.team-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.team-list li { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--soft); font-weight: 700; }
.team-list .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.team-list li.away .dot { background: #b8c1d3; }
.team-list em { font-style: normal; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--primary); color: #fff; }
.team-list small { margin-left: auto; color: var(--muted); font-weight: 400; }

.answer-form { display: flex; gap: 8px; }
.answer-input {
  flex: 1; min-width: 0; height: 50px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff;
  font-family: var(--font); font-size: 18px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.answer-input:focus { border-color: var(--cat, var(--primary)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat, var(--primary)) 20%, transparent); }
.answer-input.shake { animation: shake .4s; border-color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.form-msg { margin: -4px 0 0; min-height: 1.2em; font-size: 14px; font-family: var(--display); }
.form-msg.bad { color: var(--bad); }

/* 문제 보기 */
.viewer-panel { width: min(1260px, 100%); height: min(860px, 100%); overflow: hidden; }
.viewer { position: relative; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.vhead { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 10%, #fff), #fff); }
.vchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px; font-family: var(--display); font-size: 20px; color: #fff; background: var(--cat); box-shadow: 0 2px 0 color-mix(in srgb, var(--cat) 65%, #000); }
.vchip img { width: 22px; height: 22px; object-fit: contain; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .2)); }
.vtitle { flex: 1; margin: 0; font-family: var(--display); font-weight: 400; font-size: 19px; color: color-mix(in srgb, var(--cat) 60%, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbody { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.vstage { min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--soft); }
.img-tabs { display: flex; gap: 6px; }
.img-tabs[hidden] { display: none; }
.img-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 9px; background: #fff; font-family: var(--display); font-size: 15px; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.img-tabs button.on { color: #fff; background: var(--cat); box-shadow: none; }
.qfig { position: relative; flex: 1; min-height: 0; margin: 0; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.qimg { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 6px 22px rgba(20, 50, 100, .2); transition: opacity .2s; aspect-ratio: 2100 / 1485; background: #fff; }
.qimg.loading { opacity: .35; }
.zoom-hint { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(10, 20, 40, .55); opacity: 0; transition: opacity .15s; pointer-events: none; }
.qfig:hover .zoom-hint { opacity: 1; }
.vside { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.vside.flash, .vinfo.flash { animation: flash 1s; }
@keyframes flash { 0% { background: #fff6cf; } 100% { background: transparent; } }
.vinfo { display: flex; flex-direction: column; gap: 12px; border-radius: 12px; }
.solved { padding: 14px 16px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--cat) 80%, #fff), var(--cat)); box-shadow: 0 3px 0 color-mix(in srgb, var(--cat) 65%, #000); }
.solved-top { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 15px; }
.solved-top b { font-weight: 400; font-size: 20px; letter-spacing: .05em; }
.solved-top span { margin-left: auto; font-size: 14px; opacity: .9; }
.solved-answer { margin-top: 6px; font-family: var(--display); font-size: 26px; word-break: break-all; }
.solved-meta { font-size: 12px; opacity: .85; }
.tip { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: #fff7d8; color: #6b4b00; font-size: 16px; font-weight: 700; box-shadow: inset 0 0 0 1.5px #f3dc8f; text-align: left; }
.tip-label { font-family: var(--display); font-weight: 400; font-size: 18px; color: var(--gold-d); }
.tip.locked { border: 1.5px dashed #cdd7e6; background: var(--soft); color: var(--muted); font-size: 14px; font-weight: 400; box-shadow: none; }
.tip.locked span { flex: 1; }
.tip.locked:hover { background: #e9f0fa; }
.reveal { padding: 12px 14px; border-radius: 12px; background: #eaf6ff; font-size: 15px; }
.reveal b { display: block; font-family: var(--display); font-weight: 400; color: var(--primary-d); font-size: 17px; }
.reveal strong { font-family: var(--display); font-weight: 400; font-size: 22px; }
.reveal.wait { display: flex; align-items: center; gap: 8px; color: var(--muted); background: var(--soft); }
.phone-btn { width: 100%; justify-content: flex-start; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.phone-btn .ico { color: var(--primary); }
.phone-btn small { margin-left: auto; font-family: var(--font); font-size: 12px; color: var(--muted); }
.phone-btn.used { background: #eef4ff; box-shadow: inset 0 0 0 2px #cfe0ff; }
.game-start { width: 100%; justify-content: flex-start; background: linear-gradient(180deg, #a48bff, #6d4fe0); color: #fff; box-shadow: 0 3px 0 #4f35b5; }
.game-start img { width: 26px; height: 26px; filter: brightness(0) invert(1); }
.sub-note { margin: 0; font-size: 13px; color: var(--muted); }
.vnav { margin-top: auto; display: flex; gap: 8px; }
.vnav .btn { flex: 1; }
.v-overlay { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; background: rgba(255, 255, 255, .72); backdrop-filter: blur(3px); }
.v-overlay.on { display: flex; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.success { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 34px; border-radius: 22px; background: #fff; box-shadow: 0 18px 50px rgba(20, 40, 90, .3); animation: popIn .45s cubic-bezier(.2, 1.4, .4, 1); text-align: center; }
@keyframes popIn { from { transform: scale(.7); opacity: 0; } }
.success-text { margin: 0; font-family: var(--display); font-size: 30px; }
.success-text strong { font-weight: 400; color: var(--primary-d); }
.success-sub { margin: 0; font-size: 14px; color: var(--muted); }
.success-icon { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.success-icon img { position: relative; width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2)); animation: bob 1.6s ease-in-out infinite; }
.success-icon img.shine { position: absolute; inset: 0; width: 120px; height: 120px; filter: none; opacity: .8; animation: spin 6s linear infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* 크게 보기 */
.zoom-panel { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; background: #0b1020; }
.modal:has(.zoom-panel), .modal:has(.ending-panel) { padding: 0; }
.zoomer { position: relative; width: 100%; height: 100%; }
.zoom-view { position: absolute; inset: 0; overflow: hidden; cursor: grab; }
.zoom-view:active { cursor: grabbing; }
.zoom-content { position: absolute; left: 0; top: 0; }
.zoom-content img { width: 100%; height: 100%; }
.zoom-tools { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 8px; padding: 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }

/* 미니게임 */
.minigame-panel { width: min(1100px, 100%); height: min(880px, 100%); overflow: hidden; background: linear-gradient(180deg, #43b4f0, #a5e3ff 60%, #e8f8ff); }
.minigame { height: 100%; display: flex; flex-direction: column; }
.mg-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 12px 14px; background: rgba(255, 255, 255, .85); }
.mg-title { display: flex; align-items: center; gap: 8px; }
.mg-title img { width: 28px; height: 28px; }
.mg-title b { font-family: var(--display); font-weight: 400; font-size: 21px; }
.mg-title span { font-size: 13px; color: var(--muted); font-weight: 700; }
.mg-status { flex: 1; min-width: 200px; font-size: 13px; color: var(--muted); }
.mg-tools { display: flex; gap: 6px; }
.mg-stage { position: relative; flex: 1; min-height: 0; }
.mg-clear { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(255, 255, 255, .55); backdrop-filter: blur(2px); animation: fadeIn .25s; }

.hp { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; container-type: size; }
.hp-frame { flex: none; width: min(100cqw - 10px, 100cqh - 70px); height: min(100cqw - 10px, 100cqh - 70px); padding: 8px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 5px #ffd36b, 0 10px 30px rgba(0, 40, 90, .25); }
.hp-view { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 12px; background: #222; cursor: grab; }
.hp-view:active { cursor: grabbing; }
.hp-content { position: absolute; left: 0; top: 0; }
.hp-bg { width: 100%; height: 100%; }
.hp-bear { position: absolute; animation: bearShine 3s ease-in-out infinite; }
@keyframes bearShine { 0%, 66%, 100% { filter: none; } 80% { filter: brightness(1.6); } }
.hp-bear.found { animation: none; filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 4px #ffd36b); }
.hp-tools { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 12px rgba(0, 40, 90, .2); }
.hp-tools b { min-width: 4.5em; text-align: center; font-family: var(--display); font-weight: 400; font-size: 17px; }

.bk-wrap { height: 100%; display: flex; align-items: center; justify-content: center; padding: 12px; }
.bk-board { position: relative; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-template-rows: repeat(var(--rows), var(--cell)); touch-action: none; }
.bk-floor { margin: 2px; border-radius: 10px; background: rgba(255, 255, 255, .32); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55); }
.bk-floor.gate { background: rgba(255, 236, 160, .38); box-shadow: inset 0 0 0 2px rgba(255, 214, 90, .7); }
.bk-goal { position: relative; display: grid; place-items: center; pointer-events: none; }
.bk-goal img { width: 78%; height: 78%; object-fit: contain; opacity: .9; animation: bob 1.8s ease-in-out infinite; }
.bk-block {
  position: absolute; left: 0; top: 0; z-index: 2; display: grid;
  grid-template-columns: repeat(var(--w), var(--cell)); grid-template-rows: repeat(var(--h), var(--cell));
  transform: translate(calc(var(--cell) * var(--c0)), calc(var(--cell) * var(--r0)));
  transition: transform .09s ease-out; cursor: grab;
}
.bk-chunk { margin: 3px; border-radius: 12px; background: linear-gradient(180deg, #ffffff, #eef3fa); box-shadow: 0 4px 0 #c7d3e6, 0 6px 10px rgba(0, 40, 90, .18); }
.bk-block.main .bk-chunk { background: linear-gradient(180deg, #ffe39a, #ffc94d); box-shadow: 0 4px 0 #d39a1c, 0 6px 10px rgba(120, 70, 0, .25); }
.bk-block.active .bk-chunk { outline: 3px solid var(--primary); outline-offset: -3px; }
.bk-bear { position: absolute; left: 50%; top: 50%; width: min(calc(var(--cell) * var(--w) * .9), calc(var(--cell) * var(--h) * .9)); transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .2)); }
.bk-block.win { animation: winBounce .6s ease 2; }
@keyframes winBounce { 50% { filter: brightness(1.25) drop-shadow(0 0 12px #fff6a8); } }

/* 엔딩 */
.ending-panel { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; background: #06071c; }
.ending { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.end-art { height: 100%; max-width: 100%; object-fit: contain; animation: endArt 3.2s ease both; }
@keyframes endArt { from { opacity: 0; transform: scale(1.08); filter: brightness(.4); } to { opacity: 1; transform: none; filter: none; } }
.end-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; color: #fff; background: radial-gradient(70% 55% at 50% 50%, rgba(5, 6, 30, .78), rgba(5, 6, 30, .25) 70%, transparent); pointer-events: none; }
.end-text > * { opacity: 0; transform: translateY(10px); transition: opacity .7s, transform .7s; }
.end-text > .on { opacity: 1; transform: none; }
.end-clear { font-family: var(--display); font-size: clamp(56px, 9vw, 104px); color: #ffe27a; letter-spacing: .08em; text-shadow: 0 0 24px rgba(255, 210, 90, .8), 0 4px 0 #8a5a00; }
.end-line { font-family: var(--display); font-size: clamp(26px, 3.6vw, 42px); text-shadow: 0 2px 8px rgba(0, 0, 0, .6); font-variant-numeric: tabular-nums; }
.end-line.small { font-size: clamp(18px, 2.2vw, 24px); color: #d9dcff; }
.end-team { max-width: 640px; text-align: center; font-size: 15px; color: #cdd1ff; }
.end-btn { margin-top: 18px; pointer-events: auto; }

/* 알림 */
#toasts { position: fixed; z-index: 100; top: 60px; right: 14px; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { max-width: min(360px, 86vw); padding: 10px 14px; border-radius: 12px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(10, 40, 90, .22); border-left: 5px solid var(--primary); opacity: 0; transform: translateX(16px); transition: opacity .25s, transform .25s; }
.toast.on { opacity: 1; transform: none; }
.toast.ok { border-left-color: var(--ok); }
.toast.round { border-left-color: var(--gold); background: #fffaf0; font-weight: 700; }

/* ---------------------------------------------------------------- 좁은 화면 */
@media (max-width: 1180px) and (min-width: 901px) {
  .panels { grid-template-columns: minmax(0, 1.4fr) minmax(250px, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .p-questions { grid-row: 1 / 3; }
  .p-status { grid-column: 2; grid-row: 2; }
  .p-board { grid-column: 2; grid-row: 1; }
  .p-status .feed-head, .p-status .feed { display: none; }
  .bars { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .bar { grid-template-columns: 20px 74px 1fr 28px; }
  .bar img { width: 20px; height: 20px; }
}

@media (max-width: 900px) {
  .topbar { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .team-pill b { font-size: 17px; }
  .stat-pill { height: 34px; padding: 0 10px; }
  .stat-pill b { font-size: 16px; }
  .stat-pill .lbl { display: none; }
  .panels { grid-template-columns: minmax(0, 1fr); padding: 0 10px 10px; }
  .hub[data-pane='questions'] .p-status, .hub[data-pane='questions'] .p-board,
  .hub[data-pane='board'] .p-questions, .hub[data-pane='board'] .p-status,
  .hub[data-pane='status'] .p-questions, .hub[data-pane='status'] .p-board { display: none; }
  .panel { padding: 12px; border-radius: 16px; }
  .qrow { grid-template-columns: 30px repeat(8, minmax(0, 1fr)); gap: 4px; }
  .qgrid { gap: 4px; }
  .qcat span { display: none; }
  .qcat img { width: 26px; height: 26px; }
  .qcell { border-radius: 8px; font-size: 13px; }
  .qcell.done .clear { font-size: .6em; }
  .mobile-nav { display: flex; background: #fff; box-shadow: 0 -4px 16px rgba(20, 60, 120, .12); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav button { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; border: 0; background: none; color: var(--muted); font-family: var(--display); font-size: 13px; }
  .mobile-nav button .ico { font-size: 22px; }
  .mobile-nav button.on { color: var(--primary); }
  .plabel { font-size: 8px; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-panel.small { width: 100%; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); transform: translateY(40px); }
  .viewer-panel, .minigame-panel { width: 100%; height: 100%; border-radius: 0; }
  .viewer-panel { overflow: auto; }
  .viewer { height: auto; min-height: 100%; grid-template-rows: auto auto; }
  .vhead { position: sticky; top: 0; z-index: 3; padding: 10px 10px 10px 12px; gap: 8px; }
  .vtitle { font-size: 16px; }
  .vchip { font-size: 17px; }
  .vbody { grid-template-columns: minmax(0, 1fr); }
  .vstage { padding: 10px; }
  .qfig { flex: none; }
  .qimg { width: 100%; max-height: none; }
  .zoom-hint { opacity: 1; }
  .vside { overflow: visible; padding: 14px 12px calc(16px + env(safe-area-inset-bottom)); }
  .mg-status { order: 3; flex-basis: 100%; }
  .mg-tools .btn span { display: none; }
}
@media (max-width: 380px) {
  .team-pill .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
