/* Interface overlay styles. Values come only from the tokens in theme.css (docs/UI-SPEC.md). */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--sky0); color: var(--ink); font-family: var(--font-body); overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
#world { position: fixed; inset: 0; }
#world canvas { image-rendering: pixelated; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#ui > * { pointer-events: auto; }
#ui .passive, #ui .passive * { pointer-events: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.german { color: var(--german); font-style: italic; }
.eyebrow { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.muted { color: var(--muted); }
.on-world { text-shadow: var(--world-text-shadow); }
.diamond { display: inline-block; width: var(--diamond); height: var(--diamond); transform: rotate(45deg); border: 1px solid var(--faint); flex: none; }
.diamond.on { background: var(--gold); border-color: var(--gold); }
.keycap { font-family: var(--font-mono); font-size: 13px; border: 1px solid var(--line-chip); border-radius: 4px; padding: 0 5px; color: var(--ink); }

/* Loading and errors */
.loading { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }
.loading .title { font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: .1em; }

/* Compass */
.compass { display: flex; align-items: center; justify-content: center; gap: 0; height: 22px; font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--muted); }
.compass .ticks { flex: 1; height: 6px; margin: 0 8px; background: repeating-linear-gradient(90deg, var(--faint) 0 1px, transparent 1px 12px); opacity: .7; }
.compass .now { color: var(--gold); }

/* Bars: the fill is centered and shrinks toward the middle */
.bar { display: grid; gap: 3px; }
.bar .label { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.bar .track { position: relative; height: 4px; width: 110px; background: rgba(255, 255, 255, .12); border-radius: 2px; overflow: hidden; }
.bar .fill { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); border-radius: 2px; transition: width var(--t-bar) ease; }
.bar.nerve .fill { background: var(--nerve); }
.bar.stamina .fill { background: var(--stamina); }
.bar.battery .fill { background: var(--battery); }
.bar.hunger .fill { background: var(--hunger); }
.hud-value { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: .06em; }

/* Phone HUD */
.hud-phone { position: absolute; top: 12px; left: 12px; right: 12px; background: var(--glass); border-radius: var(--radius-hud); padding: 6px 12px 10px; }
.hud-phone .compass { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.hud-phone .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hud-phone .bars { display: grid; gap: 6px; }
.hud-phone .bar { grid-template-columns: 84px auto; align-items: center; }
.hud-phone .right { text-align: right; display: grid; gap: 2px; justify-items: end; }
.hud-desk { display: none; }

/* Desktop and landscape HUD */
@media (min-width: 720px) {
  .hud-phone { display: none; }
  .hud-desk { display: block; }
  .hud-desk .compass-wrap { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 420px; height: 32px; background: var(--glass); border-top: 1px solid rgba(227, 194, 122, .45); border-bottom: 1px solid rgba(227, 194, 122, .45); display: grid; align-items: center; padding: 0 14px; }
  .hud-desk .quest { position: absolute; top: 14px; left: 28px; width: 300px; background: var(--glass); border-radius: var(--radius-hud); padding: 10px 14px; display: grid; gap: 4px; }
  .hud-desk .quest .title { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: .06em; }
  .hud-desk .quest .step { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 15px; }
  .hud-desk .status { position: absolute; top: 14px; right: 28px; background: var(--glass); border-radius: var(--radius-hud); padding: 10px 14px; display: grid; gap: 6px; justify-items: end; }
  .hud-desk .status .bar .track { width: 90px; }
  .hud-desk .bottom { position: absolute; left: 28px; right: 28px; bottom: 22px; display: flex; justify-content: space-between; align-items: end; }
  .hud-desk .bottom .bar { justify-items: center; }
  .hud-desk .bottom .bar .label { text-shadow: var(--world-text-shadow); color: var(--ink); }
  .hud-desk .bottom .bar .track { height: 6px; width: 240px; border: 1px solid rgba(227, 194, 122, .4); background: rgba(3, 5, 10, .6); overflow: visible; }
  .hud-desk .bottom .bar.nerve .track { width: 300px; }
  .hud-desk .bottom .bar .track::before, .hud-desk .bottom .bar .track::after { content: ""; position: absolute; top: 50%; width: var(--diamond); height: var(--diamond); background: var(--gold-dim); transform: translateY(-50%) rotate(45deg); }
  .hud-desk .bottom .bar .track::before { left: -12px; }
  .hud-desk .bottom .bar .track::after { right: -12px; }
}

.menu-btn { border: 1px solid var(--line-chip); border-radius: var(--radius-pill); padding: 2px 12px; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); min-height: 28px; }

/* Location banner and notices */
.banner { position: absolute; top: 132px; left: 0; right: 0; text-align: center; opacity: 0; animation: banner calc(var(--t-fade-in) + var(--t-hold) + var(--t-fade-out)) linear forwards; }
.banner .place { display: inline-flex; align-items: center; gap: 14px; font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: .1em; margin-top: 4px; }
.banner .place::before, .banner .place::after { content: ""; width: 34px; height: 1px; background: var(--gold); }
.notice { position: absolute; top: 96px; left: 0; right: 0; text-align: center; opacity: 0; animation: banner calc(var(--t-fade-in) + var(--t-hold) + var(--t-fade-out)) linear forwards; }
.notice .word { font-size: 30px; margin-top: 2px; }
.notice .gloss { font-size: 16px; color: var(--ink); }
@media (min-width: 720px) { .banner { top: 120px; } .notice { top: 64px; } }
@keyframes banner { 0% { opacity: 0; } 8% { opacity: 1; } 84% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .banner, .notice { animation: none; opacity: 1; } }

/* Interaction prompt over a world object */
.prompt { position: absolute; transform: translate(-50%, -100%); display: inline-flex; align-items: center; gap: 8px; background: var(--glass); border: 1px solid var(--gold-dim); border-radius: var(--radius-pill); padding: 5px 12px; font-size: 15px; white-space: nowrap; min-height: 32px; }
.prompt .keycap { display: none; }
@media (hover: hover) and (pointer: fine) { .prompt .keycap { display: inline; } .prompt .diamond { display: none; } }

/* Dialog sheet */
.sheet { z-index: 10; position: absolute; left: 0; right: 0; bottom: 0; height: 372px; background: var(--panel); border-top: 1px solid var(--gold-dim); border-radius: var(--radius-panel) var(--radius-panel) 0 0; box-shadow: var(--sheet-shadow); padding: 18px 16px calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; transform: translateY(100%); transition: transform var(--t-sheet) var(--ease-sheet); }
.sheet.open { transform: translateY(0); }
@media (min-width: 720px) { .sheet { left: 50%; right: auto; width: min(720px, 100% - 56px); transform: translate(-50%, 100%); padding: 20px 28px 22px; } .sheet.open { transform: translate(-50%, 0); } }
.sheet .line { font-size: 22px; }
.sheet .gloss { font-size: 15px; color: var(--muted); }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: var(--touch-min); padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-row); text-align: left; font-size: 18px; }
.choice.sel { border-color: var(--gold-dim); background: rgba(227, 194, 122, .08); }
.choice.sel .diamond { background: var(--gold); border-color: var(--gold); }
.choice .note { margin-left: auto; font-size: 14px; color: var(--muted); }
.choice:focus-visible { outline: 1px solid var(--gold); }

/* Menu and credits panel */
.panel { z-index: 20; position: absolute; inset: 0; background: var(--panel); padding: 20px; overflow-y: auto; display: grid; align-content: start; gap: 14px; }
@media (min-width: 720px) { .panel { inset: 40px auto 40px 50%; transform: translateX(-50%); width: min(560px, 100% - 56px); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 28px; } }
.panel .head { display: flex; justify-content: space-between; align-items: center; }
.panel .title { font-family: var(--font-display); font-weight: 600; font-size: 26px; letter-spacing: .08em; }
.card { background: var(--panel-card); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 12px 14px; display: grid; gap: 6px; font-size: 15px; }
.card .k { color: var(--muted); }
.credit { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.credit:first-of-type { border-top: 0; }
.credit .name { font-size: 16px; }
.credit .meta { font-size: 14px; color: var(--muted); }
.credit a { color: var(--muted); }
.skeleton-note { font-size: 13px; color: var(--muted); }

/* Touch controls: phones only, outside dialog */
.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: block; position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); height: 150px; pointer-events: none; }
  .touch .pad { position: absolute; left: 18px; bottom: 0; width: 150px; height: 150px; pointer-events: auto; }
  .touch .pad button { position: absolute; width: 50px; height: 50px; border-radius: var(--radius-row); background: var(--glass); border: 1px solid var(--line-chip); opacity: .7; }
  .touch .pad .up { left: 50px; top: 0; } .touch .pad .down { left: 50px; bottom: 0; } .touch .pad .left { left: 0; top: 50px; } .touch .pad .right { right: 0; top: 50px; }
  .touch .pad button.held { border-color: var(--gold-dim); opacity: 1; }
  .touch .ab { position: absolute; right: 18px; bottom: 10px; display: flex; gap: 14px; align-items: end; pointer-events: auto; }
  .touch .ab button { width: 64px; height: 64px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line-chip); font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
  .touch .ab .a { margin-bottom: 30px; border-color: var(--gold-dim); }
  .touch.hidden { display: none; }
}
