:root { --ink: #f1ecff; --dim: rgba(241, 236, 255, 0.62); --panel: rgba(14, 18, 48, 0.82); --line: rgba(241, 236, 255, 0.14); --gold: #ffe9b0; --teal: #7fe8d8; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0e1230; color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.55em 1.1em; cursor: pointer; backdrop-filter: blur(8px); }
button.primary { background: rgba(255, 233, 176, 0.14); border-color: rgba(255, 233, 176, 0.45); color: var(--gold); }
button:active { transform: translateY(1px); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: 0.02em; margin: 0; }
[hidden] { display: none !important; }

#loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; background: #0e1230; z-index: 20; }
#loading .star { font-size: 28px; color: var(--gold); animation: pulse 1.8s ease-in-out infinite; }
#loading p { color: var(--dim); margin: 0; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

#title { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 28px; z-index: 10; padding: 24px; }
#title h1 { font-size: clamp(44px, 9vw, 86px); line-height: 0.95; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5); }
#title h1 em { font-style: italic; color: var(--gold); }
#title .buttons { display: flex; gap: 12px; justify-content: center; }
#title button { font-size: 17px; padding: 0.7em 1.8em; }

#hud { position: fixed; top: calc(10px + var(--sat)); left: calc(12px + var(--sal)); right: calc(12px + var(--sar)); display: flex; align-items: center; gap: 10px; z-index: 5; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud .brand { font-size: 12px; letter-spacing: 0.18em; color: var(--dim); }
#hud .brand small { margin-left: 10px; letter-spacing: 0.12em; color: var(--gold); }
#hud .counts { margin-left: auto; display: flex; gap: 14px; font-size: 14px; color: var(--dim); background: var(--panel); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
#hud .counts b { color: var(--ink); font-weight: 600; }
#hud button { width: 38px; height: 38px; padding: 0; display: grid; place-content: center; font-size: 16px; }

#prompt { position: fixed; left: 50%; bottom: calc(28px + var(--sab)); transform: translateX(-50%); z-index: 5; }
#prompt button { display: flex; align-items: center; gap: 12px; font-size: 16px; padding: 0.7em 1.4em; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35); }
#prompt kbd { font: 12px/1 system-ui; border: 1px solid rgba(255, 233, 176, 0.45); border-radius: 5px; padding: 3px 6px; opacity: 0.8; }
body.touch #prompt kbd { display: none; }

#toast { position: fixed; left: 50%; top: calc(64px + var(--sat)); transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 14px; opacity: 0; transition: opacity 0.4s; pointer-events: none; z-index: 6; white-space: nowrap; }
#toast.show { opacity: 1; }

#stick { position: fixed; left: calc(22px + var(--sal)); bottom: calc(22px + var(--sab)); width: 120px; height: 120px; border-radius: 50%; border: 1px solid var(--line); background: rgba(14, 18, 48, 0.35); touch-action: none; z-index: 5; }
#stick div { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(241, 236, 255, 0.35); }
#turn { position: fixed; right: calc(22px + var(--sar)); bottom: calc(44px + var(--sab)); width: 52px; height: 52px; padding: 0; font-size: 20px; z-index: 5; }

#telescope { position: fixed; inset: 0; background: #05060f; z-index: 8; }
#telescope canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#telescope .skybar { position: absolute; left: 0; right: 0; top: calc(12px + var(--sat)); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
#telescope .skybar span { font-family: Georgia, serif; font-style: italic; font-size: 18px; color: var(--gold); text-shadow: 0 0 20px rgba(0, 0, 0, 0.8); }
#telescope .skybar button { width: 40px; height: 40px; padding: 0; }

dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; width: min(92vw, 380px); backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
dialog::backdrop { background: rgba(5, 6, 15, 0.45); }
dialog h2 { font-size: 24px; margin-bottom: 14px; }
dialog .close { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; padding: 0; }
dialog .muted { color: var(--dim); margin: 0 0 12px; }
dialog button { display: block; width: 100%; margin-top: 10px; }
dialog .controls { color: var(--dim); font-size: 13px; margin: 16px 0 0; }
#craftList .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
#craftList .row span small { display: block; color: var(--dim); }
#craftList .row button { width: auto; margin: 0; padding: 0.4em 0.9em; }
#craftList .row.done { color: var(--dim); }
#journalBody p { margin: 6px 0; color: var(--dim); }
#journalBody b { color: var(--ink); font-weight: 600; }
#journalBody ul { margin: 8px 0 0; padding-left: 18px; }
#journalBody li { margin: 4px 0; }
#journalBody em { color: var(--gold); font-style: italic; font-family: Georgia, serif; }
