/* GARGANTUA — HUD styling */
:root {
  --cy: #7fd8ff;
  --am: #ffb35c;
  --fg: #cfe6f2;
  --dim: #6d8794;
  --bg-panel: rgba(6, 12, 18, 0.62);
  --bd: rgba(127, 216, 255, 0.18);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--fg);
  font-family: "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
  font-size: 12px;
  -webkit-user-select: none; user-select: none;
}

#app, #app canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
}

/* ---------- top bar ---------- */
#hud-top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px;
  pointer-events: none;
  z-index: 10;
}
#title h1 {
  font-size: 13px; letter-spacing: 0.08em;
  font-weight: 600; color: #fff;
  text-shadow: 0 0 18px rgba(127, 216, 255, 0.55);
  white-space: nowrap; line-height: 1.4;
}
#title p {
  margin-top: 4px;
  font-size: 10px; letter-spacing: 0.24em; color: var(--dim);
}
#status {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  font-size: 10px; letter-spacing: 0.16em;
}
#status span {
  background: var(--bg-panel);
  border: 1px solid var(--bd);
  padding: 3px 9px; border-radius: 2px;
  backdrop-filter: blur(6px);
}
#st-fps { color: var(--am); }
#st-view { color: var(--cy); }

/* ---------- left params ---------- */
#hud-left {
  position: fixed; left: 18px; bottom: 18px;
  width: 268px; max-height: 56vh;
  background: var(--bg-panel);
  border: 1px solid var(--bd);
  border-radius: 4px;
  backdrop-filter: blur(8px);
  z-index: 10;
  display: flex; flex-direction: column;
  transition: transform .28s ease, opacity .28s ease;
}
#hud-left.collapsed {
  transform: translateX(calc(-100% - 26px));
  opacity: 0; pointer-events: none;
}
.panel-title {
  padding: 8px 12px;
  font-size: 10px; letter-spacing: 0.3em; color: var(--cy);
  border-bottom: 1px solid var(--bd);
  display: flex; justify-content: space-between; align-items: center;
}
.panel-close {
  cursor: pointer; color: var(--dim);
  padding: 0 2px; letter-spacing: 0;
  transition: color .15s;
}
.panel-close:hover { color: #fff; }

/* ---------- collapsed-panel tabs ---------- */
.panel-tab {
  position: fixed; bottom: 18px;
  z-index: 9;
  font-family: inherit;
  font-size: 9px; letter-spacing: .22em;
  color: var(--cy);
  background: var(--bg-panel);
  border: 1px solid var(--bd);
  border-radius: 3px;
  padding: 7px 10px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .15s, color .15s, opacity .25s;
}
.panel-tab:hover { background: rgba(127,216,255,.18); color: #fff; }
#tab-left  { left: 18px; }
#tab-right { right: 18px; }
.panel-tab.hidden { opacity: 0; pointer-events: none; }
#params { overflow-y: auto; padding: 8px 12px 10px; }
#params::-webkit-scrollbar { width: 4px; }
#params::-webkit-scrollbar-thumb { background: rgba(127,216,255,.3); }

.prow {
  display: grid;
  grid-template-columns: 108px 1fr 44px;
  align-items: center; gap: 8px;
  margin: 5px 0;
}
.prow label { font-size: 9.5px; color: var(--dim); letter-spacing: .04em; }
.pval { font-size: 9.5px; color: var(--cy); text-align: right; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 2px; background: rgba(127,216,255,.25);
  border-radius: 1px; outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cy);
  box-shadow: 0 0 8px rgba(127,216,255,.8);
}
input[type=range]::-moz-range-thumb {
  width: 10px; height: 10px; border: none; border-radius: 50%;
  background: var(--cy);
}

/* ---------- right buttons ---------- */
#hud-right {
  position: fixed; right: 18px; bottom: 18px;
  width: 170px;
  background: var(--bg-panel);
  border: 1px solid var(--bd);
  border-radius: 4px;
  backdrop-filter: blur(8px);
  z-index: 10;
  transition: transform .28s ease, opacity .28s ease;
}
#hud-right.collapsed {
  transform: translateX(calc(100% + 26px));
  opacity: 0; pointer-events: none;
}
#buttons { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; }
button {
  font-family: inherit;
  font-size: 10px; letter-spacing: .14em;
  color: var(--fg);
  background: rgba(127,216,255,.06);
  border: 1px solid var(--bd);
  border-radius: 2px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
button:hover { background: rgba(127,216,255,.18); color: #fff; }

/* ---------- flash message ---------- */
#flash {
  position: fixed; left: 50%; top: 16%;
  transform: translateX(-50%);
  font-size: 13px; letter-spacing: .4em; color: #fff;
  text-shadow: 0 0 14px rgba(127,216,255,.9);
  opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 20;
}
#flash.show { opacity: 1; }

/* ---------- help ---------- */
#help {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.72);
  z-index: 30;
}
#help.show { display: flex; }
#help-card {
  width: min(680px, 92vw); max-height: 84vh; overflow-y: auto;
  background: rgba(8, 14, 20, .95);
  border: 1px solid var(--bd);
  border-radius: 6px;
  padding: 26px 30px;
}
#help-card h2 { font-size: 14px; letter-spacing: .35em; color: var(--cy); margin-bottom: 16px; }
#help-card table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
#help-card td { padding: 5px 8px; border-bottom: 1px solid rgba(127,216,255,.08); font-size: 11px; }
#help-card td:first-child { color: var(--am); white-space: nowrap; width: 120px; }
#help-card .dim { color: var(--dim); font-size: 10.5px; line-height: 1.7; margin-top: 8px; }
#help-card code { color: var(--cy); font-size: 10px; }

/* ---------- overlay (errors / recovery) ---------- */
#overlay-msg {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  text-align: center;
  font-size: 14px; letter-spacing: .2em; line-height: 2.2;
  color: var(--am);
  background: rgba(0,0,0,.85);
  z-index: 40;
}
#overlay-msg.show { display: flex; }

/* ---------- HUD hidden ---------- */
body.nohud #hud-top,
body.nohud #hud-left,
body.nohud #hud-right,
body.nohud .panel-tab { display: none; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  #title h1 { font-size: 10px; letter-spacing: 0.08em; white-space: nowrap; }
  #title p { font-size: 8px; }
  #hud-left { width: 220px; max-height: 38vh; left: 10px; bottom: 10px; }
  #hud-right { width: 140px; right: 10px; bottom: 10px; }
  #status { display: none; }
}
