@font-face { font-family: Pretendard; font-weight: 700; src: url(../vendor/fonts/Pretendard-Bold.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Pretendard; font-weight: 800; src: url(../vendor/fonts/Pretendard-ExtraBold.woff2) format('woff2'); font-display: swap; }

:root { --ink: #14202b; --panel: rgba(16, 26, 36, .78); --line: rgba(255, 255, 255, .16); --teal: #2fd6c3; --amber: #ffb347; --paper: #f3f6f8; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c2630; color: #fff;
  font-family: Pretendard, 'Malgun Gothic', system-ui, sans-serif; font-weight: 700;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#pad { position: fixed; inset: 0; touch-action: none; }
#joyBase { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .35); display: none; pointer-events: none; }
#joyBase.on { display: block; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .8); transform: translate(-50%, -50%); }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud[hidden] { display: none; }
#top { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 10px; align-items: flex-start;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; font-size: 15px; line-height: 1.35; backdrop-filter: blur(6px); }
.chip b { color: var(--teal); margin-right: 6px; font-weight: 800; }
.chip.goal { flex: 1; max-width: 560px; color: #e8f1f5; }
.chip.goal:empty { visibility: hidden; }
.hudBtn { pointer-events: auto; margin-left: auto; font: inherit; font-size: 15px; color: var(--ink); background: var(--paper); border: 0; border-radius: 12px;
  padding: 10px 16px; min-height: 44px; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); white-space: nowrap; }
.hudBtn:active, .hudBtn.down { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
kbd { font: inherit; font-size: 12px; background: rgba(20, 32, 43, .12); border-radius: 5px; padding: 1px 6px; margin-left: 4px; }
body.touch kbd { display: none; }

#who { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); background: var(--teal); color: var(--ink); border-radius: 999px; padding: 7px 18px;
  font-size: 15px; font-weight: 800; opacity: 0; transition: opacity .25s; }
#who.on { opacity: 1; }

#say { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); max-width: min(440px, 62vw);
  background: var(--paper); color: var(--ink); border-radius: 16px 16px 16px 4px; padding: 12px 16px 13px; font-size: 16px; line-height: 1.5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3); opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
#say.on { opacity: 1; transform: none; }
#say i { display: block; font-style: normal; font-size: 12px; font-weight: 800; color: #0f8f82; margin-bottom: 2px; }
body.touch #say { bottom: auto; top: 64px; max-width: min(420px, 46vw); border-radius: 4px 16px 16px 16px; }

#prompt { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 16px; font-size: 16px; white-space: nowrap; }
#prompt[hidden] { display: none; }
#prompt kbd { background: #fff; color: var(--ink); font-size: 14px; margin: 0 8px 0 0; padding: 2px 8px; }

#touchBtns { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); display: none; gap: 14px; align-items: flex-end; }
body.touch #touchBtns { display: flex; }
#touchBtns button { pointer-events: auto; font: inherit; font-size: 17px; font-weight: 800; color: var(--ink); border: 0; border-radius: 50%; touch-action: none; }
#btnJump { width: 96px; height: 96px; background: var(--paper); box-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
#btnAct { width: 78px; height: 78px; background: var(--amber); box-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
#touchBtns button.down { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(12, 20, 28, .72); backdrop-filter: blur(5px); padding: 20px; }
.overlay[hidden] { display: none; }
.card { width: min(460px, 100%); background: var(--paper); color: var(--ink); border-radius: 20px; padding: 28px 28px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 800; color: #0f8f82; letter-spacing: .02em; }
.card h1 { margin: 0 0 10px; font-size: 34px; line-height: 1.15; font-weight: 800; }
.lead { margin: 0 0 16px; font-size: 16px; line-height: 1.55; color: #3c4b58; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0 0 20px; font-size: 14.5px; }
dt { color: #5a6976; } dd { margin: 0; }
.primary { width: 100%; font: inherit; font-size: 18px; font-weight: 800; color: #fff; background: #12a594; border: 0; border-radius: 14px; padding: 15px; min-height: 54px; cursor: pointer; box-shadow: 0 4px 0 #0b6f64; }
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #0b6f64; }
.primary:disabled { background: #9fb0ba; box-shadow: 0 4px 0 #7d8d97; cursor: default; }
.note { margin: 12px 0 0; font-size: 13px; color: #6a7884; text-align: center; min-height: 1.3em; }

@media (max-height: 520px) {
  .card { padding: 18px 22px 16px; } .card h1 { font-size: 26px; } dl { gap: 4px 14px; margin-bottom: 12px; font-size: 13.5px; } .lead { margin-bottom: 10px; font-size: 14.5px; }
  .chip, .hudBtn { font-size: 13.5px; }
}

#roomList { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
#roomList button { font: inherit; font-size: 13.5px; color: #3c4b58; background: #e2e8ec; border: 0; border-radius: 999px; padding: 8px 13px; min-height: 36px; cursor: pointer; }
#roomList button[aria-pressed="true"] { background: #14202b; color: #fff; }
.ghost { width: 100%; margin-top: 8px; font: inherit; font-size: 15px; color: #3c4b58; background: none; border: 0; padding: 12px; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

#duo, #lobby { margin-top: 16px; padding-top: 14px; border-top: 1px solid #d5dde2; }
#duo[hidden], #lobby[hidden], #btnStart[hidden], #btnGo[hidden], #btnNext[hidden], #btnAgain[hidden], #clearWait[hidden] { display: none; }
.duoTitle { margin: 0 0 8px; font-size: 13px; font-weight: 800; color: #5a6976; }
.duoRow { display: flex; gap: 8px; }
.second { font: inherit; font-size: 15px; font-weight: 800; color: #14202b; background: #dfe6ea; border: 0; border-radius: 12px; padding: 0 16px; min-height: 48px; cursor: pointer; white-space: nowrap; box-shadow: 0 3px 0 #b9c4cb; }
.second:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9c4cb; }
#code { flex: 1; min-width: 0; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; text-align: center; color: #14202b; background: #fff; border: 2px solid #b9c4cb; border-radius: 12px; padding: 0 8px; min-height: 48px; -webkit-user-select: text; user-select: text; }
#code::placeholder { letter-spacing: 0; font-size: 14px; color: #6a7884; }
#code:focus-visible, .second:focus-visible, .primary:focus-visible, #roomList button:focus-visible { outline: 3px solid #12a594; outline-offset: 2px; }
#lobbyCode { margin: 0 0 6px; font-size: 44px; font-weight: 800; letter-spacing: .16em; line-height: 1; color: #14202b; }
#lobbyMsg { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: #3c4b58; }
#roomList button:disabled { opacity: .5; cursor: default; }
body.net #btnSwap { display: none; }
