#tool-root {
  width: 100%;
}
.regex-shell {
  padding: 1.4rem;
  border: 1px solid rgba(143, 99, 255, 0.28);
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 12% 0%, rgba(123, 74, 255, 0.16), transparent 38%),
    linear-gradient(135deg, rgba(31, 25, 53, 0.94), rgba(13, 18, 31, 0.96));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}
.regex-app {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.1rem;
  background: rgba(6, 7, 12, 0.97);
  color: #f7f5ff;
}
.regex-app__header,
.regex-toolbar,
.regex-app__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.regex-app__header {
  align-items: flex-start;
  padding: 1.35rem 1.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.regex-kicker {
  margin: 0 0 0.42rem;
  color: #bca8ff;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}
.regex-app__header h2,
.regex-results__header h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.2;
}
.regex-results__header h3 {
  font-size: 1rem;
}
.regex-app__header p:not(.regex-kicker) {
  max-width: 47rem;
  margin: 0.5rem 0 0;
  color: #aca8bd;
  font-size: 0.9rem;
  line-height: 1.55;
}
.regex-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.3rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(139, 92, 246, 0.55);
  border-radius: 999px;
  background: rgba(79, 45, 147, 0.22);
  color: #e4dcff;
  font-size: 0.8rem;
  font-weight: 800;
}
.regex-state__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 0 0.22rem rgba(139, 92, 246, 0.16);
}
.regex-state[data-state="success"] {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(16, 185, 129, 0.13);
  color: #c8ffdf;
}
.regex-state[data-state="success"] .regex-state__dot {
  background: #34d399;
  box-shadow: 0 0 0 0.22rem rgba(52, 211, 153, 0.15);
}
.regex-state[data-state="error"] {
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(244, 63, 94, 0.12);
  color: #ffd2da;
}
.regex-state[data-state="error"] .regex-state__dot {
  background: #fb7185;
  box-shadow: 0 0 0 0.22rem rgba(251, 113, 133, 0.15);
}
.regex-toolbar {
  padding: 0.85rem 1.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.regex-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.regex-toolbar .btn {
  min-height: 2.55rem;
  padding: 0.55rem 0.95rem;
  border-radius: 0.8rem;
  font-size: 0.82rem;
}
.regex-config {
  display: grid;
  grid-template-columns: minmax(14rem, 1.4fr) auto minmax(14rem, 1.1fr) auto;
  align-items: end;
  gap: 0.8rem;
  padding: 1rem 1.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.018);
}
.regex-control {
  display: grid;
  min-width: 0;
  gap: 0.42rem;
  color: #b9b4c9;
  font-size: 0.77rem;
  font-weight: 800;
}
.regex-control em {
  color: #7f7a8f;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 600;
}
.regex-control input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.65rem;
  outline: none;
  background: #101018;
  color: #f7f5ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}
.regex-control input::placeholder {
  color: #777184;
}
.regex-control input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.14);
}
.regex-flags {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 2.55rem;
  margin: 0;
  padding: 0.35rem 0.45rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0.68rem;
}
.regex-flags legend {
  padding: 0 0.25rem;
  color: #b9b4c9;
  font-size: 0.72rem;
  font-weight: 800;
}
.regex-flags label {
  display: grid;
  width: 1.8rem;
  height: 1.7rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.42rem;
  background: #11111a;
  color: #8f8a9e;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 800;
}
.regex-flags input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.regex-flags label:has(input:checked) {
  border-color: rgba(139, 92, 246, 0.85);
  background: rgba(124, 58, 237, 0.28);
  color: #f1ecff;
}
.regex-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.55rem;
  color: #c2bdcf;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 750;
  white-space: nowrap;
}
.regex-toggle input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #8b5cf6;
}
.regex-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 23rem;
}
.regex-pane {
  min-width: 0;
  padding: 1.15rem 1.45rem;
}
.regex-pane--input {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.regex-pane--preview {
  background:
    linear-gradient(180deg, rgba(91, 210, 255, 0.045), transparent 40%),
    rgba(255, 255, 255, 0.012);
}
.regex-pane__title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.65rem;
}
.regex-pane__title h3 {
  margin: 0;
  color: #fff;
  font-size: 0.96rem;
}
.regex-pane__badge {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border-radius: 0.38rem;
  background: rgba(124, 58, 237, 0.28);
  color: #dacdff;
  font-size: 0.76rem;
  font-weight: 900;
}
.regex-meta {
  margin-left: auto;
  color: #8f8a9e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
}
.regex-pane textarea,
.regex-preview {
  box-sizing: border-box;
  width: 100%;
  min-height: 18.5rem;
  height: calc(100% - 2.5rem);
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  background: #0b0c12;
  color: #e9e6f2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  overflow: auto;
}
.regex-pane textarea {
  resize: vertical;
  outline: none;
}
.regex-pane textarea:focus {
  border-color: rgba(139, 92, 246, 0.75);
  box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.12);
}
.regex-preview {
  margin-bottom: 0;
  background:
    linear-gradient(90deg, rgba(91, 210, 255, 0.06), transparent 24%),
    #0b0c12;
}
.regex-preview mark {
  padding: 0.05em 0.12em;
  border-radius: 0.22rem;
  background: rgba(139, 92, 246, 0.52);
  color: #fff;
}
.regex-preview .regex-zero {
  background: rgba(251, 191, 36, 0.55);
  color: #191207;
}
.regex-results {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.regex-results__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.45rem;
}
.regex-results__header .regex-kicker {
  margin-bottom: 0.28rem;
}
.regex-results-summary {
  color: #9d98aa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
}
.regex-table-wrap {
  overflow: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.regex-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  color: #d8d4e4;
  font-size: 0.78rem;
}
.regex-table th,
.regex-table td {
  padding: 0.75rem 0.85rem;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  vertical-align: top;
}
.regex-table th {
  position: sticky;
  top: 0;
  background: #11111a;
  color: #bdb7ce;
  font-size: 0.71rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.regex-table td code,
.regex-table td pre {
  margin: 0;
  color: #f0ecff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.regex-table td small {
  display: block;
  margin-top: 0.25rem;
  color: #8f8a9e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
}
.regex-empty {
  padding: 1.35rem !important;
  color: #9690a2;
  text-align: center !important;
}
.regex-replace {
  padding: 1.15rem 1.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.012);
}
.regex-replace .regex-preview {
  min-height: 8rem;
  height: auto;
}
.regex-app__footer {
  padding: 0.95rem 1.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.018);
}
.regex-status {
  margin: 0;
  color: #aba6b8;
  font-size: 0.8rem;
}
.regex-status[data-type="success"] {
  color: #a7f3d0;
}
.regex-status[data-type="error"] {
  color: #fda4af;
}
.regex-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}
.regex-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 2rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.025);
  color: #9d98aa;
  font-size: 0.72rem;
}
.regex-metrics strong {
  color: #f0edfa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
}
@media (max-width: 1050px) {
  .regex-config {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .regex-flags,
  .regex-toggle {
    justify-self: start;
  }
}
@media (max-width: 760px) {
  .regex-shell {
    padding: 0.65rem;
    border-radius: 1rem;
  }
  .regex-app__header,
  .regex-toolbar,
  .regex-app__footer {
    align-items: stretch;
    flex-direction: column;
    padding: 1rem;
  }
  .regex-toolbar__group {
    width: 100%;
  }
  .regex-toolbar .btn {
    flex: 1 1 auto;
  }
  .regex-config {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .regex-workspace {
    grid-template-columns: 1fr;
  }
  .regex-pane--input {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .regex-pane {
    padding: 1rem;
  }
  .regex-pane textarea,
  .regex-preview {
    min-height: 15rem;
  }
  .regex-results__header,
  .regex-replace {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .regex-app__footer {
    gap: 0.8rem;
  }
  .regex-metrics {
    justify-content: flex-start;
  }
}