/* Koltondoj World — HUD. The 3D world is the interface; everything here stays small and out of the way. */
:root { --ink: #eef1ff; --dim: #9aa3c6; --line: rgba(160,180,255,.18); --glass: rgba(9,12,26,.72); --cyan: #5ad7ff; --gold: #ffd27a;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070a18; color: var(--ink); font: 14px/1.4 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top-left: who you are + progress */
#id { position: fixed; z-index: 5; top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 10px; border-radius: 999px; }
#idDot { width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 14px currentColor, inset 0 0 0 3px rgba(0,0,0,.35); }
#idName { font-weight: 700; letter-spacing: .02em; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.counts { display: flex; gap: 10px; font: 600 12.5px var(--mono); color: var(--dim); }
.counts span b { color: var(--gold); font-weight: 600; }
/* top-right: buttons + the 2D/3D switch */
#menu { position: fixed; z-index: 5; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); display: flex; gap: 6px; padding: 4px; border-radius: 999px; }
#menu button, #menu a { border: 0; background: transparent; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
#menu button:hover, #menu a:hover { background: rgba(255,255,255,.08); }
.switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; margin-left: 4px; }
.switch a, .switch span { padding: 6px 11px !important; border-radius: 999px; font-size: 12px !important; font-weight: 700; letter-spacing: .06em; }
.switch span { background: var(--cyan); color: #05101e; }
/* minimap */
#minimap { position: fixed; z-index: 4; right: calc(14px + env(safe-area-inset-right)); top: calc(66px + env(safe-area-inset-top)); width: 160px; height: 160px; border-radius: 50%; pointer-events: none; }
/* interact prompt */
#prompt { position: fixed; z-index: 6; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100% - 32px));
  padding: 10px 18px 10px 10px; border-radius: 18px; border: 1px solid rgba(255,210,122,.45); background: rgba(12,14,30,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 40px rgba(0,0,0,.45); cursor: pointer; animation: pop .25s ease-out; text-align: left; }
#prompt[hidden] { display: none; }
#prompt .key { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font: 800 17px var(--mono); background: var(--gold); color: #1a1205; box-shadow: 0 3px 0 #b8902f; }
#prompt b { display: block; font-size: 15px; letter-spacing: .02em; }
#prompt small { display: block; color: var(--dim); font-size: 13px; margin-top: 2px; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
/* toasts + first hint */
#toasts { position: fixed; z-index: 7; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: min(520px, calc(100% - 200px)); }
.toast { padding: 9px 16px; border-radius: 12px; background: rgba(12,14,30,.88); border: 1px solid var(--line); font-weight: 600; text-align: center; animation: pop2 .3s ease-out; transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes pop2 { from { opacity: 0; transform: translateY(-8px); } }
#hint { position: fixed; z-index: 4; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; background: rgba(12,14,30,.75); color: var(--dim); font-size: 13px; white-space: nowrap; transition: opacity 1s; pointer-events: none; }
#hint.out { opacity: 0; }
/* NPC labels + bubbles */
#bubbles { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.nametag { position: absolute; left: 0; top: 0; font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); text-shadow: 0 1px 6px #000; white-space: nowrap; }
.bubble { position: absolute; left: 0; top: 0; max-width: 260px; padding: 10px 13px; border-radius: 14px; background: #f6f7ff; color: #12162a; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #f6f7ff; }
.bubble[hidden] { display: none; }
/* touch controls */
#joy, #bJump, #bAct { display: none; }
body.touch #joy { display: block; position: fixed; z-index: 6; left: calc(22px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.22); touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 4px 16px rgba(0,0,0,.4); }
body.touch #bJump, body.touch #bAct { display: grid; place-items: center; position: fixed; z-index: 6; border-radius: 50%; border: 0; touch-action: none; font-weight: 800; }
body.touch #bJump { right: calc(24px + env(safe-area-inset-right)); bottom: calc(30px + env(safe-area-inset-bottom)); width: 76px; height: 76px; background: rgba(90,215,255,.85); color: #05101e; font-size: 13px; }
body.touch #bAct { right: calc(112px + env(safe-area-inset-right)); bottom: calc(54px + env(safe-area-inset-bottom)); width: 60px; height: 60px; background: rgba(255,210,122,.92); color: #1a1205; font-size: 18px; }
body.touch #prompt { bottom: calc(170px + env(safe-area-inset-bottom)); }
body.touch #hint { bottom: calc(176px + env(safe-area-inset-bottom)); white-space: normal; text-align: center; width: min(420px, calc(100% - 32px)); border-radius: 14px; }
/* panels */
#panel { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(3,5,14,.45); }
#panel[hidden] { display: none; }
.pbox { width: min(560px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 100px rgba(0,0,0,.6); animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.phead { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.phead h2 { margin: 0; font-size: 19px; letter-spacing: .03em; }
#panelClose { border: 0; background: rgba(255,255,255,.08); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }
#panelBody { padding: 14px 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#panelBody h3 { margin: 10px 0 0; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 999px; padding: 8px 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.chip.on { border-color: var(--gold); background: rgba(255,210,122,.14); color: var(--gold); }
.chip.go { border-color: rgba(90,215,255,.5); color: var(--cyan); }
.chip:disabled { opacity: .5; cursor: default; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; background: linear-gradient(135deg, var(--a) 50%, var(--s) 50%); font-size: 14px; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.2); }
.sw:disabled { filter: grayscale(.7) brightness(.6); cursor: default; }
#nm { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.3); }
.lbl { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.mlist, .alist, .places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mlist li, .alist li { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); }
.mlist li.done, .alist li.done { color: #9fe8be; }
.alist small { color: var(--dim); margin-left: 6px; }
.places li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); }
.places b { display: block; letter-spacing: .03em; } .places small { color: var(--dim); }
.places .pa { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.links { margin: 8px 0 0; color: var(--dim); } .links a { color: var(--cyan); }
.small { font-size: 12.5px; color: var(--dim); margin: 6px 0 0; }
/* door transition */
#iris { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; text-align: center; padding: 24px; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c) 35%, #05060f), #05060f 70%);
  clip-path: circle(0% at 50% 50%); transition: clip-path .9s cubic-bezier(.7,0,.3,1); }
#iris.on { clip-path: circle(150% at 50% 50%); }
#iris[hidden] { display: none; }
#irisT { font-size: clamp(30px, 6vw, 64px); font-weight: 800; letter-spacing: .08em; color: var(--c); text-shadow: 0 0 40px var(--c); margin: 0; }
#irisS { margin: 12px auto 0; max-width: 34ch; color: #dfe4ff; font-size: clamp(15px, 2vw, 19px); }
/* loading + 2D fallback */
#loading { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, #12244a, #05060f 70%); transition: opacity .6s; }
#loading.out { opacity: 0; pointer-events: none; }
#loading p { margin: 0; font-weight: 800; letter-spacing: .3em; font-size: 14px; color: var(--cyan); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
body.no3d #id, body.no3d #minimap, body.no3d #hint, body.no3d #panelClose { display: none; }
body.no3d #panel { background: radial-gradient(circle at 50% 30%, #12244a, #05060f 75%); }
.seo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 700px) {
  #id { padding: 6px 10px 6px 7px; gap: 8px; } #idName { display: none; } .counts { gap: 7px; font-size: 11.5px; }
  #menu { gap: 0; } #menu .lab { display: none; } #menu button, #menu a { padding: 8px 9px; }
  #minimap { width: 96px; height: 96px; top: calc(62px + env(safe-area-inset-top)); }
  #toasts { width: calc(100% - 24px); top: calc(166px + env(safe-area-inset-top)); }
}
@media (max-height: 500px) { #menu .lab { display: none; } #menu button, #menu a { padding: 7px 9px; } #id { padding: 5px 10px 5px 6px; } #minimap { width: 92px; height: 92px; } body.touch #joy { width: 108px; height: 108px; } body.touch #prompt { bottom: calc(18px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { #iris { transition: none; } .toast, #prompt, .pbox { animation: none; } }
