/* ASCII.mastervb – site styles on top of Bootstrap 5.3 */
:root {
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --accent: #16a34a;
  --accent-ink: #15803d;
  --term-bg: #0b1020;
  --term-fg: #d1fae5;
  --paper: #ffffff;
  --paper-ink: #111827;
  --bs-primary: #15803d;
  --bs-primary-rgb: 21, 128, 61;
  --bs-link-color: #15803d;
  --bs-link-color-rgb: 21, 128, 61;
  --bs-link-hover-color: #166534;
}
[data-bs-theme="dark"] {
  --accent: #4ade80;
  --accent-ink: #86efac;
  --bs-body-bg: #0a0f1c;
  --bs-tertiary-bg: #111827;
  --bs-link-color: #4ade80;
  --bs-link-color-rgb: 74, 222, 128;
  --bs-link-hover-color: #86efac;
}
body { background: var(--bs-body-bg); }

.btn-primary {
  --bs-btn-bg: #15803d; --bs-btn-border-color: #15803d;
  --bs-btn-hover-bg: #166534; --bs-btn-hover-border-color: #166534;
  --bs-btn-active-bg: #14532d; --bs-btn-active-border-color: #14532d;
  --bs-btn-disabled-bg: #15803d; --bs-btn-disabled-border-color: #15803d;
}
.btn-outline-primary {
  --bs-btn-color: #15803d; --bs-btn-border-color: #15803d;
  --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d;
  --bs-btn-active-bg: #166534;
}
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #4ade80; --bs-btn-border-color: #4ade80; }
.form-range::-webkit-slider-thumb { background: var(--accent); }
.form-range::-moz-range-thumb { background: var(--accent); }
.form-check-input:checked { background-color: #15803d; border-color: #15803d; }
.nav-pills .nav-link.active { background: #15803d; }

.mono, code { font-family: var(--mono); }

/* Nav */
.site-nav { background: var(--bs-body-bg); position: sticky; top: 0; z-index: 1030; }
.brand { font-family: var(--mono); font-weight: 700; letter-spacing: -.02em; }
.brand-mark { color: var(--accent); }
.navbar .nav-link.active { color: var(--accent-ink); font-weight: 600; }
.theme-toggle { width: 2.25rem; }

/* ASCII output */
.ascii-out {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.15;
  white-space: pre;
  overflow: auto;
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--term-bg);
  color: var(--term-fg);
  border-radius: .5rem;
  tab-size: 4;
}
.output-pre { min-height: 320px; max-height: 70vh; border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius); }
.image-out.on-light { background: var(--paper); color: var(--paper-ink); }
.image-out.on-dark { background: var(--term-bg); color: #e5e7eb; }
.output-card .card-header { background: var(--bs-tertiary-bg); }
.output-card .card-body { display: flex; flex-direction: column; }
.output-card .output-pre { flex: 1 1 auto; }
.image-out { line-height: 1.2; }
.image-out.cs-blocks { line-height: 1; }
.zoom-inline { width: 90px; }

/* Hero */
.hero { padding: 3.5rem 0 2.5rem; background:
  radial-gradient(1200px 300px at 80% -10%, rgba(22,163,74,.10), transparent 60%), var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); }
.hero-out { min-height: 140px; font-size: 13px; }
.hero-try { background: var(--bs-tertiary-bg); padding: 1rem; border-radius: .75rem; border: 1px solid var(--bs-border-color); }

/* Tool pages */
.tool-head { padding: 2rem 0 1rem; }
.tool-title { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 700; }
.tool-lead { max-width: 52rem; color: var(--bs-secondary-color); font-size: 1.1rem; }
.tool-body { margin-bottom: 2rem; }
.control-card { border-color: var(--bs-border-color); }
.sticky-tools { position: sticky; top: 64px; z-index: 5; }
.content-body { margin-top: 1rem; }
.content-body h2 { font-weight: 700; }
.howto li { margin-bottom: .4rem; }
.faq .accordion-button { font-weight: 600; }

/* Cards */
.tool-card, .related-card {
  display: flex; text-decoration: none; color: inherit;
  border: 1px solid var(--bs-border-color); border-radius: .75rem; background: var(--bs-body-bg);
  transition: border-color .15s, transform .15s;
}
.tool-card { flex-direction: column; padding: 1.25rem; height: 100%; gap: .35rem; }
.tool-card:hover, .related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card-icon, .related-icon { font-family: var(--mono); font-weight: 700; color: var(--accent-ink); }
.tool-card-icon { font-size: 1.4rem; }
.tool-card-name { font-weight: 700; font-size: 1.1rem; }
.tool-card-desc { color: var(--bs-secondary-color); font-size: .9rem; }
.related-card { gap: .9rem; padding: .85rem 1rem; margin-bottom: .6rem; align-items: flex-start; }
.related-icon { min-width: 2.6rem; padding-top: .1rem; }

/* Font gallery */
.font-pre { font-size: 11px; min-height: 110px; border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius); }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
  border: 2px dashed var(--bs-border-color); border-radius: .75rem; padding: 1.5rem 1rem; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--accent); background: rgba(22,163,74,.06); }
.dropzone-icon { font-family: var(--mono); font-size: 1.5rem; color: var(--accent-ink); }

/* ASCII table */
.ascii-table { font-variant-numeric: tabular-nums; }
.ascii-table th { white-space: nowrap; font-size: .8rem; text-transform: uppercase; color: var(--bs-secondary-color); }
.ascii-table td[data-copy] { cursor: copy; }
.ascii-table td[data-copy]:hover { background: rgba(22,163,74,.10); }
.ascii-table td.copied { background: rgba(22,163,74,.30) !important; }
.ascii-char { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; text-align: center; min-width: 3rem; }

/* Ads keep their space so the page does not jump */
.ad-slot { margin: 1.5rem 0; min-height: 100px; }

.site-footer { background: var(--bs-tertiary-bg); }
.site-footer a { text-decoration: none; }

@media (max-width: 575.98px) {
  .output-pre { min-height: 220px; }
  .sticky-tools { top: 56px; }
  .ascii-out { padding: .75rem; }
}

/* ---------- Gallery ---------- */
.gallery-search { max-width: 640px; }
.cat-intro { max-width: 52rem; font-size: 1.05rem; color: var(--bs-secondary-color); margin-bottom: 1.25rem; }
.art-pre {
  font-family: var(--mono); line-height: 1.15; white-space: pre; margin: 0;
  background: var(--bs-tertiary-bg); color: var(--bs-body-color);
  overflow: hidden; padding: .75rem;
}
.art-card {
  border: 1px solid var(--bs-border-color); border-radius: .75rem; overflow: hidden; height: 100%;
  display: flex; flex-direction: column; background: var(--bs-body-bg); transition: border-color .15s;
}
.art-card:hover { border-color: var(--accent); }
.art-preview { display: block; text-decoration: none; color: inherit; flex: 1 1 auto; }
.art-preview .art-pre {
  height: 170px; display: flex; align-items: center; justify-content: center;
  -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent);
}
.art-preview .art-pre.one-line { -webkit-mask-image: none; mask-image: none; }
.art-meta { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-top: 1px solid var(--bs-border-color); }
.art-title { flex: 1 1 auto; min-width: 0; font-size: .875rem; font-weight: 600; color: inherit; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-title:hover { color: var(--accent-ink); text-decoration: underline; }
.cat-card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit;
  border: 1px solid var(--bs-border-color); border-radius: .75rem; overflow: hidden; transition: border-color .15s, transform .15s;
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cat-cover { height: 120px; display: flex; align-items: center; justify-content: center; }
.cat-name { font-weight: 700; padding: .7rem .9rem 0; }
.cat-count { font-size: .8rem; color: var(--bs-secondary-color); padding: 0 .9rem .8rem; }
.art-detail { min-height: 260px; max-height: 80vh; text-align: left; }
.art-facts dt { font-weight: 600; color: var(--bs-secondary-color); }
.art-facts dd { margin-bottom: .4rem; }
.pagination { --bs-pagination-active-bg: #15803d; --bs-pagination-active-border-color: #15803d; --bs-pagination-color: var(--bs-link-color); }

/* ---------- Fase 3 ---------- */
.dd-icon { display: inline-block; min-width: 2.6rem; font-family: var(--mono); font-size: .8rem; color: var(--accent-ink); }
.dropdown-item.active, .dropdown-item:active { background: #15803d; color: #fff; }
.dropdown-item.active .dd-icon { color: #fff; }
.io-area { font-family: var(--mono); font-size: .95rem; min-height: 180px; }
.opt-grid .form-label { margin-bottom: .2rem; }
.style-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.style-pick input { position: absolute; opacity: 0; }
.style-pick label {
  display: block; border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .4rem .5rem; cursor: pointer;
  font-size: .8rem; text-align: center; transition: border-color .15s, background .15s;
}
.style-pick label pre { font-family: var(--mono); font-size: 10px; line-height: 1.1; margin: 0 0 .25rem; color: var(--bs-body-color); }
.style-pick input:checked + label { border-color: var(--accent); background: rgba(22,163,74,.10); font-weight: 600; }
.style-pick input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.byte-table td, .byte-table th { font-family: var(--mono); font-size: .85rem; white-space: nowrap; }

/* ---------- Fase 4: animations ---------- */
.anim-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 340px; background: var(--term-bg); overflow: hidden;
}
.anim-stage canvas { display: block; max-width: 100%; }
.stage-msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #64748b; font-family: var(--mono); font-size: 13px; background: var(--term-bg);
}
.stage-msg[hidden] { display: none; }
.matrix-stage { height: 60vh; min-height: 320px; background: #000; }
.matrix-stage canvas { display: block; width: 100%; height: 100%; }
.matrix-stage:fullscreen { height: 100vh; }
.recorder .form-select, .recorder .form-control { font-size: .8rem; }
.home-group { color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
.form-control-color { height: calc(1.5em + .5rem + 2px); padding: .2rem; }

/* ---------- WhatsApp ---------- */
.wa-phone {
  --wa-mono: 13px;
  --wa-bg: #efeae2; --wa-top: #008069; --wa-top-ink: #fff; --wa-out: #d9fdd3; --wa-ink: #111b21; --wa-meta: #667781; --wa-input: #fff;
  width: 100%; max-width: 380px; margin: 0 auto; border-radius: 1.6rem; overflow: hidden;
  border: 8px solid #1f2937; box-shadow: 0 10px 30px rgba(0,0,0,.18); background: var(--wa-bg);
  display: flex; flex-direction: column; min-height: 420px;
}
.wa-phone[data-mode="web"] { max-width: 100%; border-radius: .6rem; border-width: 1px; border-color: var(--bs-border-color); box-shadow: none; }
.wa-phone[data-theme="dark"] { --wa-bg: #0b141a; --wa-top: #202c33; --wa-top-ink: #e9edef; --wa-out: #005c4b; --wa-ink: #e9edef; --wa-meta: #8696a0; --wa-input: #2a3942; }
.wa-top { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; background: var(--wa-top); color: var(--wa-top-ink); }
.wa-back { font-size: 1.4rem; line-height: 1; }
.wa-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #9ca3af, #6b7280); flex: none; }
.wa-who { display: flex; flex-direction: column; line-height: 1.15; }
.wa-name { font-weight: 600; font-size: .95rem; }
.wa-status { font-size: .72rem; opacity: .8; }
.wa-chat { flex: 1 1 auto; padding: 1rem .75rem; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; }
.wa-bubble {
  max-width: 86%; background: var(--wa-out); color: var(--wa-ink); border-radius: .55rem .1rem .55rem .55rem;
  padding: .35rem .55rem .25rem; box-shadow: 0 1px .5px rgba(11,20,26,.13); font-size: .92rem;
}
.wa-bubble-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-text { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wa-mono { font-family: var(--mono); font-size: var(--wa-mono); line-height: 1.25; }
.wa-meta { text-align: right; font-size: .68rem; color: var(--wa-meta); margin-top: .1rem; }
.wa-ticks { color: #53bdeb; letter-spacing: -.25em; }
.wa-input { margin: 0 .6rem .6rem; padding: .55rem .9rem; border-radius: 1.4rem; background: var(--wa-input); color: var(--wa-meta); font-size: .85rem; }
.wa-preview .btn-group .btn.active { background: #15803d; border-color: #15803d; color: #fff; }
.btn-success { --bs-btn-bg: #1fa855; --bs-btn-border-color: #1fa855; --bs-btn-hover-bg: #178a45; --bs-btn-hover-border-color: #178a45; }
.art-meta .btn { padding: .15rem .5rem; }
