/* Base64 Encoder / Decoder — self-contained, no dependencies. */
:root {
  color-scheme: light;
  --bg: #f4f5f8; --surface: #ffffff; --surface-2: #f6f7fb;
  --ink: #1a1c25; --muted: #475063; --faint: #5b6472; --line: #e4e6ef;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-soft: rgba(79,70,229,.10);
  --good: #06744a; --bad: #b91c1c;
  --shadow: 0 1px 2px rgba(20,24,40,.05), 0 10px 28px -14px rgba(20,24,40,.18);
  --mono: 'SF Mono','JetBrains Mono',ui-monospace,Menlo,Consolas,monospace;
  --sans: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,system-ui,sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0b0d13; --surface: #141822; --surface-2: #1a1f2b;
    --ink: #e8eaf2; --muted: #b7bccd; --faint: #99a1b3; --line: #262a38;
    --accent: #8d89f6; --accent-ink: #0b0d13; --accent-soft: rgba(141,137,246,.14);
    --good: #35c08a; --bad: #f0666b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 32px -16px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d13; --surface: #141822; --surface-2: #1a1f2b;
  --ink: #e8eaf2; --muted: #b7bccd; --faint: #99a1b3; --line: #262a38;
  --accent: #8d89f6; --accent-ink: #0b0d13; --accent-soft: rgba(141,137,246,.14);
  --good: #35c08a; --bad: #f0666b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 32px -16px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* must win over author display rules (.uu-field, .uu-name) */
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.pg-header {
  display: flex; align-items: center; gap: 16px; padding: 0 18px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.pg-brand { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.pg-logo { color: var(--accent); display: inline-flex; flex: 0 0 auto; }
.pg-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-header-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pg-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  cursor: pointer; text-decoration: none; transition: background .15s, color .15s;
}
.pg-icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-sun { display: none; } :root:not([data-theme="light"]) .icon-moon { display: inline; } }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: inline; }
:root[data-theme="light"] .icon-sun { display: inline; }
:root[data-theme="light"] .icon-moon { display: none; }

.b6-main { max-width: 860px; margin: 0 auto; padding: 24px 20px 56px; }
.b6-modebar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 16px; }
.b6-seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.b6-seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font-family: var(--sans);
  font-size: 14px; font-weight: 600; padding: 8px 20px; border-radius: 8px; cursor: pointer; }
.b6-seg button.active { background: var(--accent); color: var(--accent-ink); }
.b6-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.b6-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.b6-swap { margin-left: auto; appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-family: var(--sans); font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.b6-swap:hover { border-color: var(--accent); color: var(--accent); }

.b6-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.b6-label { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line); }
.b6-mini { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 7px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.b6-mini:hover { border-color: var(--accent); color: var(--accent); }
.b6-area { width: 100%; min-height: 150px; border: 0; background: transparent; color: var(--ink);
  font-family: var(--mono); font-size: 14px; line-height: 1.55; padding: 14px; resize: vertical; outline: none;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.b6-out { color: var(--ink); }
.b6-meta { padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface-2); font-family: var(--mono); font-size: 12px; color: var(--faint); }
.b6-meta:empty { display: none; }
.b6-status { min-height: 20px; margin: 14px 2px; font-family: var(--mono); font-size: 13px; }
.b6-status.err { color: var(--bad); }
.b6-status.ok { color: var(--good); }

.pg-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600; padding: 10px 18px;
  border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; box-shadow: var(--shadow);
}
.pg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* About — self-contained WCAG-AA palette */
.tool-about {
  --ab-bg: #ffffff; --ab-surface: #f6f7fb; --ab-text: #1a1c25;
  --ab-muted: #475063; --ab-faint: #5b6472; --ab-border: #e4e6ef; --ab-accent: #4f46e5;
  background: var(--ab-bg); color: var(--ab-text); border-top: 1px solid var(--ab-border);
  padding: 64px 24px 80px; font-size: 15px;
}
:root[data-theme="dark"] .tool-about {
  --ab-bg: #0f131a; --ab-surface: #1a1f2b; --ab-text: #e8eaf2;
  --ab-muted: #b7bccd; --ab-faint: #99a1b3; --ab-border: #262a38; --ab-accent: #8d89f6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tool-about { --ab-bg: #0f131a; --ab-surface: #1a1f2b; --ab-text: #e8eaf2;
    --ab-muted: #b7bccd; --ab-faint: #99a1b3; --ab-border: #262a38; --ab-accent: #8d89f6; }
}
.tool-about-inner { max-width: 860px; margin: 0 auto; line-height: 1.65; }
.tool-about h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: var(--ab-text); }
.tool-about code { font-family: var(--mono); font-size: 0.88em; background: var(--ab-surface); padding: 1px 6px; border-radius: 5px; color: var(--ab-text); }
.about-lede { font-size: 1.05rem; color: var(--ab-muted); margin-top: 14px; max-width: 68ch; }
.about-cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.about-btn { display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 10px; background: var(--ab-accent); color: #fff; text-decoration: none; font-weight: 600; font-size: 0.95rem; transition: transform .15s ease, box-shadow .15s ease; }
.about-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -6px var(--ab-accent); }
.about-btn.ghost { background: transparent; color: var(--ab-accent); border: 1px solid var(--ab-border); }
.about-btn:focus-visible, .about-links a:focus-visible, .about-faq summary:focus-visible { outline: 2px solid var(--ab-accent); outline-offset: 2px; border-radius: 6px; }
.about-highlight { margin: 40px 0; padding: 22px 24px; background: var(--ab-surface); border: 1px solid var(--ab-border); border-left: 4px solid var(--ab-accent); border-radius: 12px; }
.about-highlight h2 { font-size: 1.15rem; margin: 0 0 8px; color: var(--ab-text); }
.about-highlight p { color: var(--ab-muted); margin: 0; }
.about-h2 { font-size: 1.3rem; font-weight: 700; margin: 40px 0 16px; color: var(--ab-text); }
.about-features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2,1fr); gap: 12px 28px; }
.about-features li { position: relative; padding-left: 26px; color: var(--ab-muted); font-size: 0.95rem; }
.about-features li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: #15803d; font-weight: 700; }
:root[data-theme="dark"] .about-features li::before { color: #35c08a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .about-features li::before { color: #35c08a; } }
.about-features strong { color: var(--ab-text); }
.about-faq { display: flex; flex-direction: column; gap: 10px; }
.about-faq details { border: 1px solid var(--ab-border); border-radius: 10px; background: var(--ab-surface); overflow: hidden; }
.about-faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--ab-text); list-style: none; position: relative; }
.about-faq summary::-webkit-details-marker { display: none; }
.about-faq summary::after { content: "+"; position: absolute; right: 18px; color: var(--ab-accent); font-weight: 700; }
.about-faq details[open] summary::after { content: "\2013"; }
.about-faq details p { padding: 0 18px 16px; margin: 0; color: var(--ab-muted); }
.about-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.about-links li { color: var(--ab-muted); }
.about-links a { color: var(--ab-accent); font-weight: 600; text-decoration: none; }
.about-links a:hover { text-decoration: underline; }
.about-foot { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--ab-border); font-size: 0.9rem; color: var(--ab-faint); }
.about-foot a { color: var(--ab-accent); text-decoration: none; }
@media (max-width: 640px) { .about-features { grid-template-columns: 1fr; } .tool-about { padding: 48px 18px 64px; } }

/* UUID generator specifics */
.uu-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 16px; }
.uu-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.uu-field input[type="number"] { width: 72px; }
.uu-select, .uu-input, .uu-field input[type="number"] {
  font-family: var(--mono); font-size: 14px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface-2); color: var(--ink); outline: none;
}
.uu-select { font-family: var(--sans); cursor: pointer; }
.uu-select:focus, .uu-input:focus, .uu-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.uu-gen { margin-left: auto; appearance: none; border: 0; background: var(--accent); color: var(--accent-ink);
  font-family: var(--sans); font-size: 14px; font-weight: 600; padding: 9px 20px; border-radius: 10px; cursor: pointer; }
.uu-gen:hover { filter: brightness(1.05); }
.uu-name { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: -4px 0 16px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.uu-name .uu-grow { flex: 1 1 220px; }
.uu-name .uu-grow .uu-input { flex: 1 1 auto; min-width: 0; }
#nsCustom { flex: 1 1 200px; min-width: 0; }
.uuid-out { min-height: 220px; }
.uu-hint { font-size: 12.5px; color: var(--faint); margin: 12px 2px 0; }
