:root {
  --ui: 1;
  --glass: rgba(10, 22, 28, 0.62);
  --glass-2: rgba(12, 24, 30, 0.84);
  --line: rgba(255, 255, 255, 0.16);
  --fg: #f7f4ec;
  --dim: #b9c6c9;
  --accent: #ffcf6a;
  --gold: #ffd23a;
  --bad: #ff5a4f;
  --c: #ff5a5f;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", system-ui, sans-serif;
  --display: Anton, Impact, "Pretendard Variable", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6f9fb3; color: var(--fg); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; word-break: keep-all; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 40%, transparent 62%, rgba(6, 18, 24, 0.32) 100%); }
.hidden { display: none !important; }

/* ---------- 왼쪽 위: 조과 · 난이도 · 연습 현황 ---------- */
.leftcol { position: fixed; top: 22px; left: 24px; zoom: var(--ui); width: 330px; display: flex; flex-direction: column; gap: 12px; }
.setbox .pcgs-panel { background: var(--glass); border-color: var(--line); border-radius: 18px; padding: 10px 12px 8px 14px; box-shadow: 0 14px 40px rgba(0, 20, 30, 0.28); }
.setbox .pcgs-panel .pcgs-label { min-width: 0; width: auto; flex: 1; font-size: 14px; color: var(--dim); letter-spacing: 0.02em; }
.setbox .pcgs-panel kbd { margin-left: 5px; }
/* 330px 칸 안에 알약 셋이 다 들어가게 조금 촘촘하게 */
.setbox .pcgs-panel .pcgs-seg { gap: 2px; padding: 3px; }
.setbox .pcgs-panel .pcgs-pill { padding: 6px 9px; gap: 5px; font-size: 14px; }
.setbox .pcgs-panel .pcgs-lv b { width: 4px; height: 4px; }
.setbox .pcgs-panel .pcgs-row { min-height: 38px; gap: 8px; }
.setbox .pcgs-panel .pcgs-foot { min-height: 0; }
.setbox .pcgs-sub { margin: -2px 0 2px; font-size: 12px; font-weight: 700; color: var(--dim); }
.tutbox:empty { display: none; }
.tutbox .pcgb-tile { min-width: 0; max-width: none; padding: 10px 14px 10px 10px; border-radius: 16px; }
.tutbox .pcgb-badge { width: 46px; height: 46px; font-size: 21px; border-radius: 13px; }
.tutbox .pcgb-head { font-size: 12px; padding: 5px 12px; white-space: normal; }
.board { position: relative; width: 330px; border-radius: 18px; overflow: hidden; pointer-events: none;
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 20, 30, 0.28); }
.board .bh { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 8px; font-size: 13px; font-weight: 800;
  letter-spacing: 0.04em; color: var(--dim); }
.board .bh .cols { display: flex; gap: 0; }
.board .bh .cols i { font-style: normal; width: 62px; text-align: right; font-size: 11px; font-weight: 700; }
.board .row { display: flex; align-items: center; padding: 8px 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.board .row:first-child { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 26%, transparent), transparent 75%); }
.board .row.away { opacity: 0.5; }
.board .badge { font-family: var(--display); font-size: 20px; line-height: 1.25; padding: 0 9px; border-radius: 999px; background: var(--c); color: #0b1216;
  margin-right: auto; }
.board .row > span:not(.badge) { width: 62px; text-align: right; }
.board .row b { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1; }
.board .row small { font-size: 11px; color: var(--dim); margin-left: 2px; font-weight: 700; }
.board .row .bst b { font-size: 20px; color: #e8efe9; }
.board .row .bst small { display: none; }
.board .rec { padding: 9px 16px 11px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 14px; font-weight: 700; color: #e8eee8;
  background: linear-gradient(90deg, rgba(255, 210, 58, 0.16), transparent); }
.board .rec span { display: block; font-size: 11px; font-weight: 800; color: var(--gold); letter-spacing: 0.06em; margin-bottom: 2px; }
.board .rec b { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: 0.02em; }

/* ---------- 오른쪽 위: QR ---------- */
.qr { position: fixed; top: 22px; right: 24px; zoom: var(--ui); width: 186px; padding: 14px 14px 12px; border-radius: 20px; pointer-events: none;
  background: #f8f6f0; color: #14232a; text-align: center; box-shadow: 0 18px 44px rgba(0, 20, 30, 0.32); }
.qr img { width: 158px; height: 158px; display: block; margin: 0 auto; border-radius: 8px; background: #fff; image-rendering: pixelated; }
.qr-code b { display: block; margin-top: 8px; font-family: var(--display); font-weight: 400; font-size: 38px; letter-spacing: 0.22em; line-height: 1;
  padding-left: 0.22em; }
.qr-k { margin-top: 6px; font-size: 13px; font-weight: 800; color: #31474f; letter-spacing: -0.01em; }
.qr-full { margin-top: 6px; font-size: 13px; font-weight: 900; color: #b5321f; }
.seats { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.seats i { width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--c); background: transparent; }
.seats i.on { background: var(--c); }
.seats i.on.bot { background: var(--c); opacity: 0.45; }
.qr-warn { margin-top: 9px; padding: 7px 8px; border-radius: 10px; background: #fff1c7; color: #6a4b00; font-size: 11px; line-height: 1.4; font-weight: 700; text-align: left; }

/* ---------- 사람마다: 상태 칩(낚싯대 아래) ---------- */
.chips { position: fixed; left: 0; right: 0; bottom: 0; height: 0; pointer-events: none; zoom: var(--ui); }
.chip { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); min-width: 150px; padding: 7px 14px 7px 7px; border-radius: 999px;
  background: var(--glass-2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow: 0 10px 28px rgba(0, 10, 16, 0.35); transition: left 0.5s cubic-bezier(.3, 1, .4, 1), border-color 0.2s, background 0.2s, padding 0.2s, border-radius 0.2s; }
.chip .cb { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.chip .badge { font-family: var(--display); font-size: 20px; line-height: 1.3; padding: 0 10px; border-radius: 999px; background: var(--c); color: #0b1216; }
.chip .st { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.chip .tp { display: none; font-size: 11px; font-weight: 900; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; color: #2a1a00; background: var(--accent); }
.chip.tut .tp { display: inline-block; }
.chip.tut.s-bite .tp { background: #fff; }
.chip.bot .st::after { content: " · BOT"; font-size: 11px; font-weight: 800; color: var(--dim); letter-spacing: 0.06em; }
.chip.bot.s-bite .st::after, .chip.bot.s-fight .st::after { content: none; }
.chip.away { opacity: 0.55; }
.chip.away .st::after { content: " · 연결 끊김"; font-size: 12px; color: var(--dim); font-weight: 700; }
.chip.nib { border-color: var(--accent); }
.chip.nib .st { color: var(--accent); animation: nibble 0.28s 3; }
.chip.s-bite { background: rgba(214, 38, 32, 0.92); border-color: #fff; padding: 10px 22px 10px 10px; animation: pulse 0.32s infinite alternate; }
.chip.s-bite .badge { background: #fff; font-size: 24px; }
.chip.s-bite .st { font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
.chip.s-landed { border-color: var(--gold); }
.chip.s-landed .st { color: var(--gold); }
.chip.s-lost .st { color: #ffc2bd; }
.chip .fight { display: none; align-items: center; gap: 10px; padding: 7px 4px 2px 6px; }
.chip.s-fight { border-radius: 18px; border-color: var(--c); min-width: 236px; }
.chip.s-fight .fight { display: flex; }
.chip .tbar { position: relative; flex: 1; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.12); --t: 0%; }
.chip .tbar i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--t); border-radius: 6px;
  background: linear-gradient(90deg, #5ee07a 0%, #ffd23a 60%, #ff5a4f 100%); background-size: 180px 100%; transition: width 0.1s linear; }
/* 빨간 구간(드랙이 미끄러지는 장력 이상) */
.chip .tbar em { position: absolute; top: 0; bottom: 0; left: 77.3%; right: 0; background: rgba(255, 70, 60, 0.28); border-left: 2px solid rgba(255, 255, 255, 0.8); }
.chip .tbar.hot i { animation: hot 0.22s infinite alternate; }
.chip .dist { font-family: var(--display); font-weight: 400; font-size: 20px; min-width: 58px; text-align: right; }
.chip .toast { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 8px); padding: 7px 13px; border-radius: 12px;
  font-weight: 900; font-size: 17px; white-space: nowrap; background: var(--glass-2); border: 1px solid var(--line); opacity: 0;
  transition: opacity 0.2s, transform 0.3s cubic-bezier(.2, 1.4, .4, 1); }
.chip .toast.on { opacity: 1; transform: translate(-50%, 0); }
.chip .toast.miss { color: #ffc2bd; }
.chip .toast.nib { color: var(--accent); }
.chip .toast.hit { color: var(--c); font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: 0.02em; }
.chip .toast.got { color: var(--gold); }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.08); box-shadow: 0 0 0 8px rgba(255, 90, 79, 0.28), 0 10px 28px rgba(0, 10, 16, 0.35); } }
@keyframes nibble { 50% { transform: translateY(3px); } }
@keyframes hot { to { filter: brightness(1.5); } }

/* 릴 옆 이름표 */
.labels { position: fixed; inset: 0; pointer-events: none; zoom: var(--ui); }
.rlabel { position: absolute; left: 0; top: 0; font-family: var(--display); font-size: 15px; line-height: 1.3; padding: 0 7px; border-radius: 999px;
  background: var(--c); color: #0b1216; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.3s; }
.rlabel.on { opacity: 0.95; }

/* ---------- 가운데 위: 조과 카드 ---------- */
.catch { position: fixed; left: 50%; top: 22px; zoom: var(--ui); display: flex; align-items: stretch; pointer-events: none; opacity: 0;
  filter: drop-shadow(0 20px 36px rgba(0, 20, 30, 0.38));
  transform: translate(-50%, -16px) scale(0.94); transition: opacity 0.3s, transform 0.45s cubic-bezier(.2, 1.3, .4, 1); }
.catch.on { opacity: 1; transform: translate(-50%, 0); }
.catch-fish { width: 330px; height: 172px; border-radius: 20px 0 0 20px; overflow: hidden; outline: 1px solid var(--line); }
.catch-info { display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 14px 26px 14px 20px; min-width: 240px;
  background: var(--glass-2); backdrop-filter: blur(12px); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 0 20px 20px 0; }
.catch-top { display: flex; align-items: center; gap: 8px; }
.catch-who { font-family: var(--display); font-size: 21px; padding: 0 10px; border-radius: 999px; background: var(--c); color: #0b1216; line-height: 1.3; }
.catch-badge { font-size: 12px; font-weight: 900; color: #2a1a00; background: var(--gold); padding: 4px 9px; border-radius: 999px; }
.catch-name { margin-top: 5px; font-size: 28px; font-weight: 900; letter-spacing: -0.02em; }
.catch-en { font-size: 11px; font-weight: 800; letter-spacing: 0.2em; color: var(--accent); }
.catch-row { display: flex; align-items: baseline; gap: 12px; margin-top: 3px; }
.catch-row b { font-family: var(--display); font-weight: 400; font-size: 56px; line-height: 1;
  background: linear-gradient(180deg, #fff6d6 0%, #ffd23a 55%, #ff9d1a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.catch-row b small { font-size: 0.4em; margin-left: 3px; }
.catch-row span { font-size: 18px; font-weight: 800; color: var(--dim); }

/* ---------- 아무도 없을 때 · 소리 ---------- */
.hint { position: fixed; left: 50%; bottom: 46px; zoom: var(--ui); display: flex; align-items: center; gap: 12px; padding: 13px 22px 13px 16px; border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); font-size: 19px; font-weight: 800;
  white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, 12px); transition: opacity 0.6s, transform 0.6s; }
.hint.on { opacity: 1; transform: translate(-50%, 0); animation: breathe 3.6s ease-in-out infinite 0.6s; }
.hint svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes breathe { 50% { transform: translate(-50%, -4px); } }
.sound { position: fixed; left: 22px; bottom: 18px; zoom: var(--ui); display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.8);
  padding: 6px 11px 6px 8px; border-radius: 999px; background: rgba(8, 20, 26, 0.45); pointer-events: none; transition: opacity 0.5s; }
.sound svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.sound.off { opacity: 0; }

.screen { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8, 18, 24, 0.82); }
.over { text-align: center; zoom: var(--ui); }
.over h1 { margin: 0; font-size: 52px; font-weight: 900; letter-spacing: -0.03em; }
.over p { margin: 14px 0 0; font-size: 19px; color: var(--dim); }

.debug { position: fixed; left: 12px; top: 50%; margin: 0; font: 12px ui-monospace, monospace; color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.5); padding: 8px 10px; border-radius: 8px; pointer-events: none; white-space: pre; }

@media (max-aspect-ratio: 4/3) {
  .leftcol, .board { width: 270px; }
  .setbox .pcgs-panel .pcgs-lv { display: none; }
  .setbox .pcgs-panel .pcgs-pill { padding: 6px 11px; }
  .board .bh .cols i, .board .row > span:not(.badge) { width: 50px; }
  .catch-fish { width: 220px; height: 130px; }
}
