:root {
  color-scheme: dark;
  --ink: #f1f0e9;
  --muted: #97978f;
  --paper: #111310;
  --panel: #171a16;
  --panel-2: #1d201b;
  --line: #30342c;
  --acid: #c8f45b;
  --acid-dark: #96bd36;
  --danger: #ed725d;
  --mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --sans: Vazirmatn, Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(200, 244, 91, 0.07), transparent 24rem),
    var(--paper);
  font-family: var(--sans);
}

button,
textarea,
input {
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.topbar {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.topbar-actions,
.language-switch {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 12px;
}

.github-link {
  min-height: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  color: #bbbdb3;
  font: 10px var(--mono);
  text-decoration: none;
  transition: 160ms ease;
}

.github-link svg {
  width: 17px;
  fill: currentColor;
}

.github-link:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.language-switch {
  padding: 3px;
  border: 1px solid var(--line);
}

.language-button {
  min-width: 34px;
  padding: 5px 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 10px var(--mono);
  cursor: pointer;
}

.language-button.active {
  background: var(--acid);
  color: #171b10;
  font-weight: 700;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.brand-mark svg {
  width: 38px;
  fill: none;
  stroke: var(--acid);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.2;
}

.brand strong {
  font: 600 16px var(--mono);
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font: 10px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.local-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  color: #bbbdb3;
  font-size: 12px;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 4px rgba(200, 244, 91, 0.1);
}

main {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
}

.hero {
  padding: 100px 0 90px;
  position: relative;
  border-bottom: 1px solid var(--line);
}

.hero::after {
  content: "</>";
  position: absolute;
  direction: ltr;
  left: 3%;
  top: 50%;
  transform: translateY(-50%);
  color: transparent;
  -webkit-text-stroke: 1px #252921;
  font: 700 clamp(7rem, 20vw, 20rem) var(--mono);
  letter-spacing: -0.12em;
  z-index: -1;
}

.eyebrow,
.section-number {
  color: var(--muted);
  font: 500 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--acid);
  margin-left: 12px;
}

.hero h1 {
  margin: 24px 0;
  max-width: 850px;
  font-size: clamp(3rem, 7vw, 6.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.hero h1 em {
  color: var(--acid);
  font-style: normal;
}

.hero > p {
  max-width: 690px;
  margin: 24px 0 0;
  color: #b7b8b0;
  font-size: 18px;
  font-weight: 300;
  line-height: 2;
}

.trust-row {
  display: flex;
  gap: 30px;
  margin-top: 36px;
  color: var(--muted);
  font-size: 12px;
}

.trust-row span::before {
  content: "✓";
  color: var(--acid);
  margin-left: 7px;
}

.workspace {
  padding: 90px 0;
}

.workspace-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 30px;
}

.workspace h2,
.guidance h2 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.04em;
}

.mode-switch {
  display: flex;
  border: 1px solid var(--line);
  padding: 4px;
}

.mode-button {
  min-width: 100px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mode-button.active {
  background: var(--acid);
  color: #171b10;
  font-weight: 700;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.editor-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.output-card {
  border-color: #424b2e;
}

.editor-toolbar {
  min-height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.editor-toolbar > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.raw {
  background: var(--danger);
}

.status-dot.safe {
  background: var(--acid);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 15px !important;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

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

.code-wrap {
  position: relative;
  display: flex;
  direction: ltr;
  min-height: 390px;
}

.line-count {
  width: 46px;
  padding: 20px 12px;
  flex: none;
  border-right: 1px solid var(--line);
  color: #54594d;
  font: 12px/1.8 var(--mono);
  text-align: right;
  white-space: pre;
  user-select: none;
  overflow: hidden;
}

textarea {
  width: 100%;
  min-height: 390px;
  padding: 19px 20px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: #d7dacd;
  font: 13px/1.8 var(--mono);
  tab-size: 2;
  direction: ltr;
  text-align: left;
}

textarea::placeholder {
  color: #5c6056;
}

#drop-overlay {
  position: absolute;
  inset: 14px;
  display: none;
  place-items: center;
  border: 1px dashed var(--acid);
  background: rgba(17, 19, 16, 0.92);
  color: var(--acid);
  font-weight: 600;
  pointer-events: none;
}

.dragging #drop-overlay {
  display: grid;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.options-panel {
  padding: 24px;
  border-inline-end: 1px solid var(--line);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 700;
}

.mini-button {
  border: 0;
  background: none;
  color: var(--acid);
  font-size: 10px;
  cursor: pointer;
}

.option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
}

.option {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 0;
  cursor: pointer;
}

.option input {
  position: absolute;
  opacity: 0;
}

.check {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid #555b4c;
}

.option input:checked + .check {
  border-color: var(--acid);
  background: var(--acid);
}

.option input:checked + .check::after {
  content: "✓";
  color: #11150a;
  font: 700 12px var(--sans);
}

.option b,
.option small {
  display: block;
}

.option b {
  font-size: 12px;
  font-weight: 600;
}

.option small {
  margin-top: 4px;
  color: var(--muted);
  direction: ltr;
  font: 10px/1.5 var(--mono);
  text-align: right;
}

.action-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.primary-button {
  min-height: 58px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--acid);
  background: var(--acid);
  color: #15190f;
  font-weight: 800;
  cursor: pointer;
  transition: 160ms ease;
}

.primary-button:hover {
  background: #d8ff78;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(200, 244, 91, 0.12);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.primary-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  transform: scaleX(-1);
}

#privacy-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

.result-summary {
  margin-top: 20px;
  padding-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.result-summary div {
  display: flex;
  flex-direction: column;
}

.result-summary strong {
  color: var(--acid);
  font: 600 22px var(--mono);
}

.result-summary span {
  color: var(--muted);
  font-size: 9px;
}

.result-summary button {
  grid-column: 1 / -1;
  padding: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: #b7b9af;
  font-size: 10px;
  cursor: pointer;
}

.result-summary button:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.blacklist-panel {
  margin-top: 16px;
  padding: 28px;
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.blacklist-copy h3 {
  margin: 8px 0 10px;
  font-size: 22px;
}

.blacklist-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.mapping-table {
  border: 1px solid var(--line);
  background: #121410;
}

.mapping-header,
.mapping-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(180px, 1.1fr) 38px;
  gap: 10px;
  align-items: center;
}

.mapping-header {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mapping-list {
  max-height: 320px;
  overflow-y: auto;
}

.mapping-row {
  padding: 9px;
  border-bottom: 1px solid #24271f;
}

.mapping-row:last-child {
  border-bottom: 0;
}

.mapping-row input {
  min-width: 0;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  outline: 0;
  background: #171a15;
  color: var(--ink);
  direction: ltr;
  font: 11px var(--mono);
}

.mapping-row input:focus {
  border-color: var(--acid);
}

.mapping-row.invalid input {
  border-color: var(--danger);
}

.remove-mapping {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.remove-mapping:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.mapping-file-badge {
  color: var(--acid);
  font: 9px var(--mono);
  text-align: center;
}

.mapping-empty {
  margin: 0;
  padding: 24px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.blacklist-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.blacklist-actions .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-button {
  cursor: pointer;
}

#blacklist-count {
  margin-inline-start: auto;
  color: var(--muted);
  font: 10px var(--mono);
}

.restore-intro {
  margin-bottom: 28px;
}

.restore-intro h3 {
  margin: 8px 0;
  font-size: 28px;
}

.restore-intro p {
  margin: 0;
  color: var(--muted);
}

.restore-map-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.map-drop {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed #515749;
  color: #c1c3ba;
  font-size: 12px;
  cursor: pointer;
}

.map-drop:hover {
  border-color: var(--acid);
}

.map-drop svg {
  width: 20px;
  fill: none;
  stroke: var(--acid);
  stroke-width: 1.5;
}

.or-label {
  color: var(--muted);
  font-size: 11px;
}

.secondary-button {
  padding: 11px 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 11px;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--acid);
}

.restore-editors .code-wrap,
.restore-editors textarea {
  min-height: 300px;
}

.restore-button {
  width: 240px;
  margin-top: 16px;
}

.guidance {
  padding: 70px 0 100px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 80px;
  border-top: 1px solid var(--line);
}

.guidance-list p {
  margin: 0;
  padding: 22px 0;
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  color: #b9bbb3;
}

.guidance-list p > span:first-child {
  color: var(--acid);
  font: 12px var(--mono);
}

.guidance-list p > span:last-child {
  color: inherit;
  font: inherit;
}

html[dir="rtl"] .primary-button svg {
  transform: scaleX(-1);
}

html[dir="ltr"] .primary-button svg {
  transform: none;
}

#toast {
  position: fixed;
  z-index: 30;
  left: 24px;
  bottom: 24px;
  padding: 12px 18px;
  background: var(--acid);
  color: #12150d;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .editor-grid,
  .controls-grid,
  .guidance,
  .blacklist-panel {
    grid-template-columns: 1fr;
  }

  .options-panel {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero {
    padding: 70px 0;
  }

  .guidance {
    gap: 30px;
  }
}

@media (max-width: 620px) {
  .topbar,
  main {
    width: min(100% - 28px, 1400px);
  }

  .topbar {
    min-height: 72px;
  }

  .local-badge {
    padding: 7px;
    font-size: 10px;
  }

  .local-badge span:last-child {
    display: none;
  }

  .topbar-actions {
    gap: 7px;
  }

  .github-link {
    padding: 0 8px;
  }

  .github-link span {
    display: none;
  }

  .brand small {
    display: none;
  }

  .hero {
    padding: 55px 0;
  }

  .hero > p {
    font-size: 15px;
  }

  .trust-row {
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .workspace {
    padding: 55px 0;
  }

  .workspace-head {
    align-items: start;
    gap: 20px;
    flex-direction: column;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .option-list {
    grid-template-columns: 1fr;
  }

  .mapping-header {
    display: none;
  }

  .mapping-row {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .mapping-row > :first-child,
  .mapping-row > :nth-child(2) {
    grid-column: 1;
  }

  .mapping-row > :last-child {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .code-wrap,
  textarea {
    min-height: 310px;
  }

  .restore-map-row {
    align-items: stretch;
    flex-direction: column;
  }

  .or-label {
    text-align: center;
  }

  .restore-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
