:root {
  --bg-start: #09131f;
  --bg-end: #02060c;
  --panel-bg: rgba(6, 12, 24, 0.72);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-main: #eff4ff;
  --text-sub: #b9c4da;
  --accent: #ffd36a;
  --accent-strong: #ff965b;
  --shadow: rgba(0, 0, 0, 0.25);
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 177, 77, 0.12), transparent 34%),
    linear-gradient(160deg, var(--bg-start), var(--bg-end));
  color: var(--text-main);
}

body {
  overflow: hidden;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

.panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px var(--shadow);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  transition:
    transform 220ms ease,
    opacity 220ms ease;
}

.panel.is-hidden {
  transform: translateY(-10px);
  opacity: 0.08;
}

.panel__header h1,
.tips h2,
.lead,
.status,
.hint,
.eyebrow {
  margin: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel__header h1 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.1;
}

.lead {
  color: var(--text-sub);
  line-height: 1.45;
}

.controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.controls label {
  display: grid;
  gap: 5px;
  font-size: 0.92rem;
}

.controls select,
.controls input,
.buttons button,
.lab button,
.lab input,
.lab textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.controls select,
.controls input {
  min-height: 38px;
  padding: 0 12px;
}

.lab input {
  min-height: 38px;
  padding: 0 12px;
}

.controls input[type="range"] {
  padding: 0;
  accent-color: var(--accent-strong);
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.buttons button {
  min-height: 40px;
  cursor: pointer;
  font: inherit;
}

.buttons button:hover,
.lab button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.buttons button:disabled,
.lab button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.tips {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.lab {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.tips h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.lab h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.tips ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-sub);
  line-height: 1.65;
}

.lab__lead {
  margin: 0 0 10px;
  color: var(--text-sub);
  line-height: 1.5;
}

.lab label {
  display: grid;
  gap: 5px;
  font-size: 0.92rem;
}

.lab textarea {
  min-height: 188px;
  margin-top: 10px;
  padding: 12px;
  resize: vertical;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
}

.lab button {
  min-height: 40px;
  margin-top: 10px;
  cursor: pointer;
  font: inherit;
}

.lab__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.lab__actions .lab button,
.lab__actions button {
  margin-top: 0;
}

.tips code,
.hint kbd {
  padding: 0.14em 0.4em;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-family: "SFMono-Regular", "Menlo", monospace;
}

.hint {
  margin-top: 12px;
  color: var(--text-sub);
  font-size: 0.88rem;
}

.status {
  margin-top: 8px;
  color: var(--text-sub);
  font-size: 0.88rem;
}

.status span {
  color: var(--text-main);
}

.panel::-webkit-scrollbar {
  width: 10px;
}

.panel::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  background-clip: padding-box;
}

.panel::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 720px) {
  .panel {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 24px);
  }

  .buttons {
    grid-template-columns: 1fr;
  }

  .lab__actions {
    grid-template-columns: 1fr;
  }
}
