/* ─────────────────────────────────────────────────────────────────────────────
   The smartphone menu (phone.js; body.phone-ui = the desktop "full" layout with 설정 → 메뉴 방식 on 스마트폰, the default).

   No side column: the world spans the whole width (state.js VP.w), the minimap and the quest text float over its top-right corner
   without a panel behind them, the dock keeps the bottom, and a pocket button at the bottom right pulls the phone out. Classic mode
   ("기존 패널") never matches a `body.phone-ui` rule here, so it looks exactly as before.

   Text over the bare world is cream with a 1 px ink outline (same colours under every HUD theme, since there is no panel face to
   read against); the phone's own chrome (status bar, app bar, home screen) is the same dark kit under every theme, its bezel and
   the app area take the theme's colours.
   ───────────────────────────────────────────────────────────────────────────── */
:root { --ph-ol: 1px 0 0 #0d0b12, -1px 0 0 #0d0b12, 0 1px 0 #0d0b12, 0 -1px 0 #0d0b12, 1px 1px 0 #0d0b12, -1px 1px 0 #0d0b12, 1px -1px 0 #0d0b12, -1px -1px 0 #0d0b12; }

/* ── the HUD without the side column ── */
body.phone-ui #menu { display: none; }
body.phone-ui #dock { right: 0; }
body.phone-ui #side {
  right: 14px; top: 14px; bottom: auto; width: calc(var(--side) - 28px); height: auto; max-height: calc(var(--vph) - 28px);
  border: 0; border-image: none; background: none; overflow: visible; pointer-events: none; gap: 4px;
}
body.phone-ui #side > * { pointer-events: auto; }
/* the minimap: its map with a thin dark outline, its name and numbers as outlined text */
body.phone-ui #mini { background: none; }
body.phone-ui #mini-name { border: 0; border-image: none; padding: 0 4px; color: #ffe9a8; text-shadow: var(--ph-ol); }
body.phone-ui #mini .sunk { border: 2px solid #0d0b12; border-image: none; box-shadow: 0 0 0 1px rgba(243, 232, 204, .38); background: #000; }
body.phone-ui :is(#mini-xy, #mini-pct, #mini-info) { color: #f3e8cc; text-shadow: var(--ph-ol); }
/* the quest tracker: no box, the same text, outlined; its colours are fixed light-on-dark here (the theme's are made for a panel face) */
body.phone-ui #quest-track {
  --cream: #f3e8cc; --tx: #fff6dc; --tx2: #e6dcc0; --tx3: #c4b9a4; --tx-hd: #ffe9a8; --tx-hd2: #e0c07c; --tx-ok: #9af0ae; --ink: #0d0b12; --sf3: rgba(243, 232, 204, .35);
  flex: none; min-height: 0; max-height: min(46vh, calc(var(--vph) - 250px)); border: 0; border-image: none; background: none;
  padding: 2px 2px 4px; color: var(--cream); text-shadow: var(--ph-ol); scrollbar-width: none;
}
body.phone-ui #quest-track::-webkit-scrollbar { display: none; }
body.phone-ui #quest-track:empty::before { content: none; }
body.phone-ui #quest-track .qt-pin { display: none; }
body.phone-ui #quest-track .qp .bar { border-color: #0d0b12; text-shadow: none; }
body.phone-ui #quest-track .btn { text-shadow: none; }
/* cards that stood at the viewport's old right edge move left of the minimap column / the pocket button */
body.phone-ui #dim-hud { left: calc(var(--vpw) - var(--side) - 292px); }
body.phone-ui #loot { left: calc(var(--vpw) - 76px); }
body.phone-ui #emotes { bottom: calc(100vh - var(--vph) + 84px); }
/* every window is on the phone: the 분리 / 붙이기 button has nothing to do */
body.phone-ui .window > header .pop { display: none; }

/* ── the pocket button (bottom right, above the dock) ── */
#phone-btn { display: none; right: 14px; bottom: calc(var(--dock) + 12px); width: 52px; height: 66px; overflow: visible; padding: 0; border: 0; background: none; cursor: pointer; z-index: 9; }
body.phone-ui #phone-btn { display: block; }
#phone-ic { display: block; width: 42px; height: 54px; margin: 0 auto; image-rendering: pixelated; filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .5)); transition: transform .08s steps(2); }
/* the name tag above the pocket button */
#phone-lb { position: absolute; left: 50%; top: -17px; transform: translateX(-50%); white-space: nowrap; padding: 1px 6px; font: 700 var(--t11)/1.3 var(--pix); letter-spacing: 0; color: var(--cream, #f3e8cc);
  background: var(--scr, #120f18); border: 2px solid var(--ink, #0d0b12); box-shadow: 2px 2px 0 rgba(0, 0, 0, .45); pointer-events: none; }
#phone-btn.on #phone-lb { color: #2a1806; background: var(--b-mid, #cf9f55); }
#phone-btn:hover #phone-ic { transform: translateY(-3px); }
#phone-btn:active #phone-ic { transform: translateY(1px); }
#phone-btn.on #phone-ic { filter: drop-shadow(0 0 0 #ffe9a8) drop-shadow(3px 3px 0 rgba(0, 0, 0, .5)) brightness(1.18); }
#phone-btn kbd { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); padding: 1px 5px; color: var(--b-hi); background: var(--scr, #120f18); border: 2px solid var(--ink, #0d0b12); }
#phone-dot { position: absolute; top: -2px; right: 2px; width: 13px; height: 13px; background: #ff5a4a; border: 2px solid #0d0b12; box-shadow: inset 2px 2px 0 #ffa090; animation: ph-dot 1s steps(2) infinite; }
@keyframes ph-dot { 50% { background: #ffb040; box-shadow: inset 2px 2px 0 #ffe090; } }

/* ── the phone ── */
#phone { z-index: 20; pointer-events: none; }
/* opaque inside: undo #hud's transparency variables (hud.css) so nothing behind the phone shows through its panels */
#phone { --fr-brass: var(--frt-brass); --fr-screen: var(--frt-screen); --scr-a: var(--scr); --sf1-a: var(--sf1, #1a1622); --sf3-a: var(--sf3, #2a2433); --sf4-a: var(--sf4, #3a3146); --frame-a: var(--frame-bg, #18141f); }
#phone .ph-screen { background-color: #1e2545; }
#phone .ph-body {
  pointer-events: auto; position: relative; box-sizing: border-box; width: var(--ph-bw, 352px); height: var(--ph-bh, 640px); zoom: var(--ph-z, 1);
  border: solid transparent; border-width: 36px 18px 56px 18px; border-image: var(--ph-bezel) 36 18 56 18 fill / 36px 18px 56px 18px / 0 round; image-rendering: pixelated;
  animation: ph-pop .16s ease-out; font: var(--t12)/1.4 var(--pix); letter-spacing: 0;
}
/* always opaque (owner 2026-11-19): the HUD transparency let world name labels show through the screen */
@keyframes ph-pop { from { transform: translateY(22px) scale(.95); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { #phone .ph-body { animation: none; } }
.ph-top { position: absolute; left: -18px; top: -36px; width: calc(100% + 36px); height: 36px; display: flex; justify-content: center; align-items: center; gap: 18px; padding-top: 2px; pointer-events: none; }
.ph-spk { width: 28px; height: 6px; background: var(--ph-spk) 0 0 / 28px 6px no-repeat; image-rendering: pixelated; }
.ph-cam { width: 12px; height: 12px; background: var(--ph-cam) 0 0 / 12px 12px no-repeat; image-rendering: pixelated; }
.ph-hbtn { position: absolute; left: 50%; bottom: -44px; width: 32px; height: 32px; margin: 0 0 0 -16px; padding: 0; border: 0; border-radius: 0; background: var(--ph-home) 0 0 / 32px 32px no-repeat; image-rendering: pixelated; cursor: pointer; }
.ph-hbtn:hover { filter: brightness(1.25); }
.ph-hbtn:active { transform: translateY(2px); }

.ph-screen { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--ph-wall) 0 0 / 16px 16px; image-rendering: pixelated; }
.ph-status { flex: none; display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; background: rgba(8, 6, 14, .6); border-bottom: 2px solid #0d0b12; font: var(--t10)/12px var(--pix9); color: #e8dcb8; white-space: nowrap; text-shadow: 1px 1px 0 #000; }
#ph-clock { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#ph-srv { flex: none; color: #b8aedc; }

/* the home screen: a grid of app icons (a 32 px tile, its name under it) and a dock row of the four most used */
.ph-home { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
#ph-grid { flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 4px 0; padding: 8px 4px 4px; scrollbar-width: thin; scrollbar-color: var(--b-mid, #cf9f55) transparent; }
#ph-dock { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 4px 4px 3px; background: rgba(8, 6, 14, .66); border-top: 2px solid #0d0b12; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08); }
.ph-ico { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; min-width: 0; padding: 2px 0 3px; background: none; border: 0; border-radius: 0; color: #fff1d0; font: inherit; cursor: pointer; }
.ph-ic { display: block; width: 32px; height: 32px; image-rendering: pixelated; transition: transform .06s steps(2); }
.ph-lb { display: block; max-width: 100%; font: var(--t11)/13px var(--pix); color: #fff1d0; text-align: center; white-space: pre-line; word-break: keep-all; text-shadow: var(--ph-ol); }
.ph-ico:hover .ph-ic { transform: translateY(-2px); }
.ph-ico:hover .ph-lb { color: #ffe9a8; }
.ph-ico:active .ph-ic { transform: translateY(1px); }
.ph-ico:focus-visible { outline: 2px solid var(--b-mid, #cf9f55); outline-offset: -1px; }

/* an app: a title bar (‹, the name, the game's own word when it differs) over the docked window */
.ph-appbox { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; background: var(--face, #211c2a); }
.ph-bar { flex: none; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 2px; background: #2a2438; border-bottom: 2px solid #0d0b12; box-shadow: inset 0 -2px 0 #3d3450; }
.ph-back { flex: none; width: 28px; height: 24px; padding: 0; border: 0; border-radius: 0; background: var(--ph-chev) center / 14px 18px no-repeat; image-rendering: pixelated; cursor: pointer; }
.ph-back:hover { filter: brightness(1.3); }
#ph-title { font: 700 var(--t12)/1 var(--pix); color: #ffe9a8; text-shadow: 1px 1px 0 #000; white-space: nowrap; }
#ph-alias { font: var(--t10)/1 var(--pix9); color: #b8aedc; white-space: nowrap; }
#ph-app { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding: 6px 6px 4px; }
#ph-app > #panel { flex: 1 1 0; min-height: 0; }
/* the app's own title bar is the phone's: keep a window's extra header controls (the bag's gold, count and sort), drop its name, key and buttons */
body.phone-ui #ph-app .window.docked > header > :is(.t, kbd, .pop, .x, .hlp) { display: none; }
body.phone-ui #ph-app .window.docked > header:not(:has(> :not(.t, kbd, .pop, .x, .hlp))) { display: none; }
/* windows inside #hud pick up `#hud .btn` (hud.css), which outranks the windows' own selected-button looks: say them again here */
#ph-app :is(.seg, .deco-style) .btn.on { color: #2a1806; background: var(--b-mid); box-shadow: inset 2px 2px 0 var(--b-hi), inset -2px -2px 0 var(--b-lo); }
/* the wardrobe tab: the preview and the worn slots side by side need ~320 px: a smaller preview and slots fit the phone's 304 */
#ph-app .wr-top { gap: 8px; }
#ph-app .wr-pv { width: 120px; height: 120px; }
#ph-app .wr-worn { gap: 2px; }
#ph-app .wr-worn .ws canvas { width: 28px; height: 28px; }
/* frames.js ornaments over the phone's top corners (outside the border box: the bezel is 36px on top, 18px at the sides) */
#phone .ph-body::before, #phone .ph-body::after { content: ""; position: absolute; pointer-events: none; z-index: 3; image-rendering: pixelated; background: no-repeat 0 0 / 100% 100%; }
#phone .ph-body::before { left: -32px; top: -54px; width: 48px; height: 42px; background-image: var(--orn-flower); }
#phone .ph-body::after { right: -28px; top: -50px; width: 36px; height: 27px; background-image: var(--orn-sprout); }
