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

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #050505;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  cursor: default;
}

/* --- image stage --------------------------------------------------------- */
#stage {
  position: fixed;
  inset: 0;
  background: #050505;
}

.layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 700ms ease;
  will-change: opacity;
}

.layer.visible {
  opacity: 1;
}

/* --- pre-typing hint ----------------------------------------------------- */
#hint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.28);
  font-size: 15px;
  letter-spacing: 0.5px;
  pointer-events: none;
  transition: opacity 400ms ease;
}

#hint.gone {
  opacity: 0;
}

/* --- invisible capture field --------------------------------------------- */
#thought {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: transparent;              /* text is never shown */
  caret-color: rgba(255, 255, 255, 0.35);
  font-size: 24px;
  padding: 24px;
  -webkit-text-fill-color: transparent;
}

/* --- status dot ---------------------------------------------------------- */
#status {
  position: fixed;
  top: 14px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background 200ms ease, box-shadow 200ms ease;
  pointer-events: none;
}

#status.busy {
  background: rgba(140, 200, 255, 0.9);
  box-shadow: 0 0 10px 2px rgba(140, 200, 255, 0.6);
}

/* --- bottom-right controls ------------------------------------------------ */
#controls {
  position: fixed;
  bottom: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

#controls button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

#controls button:hover {
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.85);
}

#debugBtn.active,
#settingsBtn.active {
  background: rgba(140, 200, 255, 0.25);
  color: rgba(220, 240, 255, 0.95);
}

#debugOverlay[hidden] {
  display: none;
}

#debugOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vw;
  pointer-events: none;
  z-index: 5;
}

#debugText {
  color: rgba(255, 255, 255, 0.4);
  font-size: clamp(18px, 4vw, 42px);
  font-weight: 300;
  line-height: 1.35;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
  max-width: 100%;
}

/* --- settings panel ------------------------------------------------------- */
#settingsPanel[hidden] {
  display: none;
}

#settingsPanel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 28px;
  overflow-y: auto;
  background: rgba(12, 14, 18, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  animation: slideIn 220ms ease;
}

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#settingsClose {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

#settingsClose:hover {
  color: rgba(255, 255, 255, 0.9);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: rgba(255, 255, 255, 0.75);
}

.field em {
  font-style: normal;
  color: rgba(255, 255, 255, 0.4);
}

.field small {
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
}

.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.field.checkbox input {
  width: auto;
  accent-color: rgb(140, 200, 255);
}

#settingsPanel select,
#settingsPanel input[type="text"],
#settingsPanel input[type="number"] {
  width: 100%;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  outline: none;
}

#settingsPanel select:focus,
#settingsPanel input[type="text"]:focus,
#settingsPanel input[type="number"]:focus {
  border-color: rgba(140, 200, 255, 0.6);
}

#settingsPanel input[type="range"] {
  width: 100%;
  accent-color: rgb(140, 200, 255);
}

#settingsPanel option {
  background: #14181e;
}

.reset {
  margin-top: 4px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
}

.reset:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}
