/* =========================================================
   SLIME — 史莱姆解压
   极简黑白色调
========================================================= */

:root {
  --bg: #000;
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.4);
  --ink-faint: rgba(255, 255, 255, 0.15);
  --hud-bg: rgba(0, 0, 0, 0.55);
  --hud-border: rgba(255, 255, 255, 0.12);
}

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

html,
body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 300;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
}

/* =========================================================
   主画面
========================================================= */

.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

#webgl,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#webgl {
  z-index: 1;
}

#overlay {
  z-index: 2;
  pointer-events: none;
}

/* =========================================================
   启动弹窗
========================================================= */

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFade 0.6s ease;
}

.intro-modal.hidden {
  display: none;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdropIn 0.8s ease;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 40px 36px 28px;
  color: var(--ink);
  animation: modalIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 20px;
  line-height: 1;
  font-weight: 200;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s;
  font-family: inherit;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.mark-blob {
  width: 36px;
  height: 36px;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 90%
  );
  border-radius: 50% 45% 55% 50% / 50% 55% 45% 50%;
  animation: blobMorph 5s ease-in-out infinite;
}

@keyframes blobMorph {
  0%, 100% { border-radius: 50% 45% 55% 50% / 50% 55% 45% 50%; }
  50% { border-radius: 45% 55% 50% 45% / 55% 50% 45% 55%; }
}

.modal-title {
  font-family: inherit;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 12px;
  text-align: center;
  margin: 0 0 8px;
  color: var(--ink);
}

.modal-sub {
  font-size: 11px;
  letter-spacing: 3px;
  text-align: center;
  color: var(--ink-dim);
  margin-bottom: 26px;
  text-transform: lowercase;
}

.modal-body {
  font-size: 13px;
  line-height: 1.85;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  margin-bottom: 28px;
}

.modal-body p {
  margin: 0 0 14px;
}

.modal-body p:last-child {
  margin-bottom: 0;
  color: var(--ink-dim);
  font-style: italic;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-hint {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.modal-begin {
  background: var(--ink);
  color: #000;
  font-family: inherit;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 4px;
  padding: 10px 22px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, transform 0.1s;
}

.modal-begin:hover {
  background: rgba(255, 255, 255, 0.85);
}

.modal-begin:active {
  transform: translateY(1px);
}

@media (max-width: 520px) {
  .modal-box {
    padding: 32px 24px 22px;
  }
  .modal-title { font-size: 18px; letter-spacing: 10px; }
  .modal-sub { font-size: 10px; }
  .modal-body { font-size: 12px; }
  .modal-foot { flex-direction: column; gap: 14px; align-items: stretch; }
  .modal-hint { text-align: center; }
  .modal-begin { width: 100%; }
}

/* =========================================================
   极小文字输入框 (顶部) — 透明低调
========================================================= */

.input-wrap {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 180px;
  pointer-events: auto;
  opacity: 0.42;
  transition: opacity 0.4s ease;
}

.input-wrap:hover,
.input-wrap:focus-within {
  opacity: 0.95;
}

#phraseInput {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 3px;
  text-align: center;
  padding: 4px 2px;
  caret-color: var(--ink);
  text-transform: lowercase;
  opacity: 0.85;
}

#phraseInput::placeholder {
  color: var(--ink);
  opacity: 0.45;
  text-transform: none;
  letter-spacing: 2px;
}

.input-line {
  width: 100%;
  height: 1px;
  background: var(--ink);
  opacity: 0.15;
  margin-top: 2px;
  transition: opacity 0.3s;
}

.input-wrap:focus-within .input-line {
  opacity: 0.5;
}

/* =========================================================
   极小状态指示
========================================================= */

.status {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 10;
}

.dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.3s;
}

.dot.loading {
  background: rgba(255, 255, 255, 0.5);
  animation: pulse 1.2s ease-in-out infinite;
}

.dot.ok {
  background: rgba(255, 255, 255, 1);
}

.dot.err {
  background: rgba(180, 60, 60, 0.9);
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* =========================================================
   提示
========================================================= */

.hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--ink-dim);
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 1.2s;
}

.hint.hidden {
  opacity: 0;
}

/* =========================================================
   参数面板 (按 P 唤出)
========================================================= */

.panel {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 50;
  width: 280px;
  max-width: calc(100vw - 40px);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--hud-border);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  backdrop-filter: blur(10px);
  animation: panelIn 0.25s ease;
}

@keyframes panelIn {
  from { opacity: 0; transform: translate(20px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hud-border);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

#panelClose {
  color: var(--ink-dim);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

#panelClose:hover { color: var(--ink); }

.panel-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 2px;
}

.row label {
  flex: 0 0 80px;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 1px;
  background: var(--hud-border);
  margin: 0 4px;
}

.row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 8px;
  background: var(--ink);
  cursor: pointer;
  border-radius: 50%;
  border: 0;
}

.row input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  background: var(--ink);
  cursor: pointer;
  border: 0;
  border-radius: 50%;
}

.row .val {
  flex: 0 0 30px;
  text-align: right;
  color: var(--ink);
  font-size: 10px;
}

.row.toggles {
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--hud-border);
  margin-top: 4px;
}

.chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
}

.chk input {
  width: 10px;
  height: 10px;
  accent-color: var(--ink);
  margin: 0;
}

@media (max-width: 600px) {
  .input-wrap { top: 16px; width: 160px; }
  #phraseInput { font-size: 11px; }
  .status { top: 20px; right: 18px; }
  .hint { font-size: 10px; bottom: 28px; }
  .panel { right: 10px; width: calc(100vw - 20px); }
  .row label { flex: 0 0 64px; font-size: 9px; }
}
