:root {
  --bg: rgba(14, 16, 26, 0.86);
  --fg: #e6e8ef;
  --muted: #8a90a2;
  --accent: #f0a63a;
  --line: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0c16; color: var(--fg);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

#gl, #view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#view { touch-action: none; }

#panel { position: fixed; top: 10px; left: 10px; bottom: 10px; width: 330px; display: flex; flex-direction: column;
  background: var(--bg); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; transition: transform 0.25s ease; z-index: 2; }
body.hide-panel #panel { transform: translateX(-350px); }
body.init #panel { transition: none; }

#panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  border-bottom: 1px solid var(--line); }
#panel h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.3px; cursor: pointer; user-select: none; }
#panel h1::after { content: " ▾"; color: var(--muted); font-size: 12px; }
#panel h1 b { color: var(--accent); font-weight: 600; }
body.panel-min #panel h1::after { content: " ▸"; }
body.panel-min #panel { bottom: auto; }
body.panel-min #controls, body.panel-min .foot, body.panel-min .help, body.panel-min .links { display: none; }
body.panel-min #panel header { border-bottom: 0; }
#lang { width: auto; margin-right: 6px; padding: 2px 4px; font-size: 12px; }
#panel-toggle { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; }
#panel-show { position: fixed; top: 12px; left: 12px; display: none; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; font-size: 18px; padding: 4px 10px; cursor: pointer; z-index: 2; }
body.hide-panel #panel-show { display: block; }

#controls { flex: 1; overflow-y: auto; padding: 4px 0; }
.block { padding: 8px 14px; border-bottom: 1px solid var(--line); }
details { border-bottom: 1px solid var(--line); padding: 4px 14px 8px; }
summary { cursor: pointer; padding: 6px 0; font-weight: 600; color: var(--accent); list-style: none; }
summary::before { content: "▸ "; color: var(--muted); }
details[open] summary::before { content: "▾ "; }
.star { padding: 6px 14px 8px; border-bottom: 1px solid var(--line); }
.star h2 { margin: 2px 0 4px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.star h2 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.row { display: grid; grid-template-columns: 80px 1fr 102px; align-items: center; gap: 8px; margin: 4px 0; }
.row.wide { grid-template-columns: 80px 1fr; }
.row .lbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.check { grid-template-columns: auto 1fr; cursor: pointer; }

input[type=range] { width: 100%; accent-color: var(--accent); }
select { width: 100%; background: #1b1e2a; color: var(--fg); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 6px; font: inherit; }

.btn-row { display: flex; gap: 6px; margin: 8px 0 2px; }
.btn-row button, .foot button { flex: 1; padding: 8px; border-radius: 6px; border: 0; font: inherit; cursor: pointer;
  background: #262a38; color: var(--fg); }
.btn-row button:hover, .foot button:hover { background: #31364a; }
.btn-row button.primary { background: var(--accent); color: #1a1205; font-weight: 600; }
.btn-row button.primary:hover { background: #f5b65a; }
.foot { padding: 8px 14px; border-top: 1px solid var(--line); display: flex; }

.help { margin: 0; padding: 8px 14px 10px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.help b { color: var(--fg); font-weight: 600; }
.links { display: flex; justify-content: space-between; padding: 6px 14px 10px; font-size: 12px; }
.links a { color: var(--accent); text-decoration: none; }

#stats { position: fixed; color: rgba(230, 232, 239, 0.8); font-size: 12px; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #000; pointer-events: none; z-index: 1; line-height: 1.6; }
#stats .t { font: 600 15px ui-monospace, Consolas, monospace; color: var(--fg); letter-spacing: 0.5px; }
#stats .ev { color: var(--accent); }
#stats .hint { color: var(--muted); }
#fatal { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); max-width: 560px; padding: 16px 20px;
  background: #3a1414; border: 1px solid #a33; border-radius: 8px; z-index: 3; }

@media (max-width: 700px) {
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 40vh; border-radius: 12px 12px 0 0; }
  html, body { font-size: 12px; }
  #panel header { padding: 6px 10px; }
  #panel h1 { font-size: 14px; }
  #panel h1::after { content: " ▾"; }
  body.panel-min #panel { height: auto; bottom: 0; }
  body.panel-min #panel h1::after { content: " ▴"; }
  body.hide-panel #panel { transform: translateY(calc(40vh + 20px)); }
  .block, .star { padding: 4px 10px; }
  details { padding: 2px 10px 4px; }
  .row { grid-template-columns: 72px 1fr 100px; gap: 6px; margin: 2px 0; }
  .row.wide { grid-template-columns: 72px 1fr; }
  .btn-row button, .foot button { padding: 6px; }
  .foot { padding: 4px 10px; }
  .help { display: none; }
  .links { padding: 4px 10px 6px; }
  #stats { font-size: 11px; }
  #stats .t { font-size: 13px; }
}
