body.world {
  position: fixed; inset: 0; overflow: hidden; background: #f3e3c3;
  user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}
/* 화면 조작은 끌기를 막되, 기도 창 같은 시트는 손가락으로 밀어 볼 수 있어야 합니다 */
.hud { touch-action: none; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* 입장 */
.gate {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(rgba(40, 20, 8, .45), rgba(40, 20, 8, .7)), url(/img/beopdang.jpg) center / cover;
}
.gate-card {
  width: min(100%, 360px); background: var(--card); border-radius: 18px; padding: 26px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}
.gate-card h1 { font-family: var(--serif); font-size: 1.7rem; margin: 4px 0 0; }
.gate-card input { text-align: center; margin-top: 8px; user-select: text; -webkit-user-select: text; }
.gate-card .btn { width: 100%; padding: 12px; font-size: 1.05rem; }
.gate-card a { text-decoration: underline; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 10px 0; pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.hud-info {
  background: rgba(40, 22, 10, .72); color: #fbeed8; border-radius: 12px; padding: 6px 12px;
  display: flex; flex-direction: column; line-height: 1.3; backdrop-filter: blur(4px);
}
.hud-info strong { font-family: var(--serif); }
.hud-info span { font-size: .75rem; opacity: .85; }
.hud-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pill {
  border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .85rem;
  background: rgba(255, 250, 241, .92); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); white-space: nowrap;
}
.pill.live { background: var(--red); color: #fff; }

.log {
  position: absolute; left: 10px; top: 84px; width: min(70vw, 340px); margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 3px; pointer-events: none !important;
}
.log li {
  align-self: flex-start; background: rgba(40, 22, 10, .6); color: #fff; border-radius: 10px;
  padding: 3px 9px; font-size: .82rem; line-height: 1.4; transition: opacity 1s; max-width: 100%;
}
.log li b { color: #ffd27a; margin-right: 5px; }
.log li.sys { color: #c9f0e4; }
.log li.npc b { color: #b9e3ff; }
.log li.old { opacity: 0; }

.stick {
  position: absolute; left: 18px; bottom: calc(70px + env(safe-area-inset-bottom));
  width: 116px; height: 116px; border-radius: 50%;
  background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .5); touch-action: none;
}
.stick i {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px;
  border-radius: 50%; background: rgba(255, 250, 241, .9); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); pointer-events: none;
}
.acts {
  position: absolute; right: 14px; bottom: calc(70px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto auto; gap: 8px; justify-items: end; pointer-events: none;
}
.acts > * { pointer-events: auto; }
.act {
  min-width: 62px; height: 62px; border-radius: 31px; border: 2px solid rgba(255, 255, 255, .6); padding: 0 12px;
  background: rgba(90, 55, 29, .85); color: #ffe9c2; font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.act:active { transform: scale(.94); }
.act.ctx { grid-column: 1 / -1; background: var(--red); height: 46px; }

.chatbar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(40, 22, 10, .55);
}
.chatbar input { flex: 1; min-width: 0; user-select: text; -webkit-user-select: text; font-size: 16px; }

.video-dock {
  position: absolute; right: 10px; top: 110px; width: min(56vw, 360px); aspect-ratio: 16 / 9;
  background: #000; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.video-dock iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-dock button {
  position: absolute; right: 4px; top: 4px; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; font-size: 1rem;
}

/* 시트 */
.sheet {
  width: min(94vw, 640px); max-height: 86dvh; overflow-y: auto; padding: 18px;
  user-select: text; -webkit-user-select: text; touch-action: pan-y;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.sheet .lanterns { grid-template-columns: 1fr; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet .x { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 4px 8px; color: var(--muted); }
.sheet h4 { margin: 18px 0 8px; color: var(--wood-2); }
.sheet .countdown { margin-bottom: 8px; }

@media (min-width: 900px) and (pointer: fine) {
  .stick { display: none; }
  .chatbar { left: 50%; right: auto; transform: translateX(-50%); width: 520px; border-radius: 14px 14px 0 0; }
}

.act.jump { grid-column: 2; background: rgba(63, 110, 96, .9); height: 46px; min-width: 62px; }

.act.small { height: 46px; font-size: .82rem; }
.med {
  position: absolute; left: 50%; top: 11%; transform: translateX(-50%); width: min(80vw, 300px);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); pointer-events: none;
}
.med[hidden] { display: none; }
.med p { margin: 0; font-family: var(--serif); font-size: 1.15rem; }
.med .med-time { font-size: .9rem; opacity: .9; font-family: inherit; }
.med .pill { pointer-events: auto; margin-top: 4px; }
.med-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 190, .75), rgba(255, 210, 122, .25) 70%, transparent);
  border: 2px solid rgba(255, 246, 224, .8); animation: breathe 10s ease-in-out infinite;
}
@keyframes breathe { 0% { transform: scale(.55); } 40% { transform: scale(1); } 100% { transform: scale(.55); } }
.med-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }

.bead-ring {
  position: absolute; left: 14px; top: 42%; width: 128px; height: 128px; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 5px rgba(0, 0, 0, .8); background: rgba(40, 22, 10, .35); border-radius: 50%;
}
.bead-ring[hidden] { display: none; }
.bead-ring b { font-size: 1.5rem; line-height: 1; }
.bead-ring small { font-size: .7rem; opacity: .85; }
.bead-wheel { position: absolute; inset: 0; transition: transform .7s ease-in-out; }
.bead-wheel i {
  position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b9783e, #4e2a12); box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.bead-wheel i.head { width: 17px; height: 17px; margin: -8.5px 0 0 -8.5px; background: radial-gradient(circle at 35% 30%, #ffe08a, #b9791c); }
.bead-mark { position: absolute; left: 50%; top: -9px; margin-left: -6px; border: 6px solid transparent; border-top-color: #ffd27a; }

.pick { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; }
.pick > span { flex: 0 0 2.2em; font-size: .85rem; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .15); cursor: pointer; padding: 0; }
.swatch.on { outline: 3px solid var(--red); outline-offset: 2px; }
.opt { border: 1px solid rgba(90, 55, 29, .35); background: #fff; border-radius: 999px; padding: 5px 10px; font-size: .8rem; cursor: pointer; color: var(--ink); }
.opt.on { background: var(--red); color: #fff; border-color: var(--red); }

.photo { width: 100%; max-height: 60dvh; object-fit: contain; border-radius: 10px; background: #000; -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; }
.photo-acts { display: flex; gap: 8px; margin: 12px 0 6px; }
.photo-acts .btn { flex: 1; text-align: center; text-decoration: none; }

.pick > span { flex: 0 0 3.2em; }
.gate-card { max-height: 96dvh; overflow-y: auto; touch-action: pan-y; }

.cast { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.cast summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.cast input { margin: 8px 0; }
.cast .btn { width: 100%; }

.zoom { position: absolute; left: 14px; bottom: calc(204px + env(safe-area-inset-bottom)); display: flex; gap: 8px; }
.zoom button { width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); background: rgba(255, 250, 241, .92); color: var(--ink); font-size: 1.6rem; font-weight: 700; line-height: 1; cursor: pointer; }
.zoom button:active { transform: scale(.94); }
@media (min-width: 900px) and (pointer: fine) { .zoom { bottom: 24px; } }

.schedule li.group { display: block; border-top: 0; padding: 14px 0 4px; font-weight: 700; color: var(--wood-2); }

.act.b108 { grid-column: 1; background: rgba(120, 70, 30, .92); height: 46px; min-width: 62px; }
.act.b108.on { background: var(--red); }
