:root {
  --bg: #0b0e14;
  --panel: #141922;
  --panel-raised: #1a212c;
  --border: #232b38;
  --text: #e6eaf0;
  --muted: #8b97a8;
  --amber: #f5a623;
  --amber-dim: #c98a1c;
  --cyan: #4fd1c5;
  --danger: #ef6f6f;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(245, 166, 35, 0.06), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(79, 209, 197, 0.05), transparent 40%);
}

a { color: var(--cyan); }

.tape {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 28px;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: rgba(245, 166, 35, 0.16);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.tape span { display: inline-block; animation: scroll-tape 60s linear infinite; }
@keyframes scroll-tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.layout {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

main {
  min-width: 0;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-link {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  text-decoration: none;
}
.brand-link:hover { color: var(--cyan); }

.lang-switcher { position: relative; }

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.lang-switcher-btn:hover { border-color: var(--muted); }

.flag {
  display: inline-flex;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.flag svg { width: 100%; height: 100%; display: block; }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 170px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}
.lang-menu li {
  border-radius: 6px;
  font-size: 13px;
}
.lang-menu li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.lang-menu li:hover { background: rgba(255, 255, 255, 0.06); }
.lang-menu li[aria-selected="true"] { background: rgba(79, 209, 197, 0.12); color: var(--cyan); }

header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.brand .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--amber);
  text-transform: uppercase;
  margin: 0 0 6px;
}

h1 {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.tagline {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

select#langSelect {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
}

.tab-btn {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 9px 18px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: var(--amber);
  color: #1a1306;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.panel { display: none; }
.panel.active { display: block; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 160px;
  background: #0e1218;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 14px;
  resize: vertical;
}
textarea:focus, input:focus, select:focus, .tab-btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.row {
  display: flex;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.field { flex: 1; min-width: 160px; }

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.segmented button {
  background: var(--panel-raised);
  border: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: 9px 16px;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--cyan); color: #06211f; font-weight: 600; }

select, input[type="text"], input[type="number"] {
  width: 100%;
  background: #0e1218;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
}

.primary-btn {
  background: var(--amber);
  color: #1a1306;
  border: none;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 18px;
}
.primary-btn:hover { background: #ffb945; }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 18px;
  margin-left: 10px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover {
  border-color: var(--amber);
  background: rgba(245, 166, 35, 0.06);
  color: var(--text);
}
.dropzone .drop-icon {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--amber);
  margin-bottom: 10px;
}
.dropzone .or { font-size: 12px; margin: 8px 0; color: var(--muted); }
.dropzone input[type=file] { display: none; }
.browse-btn {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.file-meta {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.result-block {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.result-head label { margin: 0; }
.byte-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
}

.copy-btn {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.copy-btn.copied { border-color: var(--cyan); color: var(--cyan); }

.error-box {
  margin-top: 16px;
  border: 1px solid var(--danger);
  background: rgba(239, 111, 111, 0.08);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  display: none;
}
.error-box.show { display: block; }

.hash-list {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0e1218;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.hash-algo {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--cyan);
  width: 72px;
  flex-shrink: 0;
}
.hash-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
}

.note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

/* .legal-content always follows another block (the tool's own card, or the
   home page's card-grid) with no margin of its own on either side, so the two
   boxes touch directly. This is the gap between them, not anything inside. */
.legal-content { margin-top: 28px; }

.legal-content h2 {
  font-family: var(--mono);
  font-size: 15px;
  margin: 24px 0 8px;
}
.legal-content h2:first-child { margin-top: 0; }
.legal-content h3 {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan);
  margin: 16px 0 6px;
}
.legal-content p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 10px;
}
.legal-content ul {
  margin: 0 0 10px;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.legal-content li { margin-bottom: 4px; }

.site-footer {
  text-align: center;
  padding: 24px 0;
  color: var(--muted);
  font-size: 12px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.back-link { margin: 0 0 16px; }
.back-link a { color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link a:hover { color: var(--text); }

.intro-text {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 640px;
  margin: 20px 0 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.tool-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.tool-card:hover { border-color: var(--cyan); transform: translateY(-2px); }
.tool-card h2,
.tool-card h3 {
  font-family: var(--mono);
  font-size: 16px;
  margin: 0 0 6px;
}
.tool-card p { margin: 0; color: var(--muted); font-size: 13px; }

/* QR codes are scanned optically, so the light modules and the quiet zone around
   them have to stay light no matter how dark the page is — hence the explicit
   white plate rather than letting the transparent PNG sit on --panel. */
.qr-preview {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #ffffff;
  border-radius: var(--radius);
}
.qr-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated; /* keep module edges crisp when scaled down */
}

/* Cron: clickable example expressions and the parsed result. */
.cron-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.cron-example {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
}
.cron-example:hover { border-color: var(--cyan); }
.cron-example code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.cron-description {
  margin: 0;
  font-size: 17px;
  color: var(--amber);
}
.cron-runs {
  margin: 10px 0 0;
  padding-left: 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}
.cron-runs li { margin-bottom: 4px; }

/* Checkbox group for the password character sets. */
.charset-set {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.charset-set legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  cursor: pointer;
}
.check:last-child { margin-bottom: 0; }
.check input { accent-color: var(--amber); cursor: pointer; }
.check code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.field-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Related-tools strip at the foot of every tool page. The rule above already
   styles the cards themselves (it reuses .card-grid/.tool-card); this only adds
   the separator and section heading that set it apart from the tool's own UI. */
.related-tools {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.related-tools h2 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.related-tools .card-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-top: 16px;
}

.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--panel-raised);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
  min-width: 220px;
}
.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cookie-banner-link {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.cookie-banner-link:hover { color: var(--cyan); }
.cookie-banner-actions button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.cookie-decline-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.cookie-decline-btn:hover { color: var(--text); border-color: var(--muted); }
.cookie-accept-btn {
  background: var(--amber);
  border: none;
  color: #1a1306;
}
.cookie-accept-btn:hover { background: #ffb945; }

@media (max-width: 640px) {
  .cookie-banner { flex-direction: column; align-items: stretch; }
  .cookie-banner-actions { justify-content: flex-end; }
}

#regexHighlightOutput {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0e1218;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 14px;
  min-height: 60px;
}
#regexHighlightOutput mark {
  background: var(--amber);
  color: #1a1306;
  border-radius: 3px;
  padding: 0 1px;
}
