:root {
  --bg: #1a1d23;
  --text: #f0f0f3;
  --muted: #a1a1aa;

  /* Neumorphism Oscuro xd*/
  --panel: #1f232b;
  --shadow-dark: #14161b;
  --shadow-light: #292e37;

  /* Buttons */
  --primary: #3f6df2;
  --primary-pressed: #3055c9;
  --danger: #e94e77;
  --danger-pressed: #c7385d;

  --radius-2xl: 22px;
  --radius-xl: 16px;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 16px;
}

.header {
  text-align: center;
  margin-bottom: 18px;
}
.header h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: .4px;
  text-shadow: 1px 1px 0 #000;
}
.subtitle {
  margin: 0;
  color: var(--muted);
}

/* Paneles (Neumorphism cards) */
.panel {
  background: var(--panel);
  border-radius: var(--radius-2xl);
  padding: 22px;
  margin-top: 18px;
  box-shadow:
    10px 10px 20px var(--shadow-dark),
    -10px -10px 20px var(--shadow-light);
}

/* Fields */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.field textarea,
.field input[type="number"] {
  width: 100%;
  border: none;
  outline: none;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  box-shadow:
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);
}
.field textarea::placeholder { color: #555b65; }
.help { color: var(--muted); }

/* Grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 880px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* Stepper */
.stepper {
  display: flex;
  gap: 10px;
  align-items: center;
}
.stepper input {
  max-width: 120px;
  text-align: center;
}

/* Toggles */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  color: #e0e0e0;
}
.toggle input {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 24px;
  position: relative;
  background: var(--panel);
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  outline: none;
  cursor: pointer;
}
.toggle input::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #aaa;
  box-shadow:
    2px 2px 4px var(--shadow-dark),
    -2px -2px 4px var(--shadow-light);
  transition: transform .18s ease;
}
.toggle input:checked::after { transform: translateX(18px); }

/* Segmented control */
.segmented {
  display: flex; gap: 10px;
  background: var(--panel);
  padding: 6px;
  border-radius: var(--radius-xl);
  box-shadow:
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);
}
.segmented-item {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: #cfd2da;
  box-shadow: none;
}
.segmented-item.active {
  background: linear-gradient(145deg, #2d323c, #232831);
  box-shadow:
    4px 4px 8px var(--shadow-dark),
    -4px -4px 8px var(--shadow-light);
}

/* Buttons */
.btn {
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #2d323c, #232831);
  box-shadow:
    6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
  cursor: pointer;
  font-weight: 700;
  color: #f0f0f3;
}
.btn:active {
  box-shadow:
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);
}
.btn.primary {
  background: linear-gradient(145deg, #4c6ef5, #3a57c9);
  color: white;
}
.btn.primary:active { background: linear-gradient(145deg, var(--primary-pressed), #2d4bb5); }

.btn.danger {
  background: linear-gradient(145deg, #e94e77, #c7385d);
  color: white;
}
.btn.danger:active { background: linear-gradient(145deg, var(--danger-pressed), #b52a4e); }

.btn.ghost {
  background: var(--panel);
  color: #ddd;
}

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

/* Output */
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.result {
  width: 100%;
  min-height: 120px;
  margin: 12px 0 0;
  padding: 18px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow:
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Example */
.example { margin-top: 12px; color: var(--muted); }
.example-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow:
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);
}

/* Footer */
.footer {
  text-align: center;
  margin: 18px 0 8px;
  color: var(--muted);
}
