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

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-border: #334155;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #475569;
  --radius: 14px;
  --transition: 0.18s ease;

  --s1: #ef4444;
  --s2: #f97316;
  --s3: #eab308;
  --s4: #84cc16;
  --s5: #22c55e;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.app {
  width: 100%;
  max-width: 460px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.25rem;
  padding: 0 2px;
}

.logo {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex-shrink: 0;
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--card-border);
}

.tab {
  flex: 1;
  padding: 0.875rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
  position: relative;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Panel */
.panel {
  padding: 1.5rem;
}

.panel.hidden {
  display: none;
}

/* Slider */
.slider-group {
  margin-bottom: 1.375rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.slider-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.slider-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--card-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--accent);
  transition: background var(--transition), box-shadow var(--transition);
}

.slider::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 1px var(--accent-hover), 0 0 0 4px rgba(129,140,248,0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--accent);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Options */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  transition: background var(--transition);
}

.option-item:hover {
  background: rgba(255,255,255,0.04);
}

.option-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--card-border);
  border-radius: 5px;
  background: transparent;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}

.option-item input:checked ~ .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.option-item input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.option-text {
  font-size: 0.875rem;
  color: var(--text);
}

.option-text code {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.option-divider {
  margin-top: 0.625rem;
  padding-top: 1rem !important;
  border-top: 1px solid var(--card-border);
}

/* Passphrase hint */
.passphrase-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 1rem;
  line-height: 1.6;
}

/* Output */
.output-section {
  padding: 1.25rem 1.5rem 1.5rem;
  border-top: 1px solid var(--card-border);
}

.output-box {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 58px;
}

.output-text {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 1rem;
  word-break: break-all;
  color: var(--text);
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.output-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(129,140,248,0.1);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* Strength bar */
.strength-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.875rem;
}

.strength-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
}

.strength-label {
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 76px;
  text-align: right;
  color: var(--text-dim);
  transition: color 0.3s ease;
}

/* Strength level colors */
.str-1 { background-color: var(--s1); }
.str-2 { background-color: var(--s2); }
.str-3 { background-color: var(--s3); }
.str-4 { background-color: var(--s4); }
.str-5 { background-color: var(--s5); }

.lbl-1 { color: var(--s1) !important; }
.lbl-2 { color: var(--s2) !important; }
.lbl-3 { color: var(--s3) !important; }
.lbl-4 { color: var(--s4) !important; }
.lbl-5 { color: var(--s5) !important; }

/* Animations */
@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.spinning svg {
  animation: spin-once 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.copy-ok svg {
  color: var(--s5);
}
