/* PLAYORA 지렁이 게임 */
:root {
  --bg: #10201c; --bg-2: #142824; --bg-3: #1b322d; --line: #2a4640; --ink: #eaf2ee; --ink-2: #a7b8b1; --ink-3: #75887f;
  --acc: #c8f169; --acc-ink: #17200a; --hot: #ff5c6a; --gold: #ffd666;
  --scrim: rgba(7, 15, 13, 0.9); --glass: rgba(7, 15, 13, 0.5);
  --page: #f3f2ea; --page-ink: #1d2320; --page-2: #58625d; --page-line: #dbd8c9; --page-acc: #3f7a1f;
  --f-body: "IBM Plex Sans KR", "Pretendard", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --f-disp: "Black Han Sans", "IBM Plex Sans KR", sans-serif;
  --f-num: "Rubik", "IBM Plex Sans KR", sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r1: 8px; --r2: 12px; --r3: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(0.235 0.03 175); --bg-2: oklch(0.26 0.032 175); --bg-3: oklch(0.3 0.034 175); --line: oklch(0.38 0.036 175);
    --ink: oklch(0.95 0.012 165); --ink-2: oklch(0.77 0.022 165); --ink-3: oklch(0.6 0.022 165);
    --acc: oklch(0.91 0.17 124); --acc-ink: oklch(0.24 0.05 124); --hot: oklch(0.69 0.19 18);
    --page: oklch(0.96 0.012 110); --page-ink: oklch(0.25 0.012 160); --page-2: oklch(0.47 0.015 160); --page-line: oklch(0.88 0.018 105); --page-acc: oklch(0.5 0.13 135);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--page); color: var(--page-ink); font: 400 16px/1.7 var(--f-body); word-break: keep-all; overflow-wrap: anywhere; }
button { font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
a { color: inherit; }

/* ---------------------------------------------------------------- 페이지 머리 */
.mast { display: flex; align-items: baseline; gap: var(--s4); padding: var(--s3) clamp(var(--s4), 3vw, var(--s6)); border-bottom: 1px solid var(--page-line); }
.mast-brand { text-decoration: none; font-size: 14px; color: var(--page-2); white-space: nowrap; }
.mast-brand b { font-family: var(--f-num); font-weight: 700; letter-spacing: 0.08em; color: var(--page-ink); margin-right: 6px; }
.mast-more { margin-left: auto; font-size: 14px; color: var(--page-2); white-space: nowrap; }
.head { max-width: 1240px; margin: 0 auto; padding: var(--s4) clamp(var(--s3), 3vw, var(--s6)) var(--s3); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s4); }
.head h1 { margin: 0; font: 400 clamp(30px, 4vw, 40px)/1.1 var(--f-disp); letter-spacing: -0.01em; }
.head p { margin: 0; color: var(--page-2); font-size: 15px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(0px, 2vw, var(--s5)); }

/* ---------------------------------------------------------------- 게임 무대 */
.wg { position: relative; width: 100%; height: clamp(440px, calc(100svh - 132px), 820px); background: var(--bg); color: var(--ink); overflow: hidden; border-radius: var(--r2); outline: none;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; font-family: var(--f-body); }
.wg canvas#wc { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (max-width: 640px) { .wg { border-radius: 0; height: calc(100svh - 52px); min-height: 520px; } .head { padding-top: var(--s3); } .head p { display: none; } }
html.embed, html.embed body { height: 100%; overflow: hidden; background: var(--bg); }
html.embed .mast, html.embed .head, html.embed .about, html.embed .foot { display: none !important; }
html.embed .wrap { padding: 0; max-width: none; }
html.embed .wg { position: fixed; inset: 0; width: auto; height: auto; min-height: 0; border-radius: 0; }
[hidden] { display: none !important; }

/* 위쪽 버튼 줄 */
.bar { position: absolute; top: var(--s2); right: var(--s2); z-index: 8; display: flex; gap: var(--s1); }
.tb { height: 32px; padding: 0 var(--s3); border-radius: 999px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); font: 600 13px/1 var(--f-body); }
.tb:hover { border-color: var(--ink-3); }
.tb[aria-pressed="false"] { color: var(--ink-3); }
.wg.narrow .tb { padding: 0 10px; font-size: 12px; }
.wg button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------------------------------------------------------------- 게임 중 표시 */
.hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.hud-me { position: absolute; top: var(--s2); left: var(--s2); padding: 6px var(--s3) 8px; border-radius: var(--r2); background: rgba(6, 13, 11, 0.62); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
.hm-len { margin: 0; display: flex; align-items: baseline; gap: var(--s2); }
.hm-len span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.hm-len b { font: 700 30px/1.1 var(--f-num); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hm-sub { margin: 0; display: flex; gap: var(--s3); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hm-sub:empty, .hm-sub span:empty { display: none; }
.board { position: absolute; top: 48px; right: var(--s2); width: 196px; margin: 0; padding: 6px var(--s2) 6px; list-style: none; border-radius: var(--r1); background: rgba(6, 13, 11, 0.66); font-size: 13px; line-height: 1.55; }
.board li { display: grid; grid-template-columns: 1.7em minmax(0, 1fr) auto; gap: 6px; color: var(--ink-2); }
.board li .rk { font: 600 12px/1.9 var(--f-num); color: var(--ink-3); text-align: right; }
.board li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.board li .ln { font: 500 12px/1.9 var(--f-num); font-variant-numeric: tabular-nums; }
.board li:nth-child(-n+3) .rk { color: var(--gold); }
.board li.me .nm, .board li.me .ln { color: var(--acc); font-weight: 600; }
.board li.gap { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.wg.narrow .board { width: 148px; top: 46px; font-size: 12px; }
.wg.short .board { font-size: 12px; line-height: 1.4; }
.feed { position: absolute; left: var(--s3); bottom: var(--s3); margin: 0; padding: 0; list-style: none; max-width: min(46%, 380px); display: grid; gap: 4px; }
.feed li { font-size: 13px; color: var(--ink-2); padding: 3px 10px; border-radius: 999px; background: var(--glass); width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; animation: feedIn .35s var(--ease) both; transition: opacity .5s; }
.feed li b { color: var(--ink); font-weight: 600; }
.feed li b.me, .feed li.mine b:first-child { color: var(--acc); }
.feed li.mine { color: var(--ink); }
.feed li.out { opacity: 0; }
@keyframes feedIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.wg.touch .feed { bottom: auto; top: 76px; max-width: 58%; }
.wg.narrow .hud-me { top: 46px; }
.wg.narrow.touch .feed { top: 118px; }
.wg.narrow .feed { max-width: calc(100% - 148px - 32px); }
.wg.narrow .feed li { font-size: 12px; }
.tip { position: absolute; left: 0; right: 0; bottom: 22%; width: fit-content; max-width: 86%; margin: 0 auto; padding: var(--s2) var(--s4); border-radius: var(--r2); background: var(--scrim); color: var(--ink); font-size: 14px; font-weight: 500; text-align: center; animation: feedIn .4s var(--ease) both; }
.boost { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); z-index: 4; width: 84px; height: 84px; border-radius: 50%; border: 2px solid rgba(200, 241, 105, 0.55); background: rgba(200, 241, 105, 0.14); color: var(--acc); font: 700 17px/1 var(--f-body); touch-action: none; }
.boost.on { background: var(--acc); color: var(--acc-ink); transform: scale(0.95); }
.wg.short .boost { width: 72px; height: 72px; font-size: 15px; }

/* ---------------------------------------------------------------- 화면 공통 */
.scr { position: absolute; inset: 0; z-index: 5; display: flex; }
.scr-home, .scr-result, .mbox { touch-action: pan-y; }

/* 첫 화면: 왼쪽 글, 오른쪽 스킨. 뒤로는 실제 경기장이 돌아감 */
.scr-home { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr); column-gap: clamp(20px, 4vw, 56px); align-items: center; padding: 52px clamp(20px, 5vw, 64px) 24px; overflow-y: auto;
  background: linear-gradient(90deg, rgba(7, 15, 13, 0.9) 0%, rgba(7, 15, 13, 0.62) 55%, rgba(7, 15, 13, 0.3) 100%); }
.kicker { margin: 0 0 var(--s2); font: 600 13px/1.3 var(--f-body); letter-spacing: 0.04em; color: var(--acc); }
.logo { margin: 0; font: 400 clamp(50px, 8.6vw, 100px)/1 var(--f-disp); letter-spacing: -0.01em; color: var(--ink); }
.tag { margin: var(--s3) 0 0; max-width: 24em; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.join { display: flex; gap: var(--s2); margin-top: var(--s5); max-width: 460px; }
.nm { flex: 1; min-width: 0; display: grid; position: relative; }
.nm span { position: absolute; left: 14px; top: 7px; font-size: 12px; color: var(--ink-3); pointer-events: none; }
.nm input { width: 100%; height: 56px; padding: 20px 14px 4px; border-radius: var(--r2); border: 1px solid var(--line); background: rgba(10, 20, 18, 0.85); color: var(--ink); font: 600 17px/1 var(--f-body); -webkit-user-select: text; user-select: text; }
.nm input:focus { outline: 2px solid var(--acc); outline-offset: 1px; border-color: transparent; }
.nm input::placeholder { color: var(--ink-3); font-weight: 500; font-size: 15px; }
.go { height: 56px; padding: 0 var(--s6); border-radius: var(--r2); border: 0; background: var(--acc); color: var(--acc-ink); font: 700 18px/1 var(--f-body); transition: transform .2s var(--ease), filter .2s; }
.go:hover { filter: brightness(1.06); transform: translateY(-1px); }
.go:active { transform: translateY(1px); }
.home-best { margin: var(--s3) 0 0; font-size: 14px; color: var(--ink-2); }
.home-best b { font-family: var(--f-num); color: var(--ink); font-weight: 600; }
.home-sub { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s3); margin-left: -10px; }
.home-sub button, .ghost { background: none; border: 1px solid transparent; border-radius: 999px; padding: 6px 10px; color: var(--ink-2); font-size: 14px; }
.home-sub button:hover { color: var(--ink); border-color: var(--line); }
.home-sub button[aria-pressed="false"] { color: var(--ink-3); }
.skin-card { padding: var(--s4); border-radius: var(--r3); background: rgba(9, 19, 17, 0.82); border: 1px solid var(--line); }
#skinPrev { display: block; width: 100%; height: 92px; }
.skin-name { margin: var(--s1) 0 var(--s3); display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.skin-name b { font: 400 24px/1.1 var(--f-disp); font-weight: 400; }
.skin-name span { font-size: 13px; color: var(--ink-2); }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.sw { position: relative; aspect-ratio: 1; padding: 0; border-radius: var(--r1); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.sw canvas { width: 100%; height: 100%; display: block; }
.sw:hover { border-color: var(--ink-3); }
.sw.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); background: rgba(200, 241, 105, 0.08); }
.sw.lock canvas { filter: grayscale(0.85) brightness(0.5); }
.sw.lock::before { content: ''; position: absolute; right: 6px; bottom: 11px; width: 6px; height: 6px; border: 2px solid var(--ink-2); border-bottom: 0; border-radius: 5px 5px 0 0; }
.sw.lock::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 12px; height: 8px; border-radius: 2px; background: var(--ink-2); }
.wg.narrow .scr-home, .wg.portrait .scr-home { grid-template-columns: 1fr; align-content: start; row-gap: var(--s3); padding: 46px var(--s4) var(--s3); background: rgba(7, 15, 13, 0.78); }
.wg.narrow .logo, .wg.portrait .logo { font-size: clamp(44px, 13.5vw, 68px); }
.wg.portrait .tag { display: none; }
.wg.portrait .join { margin-top: var(--s4); }
.wg.narrow .go { padding: 0 var(--s5); }
.wg.portrait .home-best { margin-top: var(--s2); font-size: 13px; }
.wg.portrait .home-sub { margin-top: var(--s1); }
.wg.portrait #skinPrev { height: 60px; }
.wg.portrait .skin-card { padding: var(--s3); }
.wg.portrait .skin-name { margin-bottom: var(--s2); }
.wg.portrait .skin-grid { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 5px; }
.wg.short .scr-home { padding-top: 44px; padding-bottom: 10px; }
.wg.short .tag { display: none; }
.wg.short .join { margin-top: var(--s3); }
.wg.short #skinPrev { height: 64px; }
.wg.short .skin-card { padding: var(--s3); }
.wg.short .skin-grid { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.wg.short .home-sub { margin-top: var(--s1); }
.wg.tiny .logo { font-size: 42px; }
.wg.tiny .kicker { display: none; }
.wg.tiny .nm input, .wg.tiny .go { height: 48px; }
.wg.tiny .nm span { display: none; }
.wg.tiny .nm input { padding-top: 4px; }

/* 일시정지 · 결과 */
.scr-pause, .scr-result { align-items: center; justify-content: center; background: rgba(5, 11, 10, 0.72); padding: 48px var(--s4) var(--s4); }
.box { display: grid; gap: var(--s2); width: min(340px, 100%); padding: var(--s5); border-radius: var(--r3); background: var(--bg-2); border: 1px solid var(--line); }
.box-t { margin: 0; font: 400 32px/1.2 var(--f-disp); }
.box-s { margin: 0 0 var(--s2); color: var(--ink-2); font-size: 14px; white-space: normal; }
.box button, .res-btns button { height: 48px; border-radius: var(--r1); border: 1px solid var(--line); background: var(--bg-3); color: var(--ink); font-weight: 600; font-size: 16px; }
.box button:hover, .res-btns button:hover { border-color: var(--ink-3); }
.box .big, .res-btns .big { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.box-row { display: flex; gap: 6px; margin-top: var(--s1); }
.box-row .mini { flex: 1; height: 36px; font-size: 13px; padding: 0 6px; background: transparent; color: var(--ink-2); }
.scr-result { overflow-y: auto; align-items: flex-start; }
.res { margin: auto; width: min(500px, 100%); padding: var(--s5); border-radius: var(--r3); background: var(--bg-2); border: 1px solid var(--line); animation: resIn .45s var(--ease) both; }
@keyframes resIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.res-k { margin: 0; font-size: 13px; color: var(--ink-3); }
.res-t { margin: 2px 0 var(--s3); font: 700 clamp(20px, 3vw, 26px)/1.3 var(--f-body); letter-spacing: -0.01em; white-space: normal; }
.res-big { margin: 0 0 var(--s4); display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.res-big b { font: 700 clamp(44px, 7vw, 60px)/1 var(--f-num); color: var(--acc); letter-spacing: -0.02em; }
.res-big span { font-size: 14px; color: var(--ink-2); }
.res-big .nb { font: 700 13px/1 var(--f-body); padding: 6px 10px; border-radius: 999px; background: var(--gold); color: #2a2006; align-self: center; }
.res-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin: 0 0 var(--s3); }
.res-stats div { padding: var(--s2) var(--s3); border-radius: var(--r1); background: var(--bg-3); }
.res-stats dt { font-size: 12px; color: var(--ink-2); }
.res-stats dd { margin: 0; font: 600 18px/1.35 var(--f-num); white-space: nowrap; }
.wg.narrow .res-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.res-unlock, .res-next { margin: 0 0 var(--s3); font-size: 14px; color: var(--ink-2); }
.res-unlock b { color: var(--acc); }
.res-btns { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s2); margin-top: var(--s2); }
.wg.short .res { padding: var(--s3) var(--s4); }
.wg.short .res-big { margin-bottom: var(--s2); }
.wg.short .res-big b { font-size: 40px; }
.wg.short .res-t { margin-bottom: var(--s2); }

/* ---------------------------------------------------------------- 모달 */
.modal { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: 48px var(--s3) var(--s3); background: rgba(4, 9, 8, 0.6); }
.mbox { width: min(540px, 100%); max-height: 100%; overflow-y: auto; padding: var(--s4) var(--s5) var(--s5); border-radius: var(--r3); background: var(--bg-2); border: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.mhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.mtitle { margin: 0; font: 400 26px/1.2 var(--f-disp); }
.x { height: 34px; padding: 0 var(--s3); border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--ink-2); font-size: 14px; }
.mbody h3 { margin: var(--s4) 0 var(--s1); font: 400 20px/1.3 var(--f-disp); }
.mbody p { margin: 0 0 var(--s2); font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.mbody b { color: var(--ink); }
.kt { width: 100%; border-collapse: collapse; font-size: 14px; }
.kt th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 6px var(--s3) 6px 0; width: 42%; vertical-align: top; }
.kt td { font-weight: 600; padding: 6px 0; }
.kt tr + tr th, .kt tr + tr td { border-top: 1px solid var(--line); }
.hint { margin: var(--s3) 0 0; font-size: 13px; color: var(--ink-2); }

.focus-hint { position: absolute; inset: 0; z-index: 12; display: grid; place-content: center; gap: var(--s2); text-align: center; border: 0; background: rgba(4, 9, 8, 0.55); color: var(--ink); }
.focus-hint b { font: 400 34px/1.1 var(--f-disp); padding: var(--s3) var(--s5); border-radius: 999px; background: var(--acc); color: var(--acc-ink); }
.focus-hint span { font-size: 14px; color: var(--ink-2); }

/* ---------------------------------------------------------------- 소개 글 */
.about { max-width: 1240px; margin: 0 auto; padding: var(--s7) clamp(var(--s4), 4vw, var(--s7)) var(--s6); display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 0.8fr); gap: var(--s6) clamp(var(--s5), 5vw, var(--s8)); }
.about-main { min-width: 0; }
.about h2 { margin: var(--s6) 0 var(--s2); font: 400 28px/1.25 var(--f-disp); }
.about h2:first-child { margin-top: 0; }
.about p, .about li { font-size: 16px; color: var(--page-ink); }
.about p { margin: 0 0 var(--s3); }
.about ul, .about ol { margin: 0 0 var(--s3); padding-left: 1.3em; }
.about li { margin-bottom: 6px; }
.about strong { font-weight: 600; }
.about dl { margin: 0; }
.about dt { margin-top: var(--s4); font-weight: 600; }
.about dd { margin: 4px 0 0; color: var(--page-2); }
.about-side { min-width: 0; font-size: 14px; color: var(--page-2); }
.about-side h3 { margin: 0 0 var(--s2); font: 400 22px/1.3 var(--f-disp); color: var(--page-ink); }
.keytab { width: 100%; border-collapse: collapse; margin-bottom: var(--s5); font-size: 14px; }
.keytab th { text-align: left; font-weight: 500; padding: 6px var(--s2) 6px 0; color: var(--page-2); vertical-align: top; }
.keytab td { padding: 6px 0; font-weight: 600; color: var(--page-ink); }
.keytab tr + tr th, .keytab tr + tr td { border-top: 1px solid var(--page-line); }
.credits { margin-top: var(--s6) !important; padding-top: var(--s4); border-top: 1px solid var(--page-line); font-size: 13px; color: var(--page-2); line-height: 1.6; }
.credits a { color: var(--page-2); }
.more { margin-top: var(--s5); font-size: 14px; color: var(--page-2); line-height: 1.9; }
.more a { white-space: nowrap; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; padding-top: var(--s6); } }
.foot { border-top: 1px solid var(--page-line); padding: var(--s5) clamp(var(--s4), 4vw, var(--s7)) var(--s6); font-size: 13px; color: var(--page-2); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); max-width: 1240px; margin: 0 auto; }
.foot a { color: var(--page-2); white-space: nowrap; }
.foot p { flex-basis: 100%; margin: var(--s2) 0 0; }
.nojs { padding: var(--s5); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
