* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "hero"
    "stage"
    "hint";
  background: linear-gradient(180deg, #000a10 0%, #001b26 100%);
  color: #e6f7ff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
.hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #003746; }
.hero .brand { display: flex; align-items: center; gap: 10px; }
.hero h1 { margin: 0; font-size: 20px; letter-spacing: 0.5px; }
.hero .tag { padding: 2px 8px; border-radius: 10px; background: #003746; color: #66f3ff; font-size: 12px; }
.links a { color: #9fdbe2; text-decoration: none; border: 1px solid #004a5e; padding: 6px 10px; border-radius: 6px; background: #001c24; }
.links a:hover { background: #003241; color: #66f3ff; }
.install-btn { margin-right: 8px; padding: 6px 10px; border: 1px solid #2b4fa8; border-radius: 6px; background: #0b3d91; color: #e6f7ff; cursor: pointer; }
.install-btn:hover { background: #0d47a1; }
.settings-btn { margin-right: 8px; padding: 6px 10px; border: 1px solid #005e75; border-radius: 6px; background: #003746; color: #66f3ff; cursor: pointer; }
.settings-btn:hover { background: #004353; }
.controls::backdrop { background: rgba(0,0,0,0.55); }
.controls { padding: 16px; border: 1px solid #003746; border-radius: 10px; background: rgba(0, 30, 40, 0.95); max-width: 720px; width: calc(100% - 24px); color: #e6f7ff; }
.controls h2 { margin: 0; font-size: 18px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.close { border: none; background: transparent; color: #9fdbe2; font-size: 20px; cursor: pointer; }
.control-form { display: grid; gap: 14px; max-height: min(70vh, 720px); overflow: auto; padding: 2px; }
.group { border: 1px solid #003746; border-radius: 10px; padding: 12px; background: rgba(0, 30, 40, 0.35); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset; }
.group > h3, .group > summary { margin: 0 0 8px 0; font-size: 13px; color: #9fdbe2; letter-spacing: 0.3px; }
.group summary { cursor: pointer; list-style: none; display: block; padding: 10px 12px 12px 12px; margin: -12px -12px 0 -12px; border-radius: 8px; }
.group:not([open]) > summary { margin-bottom: -12px; padding-bottom: 24px; }
.group summary:hover { background: rgba(0, 52, 65, 0.5); }
.group summary:focus-visible { outline: 2px solid #66f3ff; outline-offset: 2px; }
.group[open] > summary { color: #66f3ff; background: rgba(0, 52, 65, 0.35); }
.group summary::-webkit-details-marker { display: none; }
.field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin: 6px 0; font-size: 14px; }
.field input[type="text"], .field select { width: 150px; padding: 6px 8px; border: 1px solid #004a5e; border-radius: 6px; background: #001c24; color: #e6f7ff; }
.field input[type="range"] { width: 160px; }
.field input[type="checkbox"] { width: 18px; height: 18px; accent-color: #20b8d4; }
.field:has(input:disabled), .field:has(select:disabled) { opacity: 0.6; }
.weights-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.weights-grid .subheader { grid-column: 1 / -1; margin: 4px 0 0; font-size: 12px; color: #9fdbe2; }
.actions { display: flex; gap: 8px; }
.controls button { padding: 6px 10px; border: 1px solid #005e75; border-radius: 6px; background: #003746; color: #66f3ff; cursor: pointer; }
.controls button:hover { background: #004353; }
.md-content { max-height: min(70vh, 720px); overflow: auto; padding: 4px; line-height: 1.5; }
.md-content h1, .md-content h2, .md-content h3 { margin: 12px 0 8px; }
.md-content p { margin: 8px 0; }
.md-content code { background: #01222b; padding: 1px 4px; border-radius: 4px; }
.md-content pre { background: #01222b; padding: 8px; border-radius: 6px; overflow: auto; }
.stage { grid-area: stage; display: grid; grid-template-rows: 1fr; grid-template-columns: 1fr; padding: 12px; min-height: 0; min-width: 0; }
#aquarium { width: 100%; height: 100%; max-width: 1400px; background: #000; box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 0 1px #003746 inset; border-radius: 8px; font-variant-ligatures: none; font-kerning: none; text-rendering: optimizeLegibility; image-rendering: pixelated; }
.hint { grid-area: hint; padding: 10px 16px; font-size: 12px; color: #9fdbe2; border-top: 1px solid #003746; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint .repo { margin-left: auto; color: #9fdbe2; text-decoration: none; }
.hint .repo:hover { color: #66f3ff; }

@media (max-width: 600px) {
  #aquarium {
    font-size: 10px !important;
  }
  .controls { width: calc(100% - 16px); }
  .field input[type="range"] { width: 100%; }
}

@media (min-width: 1100px) {
  .weights-grid { grid-template-columns: 1fr 1fr; column-gap: 28px; }
}
