/* 포트라인 게임 엔진 — 공통 UI (ui-shell) */
:root {
  --pl-navy: #0b1220;
  --pl-navy-2: #0d2033;
  --pl-cream: #f7f1e6;
  --pl-gold: #e0b061;
  --pl-rust: #bf451f;
  --pl-bar: 67px;
  --pl-apppad: 0px;
  --pl-safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html.pl-protected,
html.pl-protected body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html.pl-protected canvas,
html.pl-protected img {
  -webkit-user-drag: none;
  pointer-events: auto;
}

/* ------------------------------------------------------------- 3종 버전 바 */
.pl-verbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--pl-bar) + var(--pl-safe));
  padding-bottom: var(--pl-safe);
  background: rgba(9, 15, 26, 0.94);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-top: 1px solid rgba(224, 176, 97, 0.28);
  z-index: 9000;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.pl-verbar__inner {
  display: flex;
  width: 100%;
  max-width: 560px;
  gap: 6px;
  padding: 8px 12px;
}
.pl-verbar__btn {
  flex: 1;
  min-height: 44px;
  border: 1px solid rgba(247, 241, 230, 0.14);
  border-radius: 10px;
  background: rgba(247, 241, 230, 0.04);
  color: rgba(247, 241, 230, 0.72);
  font: 600 13px/1 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.pl-verbar__btn:hover { background: rgba(247, 241, 230, 0.09); color: var(--pl-cream); }
.pl-verbar__btn:active { transform: scale(0.97); }
.pl-verbar__btn.is-on {
  background: linear-gradient(180deg, rgba(224, 176, 97, 0.22), rgba(224, 176, 97, 0.10));
  border-color: rgba(224, 176, 97, 0.75);
  color: #ffe9b0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.pl-verbar__btn:focus-visible { outline: 2px solid var(--pl-gold); outline-offset: 2px; }

/* 앱 버전 — 하단 여백 140px */
html[data-ver="app"] .pl-apppad {
  padding-bottom: calc(var(--pl-apppad) + 24px);
}
html[data-ver="app"] .pl-verbar {
  border-top-color: rgba(224, 176, 97, 0.45);
}
html[data-ver="app"] .pl-verbar__btn { min-height: 48px; }

/* PC 버전을 좁은 화면에서 볼 때 — 가로 팬 */
html.pl-pan body {
  overflow-x: auto;
}
html.pl-pan .pl-page {
  min-width: 1024px;
}

/* ------------------------------------------------------------------ 토스트 */
.pl-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--pl-bar) + var(--pl-safe) + 16px);
  transform: translate(-50%, 12px);
  background: rgba(9, 15, 26, 0.95);
  border: 1px solid rgba(224, 176, 97, 0.45);
  color: var(--pl-cream);
  font: 600 13px/1.35 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  padding: 11px 18px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 9100;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.pl-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------- 인트로 커튼 */
.pl-curtain {
  position: fixed;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, #12253c 0%, #0b1220 55%, #070c16 100%);
  display: grid;
  place-items: center;
  z-index: 9500;
  opacity: 0;
  transition: opacity 0.5s ease;
  cursor: pointer;
}
.pl-curtain.is-in { opacity: 1; }
.pl-curtain.is-open {
  opacity: 0;
  transform: translateY(-3%);
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.7, 0, 0.2, 1);
  pointer-events: none;
}
.pl-curtain__inner { text-align: center; transform: translateY(8px); }
.pl-curtain.is-in .pl-curtain__inner { animation: pl-rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
@keyframes pl-rise { to { transform: translateY(0); } }
.pl-curtain__mark { filter: drop-shadow(0 8px 30px rgba(224, 176, 97, 0.25)); }
.pl-curtain__title {
  margin-top: 22px;
  color: var(--pl-cream);
  font: 700 clamp(22px, 6vw, 30px)/1.2 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: -0.02em;
}
.pl-curtain__line {
  width: 44px;
  height: 1px;
  margin: 18px auto 14px;
  background: linear-gradient(90deg, transparent, var(--pl-gold), transparent);
  animation: pl-line 1.2s 0.2s ease both;
}
@keyframes pl-line { from { width: 0; opacity: 0; } to { width: 44px; opacity: 1; } }
.pl-curtain__sub {
  color: rgba(247, 241, 230, 0.55);
  font: 500 13px/1.5 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: 0.02em;
}
.pl-curtain__hint {
  position: absolute;
  bottom: 34px;
  color: rgba(247, 241, 230, 0.35);
  font: 500 11px/1 "Pretendard", sans-serif;
  letter-spacing: 0.14em;
}

/* --------------------------------------------------------------------- HUD */
.pl-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  pointer-events: none;
  z-index: 20;
}
.pl-hud__cell {
  flex: 1;
  min-width: 0;
  padding: 8px 11px 9px;
  border-radius: 10px;
  background: rgba(7, 12, 22, 0.62);
  border: 1px solid rgba(247, 241, 230, 0.13);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pl-hud__k {
  color: rgba(247, 241, 230, 0.48);
  font: 600 9.5px/1 "Pretendard", "Apple SD Gothic Neo", sans-serif;
  letter-spacing: 0.10em;
}
.pl-hud__v {
  color: #fff6dd;
  font: 800 18px/1.1 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-hud__cell.is-bump { animation: pl-bump 0.34s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pl-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.09); border-color: rgba(224, 176, 97, 0.8); }
  100% { transform: scale(1); }
}
.pl-hud--compact .pl-hud__v { font-size: 15px; }
.pl-hud--compact .pl-hud__cell { padding: 6px 9px 7px; }
