:root {
  --bg-primary: #01130c;
  --bg-secondary: #072417;
  --panel-bg: rgba(8, 30, 21, 0.7);
  --panel-border: rgba(12, 63, 46, 0.4);
  --panel-highlight: rgba(12, 115, 77, 0.18);
  --text-primary: #e8fef4;
  --text-muted: rgba(200, 230, 215, 0.75);
  --accent: #2bd793;
  --accent-soft: rgba(43, 215, 147, 0.28);
  --critical-bg: rgba(250, 120, 132, 0.38);
  --critical-border: rgba(250, 120, 132, 0.9);
  --warning-bg: rgba(255, 205, 120, 0.32);
  --warning-border: rgba(255, 205, 120, 0.74);
  --radius-large: 26px;
  --radius: 18px;
  --radius-small: 10px;
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 18% 20%, rgba(47, 165, 114, 0.16), transparent 55%),
    radial-gradient(circle at 82% 0%, rgba(21, 107, 69, 0.22), transparent 52%);
  z-index: -1;
}


.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 6vw, 44px);
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3.5vw, 40px);
}

.top-nav {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  align-items: center;
  font-size: 0.94rem;
}

.top-nav__lang {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  background: rgba(12, 73, 54, 0.22);
  padding: 6px 14px;
  backdrop-filter: blur(10px);
  position: relative;
  margin-right: auto;
}

.top-nav__lang::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.75rem;
}

.top-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, transform 0.2s ease;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--accent);
  transform: translateY(-1px);
}

.masthead {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.masthead__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2.3rem, 1.6rem + 2vw, 3.1rem);
  line-height: 1.05;
}

.masthead .lede {
  margin: 0;
  max-width: 650px;
  font-size: clamp(0.98rem, 0.9rem + 0.5vw, 1.08rem);
  color: var(--text-muted);
}

.language-select {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  padding-right: 20px;
  cursor: pointer;
}

.language-select option {
  color: #0c1027;
  background-color: #ffffff;
  font-weight: 500;
}

.top-nav__lang:focus-within {
  box-shadow: 0 0 0 2px rgba(43, 215, 147, 0.35);
}

.language-select:focus-visible {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.main-layout {
  display: grid;
  align-items: stretch;
  gap: clamp(20px, 3.2vw, 32px);
  grid-template-columns: minmax(0, 1fr) minmax(120px, 260px);
}

.editor-panel {
  position: relative;
  border-radius: var(--radius-large);
  padding: clamp(20px, 2.8vw, 28px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 0%, rgba(33, 155, 110, 0.25), transparent 55%),
    radial-gradient(circle at 82% 12%, rgba(17, 96, 68, 0.18), transparent 50%);
  opacity: 0.8;
  pointer-events: none;
}

.editor-panel > * {
  position: relative;
  z-index: 1;
}

.editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(12px, 2vw, 18px);
}

.editor-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.editor-header .hint {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.control-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.control-actions button {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.3s ease;
}

.control-actions .primary {
  background: linear-gradient(135deg, var(--accent), rgba(27, 190, 124, 0.9));
  color: #0c1027;
  box-shadow: 0 12px 32px rgba(43, 215, 147, 0.24);
}

.control-actions .primary:hover {
  transform: translateY(-1px);
}

.control-actions .ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.control-actions .ghost:hover {
  background: rgba(43, 215, 147, 0.12);
}

.editor-surface {
  position: relative;
  border-radius: var(--radius);
  background: rgba(4, 22, 16, 0.78);
  border: 1px solid rgba(12, 63, 46, 0.45);
  overflow: hidden;
  min-height: clamp(360px, 52vh, 680px);
}

textarea {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: "JetBrains Mono", "Fira Mono", "Courier New", monospace;
  font-size: clamp(0.88rem, 0.82rem + 0.22vw, 0.98rem);
  line-height: 1.6;
  padding: 26px clamp(18px, 2.6vw, 26px);
  border-radius: var(--radius);
  min-height: clamp(360px, 52vh, 680px);
  resize: vertical;
  outline: none;
  overflow: auto;
}

.highlight-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: transparent;
  overflow: hidden;
  z-index: 1;
}

.highlight-content {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  box-sizing: border-box;
  color: inherit;
  will-change: transform;
}

textarea::-webkit-scrollbar {
  width: 10px;
}

textarea::-webkit-scrollbar-thumb {
  background-color: rgba(43, 215, 147, 0.18);
  border-radius: 99px;
}

.highlight {
  border-radius: 4px;
  padding: 1px 0;
  box-shadow: inset 0 0 0 1px rgba(12, 17, 42, 0.28);
  position: relative;
}

.highlight[data-severity="critical"] {
  background: var(--critical-bg);
  outline: 1px solid var(--critical-border);
}

.highlight[data-severity="warning"] {
  background: var(--warning-bg);
  outline: 1px solid var(--warning-border);
}

.status-bar {
  margin-top: clamp(16px, 2vw, 22px);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.status-bar span[data-status="critical"] strong {
  color: #f06088;
}

.status-bar span[data-status="warning"] strong {
  color: #ffb347;
}

.ad-panel {
  position: relative;
  min-height: clamp(360px, 52vh, 680px);
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(7, 33, 24, 0.6);
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 32px);
  color: rgba(212, 223, 255, 0.6);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.18em;
  backdrop-filter: blur(12px);
  min-height: clamp(250px, 40vh, 620px);
}

.site-footer {
  text-align: center;
  color: rgba(232, 236, 255, 0.54);
  font-size: 0.85rem;
}

.page-content {
  max-width: 820px;
  margin: 0 auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-large);
  padding: clamp(28px, 4vw, 40px);
  box-shadow: 0 24px 48px rgba(6, 24, 16, 0.3);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-content h1 {
  margin: 0;
  font-size: clamp(2rem, 1.6rem + 1vw, 2.6rem);
}

.page-content h2 {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.page-content p,
.page-content li {
  color: var(--text-muted);
  line-height: 1.7;
}

.page-content ul {
  padding-left: 20px;
}

.page-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.page-content a:hover,
.page-content a:focus-visible {
  text-decoration: underline;
}

.tool-content {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  grid-template-columns: minmax(0, 1fr) minmax(120px, 260px);
  align-items: start;
}

.tool-content article {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-large);
  padding: clamp(28px, 4vw, 40px);
  box-shadow: 0 24px 48px rgba(6, 24, 16, 0.3);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.6vw, 32px);
}

.tool-header h1 {
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 1.2vw, 2.6rem);
}

.tool-header .lede {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 680px;
}

.tool-steps ol {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 8px;
  color: var(--text-muted);
}

.tool-steps strong {
  color: var(--text-primary);
}

.tool-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(15, 60, 43, 0.3);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(43, 215, 147, 0.16);
}

.tool-editor {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 22px);
}

.example-button {
  align-self: flex-start;
  background: rgba(43, 215, 147, 0.15);
  color: var(--accent);
  border: 1px solid rgba(43, 215, 147, 0.38);
  border-radius: var(--radius-small);
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.example-button:hover,
.example-button:focus-visible {
  background: rgba(43, 215, 147, 0.28);
  transform: translateY(-1px);
}

.example-button:focus-visible {
  outline: 2px solid rgba(43, 215, 147, 0.45);
  outline-offset: 2px;
}

.example-preview {
  margin: 0;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.92rem;
  background: rgba(6, 28, 20, 0.92);
  border-radius: var(--radius-small);
  padding: 14px 16px;
  color: rgba(232, 254, 244, 0.78);
  word-break: break-word;
  white-space: pre-wrap;
  overflow-x: hidden;
}

.tool-how ul,
.tool-related ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  display: grid;
  gap: 10px;
}

.tool-actions ul,
.lost-links {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-muted);
}

.tool-faq details {
  background: rgba(15, 60, 43, 0.32);
  border: 1px solid rgba(43, 215, 147, 0.18);
  border-radius: var(--radius-small);
  padding: 12px 16px;
  color: var(--text-muted);
}

.tool-faq details + details {
  margin-top: 12px;
}

.tool-faq summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
  outline: none;
}

.tool-faq summary::-webkit-details-marker {
  color: var(--accent);
}

.tool-content a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.tool-content a:hover,
.tool-content a:focus-visible {
  color: #5cf2b6;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .top-nav {
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .top-nav__lang {
    width: 100%;
    justify-content: center;
    margin-right: 0;
  }

  .masthead__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .language-select {
    width: 100%;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .tool-content {
    grid-template-columns: 1fr;
  }

  .control-actions {
    width: 100%;
  }

  .control-actions button {
    flex: 1 1 auto;
  }

}

@media (max-width: 540px) {
  .app-shell {
    padding: 20px 14px 32px;
  }

  .editor-panel,
   .ad-panel {
    border-radius: 18px;
  }
}
