/* ==========================================================================
 * Phong Than Online — Core Viewport & Reset (shell.css)
 * Pure World Canvas + Unified #pt-app-viewport (Portrait, Landscape & PC)
 * ========================================================================== */
:root {
  --pt-vh: 100dvh;
  --logical-w: 1024;
  --logical-h: 768;
  --gold-bright: #ffdf9a;
  --gold: #e2b857;
  --gold-mid: #ba8f43;
  --gold-dim: #6e5220;
  --text-main: #f4ebd4;
  --text-muted: #b6b19e;
  --danger: #ff7b68;
  --ok: #6ee27a;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: var(--pt-vh, 100dvh);
  overflow: hidden;
  background: #050809;
  color: var(--text-main);
  font-family: DemoBody, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-kerning: normal;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

button, select, input, textarea {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
 * Unified Application Viewport (#pt-app-viewport)
 * Rotates Stage + Overhead Canvas + HTML HUD + Modals TOGETHER when user
 * forces Landscape mode on a vertically-held mobile viewport (vh > vw)!
 * -------------------------------------------------------------------------- */
#pt-app-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--pt-vh, 100dvh);
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

body[data-force-landscape-rotate="true"] #pt-app-viewport {
  inset: auto;
  left: 50%;
  top: 50%;
  width: var(--pt-vh, 100dvh);
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  z-index: 1;
}

#screen {
  display: block;
  background: #000;
  width: min(100%, calc(100% * var(--logical-w) / var(--logical-h)));
  height: min(100%, calc(100% * var(--logical-h) / var(--logical-w)));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--logical-w) / var(--logical-h);
  box-shadow: 0 0 56px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(226, 184, 87, 0.18);
  touch-action: none;
  image-rendering: auto;
}

body[data-fit-mode="fit"] #screen,
body[data-orientation="portrait"] #screen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  box-shadow: none;
}

/* Retina Unicode Overhead Nameplates Canvas */
#pt-overhead-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 12;
}

/* Hidden / Active IME Bridge Anti-Zoom Rule */
textarea.pt-ime-bridge {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  width: 32px !important;
  height: 24px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  outline: none !important;
  opacity: 0.001 !important;
  background: transparent !important;
  color: transparent !important;
  caret-color: transparent !important;
  font-size: 16px !important;
  line-height: 16px !important;
  transform: scale(0.625) !important;
  transform-origin: top left !important;
  pointer-events: none !important;
  resize: none !important;
  overflow: hidden !important;
  z-index: -1 !important;
}
