:root {
  --bg: #060606;
  --sidebar: #0a0a0a;
  --surface: #101010;
  --surface-2: #161616;
  --border: #262626;
  --text: #ececec;
  --muted: #888;
  --dim: #555;
  --green: #3dff8a;
  --blue: #5b9cff;
  --purple: #b07cff;
  --red: #ff5c6a;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-gutter: stable;
  height: 100%;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
}

a { color: inherit; }

.layout {
  display: flex;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: 220px;
  height: 100vh;
  max-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  margin-bottom: 1.5rem;
  padding-left: 0.25rem;
}

.nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin: 1rem 0 0.4rem 0.35rem;
}

.nav-link {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 0.1rem;
  transition: 0.15s;
}

.nav-link:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-link.active {
  background: var(--surface-2);
  color: var(--text);
  border-left: 2px solid var(--green);
  padding-left: calc(0.65rem - 2px);
}

.sidebar-bottom {
  margin-top: auto;
  width: 100%;
}

.sidebar-login {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.sidebar-login.is-active {
  border-color: rgba(61, 255, 138, 0.45);
  background: var(--surface-2);
}

.auth-panel {
  max-width: 440px;
}

.auth-switch {
  margin-top: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.auth-switch a {
  color: var(--green);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.vip-badge,
.vip-badge-inline {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0a1a10;
  background: var(--green);
  border-radius: 4px;
  vertical-align: middle;
}

.payment-panel {
  max-width: 520px;
}

.payment-price {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.payment-amount {
  font-family: var(--mono);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--green);
}

.payment-once {
  font-size: 0.9rem;
  color: var(--muted);
}

.payment-perks {
  margin: 0 0 1.25rem 1.1rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.payment-perks li {
  margin-bottom: 0.45rem;
}

.payment-status-row {
  margin-bottom: 0.5rem;
}

.payment-divider {
  margin: 1.25rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.payment-divider::before,
.payment-divider::after {
  content: "";
  display: inline-block;
  width: 2rem;
  height: 1px;
  background: var(--border);
  vertical-align: middle;
  margin: 0 0.65rem;
}

.payment-return-panel {
  max-width: 560px;
}

.payment-return-detail {
  margin-bottom: 1rem;
}

.payment-return-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.owner-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1020;
  background: #c9a0ff;
  border-radius: 4px;
  vertical-align: middle;
}

.admin-panel {
  margin-bottom: 1.25rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  color: var(--muted);
  font-weight: 500;
}

.admin-role-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

.admin-sql-hint {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
}

#code-modal-error a,
.modal-error a {
  color: var(--green);
}

.sidebar-login:hover {
  border-color: rgba(61, 255, 138, 0.45);
  background: var(--surface-2);
}

.sidebar-login-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-login-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--green);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-foot {
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.credit-line {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.35rem 0.35rem 0;
  font-family: "IBM Plex Mono", monospace;
}

.credit-line strong {
  color: var(--text);
  font-weight: 500;
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  padding: 2rem 2.5rem;
  max-width: 1200px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.head-icon {
  flex-shrink: 0;
  line-height: 0;
}

.head-icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.5;
  opacity: 0.55;
}

.page-head h1 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.page-head p {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 860px) {
  .stat-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border);
}

.stat-card.accent-green::before { background: var(--green); }
.stat-card.accent-blue::before { background: var(--blue); }
.stat-card.accent-purple::before { background: var(--purple); }

.stat-card .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 0.6rem;
}

.stat-card .value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.5rem;
  color: var(--muted);
  min-height: 1.75rem;
}

.stat-card .hint {
  font-size: 0.78rem;
  color: var(--dim);
  margin-top: 0.5rem;
}

.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
}

.panel h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--dim);
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.empty-row {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.empty-row:last-child { border-bottom: none; }

.empty-row span:first-child { color: var(--muted); }

.empty-row span:last-child {
  color: var(--dim);
  font-family: "IBM Plex Mono", monospace;
}

/* tool pages — full width; spamhook also fills height */
.main-wide {
  max-width: none;
  width: 100%;
}

.main-fill {
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
}

.main-fill .page-head {
  flex-shrink: 0;
  margin-bottom: 1.25rem;
}

.tool-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel.tool-full {
  flex: 1;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tool-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tool-body .field-grow {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tool-body .field-grow textarea {
  flex: 1;
  min-height: 12rem;
}

.tool-actions {
  margin-top: auto;
  padding-top: 1.25rem;
}

.tool-form {
  max-width: 520px;
}

.field {
  margin-bottom: 1.1rem;
}

.field input.field-gap {
  margin-bottom: 0.5rem;
}

.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: #444;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.field select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  outline: none;
  cursor: pointer;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.custom-select-trigger:hover {
  border-color: #3a3a3a;
  background: #141414;
}

.custom-select.is-open {
  z-index: 10051;
}

.custom-select.is-open .custom-select-trigger {
  border-color: rgba(61, 255, 138, 0.45);
  background: #121612;
}

.custom-select-value {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-chevron {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.custom-select.is-open .custom-select-chevron {
  transform: rotate(-135deg) translateY(2px);
  border-color: var(--green);
}

.panel-translator,
.panel-translator .field,
.panel-translator .field-row {
  overflow: visible;
}

.lang-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface-2);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 2.25rem 0.65rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.lang-select:hover {
  border-color: #3a3a3a;
  background-color: #141414;
}

.lang-select:focus {
  border-color: rgba(61, 255, 138, 0.45);
  background-color: #121612;
}

.lang-select option {
  background: #0c0c0c;
  color: var(--text);
}

.translator-copy-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.copy-hint-inline {
  font-size: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.copy-hint-inline.is-visible {
  opacity: 1;
}

.copy-hint-inline.is-error {
  color: var(--red);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 10050;
  pointer-events: none;
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.custom-select.is-open .custom-select-dropdown {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-search-wrap {
  padding: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.custom-select-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  color: var(--text);
  font-size: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  outline: none;
}

.custom-select-search:focus {
  border-color: rgba(61, 255, 138, 0.45);
  background: #121612;
}

.custom-select-search::placeholder {
  color: var(--muted);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 10050;
  pointer-events: none;
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  max-height: 240px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.custom-select-dropdown .custom-select-menu {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  border: none;
  border-radius: 0 0 8px 8px;
  box-shadow: none;
  max-height: 220px;
  opacity: 0;
  visibility: hidden;
  transform: none;
  pointer-events: none;
}

.custom-select.is-open > .custom-select-menu {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select.is-open .custom-select-dropdown .custom-select-menu {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.custom-select-option {
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.custom-select-option:hover,
.custom-select-option:focus {
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.custom-select-option.is-selected {
  color: var(--green);
  background: rgba(61, 255, 138, 0.08);
}

.custom-select-option.is-selected:hover {
  background: rgba(61, 255, 138, 0.12);
}

.custom-select-option.is-hidden {
  display: none;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.btn:hover { border-color: #444; }

.btn-danger {
  border-color: #5a2a30;
  color: var(--red);
}

.btn-danger:hover {
  background: #1a0d0f;
}

.note {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.5;
}

.status {
  margin-top: 1rem;
  font-size: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  min-height: 1.25rem;
  color: var(--muted);
}

.status.ok { color: var(--green); }

.status.err { color: var(--red); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* malware tab */
.malware-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.35rem;
}

.malware-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.65rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.malware-card-icon {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  line-height: 0;
}

.malware-card-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--dim);
  fill: none;
  stroke-width: 1.5;
  opacity: 0.5;
}

.malware-card:hover {
  border-color: #333;
  background: var(--surface-2);
}

.malware-card-dl {
  cursor: pointer;
}

.malware-card-dl.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.malware-status.ok { color: var(--green); }

.malware-status.err { color: var(--red); }

.malware-code-btn {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  z-index: 1;
}

.malware-card .malware-status {
  margin-bottom: 0.65rem;
}

.modal-box-wide {
  max-width: min(920px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.code-view {
  margin: 0.75rem 0 0;
  padding: 1rem 1.1rem;
  max-height: min(60vh, 520px);
  overflow: auto;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #c8e6d0;
  white-space: pre;
  tab-size: 4;
}

.code-view code {
  font-family: inherit;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.policy-panel {
  margin-top: 1.5rem;
}

.policy-lead {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.policy-lead strong {
  color: var(--text);
  font-weight: 500;
}

.policy-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.policy-list li {
  margin-bottom: 0.45rem;
}

.policy-list li::marker {
  color: var(--green);
}

.policy-note {
  font-size: 0.82rem;
  color: var(--dim);
  font-family: "IBM Plex Mono", monospace;
  margin: 0;
}

/* webhook modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 480px;
  z-index: 1;
}

.modal-box h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.modal-desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal-error {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--red);
  min-height: 1.1rem;
  font-family: "IBM Plex Mono", monospace;
}

.btn-accent {
  border-color: var(--green);
  color: var(--green);
}

.btn-accent:hover {
  background: #0d1f14;
}

.field-hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1rem 0;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.check-row input {
  margin-top: 0.2rem;
  accent-color: var(--green);
}

.webhook-choice {
  border: none;
  margin: 0 0 1rem;
  padding: 0;
}

.webhook-choice legend {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.radio-row input {
  margin-top: 0.2rem;
  accent-color: var(--green);
}

.radio-row em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  margin-top: 0.15rem;
}

.radio-row.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#webhook-custom-wrap.hidden {
  display: none;
}

.settings-status {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  min-height: 1.1rem;
  font-family: "IBM Plex Mono", monospace;
}

.settings-status.ok {
  color: var(--green);
}

.settings-status.err {
  color: var(--red);
}

.malware-card h3 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.85rem;
  line-height: 1.3;
  padding-right: 2.25rem;
}

.malware-desc {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 1.25rem;
}

.malware-status {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  font-family: "IBM Plex Mono", monospace;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-soft);
}

.settings-block {
  max-width: 560px;
}

.account-masked {
  letter-spacing: 0.2em;
  font-family: "IBM Plex Mono", monospace;
}

.account-change-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.password-history-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.password-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.password-history-item:last-child {
  border-bottom: none;
}

.password-history-mask {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.15em;
  color: var(--text);
}

.password-history-date {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-lookups {
  min-height: 4rem;
}

.dashboard-lookup-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-lookup-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.2rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  align-items: center;
}

.dashboard-lookup-item:last-child {
  border-bottom: none;
}

.dashboard-lookup-type {
  color: var(--green);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.dashboard-lookup-query {
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  word-break: break-all;
}

.dashboard-lookup-detail {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-lookup-time {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.75rem;
}

.dashboard-lookup-link {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--green);
  text-decoration: none;
  font-size: 0.8rem;
}

.dashboard-lookup-link:hover {
  text-decoration: underline;
}

.settings-block .panel {
  margin-bottom: 1rem;
}

/* page transitions (sidebar nav) — fade only, no horizontal slide */
.main {
  transform: translateZ(0);
  backface-visibility: hidden;
}

@keyframes page-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes page-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.main.page-enter {
  animation: page-fade-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.main.page-leave {
  animation: page-fade-out 0.26s cubic-bezier(0.4, 0, 0.2, 1) both;
  pointer-events: none;
}

.nav-link {
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.osint-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.osint-filter input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--green);
  cursor: pointer;
}

.osint-summary {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2rem;
}

.osint-results {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 55vh;
  overflow-y: auto;
}

.osint-row {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.osint-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.osint-site {
  font-weight: 500;
  font-size: 0.9rem;
}

.osint-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.osint-found .osint-badge {
  color: var(--green);
  border-color: rgba(62, 255, 138, 0.35);
}

.osint-not_found .osint-badge {
  color: var(--dim);
}

.osint-error .osint-badge {
  color: var(--red);
}

.osint-link {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--green);
  word-break: break-all;
  text-decoration: none;
}

.osint-link:hover {
  color: #6affaa;
  text-decoration: underline;
}

.breach-source-block {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.breach-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.breach-source-title {
  margin: 0;
  font-size: 1rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
}

.breach-source-badge {
  font-size: 0.75rem;
  font-family: "IBM Plex Mono", monospace;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.breach-source-ok {
  color: #3dffa0;
  border-color: rgba(61, 255, 160, 0.35);
}

.breach-source-empty,
.breach-source-skipped {
  color: var(--muted);
}

.breach-source-error {
  color: #ff6b4a;
  border-color: rgba(255, 107, 74, 0.35);
}

.breach-record-card {
  padding: 0.85rem 0.95rem;
  margin-top: 0.65rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(61, 255, 138, 0.12);
  border-radius: 10px;
}

.breach-record-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.breach-record-source {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  color: #3dffa0;
}

.breach-record-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.breach-record-summary {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
}

.breach-record-fields {
  margin: 0;
}

.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-dataleak {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.5rem;
}

.dataleak-hero {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 1.5rem 1.25rem 1.25rem;
  margin-bottom: 0.5rem;
}

.dataleak-hero-inner {
  width: 100%;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.dataleak-hero-title {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
}

.dataleak-hero-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dataleak-search-shell {
  width: 100%;
  padding: 0.7rem 0.7rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(61, 255, 138, 0.22);
  background: rgba(10, 14, 12, 0.85);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(61, 255, 138, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.dataleak-search-main {
  width: 100%;
}

.dataleak-custom-select .custom-select-trigger {
  min-height: 52px;
  border-radius: 12px;
  font-size: 0.88rem;
  padding: 0.72rem 0.88rem;
  background: #0a0a0a;
  border-color: var(--border);
}

.dataleak-search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.6rem 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0a0a0a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dataleak-search-bar:focus-within {
  border-color: rgba(61, 255, 138, 0.4);
  box-shadow: 0 0 20px rgba(61, 255, 138, 0.08);
}

.dataleak-search-icon {
  flex-shrink: 0;
  color: var(--dim);
  display: flex;
  align-items: center;
}

.dataleak-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.dataleak-search-bar input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  padding: 0.8rem 0;
  position: relative;
  z-index: 2;
}

.dataleak-search-bar input:focus {
  outline: none;
}

.dataleak-search-bar input::placeholder {
  color: var(--dim);
  opacity: 0.85;
}

.dataleak-search-btn {
  flex-shrink: 0;
  min-height: 46px;
  padding: 0.62rem 2.35rem;
  border: none;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0a120e;
  cursor: pointer;
  background: var(--green);
  box-shadow: 0 4px 16px rgba(61, 255, 138, 0.25);
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.dataleak-search-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 22px rgba(61, 255, 138, 0.35);
  transform: translateY(-1px);
}

.dataleak-search-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.dataleak-search-bottom {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
}

.dataleak-bottom-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dataleak-type-select-wrap {
  width: 210px;
}

.dataleak-region-wrap {
  width: 190px;
  margin-top: 0;
}

.dataleak-region-wrap.is-hidden {
  display: none;
}

.dataleak-region-select {
  width: 100%;
}

.dataleak-region-select .custom-select-trigger {
  min-height: 48px;
  padding: 0.62rem 0.82rem;
  background: #0a0a0a;
  border-color: var(--border);
}

.dataleak-quota-line {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--dim);
  font-family: "IBM Plex Mono", monospace;
}

.nav-link.is-vip-hidden {
  display: none !important;
}

.dataleak-results-area {
  width: 100%;
  max-width: 880px;
  padding: 0 1.25rem 2rem;
}

.dataleak-results-area .status,
.dataleak-results-area .osint-summary {
  text-align: center;
}

.dataleak-results-section {
  margin-top: 1.25rem;
}

.dataleak-results-section.is-hidden {
  display: none;
}

.osint-results-compact .osint-row {
  padding: 0.55rem 0.65rem;
}

@media (max-width: 720px) {
  .dataleak-search-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .dataleak-type-select-wrap,
  .dataleak-region-select {
    width: 100%;
  }

  .dataleak-bottom-controls {
    width: 100%;
    flex-direction: column;
  }

  .dataleak-search-bar {
    padding: 0.55rem 0.55rem 0.55rem 0.85rem;
  }

  .dataleak-search-btn {
    min-height: 50px;
  }
}

.dataleak-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.dataleak-type-tab {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.dataleak-type-tab:hover {
  color: var(--text);
  border-color: rgba(61, 255, 138, 0.35);
}

.dataleak-type-tab.is-active {
  color: #0a120e;
  background: #3dffa0;
  border-color: #3dffa0;
  transform: translateY(-1px);
}

.dataleak-field .field,
.dataleak-field.field {
  margin-bottom: 0;
}

.dataleak-input-wrap {
  position: relative;
}

.dataleak-input-wrap input {
  width: 100%;
  position: relative;
  z-index: 1;
  background: transparent;
}

.dataleak-ph-ghost {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1.4rem;
  width: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
  text-align: left;
}

.dataleak-ph-ghost.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.dataleak-ph-text {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  line-height: 1.4rem;
  color: var(--dim);
  opacity: 0.85;
  white-space: nowrap;
}

.osint-open-link {
  display: inline-block;
  margin-top: 0.25rem;
}

.osint-open-wrap {
  margin-bottom: 0.5rem;
}

.osint-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.osint-section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 0.65rem;
  font-weight: 500;
}

.osint-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.osint-list-item {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  word-break: break-all;
}

.osint-list-row {
  display: grid;
  grid-template-columns: minmax(5rem, 8rem) 1fr auto;
  gap: 0.65rem;
  align-items: start;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-soft, #1a1a1a);
}

.osint-list-row:last-child {
  border-bottom: none;
}

.osint-list-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  word-break: break-word;
}

.osint-list-code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--green);
}

/* custom scrollbars — hide native everywhere; green pill from scrollbar.js */
* {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.custom-scroll-host {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.custom-scroll-host::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.custom-scrollbar-rail {
  position: fixed;
  z-index: 10050;
  width: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.custom-scrollbar-rail.is-visible {
  opacity: 0.85;
}

.custom-scrollbar-rail.is-visible.is-hovered,
.custom-scrollbar-rail.is-dragging {
  opacity: 1;
}

.custom-scrollbar-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1a3d24, #2a5c38);
  pointer-events: auto;
  cursor: grab;
  will-change: transform;
  transition: background 0.15s ease;
  transition-property: background;
}

.custom-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2a5c38, #3d8a52);
}

.custom-scrollbar-thumb.is-dragging {
  cursor: grabbing;
  background: linear-gradient(180deg, #2a5c38, #3d8a52);
}

body.custom-scroll-dragging {
  user-select: none;
}

.main.custom-scroll-host,
.sidebar.custom-scroll-host,
.main-builder-fill.custom-scroll-host,
.builder-workspace.custom-scroll-host,
.tool-page.custom-scroll-host {
  position: relative;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.custom-scroll-wrap {
  position: relative;
  width: 100%;
}

.custom-scroll-wrap textarea.custom-scroll-host {
  display: block;
  width: 100%;
}

textarea.custom-scroll-host,
.util-output.custom-scroll-host,
.code-view.custom-scroll-host,
.osint-results.custom-scroll-host,
pre.custom-scroll-host {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

textarea.custom-scroll-host::-webkit-scrollbar,
.util-output.custom-scroll-host::-webkit-scrollbar,
.code-view.custom-scroll-host::-webkit-scrollbar,
.osint-results.custom-scroll-host::-webkit-scrollbar,
pre.custom-scroll-host::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

/* malware builder — full page */
body.builder-page .layout {
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

body.builder-page .main-builder-fill {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  padding: 0.85rem 1rem 0.65rem;
  max-width: none;
}

body.builder-page .page-head-compact {
  flex-shrink: 0;
  margin-bottom: 0.65rem;
  align-items: center;
}

body.builder-page .page-head-compact h1 {
  font-size: 1.35rem;
  margin-bottom: 0.15rem;
}

body.builder-page .builder-head-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

body.builder-page .page-head-compact .builder-toolbar {
  margin: 0;
  flex-shrink: 0;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  height: 100%;
}

body.builder-page .builder-layout {
  min-height: 0;
}

body.builder-page .builder-panel,
body.builder-page .builder-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0.85rem 1rem;
}

.builder-panel h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.builder-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.builder-inventory {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.builder-inv-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0a0a0a;
  cursor: grab;
  user-select: none;
}

.builder-inv-item:hover {
  border-color: var(--green);
}

.builder-inv-item strong {
  display: block;
  font-size: 0.82rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--green);
}

.builder-inv-item span {
  font-size: 0.72rem;
  color: var(--muted);
}

.builder-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.builder-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.builder-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background:
    linear-gradient(#111 1px, transparent 1px),
    linear-gradient(90deg, #111 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #050505;
  overflow: auto;
}

.builder-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 2400px;
  height: 1600px;
  pointer-events: none;
}

.builder-edge {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  opacity: 0.85;
  pointer-events: none;
  transition: stroke 0.12s ease, opacity 0.12s ease;
}


.builder-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 22;
  pointer-events: stroke;
  cursor: pointer;
}

.builder-edge-hit:hover + .builder-edge,
.builder-edge.is-hover {
  stroke: var(--red);
  stroke-width: 3;
  opacity: 1;
}

.builder-edge-preview {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 8 6;
  opacity: 0.9;
  pointer-events: none;
  animation: builder-dash 0.5s linear infinite;
}

@keyframes builder-dash {
  to {
    stroke-dashoffset: -14;
  }
}

.builder-node {
  position: absolute;
  width: 200px;
  padding: 0.55rem 0.65rem 0.45rem;
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 2;
  cursor: grab;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.builder-node.is-dragging {
  cursor: grabbing;
  border-color: var(--green);
}

.builder-node-del {
  position: absolute;
  top: 4px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.builder-node-del:hover {
  color: var(--red);
}

.builder-node-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--green);
  padding-right: 1rem;
}

.builder-node-desc {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.builder-ports {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.45rem;
}

.builder-port {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--green);
  background: #000;
  padding: 0;
  cursor: crosshair;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.builder-port.is-active {
  border-color: #7fff9f;
  box-shadow: 0 0 0 4px rgba(62, 255, 128, 0.25);
  transform: scale(1.15);
}

.builder-port-in {
  margin-left: -14px;
}

.builder-port-out {
  margin-right: -14px;
}

.builder-status {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  min-height: 1.1rem;
  flex-shrink: 0;
  font-family: "IBM Plex Mono", monospace;
}

.builder-status.ok {
  color: var(--green);
}

.builder-status.err {
  color: var(--red);
}

@media (max-width: 900px) {
  body.builder-page .builder-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(140px, 28vh) 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-old(page-main),
  ::view-transition-new(page-main) {
    animation: none !important;
  }

  .main.page-enter,
  .main.page-leave {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 1rem;
}

.util-output {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  background: var(--panel-2, #0a0a0a);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  resize: vertical;
}

.util-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.util-dl dt {
  color: var(--muted);
  font-weight: 500;
}

.util-dl dd {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
}

.strength-meter {
  margin-top: 1rem;
}

.strength-meter-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.strength-meter-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.25s ease;
  width: 0;
}

.strength-meter-label {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.strength-very-weak { background: #c44; }
.strength-weak { background: #d86; }
.strength-fair { background: #ca4; }
.strength-good { background: #6c6; }
.strength-strong { background: var(--green, #3eff80); }

.main-ttt {
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.main-ttt .page-head-ttt {
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.panel-ttt {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding: 1rem 1.25rem 1.5rem;
}

.ttt-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ttt-game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2vmin, 1.25rem);
  width: 100%;
  max-width: min(100%, calc(100vh - 9rem), calc(100vw - 16rem), 72rem);
  min-height: 0;
  flex: 1 1 auto;
}

.ttt-prompt {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vmin, 1.5rem);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  line-height: 1.4;
}

.ttt-prompt-thinking {
  color: #7eb8ff;
}

.ttt-game-box {
  width: 100%;
  padding: clamp(1rem, 2.5vmin, 1.5rem);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 2vmin, 18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ttt-board-wrap {
  width: min(100%, 520px);
  margin: 0 auto;
}

.ttt-board-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
  aspect-ratio: 1;
  height: auto;
  max-height: min(calc(100vh - 14rem), 520px);
  container-type: size;
  container-name: ttt-board;
}

.ttt-board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(0.4rem, 2.5%, 0.75rem);
  width: 100%;
  height: 100%;
  z-index: 1;
}

.ttt-win-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ttt-win-line.is-visible {
  opacity: 1;
}

.ttt-win-line .ttt-win-stroke {
  stroke: #3dffa0;
  stroke-width: clamp(4px, 0.55vmin, 10px);
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(61, 255, 138, 0.65));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: ttt-win-draw 0.65s ease-out forwards;
}

@keyframes ttt-win-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.ttt-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: clamp(8px, 1.2vmin, 14px);
  color: var(--text);
  font-size: clamp(1.75rem, 24cqmin, 4rem);
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  padding: 0;
  box-sizing: border-box;
}

.ttt-cell:hover:not(:disabled):not(.ttt-cell-filled) {
  border-color: rgba(61, 255, 138, 0.45);
  background: #121612;
}

.ttt-cell:disabled {
  cursor: default;
}

.ttt-cell-x {
  color: #3dffa0;
}

.ttt-cell-o {
  color: #7eb8ff;
}

.ttt-cell-win {
  border-color: rgba(61, 255, 138, 0.7);
  background: rgba(61, 255, 138, 0.12);
  box-shadow: 0 0 20px rgba(61, 255, 138, 0.15);
}

.ttt-board-finished .ttt-cell:not(.ttt-cell-filled) {
  opacity: 0.45;
}

.ttt-result {
  margin: 0;
  min-height: 1.5em;
  font-size: clamp(1.1rem, 2.8vmin, 1.65rem);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

.ttt-result-x {
  color: #3dffa0;
}

.ttt-result-o {
  color: #7eb8ff;
}

.ttt-result-draw {
  color: var(--muted);
  font-weight: 500;
}

.ttt-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  font-size: clamp(0.88rem, 2vmin, 1.05rem);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.ttt-legend-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(1.5rem, 3vmin, 2rem);
  height: clamp(1.5rem, 3vmin, 2rem);
  margin-right: 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: clamp(0.85rem, 2vmin, 1.1rem);
  vertical-align: middle;
}

@media (max-width: 700px) {
  .main-ttt {
    overflow-y: auto;
  }

  .ttt-board-wrap {
    width: min(100%, 92vw);
  }

  .ttt-board-stage {
    max-height: min(calc(100vh - 16rem), 92vw);
  }

  .ttt-cell {
    font-size: clamp(1.5rem, 20vw, 3.25rem);
  }

  .ttt-game-center {
    max-width: 100%;
  }
}

.ttt-legend-x {
  color: #3dffa0;
  background: rgba(61, 255, 138, 0.1);
}

.ttt-legend-o {
  color: #7eb8ff;
  background: rgba(126, 184, 255, 0.1);
}

.main-snake {
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.main-snake .page-head-snake {
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.panel-snake {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 1.5rem;
  overflow: visible;
}

.snake-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.snake-game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2vmin, 1.25rem);
  width: 100%;
  max-width: min(100%, 560px);
}

.snake-prompt {
  margin: 0;
  font-size: clamp(1rem, 2.4vmin, 1.35rem);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

.snake-prompt-paused {
  color: #7eb8ff;
}

.snake-prompt-over {
  color: var(--muted);
}

.snake-game-box {
  width: 100%;
  padding: clamp(0.75rem, 2vmin, 1.25rem);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 2vmin, 18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.snake-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: min(calc(100vh - 16rem), 520px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.snake-canvas {
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(61, 255, 138, 0.2);
  touch-action: none;
  outline: none;
}

.snake-canvas:focus {
  border-color: rgba(61, 255, 138, 0.45);
  box-shadow: 0 0 0 2px rgba(61, 255, 138, 0.15);
}

.snake-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(8, 12, 10, 0.88);
  border-radius: 10px;
  text-align: center;
}

.snake-overlay.is-hidden {
  display: none;
}

.snake-overlay-title {
  margin: 0;
  font-size: 1.35rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  color: #3dffa0;
  letter-spacing: 0.06em;
}

.snake-overlay-hint {
  margin: 0;
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.snake-score {
  margin: 0;
  font-size: clamp(0.95rem, 2.2vmin, 1.15rem);
  font-family: "IBM Plex Mono", monospace;
  color: #3dffa0;
  text-align: center;
}

.snake-result {
  margin: 0;
  min-height: 1.4em;
  font-size: clamp(1rem, 2.4vmin, 1.3rem);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  text-align: center;
}

.snake-result-over {
  color: #ff6b4a;
}

.snake-controls {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0.35rem;
  user-select: none;
}

.snake-pad-row {
  display: flex;
  gap: 0.5rem;
}

.snake-pad-btn {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.snake-pad-btn:hover {
  border-color: rgba(61, 255, 138, 0.45);
  background: #121612;
}

@media (min-width: 900px) {
  .snake-controls {
    display: none;
  }
}

.main-pacman {
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.main-pacman .page-head-pacman {
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.panel-pacman {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 1.5rem;
  overflow: visible;
}

.pacman-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.pacman-game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2vmin, 1.25rem);
  width: 100%;
  max-width: 960px;
}

.pacman-prompt {
  margin: 0;
  font-size: clamp(1rem, 2.4vmin, 1.35rem);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

.pacman-prompt-over {
  color: var(--muted);
}

.pacman-prompt-hit {
  color: #ff6b4a;
}

.pacman-prompt-win {
  color: #3dffa0;
}

.pacman-game-box {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(0.75rem, 2vmin, 1.25rem);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 2vmin, 18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.pacman-canvas-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

.pacman-canvas {
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(61, 255, 138, 0.25);
  outline: none;
  touch-action: none;
}

.pacman-canvas:focus {
  border-color: rgba(61, 255, 138, 0.5);
  box-shadow: 0 0 0 2px rgba(61, 255, 138, 0.15);
}

.pacman-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(8, 12, 10, 0.9);
  border-radius: 10px;
  text-align: center;
}

.pacman-overlay.is-hidden {
  display: none;
}

.pacman-overlay-title {
  margin: 0;
  font-size: 1.35rem;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  color: #ffe066;
  letter-spacing: 0.06em;
}

.pacman-overlay-hint {
  margin: 0;
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.pacman-score {
  margin: 0;
  font-size: clamp(0.95rem, 2.2vmin, 1.15rem);
  font-family: "IBM Plex Mono", monospace;
  color: #3dffa0;
  text-align: center;
}

.pacman-lives {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 1.5rem;
}

.pacman-life {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: rgba(255, 216, 0, 0.2);
  border: 2px solid rgba(255, 216, 0, 0.35);
}

.pacman-life--active {
  background: #ffd800;
  border-color: #ffd800;
  box-shadow: 0 0 10px rgba(255, 216, 0, 0.45);
}

.pacman-life--spent {
  opacity: 0.35;
}

.pacman-result {
  margin: 0;
  min-height: 1.4em;
  font-size: clamp(1rem, 2.4vmin, 1.3rem);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  text-align: center;
}

.pacman-result-over {
  color: #ff6b4a;
}

.pacman-controls {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0.35rem;
  user-select: none;
}

.pacman-pad-row {
  display: flex;
  gap: 0.5rem;
}

.pacman-pad-btn {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pacman-pad-btn:hover {
  border-color: rgba(61, 255, 138, 0.45);
  background: #121612;
}

@media (min-width: 900px) {
  .pacman-controls {
    display: none;
  }
}
