:root {
  --ink: #4a3f63;
  --ink-soft: #7d7396;
  --cream: #fffaf0;
  --purple: #8f78d6;
  --purple-soft: #e9e1fb;
  --yellow: #ffd65a;
  --pink: #f7c8d4;
  --line: #eadfca;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e8cfa0; color: var(--ink);
  font-family: "Gowun Dodum", "Pretendard", "Apple SD Gothic Neo", sans-serif; font-weight: 700; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
canvas#world { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }

#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: rgba(255,250,240,0.92); border-bottom: 2px solid var(--line); z-index: 5; }
#topbar .who { display: flex; align-items: center; gap: 6px; font-size: 15px; min-width: 0; }
#topbar .who span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
#topbar .count { flex: 1; font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar .btns { display: flex; gap: 6px; }
.pill { background: var(--purple-soft); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
.mini { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.mini:active { transform: translateY(1px); }
#hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 14px); margin: 0;
  background: rgba(74,63,99,0.82); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 14px; z-index: 4; pointer-events: none; white-space: nowrap; }

#joy { position: fixed; left: 22px; bottom: calc(env(safe-area-inset-bottom) + 56px); width: 116px; height: 116px; border-radius: 50%;
  background: rgba(255,255,255,0.55); border: 3px solid rgba(74,63,99,0.18); z-index: 4; touch-action: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  background: var(--purple); box-shadow: 0 3px 0 rgba(74,63,99,0.25); }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px;
  background: rgba(74,63,99,0.28); z-index: 10; overflow-y: auto; }
.overlay[hidden] { display: none; }
.card { background: var(--cream); border: 3px solid var(--line); border-radius: 24px; width: 100%; max-width: 460px;
  box-shadow: 0 10px 30px rgba(74,63,99,0.18); margin: auto; }
.entry { padding: 26px 22px 20px; text-align: center; }
.entry h1 { margin: 4px 0 2px; font-size: 34px; letter-spacing: -0.5px; }
.entry h2 { margin: 22px 0 12px; font-size: 20px; }
.sub { margin: 0; color: var(--ink-soft); font-size: 15px; }
.badge { display: inline-block; margin: 0; background: var(--yellow); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 6px; font-size: 16px; }
.chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip.locked { color: var(--ink-soft); background: #f4efe6; }
.namebox { margin: 18px 0 14px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.namebox strong { font-size: 19px; }
.primary { width: 100%; background: var(--purple); color: #fff; border-radius: 16px; padding: 15px; font-size: 18px; box-shadow: 0 4px 0 #6d58b3; }
.primary:disabled { background: #cfc6e6; box-shadow: none; cursor: default; }
.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #6d58b3; }
.ghost { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 14px; }
.tiny { font-size: 12px; color: var(--ink-soft); margin: 12px 0 0; }

.panel { padding: 16px 16px 18px; }
.panelHead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panelHead h2 { margin: 0; font-size: 22px; }
.stage { width: 100%; aspect-ratio: 1 / 1; max-height: 46vh; display: block; margin: 0 auto; background: #fff7ea; border-radius: 18px; border: 2px solid var(--line); touch-action: none; }
.gauge { height: 18px; border-radius: 999px; background: #efe6d6; overflow: hidden; margin: 12px 0 6px; border: 2px solid var(--line); }
.gauge > div { height: 100%; width: 0; background: linear-gradient(90deg, #ffd65a, #f7a8c0); transition: width 0.1s linear; }
.gaugeLabel { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); }
.row { display: flex; gap: 8px; margin-top: 12px; }
.row > button { flex: 1; }
.big { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px 8px; font-size: 16px; user-select: none; -webkit-user-select: none; touch-action: none; }
.big.on, .big:active { background: var(--purple-soft); border-color: var(--purple); }
.note { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; text-align: center; }
.msg { min-height: 24px; text-align: center; font-size: 17px; margin: 10px 0 0; }
textarea { width: 100%; height: 96px; resize: none; border: 2px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; margin-top: 10px; }
.help { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 14px 0 0; }
.help a { color: var(--ink-soft); }
.optTitle { font-size: 15px; margin: 14px 0 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts .chip { padding: 8px 12px; font-size: 14px; }
.statRow { display: grid; grid-template-columns: 56px 1fr 40px; align-items: center; gap: 8px; margin: 8px 0; font-size: 15px; }
.bar { height: 16px; border-radius: 999px; background: #efe6d6; overflow: hidden; }
.bar > div { height: 100%; background: var(--purple); border-radius: 999px; }

#toast { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 999px; font-size: 14px; z-index: 20; max-width: 92vw; text-align: center; }
#offline { position: fixed; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 14px); background: #fff; border: 2px solid var(--line);
  padding: 6px 10px; border-radius: 12px; font-size: 12px; color: var(--ink-soft); z-index: 4; }

/* 결제 · 막걸리 · 복원 코드 (2026-11-05) */
.mini.mak { background: #fff6d6; border-color: #f0d98a; }
.big.mak { background: #fff6d6; border-color: #f0d98a; }
.jumo { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 16px 18px; text-align: center; }
.jumo .say { font-size: 18px; line-height: 1.6; margin: 0; }
.jumo .who { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }
.facts { margin: 12px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.7; }
.restore { margin-top: 16px; padding-top: 6px; border-top: 2px dashed var(--line); }
.restore .mycode { margin: 4px 0 0; font-size: 15px; }
.restore .mycode b { font-size: 17px; letter-spacing: 0.5px; }
.rrow { display: flex; gap: 6px; margin-top: 8px; }
.rrow input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: 10px; font: inherit; font-size: 15px; color: var(--ink); background: #fff; }
.note a, .biz a { color: var(--ink-soft); }
.biz { margin-top: 16px; padding-top: 10px; border-top: 2px solid var(--line); font-size: 11px; color: var(--ink-soft); }
.biz nav { font-size: 12px; }
.biz p { margin: 6px 0 0; line-height: 1.6; }
