:root {
  --bg-1: #020814;
  --bg-2: #081224;
  --bg-orb-1: rgba(110, 219, 255, 0.08);
  --bg-orb-2: rgba(139, 124, 255, 0.08);
  --bg-soft: rgba(8, 17, 32, 0.72);
  --border: rgba(154, 180, 255, 0.18);
  --text: #eff5ff;
  --muted: #a4b4d4;
  --accent: #6edbff;
  --accent-2: #8b7cff;
  --success: #97f0b2;
  --warning: #ffcb70;
  --danger: #ff8a8a;
  --shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}

body[data-theme="forest"] {
  --bg-1: #050d06;
  --bg-2: #10180d;
  --bg-orb-1: rgba(138, 224, 116, 0.08);
  --bg-orb-2: rgba(255, 184, 96, 0.05);
  --border: rgba(167, 218, 136, 0.16);
  --text: #eef8e8;
  --muted: #b7c7b0;
  --accent: #9dea7a;
  --accent-2: #f2bf70;
  --success: #b4f1af;
}

body[data-theme="prism"] {
  --bg-1: #070511;
  --bg-2: #120e24;
  --bg-orb-1: rgba(102, 233, 255, 0.09);
  --bg-orb-2: rgba(232, 116, 255, 0.08);
  --border: rgba(178, 145, 255, 0.18);
  --text: #f7f2ff;
  --muted: #c7bddc;
  --accent: #74e9ff;
  --accent-2: #d96bff;
  --success: #b3f2ff;
}

body[data-theme="ember"] {
  --bg-1: #140604;
  --bg-2: #2a0d06;
  --bg-orb-1: rgba(255, 106, 55, 0.1);
  --bg-orb-2: rgba(255, 188, 75, 0.08);
  --border: rgba(255, 141, 94, 0.18);
  --text: #fff2e8;
  --muted: #d7b8a7;
  --accent: #ff824f;
  --accent-2: #ffc85c;
  --success: #ffd385;
  --warning: #ffc85c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, var(--bg-orb-1), transparent 28%),
    radial-gradient(circle at bottom right, var(--bg-orb-2), transparent 32%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  overflow: hidden;
  transition:
    background 240ms ease,
    color 240ms ease;
}

body {
  position: relative;
}

#scene,
.background-grid {
  position: fixed;
  inset: 0;
}

#scene {
  z-index: 0;
}

.background-grid {
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0.9),
    transparent 82%
  );
  transition:
    opacity 220ms ease,
    filter 220ms ease;
}

body[data-theme="forest"] .background-grid {
  opacity: 0.18;
  filter: hue-rotate(-42deg) saturate(0.72);
}

body[data-theme="prism"] .background-grid {
  opacity: 0.55;
  filter: hue-rotate(26deg) saturate(1.25);
}

body[data-theme="ember"] .background-grid {
  opacity: 0.22;
  filter: hue-rotate(-92deg) saturate(1.65);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 1fr;
  gap: 1.25rem;
  padding: 1.5rem;
  width: 100%;
  min-height: 100vh;
}

.panel {
  align-self: end;
  background: linear-gradient(
    180deg,
    rgba(13, 23, 42, 0.8),
    rgba(8, 16, 31, 0.78)
  );
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition:
    border-color 220ms ease,
    background 220ms ease;
}

body[data-theme="forest"] .panel {
  background: linear-gradient(
    180deg,
    rgba(15, 25, 13, 0.84),
    rgba(9, 14, 9, 0.82)
  );
}

body[data-theme="prism"] .panel {
  background: linear-gradient(
    180deg,
    rgba(22, 17, 39, 0.82),
    rgba(10, 12, 26, 0.8)
  );
}

body[data-theme="ember"] .panel {
  background: linear-gradient(
    180deg,
    rgba(35, 14, 10, 0.84),
    rgba(18, 9, 8, 0.82)
  );
}

.intro-panel {
  padding: 1.75rem;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.control-panel,
.output-panel {
  padding: 1.35rem;
  min-width: 0;
}

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

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 1;
}

h2 {
  font-size: 1.2rem;
}

.subtitle,
.microcopy {
  color: var(--muted);
  line-height: 1.65;
}

.stats-row,
.signal-grid,
.report-grid,
.button-row,
.output-actions {
  display: grid;
  gap: 0.9rem;
}

.stats-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.5rem;
}

.stat-card,
.signal-pill,
.report-card {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 0;
}

.stat-label,
.report-label,
.signal-pill span,
.control-group label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.stat-value,
.signal-pill strong,
.report-card strong {
  font-size: 1rem;
  font-weight: 700;
  min-width: 0;
}

.stat-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value-mono {
  font-family: "SF Mono", "Roboto Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.control-group + .control-group,
.control-group + .entropy-block,
.entropy-block + .button-row,
.button-row + .microcopy {
  margin-top: 1rem;
}

select,
input,
button {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}

select,
input {
  padding: 0.9rem 1rem;
  outline: none;
}

select:focus,
input:focus {
  border-color: rgba(110, 219, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(110, 219, 255, 0.15);
}

button {
  padding: 0.95rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(
    135deg,
    rgba(110, 219, 255, 0.2),
    rgba(139, 124, 255, 0.22)
  );
  border-color: rgba(110, 219, 255, 0.45);
}

body[data-theme="forest"] .primary {
  background: linear-gradient(
    135deg,
    rgba(157, 234, 122, 0.16),
    rgba(242, 191, 112, 0.18)
  );
  border-color: rgba(157, 234, 122, 0.42);
}

body[data-theme="ember"] .primary {
  background: linear-gradient(
    135deg,
    rgba(255, 130, 79, 0.18),
    rgba(255, 200, 92, 0.18)
  );
  border-color: rgba(255, 130, 79, 0.42);
}

.secondary {
  background: rgba(255, 255, 255, 0.035);
}

.button-row,
.output-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entropy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.meter-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(110, 219, 255, 0.45);
  transition: width 160ms ease;
}

.signal-grid,
.report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.9rem;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.security-chip {
  border-radius: 999px;
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
  border: 1px solid rgba(151, 240, 178, 0.2);
  background: rgba(151, 240, 178, 0.08);
  color: var(--success);
  font-weight: 700;
  font-size: 0.84rem;
}

.secret-box {
  margin-top: 1rem;
  min-height: 120px;
  padding: 1.15rem;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at top left,
      rgba(110, 219, 255, 0.08),
      transparent 28%
    ),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: "SF Mono", "Roboto Mono", "Cascadia Code", Consolas, monospace;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  line-height: 1.6;
  word-break: break-word;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(18px);
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(8, 16, 31, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  z-index: 5;
}

body[data-theme="ember"] .toast {
  background: rgba(28, 10, 8, 0.94);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1120px) {
  html,
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel {
    align-self: stretch;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }
}
