/* 오목(/omok)·알까기(/alkkagi)가 같이 쓰는 모양. 차례를 주고받는 1:1 게임 화면.
   휴대폰이 기준이고, 넓은 화면에서는 가운데에 휴대폰 폭의 판만 보인다. 테두리 선 없이 색과 그림자로만 구분한다. */
@font-face { font-family: "Pretendard Variable"; src: url("/fonts/PretendardVariable.woff2") format("woff2"); font-weight: 45 920; font-display: swap; }
:root {
  --bg: #fcf6f2; --ink: #2b2420; --soft: #7a685a; --brown: #94663e; --coral: #ea6f67; --sand: #f5ebe3; --wood: #efd2a4; --mint: #4fae8e;
  color-scheme: light;
}
html, body { height: 100%; }
body { margin: 0; background: #f3e9e1; color: var(--ink); overflow: hidden; overscroll-behavior: none;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; letter-spacing: 0;
  word-break: keep-all; overflow-wrap: break-word;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; margin: 0; padding: 0; background: none; cursor: pointer; }
.stage { position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100vw, 520px); overflow: hidden; background: var(--bg); }

/* 첫 화면 · 결과 · 기다림 판 */
.panel { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; box-sizing: border-box; overflow-x: hidden; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 24px calc(22px + env(safe-area-inset-bottom, 0px)); background: var(--bg); }
.in-app .panel { padding-top: 18px; }
.panel.dim { background: rgba(252, 246, 242, .93); justify-content: center; }
.art { flex: 0 1 auto; min-height: 0; width: auto; max-width: 100%; height: 38%; max-height: 320px; object-fit: contain; margin-top: 4vh; }
h1 { margin: 14px 0 6px; font-size: 30px; line-height: 1.2; font-weight: 800; color: var(--ink); }
h2 { margin: 10px 0 6px; font-size: 32px; line-height: 1.2; font-weight: 800; color: var(--brown); }
h2.win { color: var(--coral); }
.sub { margin: 0; max-width: 300px; font-size: 14px; line-height: 1.55; color: var(--soft); text-align: center; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; background: #fde4e1; color: #c8524a; font-size: 12px; font-weight: 700; }
.rules { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; align-self: center; max-width: 300px; }
.rules li { display: flex; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--soft); text-align: left; }
.rules li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--coral); }
.spacer { flex: 1 1 10px; }
.btns { align-self: stretch; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn { flex: 1 1 0; min-height: 46px; padding: 0 14px; border-radius: 999px; background: #fff; color: var(--brown); font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 10px rgba(43, 36, 32, .05); }
.btn.main { flex-basis: 100%; min-height: 50px; background: var(--coral); color: #fff; font-size: 15px; box-shadow: 0 8px 18px rgba(234, 111, 103, .28); }
.btn.vs { flex-basis: 100%; min-height: 50px; background: var(--brown); color: #fff; font-size: 15px; box-shadow: 0 8px 18px rgba(148, 102, 62, .22); }
.btn:active, .chip:active, .icon:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.toplay { margin-top: 10px; min-height: 32px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; }
.in-app .toplay { display: none; }
.face { width: 108px; height: 108px; object-fit: contain; }
.wait-dots { display: flex; gap: 8px; margin: 18px 0 14px; }
.wait-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); animation: bob 1s ease-in-out infinite; }
.wait-dots i:nth-child(2) { animation-delay: .15s; } .wait-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 50% { transform: translateY(-8px); opacity: .5; } }

/* 놀이 화면: 위 두 사람 · 가운데 판 · 아래 한 줄 */
.play { position: absolute; inset: 0; display: flex; flex-direction: column; box-sizing: border-box;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
.in-app .play { padding-top: 10px; }
.bar { flex: none; display: flex; gap: 8px; }
.who { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 12px 0 8px; border-radius: 20px; transition: background .2s, box-shadow .2s; }
.who > .ring, .who > .txt { opacity: .55; transition: opacity .2s; }
.who.on > .ring, .who.on > .txt { opacity: 1; }
.who.right { flex-direction: row-reverse; padding: 0 8px 0 12px; text-align: right; }
.who.on { background: #fff; box-shadow: 0 6px 18px rgba(43, 36, 32, .07); }
.ring { position: relative; flex: none; width: 46px; height: 46px; }
.ring img { position: absolute; inset: 6px; width: 34px; height: 34px; object-fit: contain; }
.ring svg { position: absolute; inset: 0; width: 46px; height: 46px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.ring .track { stroke: var(--sand); }
.ring .time { stroke: var(--coral); stroke-dasharray: 131.9; stroke-dashoffset: 131.9; }
.who .txt { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.who b { font-size: 14px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { font-size: 12px; line-height: 1.3; color: var(--soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.who.on small { color: var(--coral); font-weight: 600; }
.who.low small { color: #d6453c; }
.bubble { position: absolute; top: 54px; left: 8px; z-index: 3; max-width: 180px; padding: 8px 12px; border-radius: 4px 16px 16px 16px; background: var(--ink); color: #fff; font-size: 13px; line-height: 1.4; font-weight: 600; white-space: nowrap; pointer-events: none; animation: pop .25s cubic-bezier(.2, 1.6, .4, 1); }
.who.right .bubble { left: auto; right: 8px; border-radius: 16px 4px 16px 16px; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.mid { position: relative; flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
canvas#c { display: block; touch-action: none; border-radius: 22px; box-shadow: 0 12px 30px rgba(148, 102, 62, .2); }
.foot { flex: none; display: flex; flex-direction: column; gap: 10px; }
.status { min-height: 21px; margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; color: var(--soft); text-align: center; }
.status.me { color: var(--brown); }
.row { display: flex; align-items: center; gap: 8px; }
.icon { flex: none; width: 48px; height: 48px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(43, 36, 32, .05); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: var(--brown); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row .btn.main { flex: 1; min-height: 48px; }
.row .btn.undo { flex: none; min-height: 48px; padding: 0 16px; transition: opacity .2s; }
.row .btn.undo.off { opacity: .45; }
.row .hint { flex: 1; margin: 0; font-size: 13px; line-height: 1.45; color: var(--soft); text-align: center; }
.toast { position: absolute; left: 50%; top: 46%; z-index: 6; transform: translate(-50%, -50%); width: max-content; max-width: calc(100% - 56px); padding: 11px 18px; border-radius: 999px; background: rgba(43, 36, 32, .9); color: #fff; font-size: 14px; font-weight: 600; text-align: center; pointer-events: none; transition: opacity .3s; }
.toast.off { opacity: 0; }

/* 아래에서 올라오는 작은 판(한마디 · 메뉴) */
.sheet { position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; }
.sheet .shade { position: absolute; inset: 0; background: rgba(43, 36, 32, .3); }
.sheet .card { position: relative; box-sizing: border-box; width: 100%; padding: 22px 20px calc(18px + env(safe-area-inset-bottom, 0px)); border-radius: 24px 24px 0 0; background: #fff; animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.sheet .note { margin: -4px 0 16px; font-size: 14px; line-height: 1.55; color: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--sand); color: var(--ink); font-size: 14px; font-weight: 600; }
.sheet .btn { background: var(--sand); box-shadow: none; }
.sheet .btn.main { background: var(--coral); box-shadow: none; }
.loading { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: var(--bg); color: var(--brown); font-size: 15px; font-weight: 600; }
@media (max-height: 600px) { .art { height: 30%; margin-top: 0; } h1 { font-size: 26px; } .who { height: 52px; } }
@media (prefers-reduced-motion: reduce) { .wait-dots i, .bubble, .sheet .card { animation: none; } }
