.regex-main { padding-top: 46px; }
.regex-main .breadcrumbs { width: 100%; margin: 0 0 28px; }
.regex-main .developer-hero { min-height: 0; margin-bottom: 35px; padding: 15px 0 8px; }
.regex-main .developer-hero h1 { margin-top: 20px; font-size: clamp(48px, 6vw, 72px); }
.focused-header-link { justify-self: end; color: #292725; font-size: 12px; font-weight: 800; text-decoration: none; }
.focused-header-link span { color: #4b8ba5; }

.regex-workbench { margin-bottom: 0; }
.regex-workbench [hidden] { display: none !important; }
.regex-grid { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); gap: 14px; }
.regex-card { min-width: 0; overflow: hidden; border: 1px solid #ddd8cf; border-radius: 16px; background: #fbfaf7; }
.regex-card-heading { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #e3ded5; }
.regex-card-heading div { display: grid; gap: 3px; }
.regex-card-heading strong { font-size: 11px; }
.regex-card-heading small { color: #989188; font-size: 8px; }

.regex-pattern-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 15px; border: 1px solid #d7d1c8; border-radius: 11px; padding: 4px 10px; background: #fff; }
.regex-pattern-wrap:focus-within { border-color: #4f8da7; box-shadow: 0 0 0 3px rgba(79, 141, 167, .1); }
.regex-pattern-wrap > span { color: #4f8da7; font: 700 17px ui-monospace, monospace; }
.regex-pattern-wrap input { min-width: 0; height: 39px; border: 0; outline: 0; color: #2b2926; background: transparent; font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.regex-pattern-wrap small { color: #9b948c; font-size: 8px; }
.regex-flags { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 15px 15px; }
.regex-flags label { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 7px 9px; color: #69635c; background: #f0ede7; font-size: 9px; font-weight: 800; cursor: pointer; }
.regex-flags input { accent-color: #4f8da7; }
.regex-flag-help { padding: 13px 15px; border-top: 1px solid #e6e1d9; color: #8f887f; font-size: 9px; line-height: 1.65; }
.regex-flag-help code { color: #467e95; font-weight: 800; }

.regex-textarea { width: 100%; min-height: 290px; display: block; resize: vertical; border: 0; outline: 0; padding: 17px; color: #2d2a26; background: transparent; font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; tab-size: 2; }
.regex-replace-row { margin-top: 13px; padding: 15px; border: 1px solid #ddd8cf; border-radius: 15px; background: #f6f3ed; }
.regex-replace-row label { display: grid; gap: 7px; color: #5f5952; font-size: 10px; font-weight: 800; }
.regex-replace-row input { width: 100%; height: 43px; border: 1px solid #d8d2c8; border-radius: 9px; outline: 0; padding: 0 12px; color: #302d29; background: #fff; font: 11px ui-monospace, monospace; }
.regex-replace-row input:focus { border-color: #4f8da7; box-shadow: 0 0 0 3px rgba(79, 141, 167, .09); }
.regex-replace-row small { color: #979087; font-size: 8px; font-weight: 500; }

.regex-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; }
.regex-actions > div { display: flex; flex-wrap: wrap; gap: 7px; }
.regex-actions button { min-height: 39px; border: 1px solid #d7d1c8; border-radius: 9px; padding: 0 13px; color: #6c655e; background: #fff; font-size: 9px; font-weight: 800; cursor: pointer; }
.regex-actions button:hover { border-color: #76a1b3; color: #3e7186; }
.regex-actions .regex-primary { min-width: 150px; border: 0; color: #fff; background: #397f9d; font-size: 10px; }
.regex-actions .regex-primary:hover { color: #fff; background: #2e708b; }
.regex-actions button:disabled { opacity: .55; cursor: wait; }
.regex-status { min-height: 18px; margin: 9px 2px 0; color: #4b7f94; font-size: 10px; font-weight: 700; }
.regex-status.error { color: #b34a3b; }

.regex-results { margin-top: 22px; padding-top: 20px; border-top: 1px solid #ded9d0; }
.regex-result-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 11px; }
.regex-result-heading > div:first-child { display: grid; gap: 4px; }
.regex-result-heading span { color: #8f8981; font-size: 8px; font-weight: 850; letter-spacing: .13em; }
.regex-result-heading h3 { margin: 0; font-size: 18px; }
.regex-result-heading > div:last-child { display: flex; gap: 6px; }
.regex-result-heading button { min-height: 34px; border: 1px solid #d7d1c8; border-radius: 8px; padding: 0 10px; color: #69635b; background: #fff; font-size: 8px; font-weight: 800; cursor: pointer; }
.regex-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.regex-summary article { min-height: 66px; display: grid; place-content: center; gap: 4px; border-radius: 11px; background: #f1eee8; text-align: center; }
.regex-summary strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.regex-summary small { color: #8c857d; font-size: 8px; }
.regex-summary article:first-child { color: #2f7352; background: #e6f3eb; }

.regex-preview-card { overflow: hidden; border: 1px solid #dcd7ce; border-radius: 14px; }
.regex-preview-card header, .regex-output-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; color: #5c5650; background: #efebe5; font-size: 9px; font-weight: 800; }
.regex-preview { min-height: 170px; max-height: 380px; overflow: auto; margin: 0; padding: 17px; color: #403b35; background: #fbfaf7; font: 11px/1.8 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.regex-match-highlight { border-radius: 3px; padding: 1px 0; color: #194f36; background: #bfe8ce; }
.regex-zero-match { display: inline-block; width: 2px; height: 1.3em; padding: 0; background: #d3745f; vertical-align: -.25em; }

.regex-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.regex-match-list, .regex-output-card { min-width: 0; max-height: 470px; overflow: auto; border: 1px solid #ddd8cf; border-radius: 14px; background: #f8f6f1; }
.regex-match-list article { padding: 12px; border-bottom: 1px solid #e2ddd5; }
.regex-match-list article:last-child { border-bottom: 0; }
.regex-match-list article > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.regex-match-list strong { font-size: 9px; }
.regex-match-list article > div span { color: #989188; font: 8px ui-monospace, monospace; }
.regex-match-list code { display: block; overflow: auto; margin-top: 8px; color: #315f73; font: 10px/1.5 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.regex-match-list dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 9px; margin: 9px 0 0; padding-top: 8px; border-top: 1px dashed #ded8cf; }
.regex-match-list dt { color: #8f887f; font: 8px ui-monospace, monospace; }
.regex-match-list dd { min-width: 0; overflow: hidden; margin: 0; color: #5b5650; font: 8px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.regex-empty-state { padding: 22px; color: #8d867e; font-size: 10px; text-align: center; }
.regex-output-card { display: grid; grid-template-rows: auto 1fr; }
.regex-output-card textarea { width: 100%; min-height: 260px; resize: vertical; border: 0; outline: 0; padding: 15px; color: #36322d; background: #fbfaf7; font: 10px/1.7 ui-monospace, monospace; }

@media (max-width: 820px) {
  .regex-grid, .regex-detail-grid { grid-template-columns: 1fr; }
  .regex-actions, .regex-result-heading { align-items: flex-start; flex-direction: column; }
  .regex-actions > div, .regex-result-heading > div:last-child { width: 100%; }
  .regex-actions button, .regex-result-heading button { flex: 1; }
}

@media (max-width: 700px) {
  .regex-main { width: calc(100% - 24px); padding-top: 25px; }
  .regex-main .breadcrumbs { width: 100%; margin-top: 0; }
  .regex-main .developer-hero { padding-top: 8px; }
  .focused-header-link { display: none; }
  .regex-workbench { padding: 12px; }
  .regex-summary { grid-template-columns: 1fr; }
}
