:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111827;
  color: #f8fafc;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: radial-gradient(circle at 5% 0%, #4338ca 0, transparent 28rem), #111827; }

button, input { font: inherit; }

button { cursor: pointer; }

.page-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 72px 0; }

.hero { max-width: 680px; margin-bottom: 38px; }
.hero h1, .panel-heading h2 { margin: 6px 0 0; letter-spacing: -0.04em; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.8rem); line-height: .95; }
.hero p:not(.eyebrow) { max-width: 560px; margin: 18px 0 0; color: #cbd5e1; line-height: 1.7; }

.eyebrow { margin: 0; color: #a5b4fc; font-size: .72rem; font-weight: 800; letter-spacing: .16em; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 20px; align-items: stretch; }
.panel { padding: clamp(24px, 4vw, 40px); border: 1px solid rgb(255 255 255 / .12); border-radius: 24px; background: rgb(15 23 42 / .8); box-shadow: 0 24px 60px rgb(0 0 0 / .2); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.panel-heading h2 { font-size: 1.7rem; }
.local-badge { padding: 6px 9px; border-radius: 999px; background: #172554; color: #bfdbfe; font-size: .75rem; font-weight: 700; white-space: nowrap; }

.field { display: grid; gap: 8px; margin-bottom: 18px; color: #e2e8f0; font-size: .9rem; font-weight: 700; }
.field input { width: 100%; padding: 14px 15px; border: 1px solid #334155; border-radius: 12px; outline: 0; background: #0f172a; color: #fff; transition: border-color .2s, box-shadow .2s; }
.field input:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgb(129 140 248 / .16); }
.password-input { position: relative; }
.password-input input { padding-right: 70px; }
.icon-button { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; background: transparent; color: #a5b4fc; font-size: .78rem; font-weight: 800; }

.control-group { margin: 26px 0; padding: 0; border: 0; }
.control-group legend, .range-field > span { color: #e2e8f0; font-size: .9rem; font-weight: 800; }
.hint, .range-field small, .status { color: #94a3b8; font-size: .84rem; line-height: 1.55; }
.hint { margin: 7px 0 14px; }
.algorithm-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.algorithm-grid label, .gate-options label { position: relative; }
.algorithm-grid input, .gate-options input { position: absolute; opacity: 0; }
.algorithm-grid span, .gate-options span { display: grid; place-items: center; min-height: 42px; border: 1px solid #334155; border-radius: 10px; color: #94a3b8; font-size: .82rem; font-weight: 800; transition: .2s; }
.algorithm-grid input:checked + span, .gate-options input:checked + span { border-color: #818cf8; background: #4338ca; color: #fff; box-shadow: 0 8px 18px rgb(67 56 202 / .24); }
.algorithm-grid input:focus-visible + span, .gate-options input:focus-visible + span { outline: 3px solid #c4b5fd; outline-offset: 2px; }

.range-field { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 26px 0; }
.range-field output { color: #c4b5fd; font-weight: 800; }
.range-field input { grid-column: 1 / -1; width: 100%; accent-color: #818cf8; }
.range-field small { grid-column: 1 / -1; }

.primary-button, .copy-button { width: 100%; border: 0; border-radius: 12px; padding: 15px 18px; color: white; font-weight: 800; }
.primary-button { background: linear-gradient(120deg, #4f46e5, #7c3aed); box-shadow: 0 12px 22px rgb(79 70 229 / .24); }
.primary-button:hover { filter: brightness(1.12); }

.result-panel { display: flex; flex-direction: column; }
.gate-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.gate-options label:last-child { grid-column: 1 / -1; }
.blocked-field { display: grid; gap: 8px; margin-top: 22px; color: #e2e8f0; font-size: .9rem; font-weight: 800; }
.blocked-field textarea { width: 100%; resize: vertical; min-height: 74px; padding: 12px 14px; border: 1px solid #334155; border-radius: 12px; outline: 0; background: #0f172a; color: #fff; line-height: 1.5; }
.blocked-field textarea:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgb(129 140 248 / .16); }
.blocked-field small { color: #94a3b8; font-size: .78rem; font-weight: 500; }
.blocked-list { display: flex; flex-wrap: wrap; gap: 7px; min-height: 32px; margin-top: 12px; }
.blocked-character, .empty-list { border-radius: 999px; font-size: .78rem; }
.blocked-character { padding: 5px 9px; background: #3f1d3d; color: #fbcfe8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-list { color: #64748b; }
.result-card { margin-top: 28px; padding: 20px; border-radius: 16px; background: #020617; border: 1px solid #334155; }
.result-meta { display: flex; justify-content: space-between; gap: 10px; color: #94a3b8; font-size: .78rem; font-weight: 700; }
.result-value { display: block; min-height: 60px; padding: 17px 0; overflow-wrap: anywhere; color: #fef08a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1rem, 2vw, 1.2rem); letter-spacing: .04em; text-align: left; }
.result-value.masked { color: #64748b; letter-spacing: .16em; }
.visibility-toggle { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 16px; color: #cbd5e1; font-size: .84rem; font-weight: 700; cursor: pointer; }
.visibility-toggle input { position: absolute; opacity: 0; }
.switch { width: 37px; height: 22px; padding: 3px; border-radius: 999px; background: #334155; transition: .2s; }
.switch::after { display: block; width: 16px; height: 16px; border-radius: 50%; background: #e2e8f0; content: ''; transition: transform .2s; }
.visibility-toggle input:checked + .switch { background: #6366f1; }
.visibility-toggle input:checked + .switch::after { transform: translateX(15px); }
.visibility-toggle input:focus-visible + .switch { outline: 3px solid #c4b5fd; outline-offset: 2px; }
.copy-button { background: #1e293b; transition: .2s; }
.copy-button:hover:not(:disabled) { background: #334155; }
.copy-button:disabled { cursor: not-allowed; opacity: .5; }
.status { margin: 16px 0 0; }
.status[data-state="success"] { color: #86efac; }
.status[data-state="error"] { color: #fda4af; }

@media (max-width: 780px) {
  .page-shell { width: min(100% - 24px, 620px); padding: 40px 0 24px; }
  .workspace { grid-template-columns: 1fr; }
  .hero { margin-bottom: 24px; }
  .panel { border-radius: 18px; }
}

@media (max-width: 420px) {
  .page-shell { width: min(100% - 20px, 620px); padding-top: 28px; }
  .algorithm-grid { grid-template-columns: repeat(3, 1fr); }
  .gate-options { grid-template-columns: 1fr; }
  .gate-options label:last-child { grid-column: auto; }
}
