/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  color: #e5e7eb;
  /* Subtle noise texture */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ─── Page Layout ──────────────────────────────────────────────────────────── */
.page-wrap {
  width: 100%;
  max-width: 480px;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.header-icon {
  width: 32px;
  height: 32px;
  border: 1px solid #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #4b5563;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.header-title {
  font-size: 14px;
  letter-spacing: 0.1em;
  color: #e5e7eb;
  font-weight: 600;
}

/* ─── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: #111111;
  border: 1px solid #1f2937;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #1f2937;
}

.tab {
  padding: 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #4b5563;
  font-size: 11px;
  letter-spacing: 0.15em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  font-family: inherit;
}

.tab:hover {
  color: #6b7280;
}

.tab.active {
  background: #0f1f0f;
  border-bottom-color: #22c55e;
  color: #22c55e;
}

/* ─── Card Body ────────────────────────────────────────────────────────────── */
.card-body {
  padding: 24px;
}

/* ─── Output ───────────────────────────────────────────────────────────────── */
.output-wrap {
  position: relative;
  margin-bottom: 8px;
}

.output-display {
  background: #0a0a0a;
  border: 1px solid #1f2937;
  padding: 16px 52px 16px 16px;
  min-height: 60px;
  display: flex;
  align-items: center;
  word-break: break-all;
  line-height: 1.6;
  font-size: 15px;
  color: #6b7280;
  letter-spacing: 0.05em;
  font-family: inherit;
  transition: color 0.2s, font-size 0.2s;
  user-select: text;
}

.output-display.has-value {
  color: #d1fae5;
}

.output-display.masked {
  letter-spacing: 0.15em;
  font-size: 18px;
}

.output-display.long-text {
  font-size: 13px;
}

.mask-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

/* ─── Entropy ──────────────────────────────────────────────────────────────── */
.entropy-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  margin-bottom: 0;
}

.entropy-track {
  flex: 1;
  height: 2px;
  background: #1f2937;
  border-radius: 9999px;
  overflow: hidden;
}

.entropy-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.5s ease, background-color 0.5s ease;
  width: 0%;
}

.entropy-label {
  font-size: 11px;
  font-family: inherit;
  white-space: nowrap;
  tabular-nums: all;
}

/* ─── Warning ──────────────────────────────────────────────────────────────── */
.warning {
  margin-top: 10px;
  padding: 8px 12px;
  background: #1c0a0a;
  border: 1px solid #7f1d1d;
  color: #f87171;
  font-size: 11px;
  letter-spacing: 0.05em;
}

/* ─── Action Buttons ───────────────────────────────────────────────────────── */
.actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-top: 16px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s;
}

.btn-generate {
  background: #0f1f0f;
  border: 1px solid #22c55e;
  color: #22c55e;
  padding: 11px 16px;
  font-size: 12px;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-generate:hover:not(:disabled) {
  background: #162916;
}

.btn-generate:disabled {
  background: #1a1a1a;
  border-color: #374151;
  color: #374151;
  cursor: not-allowed;
}

.btn-copy {
  background: #0a0a0a;
  border: 1px solid #1f2937;
  color: #6b7280;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.btn-copy:hover:not(:disabled) {
  border-color: #374151;
  color: #9ca3af;
}

.btn-copy:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.btn-copy.copied {
  background: #052e16;
  border-color: #22c55e;
  color: #22c55e;
}

.btn-settings {
  background: #0a0a0a;
  border: 1px solid #1f2937;
  color: #4b5563;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-settings:hover {
  border-color: #374151;
  color: #6b7280;
}

.btn-settings.open {
  background: #0f1a0f;
  border-color: rgba(34,197,94,0.25);
  color: #86efac;
}

/* ─── Icon Button (generic) ────────────────────────────────────────────────── */
.icon-btn {
  background: none;
  border: none;
  color: #4b5563;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.icon-btn:hover { color: #6b7280; }

/* ─── Settings Panel ───────────────────────────────────────────────────────── */
.settings-panel {
  margin-top: 18px;
  border-top: 1px solid #1f2937;
  padding-top: 18px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.setting-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #9ca3af;
  display: block;
}

.setting-value {
  font-size: 13px;
  color: #22c55e;
  font-weight: 700;
}

/* ─── Slider ───────────────────────────────────────────────────────────────── */
.slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: #1f2937;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 0;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 0;
  cursor: pointer;
  border: none;
}

.slider::-webkit-slider-thumb:hover { background: #4ade80; }
.slider::-moz-range-thumb:hover { background: #4ade80; }

.slider-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.slider-bounds span {
  font-size: 10px;
  color: #374151;
}

/* ─── Charset Grid ─────────────────────────────────────────────────────────── */
.charset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.charset-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 10px;
  background: #0a0a0a;
  border: 1px solid #1f2937;
  transition: all 0.15s;
}

.charset-option:hover {
  border-color: #374151;
}

.charset-option.checked {
  background: #0f1f0f;
  border-color: rgba(34,197,94,0.25);
}

.charset-option input[type="checkbox"] {
  accent-color: #22c55e;
  cursor: pointer;
  flex-shrink: 0;
}

.charset-option span {
  font-size: 11px;
  color: #4b5563;
  letter-spacing: 0.03em;
  font-family: inherit;
  transition: color 0.15s;
}

.charset-option.checked span {
  color: #86efac;
}

/* ─── Separator Input ──────────────────────────────────────────────────────── */
.sep-input {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #1f2937;
  color: #d1fae5;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color 0.2s;
}

.sep-input:focus {
  border-color: rgba(34,197,94,0.4);
}

/* ─── Apply Button ─────────────────────────────────────────────────────────── */
.btn-apply {
  margin-top: 16px;
  width: 100%;
  background: transparent;
  border: 1px dashed #1f2937;
  color: #4b5563;
  padding: 9px;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-apply:hover {
  border-color: #374151;
  color: #6b7280;
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 2px;
}

.app-footer span {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #1f2937;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  body { padding: 16px; }

  .actions {
    grid-template-columns: 1fr auto auto;
  }

  .btn-generate { font-size: 11px; padding: 10px 12px; }
  .btn-copy, .btn-settings { padding: 10px 12px; }

  .charset-grid { grid-template-columns: 1fr; }

  .output-display { font-size: 13px; }
}

@media (min-width: 600px) {
  .card-body { padding: 28px; }
}
