/* ============ tokens ============ */
:root{
  --bg: #0c0d0d;
  --bg-raised: #131515;
  --bg-card: #131515;
  --bg-card-hover: #171919;
  --border: #242727;
  --border-soft: #1a1c1c;
  --text: #e9ebe9;
  --text-dim: #98a09d;
  --text-dimmer: #7f8985;
  --accent: #22d3ee;
  --accent-ink: #06222a;
  --discord-color: #6f76e0;
  --varies-color: #d99a4e;
  --danger: #e2685c;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --max-w: 640px;
  --max-w-wide: 880px;
  --max-w-hub: 1280px;
  --sidebar-w: 200px;
  --header-h: 61px;
  --scroll-offset: 232px;
}

[data-theme="light"]{
  --bg: #f7f6f3;
  --bg-raised: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fbfaf7;
  --border: #dedad2;
  --border-soft: #e8e4dc;
  --text: #17191a;
  --text-dim: #565f5c;
  --text-dimmer: #656e6a;
  --accent: #0a7a8e;
  --accent-ink: #ffffff;
  --discord-color: #4752c4;
  --varies-color: #9a5a0e;
}

*{ box-sizing: border-box; min-width: 0; }
html{ color-scheme: dark; scroll-behavior: smooth; }
[data-theme="light"] html{ color-scheme: light; }

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ ambient background ============ */
/* Fixed, full-viewport layer sitting behind all content. Two parts:
   a very slow, low-opacity drifting glow (::before) and a faint static
   grid for texture (::after), faded out toward the edges so it never
   competes with text. Motion is disabled entirely under reduced-motion. */
.bg-fx{
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none; overflow: hidden;
}
.bg-fx::before{
  content: '';
  position: absolute; inset: -12%;
  background:
    radial-gradient(640px 640px at 18% 12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 62%),
    radial-gradient(720px 720px at 86% 78%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 62%),
    radial-gradient(520px 520px at 60% 45%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 65%);
  animation: bgDrift 46s ease-in-out infinite alternate;
  will-change: transform;
}
.bg-fx::after{
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 18%, black 35%, transparent 88%);
  mask-image: radial-gradient(ellipse 75% 55% at 50% 18%, black 35%, transparent 88%);
  opacity: .5;
}
@keyframes bgDrift{
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-2.5%, 2%) scale(1.05); }
}
[data-theme="light"] .bg-fx::before{ opacity: .7; }
[data-theme="light"] .bg-fx::after{ opacity: .35; }


a{ color: inherit; }
p{ margin: 0 0 1em; }

.skip-link{
  position:absolute; left:-999px; top:0;
  background: var(--accent); color: var(--accent-ink); padding:.6em 1em; z-index:200;
}
.skip-link:focus{ left:0; }

:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* keep anchor-jump targets from landing underneath the sticky header + sticky text input */
section[id], .tool-group[id], .panel[id]{
  scroll-margin-top: var(--scroll-offset);
}

/* text that must never overflow its box, however long or unbroken */
input, textarea, pre, code,
.style-preview, .output-text, .json-box, .intro-text, .section-note,
.template-card p, .compat-table td, .color-preview-box, .live-text-hint,
.tool-output, .embed-preview, .md-preview-box, .message-preview-box,
.ts-label, .ts-code, .role-pill, .popular-chip, .panel-sub, .panel-title,
.group-title, .ep-desc, .mp-content{
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ============ header ============ */
.site-header{
  position: sticky; top:0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner{
  max-width: 1280px; margin:0 auto;
  display:flex; align-items:center; gap: 24px;
  padding: 14px 20px;
}
.logo{ display:flex; align-items:center; gap:8px; text-decoration:none; flex-shrink:0; }
.logo-mark{
  display:grid; place-items:center; width:20px; height:20px;
  color: var(--accent); font-size:16px; line-height:1;
}
.logo-text{ font-family: var(--mono); font-weight:600; font-size:14.5px; letter-spacing:-.01em; }

.main-nav{ display:none; gap: 20px; font-size: 14px; color: var(--text-dim); }
.main-nav a{ text-decoration:none; }
.main-nav a:hover{ color: var(--text); }

.header-actions{ display:flex; align-items:center; gap:6px; margin-left:auto; }

.text-btn{
  background:none; border:none; color: var(--text-dim);
  font-size:13.5px; text-decoration:none; cursor:pointer; padding:6px 4px;
}
.text-btn:hover{ color: var(--accent); }
.support-link{ display:none; }
@media (min-width: 860px){ .support-link{ display:inline-flex; } }

/* smooth, restrained transitions for every small interactive control */
.icon-btn, .filter-pill, .fav-heart, .format-btn, .ansi-btn, .popular-chip,
.case-btn, .clear-btn, .embed-field-remove, .role-pill{
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.icon-btn{
  display:grid; place-items:center; gap:0;
  width: 32px; height:32px; border-radius:6px;
  border:1px solid transparent; background:transparent;
  color: var(--text-dim); cursor:pointer;
}
.icon-btn:hover{ color: var(--text); background: var(--bg-card-hover); }
.fav-btn{ width:auto; padding:0 8px; display:flex; flex-direction:row; gap:5px; font-family: var(--mono); font-size:12.5px; }

.mobile-menu{
  display:none; flex-direction:column;
  position: absolute; top: 100%; left:0; right:0;
  background: var(--bg); border-top: 1px solid var(--border-soft);
  padding: 6px 20px 12px; z-index: 95;
}
.mobile-menu.open{ display:flex; }
.mobile-menu a{
  padding: 12px 2px; text-decoration:none; color: var(--text);
  border-bottom: 1px solid var(--border-soft); font-size:15px;
}
.mobile-menu a:last-child{ border-bottom:none; }

@media (min-width: 860px){
  .main-nav{ display:flex; }
  .mobile-menu, #menu-toggle{ display:none; }
}

/* ============ intro ============ */
.intro{ max-width: var(--max-w); margin: 34px auto 0; padding: 0 20px; }
.intro-text{ color: var(--text-dim); font-size:15px; line-height:1.65; margin:0; max-width: 56ch; }

/* ============ shared panel ============ */
.panel{
  border:1px solid var(--border); background: var(--bg-card);
  border-radius: var(--radius-md); padding: 18px;
}

/* ============ live text ============ */
.live-text-wrap{
  max-width: var(--max-w); margin: 20px auto 0; padding: 0 20px;
  position: sticky; top: var(--header-h); z-index: 90;
}
.live-text-panel{ box-shadow: 0 10px 18px -14px rgba(0,0,0,.55); }
[data-theme="light"] .live-text-panel{ box-shadow: 0 10px 18px -14px rgba(0,0,0,.18); }
.panel-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom: 10px; }
.panel-label{ font-family: var(--mono); font-size:12px; letter-spacing:.03em; color: var(--text-dimmer); }
.char-count{ font-family: var(--mono); font-size:12px; color: var(--text-dimmer); }

.input-row{ position:relative; }
#live-input{
  width:100%; background: var(--bg); border:1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 12px 40px 12px 12px; font-size:15.5px; font-family: var(--sans);
}
#live-input:focus{ border-color: var(--accent); outline: none; }
.clear-btn{
  position:absolute; right:6px; top:50%; transform: translateY(-50%);
  width:26px; height:26px; border-radius:5px; border:none;
  background:transparent; color: var(--text-dimmer); cursor:pointer;
  display:grid; place-items:center;
}
.clear-btn:hover{ color: var(--text); background: var(--border-soft); }

.live-controls{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; flex-wrap:wrap; }
.case-group{ display:flex; gap:4px; }
.case-btn{
  border:1px solid var(--border); background: var(--bg);
  color: var(--text-dim); border-radius: 5px;
  min-width:36px; height:30px; padding: 0 10px; font-size:12px; cursor:pointer; font-family: var(--mono);
  white-space: nowrap;
}
.case-btn.active{ border-color: var(--accent); color: var(--accent); }
.size-group{ display:flex; align-items:center; gap:8px; flex:1; min-width:150px; max-width:220px; }
#size-range{ flex:1; accent-color: var(--accent); }
#size-label{ font-family: var(--mono); font-size:11.5px; color: var(--text-dimmer); width:38px; }

.live-text-hint{
  max-width: var(--max-w); margin: 10px auto 0; padding: 0 20px;
  color: var(--text-dimmer); font-size:12.5px;
}

/* ============ section chrome ============ */
.styles-section, .discord-tools, .text-tools, .color-lab, .presets-section, .shortcuts-section, .reference-section{
  max-width: var(--max-w); margin: 40px auto 0; padding: 0 20px;
}
.wide{ max-width: var(--max-w-wide); }
.hub{ max-width: var(--max-w-hub); }
/* Styles gets a bit more room than the shared hub width so the card wall
   can reach a comfortable 4th column on very wide screens. Scoped to just
   this section — Discord Tools keeps its existing width. */
.styles-section.hub{ max-width: 1400px; }
.section-head{ display:flex; align-items:baseline; gap:10px; margin-bottom: 6px; }
.section-title{ font-family: var(--sans); font-size: 21px; font-weight:700; margin: 0; letter-spacing:-.01em; }
.section-count{ font-family: var(--mono); font-size:12px; color: var(--text-dimmer); }
.section-note{ color: var(--text-dim); font-size:13.5px; line-height:1.6; margin: 0 0 18px; max-width: 62ch; }

/* ============ legend / filters / search ============ */
.legend{
  list-style:none; padding:0; margin: 0 0 16px;
  display:flex; flex-direction:column; gap:6px;
  font-size: 12.5px; color: var(--text-dimmer);
}
.legend li{ display:flex; align-items:center; gap:8px; }
.dot{ width:6px; height:6px; border-radius:999px; flex-shrink:0; }
.dot-discord{ background: var(--discord-color); }
.dot-unicode{ background: var(--accent); }
.dot-varies{ background: var(--varies-color); }

.filter-row{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }

/* ============ section sidebar + content layout ============ */
/* Mobile default: sidebar renders inline, above content, no grid — filter-row/group-nav
   keep their normal horizontal wrapping pill look, so nothing changes on small screens. */
.section-layout{ display:block; }
.sidebar-label{
  font-family: var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase;
  color: var(--text-dimmer); margin: 0 0 10px;
}
.section-sidebar .legend{ margin-top:18px; }

@media (min-width: 900px){
  .section-layout{
    display:grid; grid-template-columns: var(--sidebar-w) 1fr; gap: 32px; align-items:start;
  }
  .section-sidebar{ position: sticky; top: 76px; }
  .section-sidebar .filter-row, .section-sidebar .group-nav{
    flex-direction: column; flex-wrap: nowrap; gap:3px;
  }
  .section-sidebar .filter-pill{
    width:100%; text-align:left; border-radius: var(--radius-sm);
    border-color: transparent; padding: 9px 12px 9px 11px;
    border-left: 2px solid transparent;
  }
  .section-sidebar .filter-pill:hover{ background: var(--bg-card-hover); color: var(--text); }
  .section-sidebar .filter-pill.active{
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: transparent;
    border-left-color: var(--accent);
    color: var(--accent);
  }
}

.filter-pill{
  border:1px solid var(--border); background: transparent;
  color: var(--text-dim); border-radius:6px; padding:6px 12px;
  font-size:13px; cursor:pointer; font-family: var(--sans); text-decoration:none; display:inline-block;
}
.filter-pill:hover{ color: var(--text); }
.filter-pill.active{ border-color: var(--accent); color: var(--accent); }

.search-row{
  position:relative; display:flex; align-items:center;
  border:1px solid var(--border); background: var(--bg-card);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 20px;
}
.search-row:focus-within{ border-color: var(--accent); }
.search-icon{ color: var(--text-dimmer); flex-shrink:0; margin-right:8px; }
#search-input{ flex:1; background:transparent; border:none; color: var(--text); font-size:14.5px; min-width:0; }
#search-input:focus{ outline:none; }
.kbd{
  font-family: var(--mono); font-size:11px; color: var(--text-dimmer);
  border:1px solid var(--border); border-radius:4px; padding:2px 6px;
}
.results-empty{ color: var(--text-dim); font-size:14px; padding: 16px 0; }

/* ============ style cards ============ */
/* Self-sizing grid: each card gets a real minimum width, and the grid packs
   as many equal-width columns as actually fit — no fixed breakpoint jumps,
   no lonely last-row card, and it naturally collapses to one column on
   narrow/mobile screens without a separate mobile-specific rule. */
.card-grid{ display:grid; gap:12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.style-card{
  border:1px solid var(--border); background: var(--bg-card);
  border-radius: var(--radius-md); padding:16px;
  display:flex; flex-direction:column; gap:10px;
  min-width: 0;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.style-card:hover{ border-color: var(--text-dimmer); transform: translateY(-2px); box-shadow: 0 8px 18px -14px rgba(0,0,0,.5); }
.style-card.is-fav{ border-color: var(--accent); }

.card-top{ display:flex; justify-content:space-between; align-items:center; gap:8px; }
.card-meta{ display:flex; align-items:center; gap:7px; min-width:0; }
.kind-label{ font-family: var(--mono); font-size:10px; letter-spacing:.05em; color: var(--text-dimmer); text-transform: uppercase; flex-shrink:0; }
.badge{
  display:inline-flex; align-items:center; gap:5px;
  font-family: var(--mono); font-size:10px; letter-spacing:.02em;
  color: var(--text-dimmer); text-transform: lowercase; white-space:nowrap;
}
.badge::before{ content:''; width:6px; height:6px; border-radius:999px; background: currentColor; flex-shrink:0; }
.badge.discord{ color: var(--discord-color); }
.badge.unicode{ color: var(--accent); }
.badge.varies{ color: var(--varies-color); }

.fav-heart{
  width:26px; height:26px; border-radius:5px; border:none;
  background: transparent; color: var(--text-dimmer); cursor:pointer;
  display:grid; place-items:center; flex-shrink:0;
}
.fav-heart:hover{ color: var(--text); }
.fav-heart.active{ color: var(--accent); }
.fav-heart svg{ width:14px; height:14px; }

.style-name{ font-size:14.5px; font-weight:600; margin:0; }
.style-desc{ color: var(--text-dim); font-size:12.5px; margin:0; margin-top:-6px; }

.style-preview{
  font-family: var(--sans); font-size: 17px; line-height:1.45;
  color: var(--text); min-height: 1.4em; overflow: hidden;
}
.style-preview.mono-preview{ font-family: var(--mono); font-size:14px; }

.card-bottom{
  display:flex; justify-content:space-between; align-items:center;
  border-top:1px solid var(--border-soft); padding-top:10px; margin-top:2px; gap:8px;
}
.preview-chars{ font-family: var(--mono); font-size:11px; color: var(--text-dimmer); flex-shrink:0; }

/* ============ buttons ============ */
.btn-solid, .btn-outline, .copy-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border-radius: var(--radius-sm); padding: 9px 14px;
  font-weight:600; font-size:13.5px; cursor:pointer; font-family: var(--sans);
  border: 1px solid transparent;
  transition: opacity .16s ease, transform .16s ease, border-color .16s ease, color .16s ease, background-color .16s ease;
}
.btn-solid:active, .btn-outline:active, .copy-btn:active{ transform: translateY(0); }
.copy-btn{ background: var(--accent); color: var(--accent-ink); }
.copy-btn:hover{ opacity:.9; transform: translateY(-1px); }
.copy-btn.copied{ background:#4ade80; }
.copy-btn.small{ padding:6px 11px; font-size:12px; }

.btn-solid{ background: var(--accent); color: var(--accent-ink); width:100%; }
.btn-solid:hover{ opacity:.9; transform: translateY(-1px); }
.btn-discord{ background: #5865f2; color:#fff; }   /* Discord's own blurple: 4.6:1 with white text */

.btn-outline{
  background: transparent; border-color: var(--border); color: var(--text-dim);
}
.btn-outline:hover{ color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.btn-outline.small{ padding:6px 11px; font-size:12px; margin-top:10px; }

/* ============ discord lab ============ */
.color-lab .panel{ margin-bottom: 14px; }
.panel-title{ font-size:15px; font-weight:700; margin: 0 0 12px; }
.panel-title.small{ font-size:14px; margin:0; }
.panel-sub{ color: var(--text-dim); font-size:13px; margin: -6px 0 14px; }
.panel-head-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; }

.format-grid{ display:grid; grid-template-columns: repeat(2, 1fr); gap:6px; margin-bottom:14px; }
@media (min-width: 520px){ .format-grid{ grid-template-columns: repeat(3, 1fr); } }
.format-btn{
  border:1px solid var(--border); background: transparent; color: var(--text-dim);
  border-radius: 6px; padding:9px 8px; font-size:12.5px; cursor:pointer; font-family: var(--sans);
  text-align:center;
}
.format-btn:hover{ color: var(--text); }
.format-btn.active{ border-color: var(--accent); color: var(--accent); }

.output-box{
  border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 12px; overflow: hidden;
}
.output-label{ display:block; font-family: var(--mono); font-size:10px; letter-spacing:.06em; text-transform:uppercase; color: var(--text-dimmer); margin-bottom:6px; }
.output-text{ font-family: var(--mono); font-size: 13.5px; color: var(--text); white-space: pre-wrap; margin:0; }

.template-grid{ display:grid; gap:8px; margin-bottom:14px; }
.template-card{
  border:1px solid var(--border); border-radius: var(--radius-sm); padding:12px 14px;
  display:block; cursor:pointer; background: transparent; text-align:left; width:100%; font-family: var(--sans);
  color: var(--text); min-width:0;
  transition: border-color .16s ease, background-color .16s ease;
}
.template-card:hover{ border-color: var(--text-dimmer); background: var(--bg-card-hover); }
.template-card.active{ border-color: var(--accent); }
.template-card h4{ margin:0 0 3px; font-size:14px; font-weight:600; }
.template-card p{ margin:0; color: var(--text-dim); font-size:12.5px; }

.selected-template-box{ border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); padding: 12px; overflow:hidden; }
.selected-template-box .output-text{ color: var(--text-dim); font-size:13px; line-height:1.6; }

.ansi-swatches{ display:grid; grid-template-columns: repeat(2, 1fr); gap:6px; margin-bottom:12px; }
@media (min-width:520px){ .ansi-swatches{ grid-template-columns: repeat(3, 1fr); } }
.ansi-btn{
  display:flex; align-items:center; gap:8px; border:1px solid var(--border);
  background: transparent; color: var(--text-dim); border-radius:6px; padding:8px 10px;
  font-size:12.5px; cursor:pointer; font-family: var(--sans);
}
.ansi-btn .swatch-dot{ width:10px; height:10px; border-radius:999px; flex-shrink:0; }
.ansi-btn.active{ border-color: var(--accent); color: var(--text); }

/* ============ color lab ============ */
.color-lab-grid{ display:grid; gap:14px; grid-template-columns: 1fr; }
@media (min-width: 860px){ .color-lab-grid{ grid-template-columns: 1fr 1fr; align-items:start; } }

.palette-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:8px; margin-bottom:18px; }
.palette-card{
  border:1px solid var(--border); border-radius: var(--radius-sm); padding:11px;
  background: transparent; cursor:pointer; text-align:left; font-family: var(--sans);
  color: var(--text); display:flex; flex-direction:column; gap:8px;
  transition: border-color .16s ease, background-color .16s ease;
}
.palette-card:hover{ border-color: var(--text-dimmer); background: var(--bg-card-hover); }
.palette-card.active{ border-color: var(--accent); }
.palette-swatches{ display:flex; gap:5px; }
.palette-swatches span{ width:18px; height:18px; border-radius:4px; border:1px solid var(--border-soft); }
.palette-card-name{ font-size:12.5px; font-weight:600; }

.color-field{ margin-bottom:12px; }
.color-field label{ display:block; font-family: var(--mono); font-size:10px; letter-spacing:.05em; text-transform:uppercase; color: var(--text-dimmer); margin-bottom:5px; }
.color-input-row{ display:flex; align-items:center; gap:8px; border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); padding: 7px 10px; }
.color-input-row:focus-within{ border-color: var(--accent); }
.color-input-row input[type="color"]{ width:22px; height:22px; border-radius:4px; border:1px solid var(--border-soft); padding:0; background:none; cursor:pointer; flex-shrink:0; }
.color-input-row input[type="text"]{ flex:1; background:transparent; border:none; color: var(--text); font-family: var(--mono); font-size:13px; min-width:0; }
.color-input-row input[type="text"]:focus{ outline:none; }

.contrast-pill{ font-family: var(--mono); font-size:11px; padding:3px 9px; border-radius:5px; border:1px solid #3fae72; color:#5cd68f; }
.contrast-pill.low{ border-color: var(--danger); color: var(--danger); }
.contrast-pill.mid{ border-color: var(--varies-color); color: var(--varies-color); }

.color-preview-box{ border-radius: var(--radius-sm); padding: 28px 18px; text-align:center; font-size:19px; line-height:1.4; margin-bottom:14px; overflow:hidden; }
.color-lab-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* ============ presets ============ */
.json-box{
  border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding:12px 14px; font-family: var(--mono); font-size:12px; color: var(--text-dim);
  overflow-x:auto; max-height: 240px; overflow-y:auto; margin: 0 0 14px; white-space: pre-wrap;
}
.preset-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* ============ shortcuts ============ */
.shortcuts-section{ margin-top: 40px; }
.shortcut-list{ list-style:none; padding:0; margin:0; border:1px solid var(--border); border-radius: var(--radius-md); }
.shortcut-list li{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding: 13px 16px; border-bottom:1px solid var(--border-soft); font-size:13.5px; }
.shortcut-list li:last-child{ border-bottom:none; }
.kbd-pair{ display:flex; align-items:center; gap:3px; color: var(--text-dimmer); font-size:12px; flex-shrink:0; }

/* ============ reference (collapsed) ============ */
.reference-section{ margin: 32px auto 0; }
.reference-details summary{
  cursor:pointer; font-size:13px; color: var(--text-dimmer);
  padding: 10px 0; list-style: none; user-select:none;
}
.reference-details summary::-webkit-details-marker{ display:none; }
.reference-details summary::before{ content:'▸ '; }
.reference-details[open] summary::before{ content:'▾ '; }
.reference-details summary:hover{ color: var(--text-dim); }
.compat-table-wrap{ overflow-x: auto; border:1px solid var(--border); border-radius: var(--radius-sm); margin-top:10px; }
.compat-table{ width:100%; border-collapse: collapse; font-size: 12.5px; min-width: 480px; }
.compat-table th{ text-align:left; font-weight:600; font-size:11.5px; padding: 10px 12px; border-bottom:1px solid var(--border); color: var(--text-dim); }
.compat-table td{ padding: 9px 12px; border-bottom:1px solid var(--border-soft); color: var(--text-dimmer); vertical-align: top; }
.compat-table tr:last-child td{ border-bottom:none; }
.compat-table td.name-cell{ color: var(--text); font-weight:500; }

/* ============ footer ============ */
.site-footer{ border-top:1px solid var(--border-soft); margin-top:56px; }
.footer-inner{ max-width: 1280px; margin:0 auto; padding: 24px 20px 40px; }
.footer-brand-name{ font-family: var(--mono); font-weight:600; font-size:14px; margin:0 0 4px; }
.footer-tagline{ color: var(--text-dimmer); font-size:12.5px; margin:0 0 8px; }
.footer-links{ display:flex; gap:18px; flex-wrap:wrap; }
.footer-support-link{ color: var(--accent); text-decoration:none; font-size:13px; }
.footer-support-link:hover{ text-decoration: underline; }

/* ============ toast ============ */
.toast{
  position: fixed; left:50%; bottom:24px; transform: translate(-50%, 12px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius-sm); font-size:13px; font-weight:600;
  width:max-content; max-width:calc(100vw - 32px); text-align:center; overflow-wrap:anywhere;
  opacity:0; pointer-events:none; transition: opacity .15s ease, transform .15s ease;
  z-index: 300;
}
.toast[popover]{ inset:auto; margin:0; border:0; left:50%; bottom:24px; overflow:visible; }
.toast[popover]:not(:popover-open){ display:none; }
.toast.show{ opacity:1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
  html{ scroll-behavior: auto; }
  .bg-fx::before{ animation: none !important; }
}

/* ============ discord tools ============ */
.discord-tools .panel{ display:flex; flex-direction:column; }
.tool-grid{ display:grid; gap:14px; grid-template-columns: 1fr; }
@media (min-width: 640px){ .tool-grid{ grid-template-columns: 1fr 1fr; } }
@media (min-width: 1320px){ .tool-grid{ grid-template-columns: 1fr 1fr 1fr; } }

.group-nav{ display:flex; gap:6px; flex-wrap:wrap; margin: 4px 0 26px; }
.group-nav-pill{ text-decoration:none; }

.tool-group{ margin-top: 30px; }
.tool-group:first-of-type{ margin-top: 0; }
.group-title{
  font-size:15px; font-weight:700; margin: 0 0 12px;
  display:flex; align-items:center; gap:9px;
}
.group-title::before{ content:''; width:3px; height:14px; background: var(--accent); border-radius:2px; flex-shrink:0; }

.text-input{
  width:100%; background: var(--bg); border:1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size:13.5px; font-family: var(--sans); margin-bottom:10px;
}
.text-input:focus{ border-color: var(--accent); outline:none; }
.text-input.textarea{ resize: vertical; font-family: var(--mono); line-height:1.5; }
.select-input{ margin-bottom:0; cursor:pointer; }

.tool-output{
  border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--mono); font-size:12.5px; color: var(--text-dim);
  display:flex; flex-direction:column; gap:5px; min-height: 20px;
}
.tool-output .row{ display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.tool-output .row span:first-child{ color: var(--text-dimmer); flex-shrink:0; }
.tool-output .row span:last-child{ color: var(--text); text-align:right; }
.tool-output .err{ color: var(--danger); }
.tool-output .copy-link{ background:none; border:none; color: var(--accent); font-family: var(--mono); font-size:11.5px; cursor:pointer; padding:0; text-align:left; }
.tool-output .copy-link:hover{ text-decoration: underline; }
.tool-output img.emoji-preview{ width:32px; height:32px; margin-top:4px; }

.timestamp-grid{ display:grid; gap:6px; }
.ts-row{
  display:flex; justify-content:space-between; align-items:flex-start; gap:10px;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  cursor:pointer; background: var(--bg); text-align:left; width:100%; font-family: var(--sans); color: var(--text);
  transition: border-color .16s ease;
}
.ts-row:hover{ border-color: var(--accent); }
.ts-row .ts-label{ font-size:12.5px; color: var(--text-dim); line-height:1.5; flex:1; min-width:0; }
.ts-row .ts-label strong{ color: var(--text); }
.ts-row .ts-code{ font-family: var(--mono); font-size:12px; color: var(--accent); flex-shrink:0; white-space:nowrap; padding-top:2px; }
@media (max-width: 420px){
  .ts-row{ flex-direction:column; }
  .ts-row .ts-code{ padding-top:0; }
}

.checkbox-row{ display:flex; align-items:center; gap:7px; font-size:12.5px; color: var(--text-dim); margin-bottom:10px; }
.checkbox-row input{ accent-color: var(--accent); }

.length-bars{ display:flex; flex-direction:column; gap:8px; }
.length-bar-item{ font-size:12px; color: var(--text-dim); }
.length-bar-track{ height:5px; border-radius:99px; background: var(--border-soft); margin-top:4px; overflow:hidden; }
.length-bar-fill{ height:100%; background: var(--accent); border-radius:99px; }
.length-bar-fill.over{ background: var(--danger); }

.perm-integer-row{ margin-bottom:6px; }
.perm-grid{ display:grid; grid-template-columns: 1fr; gap:2px; max-height: 260px; overflow-y:auto; border:1px solid var(--border); border-radius: var(--radius-sm); padding:8px 10px; }
@media (min-width: 460px){ .perm-grid{ grid-template-columns: 1fr 1fr; } }
.perm-item{ display:flex; align-items:center; gap:7px; font-size:12px; color: var(--text-dim); padding:4px 0; }
.perm-item input{ accent-color: var(--accent); flex-shrink:0; }

.cdn-form .cdn-selects{ display:flex; gap:8px; margin-bottom:10px; }
.cdn-form .cdn-selects select{ flex:1; }

/* ============ discord tools: expanded ============ */
.span-2{ grid-column: span 1; }
@media (min-width: 640px){ .tool-grid .span-2{ grid-column: span 2; } }

/* timestamp builder */
.ts-preset-row{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px; }

/* role color preview */
.role-preview-row{ margin: 4px 0 10px; }
.role-pill{
  display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600;
  padding: 5px 10px; border-radius: var(--radius-sm); background: var(--bg);
  border: 1px solid var(--border);
}
.role-pill::before{ content:'#'; opacity:.6; }

/* embed builder */
.embed-form{ display:flex; flex-direction:column; }
.embed-section-label{
  font-family: var(--mono); font-size:10.5px; letter-spacing:.06em; text-transform:uppercase;
  color: var(--text-dimmer); margin: 16px 0 8px;
}
.embed-section-label:first-child{ margin-top:0; }
.embed-section-label.no-margin{ margin:0; }
.optional-tag{ text-transform:none; letter-spacing:0; opacity:.7; }

.embed-fields-head{ display:flex; align-items:center; justify-content:space-between; margin: 16px 0 10px; }
.embed-fields-list{ display:flex; flex-direction:column; gap:10px; margin-bottom: 8px; }
.embed-field-row{
  border:1px solid var(--border-soft); border-radius: var(--radius-sm); padding:8px;
  display:flex; flex-direction:column; gap:6px;
}
.field-inputs{ display:flex; gap:6px; align-items:flex-start; }
.field-inputs .text-input{ margin-bottom:0; }
.field-inputs .field-name{ flex: 1; }
.field-inputs .field-value{ flex: 2; }
@media (max-width: 460px){
  .field-inputs{ flex-wrap:wrap; }
  .field-inputs .field-name, .field-inputs .field-value{ flex: 1 1 100%; }
}
.field-controls{ display:flex; align-items:center; gap:8px; }
.field-inline-toggle{ display:flex; align-items:center; gap:5px; font-size:11.5px; color: var(--text-dim); margin-right:auto; }
.field-inline-toggle input{ accent-color: var(--accent); }
.field-move, .embed-field-remove{
  border:1px solid var(--border); background: transparent; color: var(--text-dimmer);
  border-radius: var(--radius-sm); width:28px; height:28px; flex-shrink:0; cursor:pointer; font-size:11px;
  transition: color .15s ease, border-color .15s ease;
}
.field-move:hover{ color: var(--accent); border-color: var(--accent); }
.field-move:disabled{ opacity:.35; cursor:default; }
.field-move:disabled:hover{ color: var(--text-dimmer); border-color: var(--border); }
.embed-field-remove:hover{ color: var(--danger); border-color: var(--danger); }

/* two-panel layout */
.embed-builder-grid{ display:grid; grid-template-columns: 1fr; gap:20px; margin-top:14px; }
@media (min-width: 860px){
  .embed-builder-grid{ grid-template-columns: 1fr 1fr; align-items:start; }
  .embed-editor-col{ max-height: 74vh; overflow-y:auto; padding-right:6px; }
  .embed-preview-col{ position: sticky; top: calc(var(--header-h) + 12px); }
}

.embed-warnings{
  border:1px solid color-mix(in srgb, var(--varies-color) 45%, var(--border));
  background: color-mix(in srgb, var(--varies-color) 8%, transparent);
  border-radius: var(--radius-sm); padding: 8px 12px; margin: 14px 0;
  font-size:11.5px; color: var(--varies-color); line-height:1.6;
}
.embed-warnings ul{ margin:0; padding-left:18px; }

.embed-actions{ display:flex; gap:8px; flex-wrap:wrap; margin: 14px 0; }
.embed-actions .btn-solid{ width:auto; flex: 1 1 160px; }

.embed-json-details summary{
  cursor:pointer; font-family: var(--mono); font-size:12px; color: var(--text-dimmer);
  padding: 6px 0; list-style:none; user-select:none;
}
.embed-json-details summary::-webkit-details-marker{ display:none; }
.embed-json-details[open] summary{ margin-bottom:8px; }

.embed-live-message{ display:flex; gap:10px; }

.embed-preview-label{ margin-top: 14px; }
.embed-preview{
  border-left: 4px solid var(--accent); background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px; margin-top: 8px; font-size:13.5px; line-height:1.5;
}
.embed-preview:empty::before{ content:'Fill in the form to see a preview.'; color: var(--text-dimmer); font-size:13px; }
.embed-preview .ep-author{ display:flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; color: var(--text-dim); margin-bottom:4px; }
.embed-preview .ep-author-icon{ width:18px; height:18px; border-radius:50%; object-fit:cover; }
.embed-preview .ep-title{ font-size:15px; font-weight:700; color: var(--text); margin-bottom:4px; }
.embed-preview .ep-title a{ color: inherit; text-decoration:none; }
.embed-preview .ep-title a:hover{ text-decoration:underline; }
.embed-preview .ep-desc{ color: var(--text-dim); margin-bottom:8px; white-space:pre-wrap; overflow-wrap:anywhere; }
.embed-preview .ep-fields{ display:grid; grid-template-columns: 1fr 1fr; gap:8px; margin-bottom:8px; }
.embed-preview .ep-fields.ep-fields-stack{ grid-template-columns: 1fr; }
.embed-preview .ep-field{ min-width:0; }
.embed-preview .ep-field-name{ font-weight:600; font-size:12.5px; color: var(--text); overflow-wrap:anywhere; }
.embed-preview .ep-field-value{ font-size:12.5px; color: var(--text-dim); overflow-wrap:anywhere; }
.embed-preview .ep-thumb, .embed-preview .ep-image{ max-width:100%; border-radius: var(--radius-sm); margin-bottom:8px; display:block; }
.embed-preview .ep-thumb{ max-width:80px; float:right; margin-left:10px; }
.embed-preview .ep-footer{ display:flex; align-items:center; gap:6px; font-size:11.5px; color: var(--text-dimmer); clear:both; }
.embed-preview .ep-footer-icon{ width:16px; height:16px; border-radius:50%; object-fit:cover; }

/* markdown preview */
.md-preview-box{
  border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size:14px; line-height:1.6; min-height: 40px;
}
.md-preview-box strong{ font-weight:700; }
.md-preview-box em{ font-style: italic; }
.md-preview-box del{ text-decoration: line-through; }
.md-preview-box u{ text-decoration: underline; }
.md-preview-box code{ font-family: var(--mono); background: var(--border-soft); padding:1px 5px; border-radius:4px; font-size:0.9em; }
.md-preview-box pre{ font-family: var(--mono); background: var(--border-soft); padding:8px 10px; border-radius: var(--radius-sm); overflow-x:auto; margin: 6px 0; }
.md-preview-box .spoiler{ background: var(--border-soft); color: transparent; border-radius:3px; cursor:pointer; }
.md-preview-box .spoiler.revealed{ color: var(--text); background: transparent; }
.md-preview-box blockquote{ border-left:3px solid var(--border); margin:4px 0; padding-left:10px; color: var(--text-dim); }

/* mention formatter */
.mention-form{ display:flex; gap:8px; }
.mention-form select{ flex: 0 0 110px; }
.mention-form input{ flex:1; margin-bottom:0; }
.mention-form select{ margin-bottom:0; }

/* message preview */
.message-preview-box{
  border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding: 12px 14px; display:flex; gap:10px;
}
.mp-avatar{
  width:38px; height:38px; border-radius:50%; background: var(--accent); color: var(--accent-ink);
  display:grid; place-items:center; font-weight:700; font-size:14px; flex-shrink:0;
}
.mp-body{ flex:1; min-width:0; }
.mp-head{ display:flex; align-items:baseline; gap:8px; margin-bottom:3px; }
.mp-username{ font-weight:600; font-size:14px; }
.mp-time{ font-size:11px; color: var(--text-dimmer); }
.mp-content{ font-size:14px; line-height:1.5; }
.mp-embed-wrap{ margin-top:8px; }

/* invite lookup */
#invite-lookup-btn{ margin-bottom:12px; }

/* ============ popular row + tool search ============ */
.popular-row{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin: 4px 0 16px; }
.popular-label{ font-family: var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color: var(--text-dimmer); margin-right:2px; }
.popular-chip{
  display:inline-flex; align-items:center; gap:6px; text-decoration:none;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding:7px 12px;
  font-size:12.5px; color: var(--text-dim); background: var(--bg-card);
}
.popular-chip:hover{ border-color: var(--accent); color: var(--text); }

.tool-search-row{
  position:relative; display:flex; align-items:center;
  border:1px solid var(--border); background: var(--bg-card);
  border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px;
}
.tool-search-row:focus-within{ border-color: var(--accent); }
.tool-search-row .search-icon{ color: var(--text-dimmer); flex-shrink:0; margin-right:8px; }
#tool-search-input{ flex:1; background:transparent; border:none; color: var(--text); font-size:14px; min-width:0; }
#tool-search-input:focus{ outline:none; }

.featured-panel{ border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* ============ timestamp builder ============ */
.ts-controls-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin: 12px 0; flex-wrap:wrap; }

/* ============ timezone comparison ============ */
.ts-tz-compare{ margin-bottom: 16px; }
.ts-tz-label{ margin: 0 0 8px; }
.tz-search-wrap{ position: relative; margin-bottom: 10px; }
.tz-search-row{
  display:flex; align-items:center; gap:8px;
  border:1px solid var(--border); background: var(--bg);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.tz-search-row:focus-within{ border-color: var(--accent); }
.tz-search-row .search-icon{ color: var(--text-dimmer); flex-shrink:0; }
#tz-search-input{ flex:1; background:transparent; border:none; color: var(--text); font-size:13.5px; min-width:0; }
#tz-search-input:focus{ outline:none; }

.tz-search-results{
  position:absolute; left:0; right:0; top: calc(100% + 4px); z-index: 20;
  border:1px solid var(--border); background: var(--bg-card); border-radius: var(--radius-sm);
  max-height: 220px; overflow-y:auto;
  box-shadow: 0 10px 24px -12px rgba(0,0,0,.5);
}
.tz-result{
  display:block; width:100%; text-align:left; background:none; border:none;
  color: var(--text); font-size:13px; padding: 9px 12px; cursor:pointer; font-family: var(--sans);
  border-bottom: 1px solid var(--border-soft);
}
.tz-result:last-child{ border-bottom:none; }
.tz-result:hover, .tz-result.is-active{ background: var(--bg-card-hover); color: var(--accent); }
.tz-result .tz-result-offset{ color: var(--text-dimmer); font-family: var(--mono); font-size:11px; float:right; }
.tz-search-empty{ padding: 10px 12px; color: var(--text-dimmer); font-size:12.5px; }

.tz-rows{ display:flex; flex-direction:column; gap:6px; }
.tz-row{
  display:flex; align-items:center; justify-content:space-between; gap:8px 12px; flex-wrap:wrap;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px;
  background: var(--bg); transition: border-color .16s ease;
}
.tz-row:hover{ border-color: var(--text-dimmer); }
.tz-row-main{ display:flex; align-items:center; gap:8px; min-width:0; flex:1 1 140px; }
.tz-city{ font-size:13px; font-weight:600; color: var(--text); overflow-wrap:anywhere; }
.tz-offset{ font-family: var(--mono); font-size:11px; color: var(--text-dimmer); flex-shrink:0; }
.tz-row-time{ display:flex; align-items:center; gap:6px; flex-shrink:0; }
.tz-time{ font-family: var(--mono); font-size:14px; color: var(--accent); }
.tz-date-badge{
  font-family: var(--mono); font-size:10px; color: var(--varies-color);
  border:1px solid color-mix(in srgb, var(--varies-color) 45%, transparent);
  border-radius:4px; padding:1px 5px;
}
.tz-remove{
  width:24px; height:24px; border-radius:5px; border:none; background:transparent;
  color: var(--text-dimmer); cursor:pointer; font-size:16px; line-height:1; flex-shrink:0;
  display:grid; place-items:center; transition: color .15s ease;
}
.tz-remove:hover{ color: var(--danger); }
.tz-empty-note{ color: var(--text-dimmer); font-size:12.5px; padding: 4px 2px; }
.ts-highlight-row{ display:grid; gap:8px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 480px){ .ts-highlight-row{ grid-template-columns: 1fr 1fr; } }
.ts-highlight-item{
  border:1px solid var(--border); border-radius: var(--radius-sm); padding:10px 12px; background: var(--bg);
}
.ts-highlight-item .ts-highlight-label{ font-family: var(--mono); font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color: var(--text-dimmer); display:block; margin-bottom:4px; }
.ts-highlight-item .ts-highlight-value{ font-size:14px; color: var(--text); }
.ts-grid-label{ margin: 4px 0 8px; }

/* ============ markdown preview: headings/lists/links ============ */
.md-preview-box p{ margin:0 0 6px; }
.md-preview-box p:last-child{ margin-bottom:0; }
.md-preview-box ul, .md-preview-box ol{ margin:2px 0 8px 20px; padding:0; }
.md-preview-box li{ margin-bottom:2px; }
.md-preview-box .md-h1{ font-size:1.3em; font-weight:700; margin:2px 0 4px; }
.md-preview-box .md-h2{ font-size:1.15em; font-weight:700; margin:2px 0 4px; }
.md-preview-box .md-h3{ font-size:1.05em; font-weight:700; color: var(--text-dim); margin:2px 0 4px; }
.md-preview-box a{ color: var(--accent); text-decoration: underline; }

/* ============ markdown cheat sheet ============ */
.cheatsheet-list{ display:flex; flex-direction:column; gap:6px; margin-top:10px; }
.cheatsheet-row{
  display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; align-items:center; gap:6px 14px;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 56px; background: var(--bg);
}
.cheatsheet-main{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.cheatsheet-label{ font-size:12.5px; font-weight:600; color: var(--text); }
.cheatsheet-syntax{ font-family: var(--mono); font-size:11.5px; color: var(--text-dimmer); overflow-wrap:anywhere; }
.cheatsheet-preview{ font-size:13px; color: var(--text-dim); min-width:0; overflow-wrap:anywhere; }
.cheatsheet-row .copy-btn.small{ margin-top:0; justify-self:end; }

/* ============ symbol browser ============ */
.symbol-grid{
  display:grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap:6px; margin-top:10px;
  max-height: 320px; overflow-y:auto; padding-right:2px;
}
.symbol-chip{
  display:flex; flex-direction:column; align-items:center; gap:3px;
  border:1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  padding: 8px 4px; cursor:pointer; color: var(--text); transition: border-color .15s ease, background-color .15s ease;
}
.symbol-chip:hover{ border-color: var(--accent); background: var(--bg-card-hover); }
.symbol-chip .sc-glyph{ font-size:18px; line-height:1; }
.symbol-chip .sc-name{ font-size:9px; color: var(--text-dimmer); text-align:center; overflow-wrap:anywhere; }

/* ============ divider / border generator ============ */
.divider-list{ display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.divider-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 11px; background: var(--bg);
}
.divider-preview{ font-family: var(--mono); font-size:13px; color: var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; min-width:0; }
.border-form .text-input{ margin-bottom:10px; }

/* ============ invisible characters ============ */
.invisible-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.invisible-row{
  border:1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--bg);
}
.invisible-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:3px; }
.invisible-name{ font-size:13px; font-weight:600; }
.invisible-code{ font-family: var(--mono); font-size:11px; color: var(--text-dimmer); }
.invisible-desc{ font-size:12px; color: var(--text-dim); margin:0; }

/* ============ case converter ============ */
.case-convert-grid{ display:flex; flex-direction:column; gap:6px; margin-top:10px; }
.case-convert-row{
  display:grid; grid-template-columns: 7.5rem minmax(0,1fr) auto; align-items:center; gap:6px 12px;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 48px; background: var(--bg);
}
.case-convert-label{ font-size:12px; color: var(--text-dimmer); overflow-wrap:anywhere; }
.case-convert-value{ font-size:13px; color: var(--text); min-width:0; overflow-wrap:anywhere; }
.case-convert-value.is-empty{ color: var(--text-dimmer); }
.case-convert-row .copy-btn.small{ justify-self:end; }

/* ============ general utilities batch 2 ============ */
.btn-row{ display:flex; gap:8px; flex-wrap:wrap; }

.uuid-count-row{ display:flex; gap:8px; margin-bottom:10px; }
.uuid-count-row input[type="number"]{ width:80px; flex-shrink:0; margin-bottom:0; }
.uuid-count-row button{ flex-shrink:0; }
.tool-output .uuid-line{ display:flex; justify-content:space-between; align-items:center; gap:8px; padding:4px 0; border-bottom:1px solid var(--border-soft); }
.tool-output .uuid-line:last-child{ border-bottom:none; }

.diff-inputs{ display:grid; grid-template-columns: 1fr; gap:10px; margin-bottom:12px; }
@media (min-width: 640px){ .diff-inputs{ grid-template-columns: 1fr 1fr; } }
.diff-output{
  border:1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--mono); font-size:12.5px; line-height:1.6;
  max-height: 320px; overflow-y:auto; overflow-wrap:anywhere;
}
.diff-line{ padding:1px 6px; border-radius:3px; white-space:pre-wrap; }
.diff-line.diff-added{ background: color-mix(in srgb, #34d399 16%, transparent); color:#6ee7b7; }
.diff-line.diff-removed{ background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.diff-line.diff-same{ color: var(--text-dim); }
.diff-empty-line{ display:block; min-height: 1.6em; }
.diff-summary{ font-family: var(--sans); font-size:11.5px; color: var(--text-dimmer); margin-bottom:8px; }

/* v9.2 — send to Discord */
.webhook-privacy-note{ font-size:11px; color: var(--text-dimmer); margin: -6px 0 14px; }
.send-status{ border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0 14px; font-size:12.5px; line-height:1.5; }
.send-status.status-ok{ border:1px solid color-mix(in srgb, #34d399 45%, var(--border)); background: color-mix(in srgb, #34d399 10%, transparent); color:#6ee7b7; }
.send-status.status-err{ border:1px solid color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.send-status.status-pending{ border:1px solid var(--border); background: var(--bg); color: var(--text-dimmer); }
.embed-dev-actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
#send-to-discord:disabled{ opacity:.6; cursor:default; }

/* v9.3 — send options */
.embed-send-options{ margin: 0 0 14px; }
.embed-send-options .text-input{ margin-top:8px; }

/* SEO phase 1 — visible page heading */
.intro-title{ font-size:20px; font-weight:600; letter-spacing:-.01em; color: var(--text); margin:0 0 8px; line-height:1.3; }

/* SEO phase 2 — standalone tool pages */
.tool-page{ max-width: var(--max-w-wide); margin: 0 auto; padding: 28px 20px 70px; }
.tool-breadcrumb{ font-size:12.5px; color: var(--text-dimmer); margin-bottom: 14px; }
.tool-breadcrumb a{ color: var(--text-dim); text-decoration:none; }
.tool-breadcrumb a:hover{ color: var(--accent); }
.tool-page-title{ margin: 0 0 8px; }
.tool-page-intro{ color: var(--text-dim); font-size:14.5px; line-height:1.65; max-width: 66ch; margin: 0 0 22px; }
.tool-page .discord-tools{ padding: 0; margin: 0 0 34px; max-width: none; }
.tool-grid.single{ grid-template-columns: 1fr; }
.tool-page-info{ max-width: 70ch; }
.tool-page-info h2{ font-size:17px; font-weight:700; margin: 30px 0 10px; }
.tool-page-info ol{ margin:0; padding-left: 20px; color: var(--text-dim); font-size:14px; line-height:1.75; }
.tool-example-table{ width:100%; border-collapse: collapse; font-size:13.5px; }
.tool-example-table td{ padding: 8px 10px; border-bottom:1px solid var(--border); color: var(--text-dim); vertical-align: top; }
.tool-example-table td:first-child{ white-space: nowrap; }
.tool-example-table code{ font-family: var(--mono); font-size:12.5px; color: var(--accent); overflow-wrap:anywhere; white-space: normal; }
@media (max-width:560px){ .tool-example-table td:first-child{ white-space: normal; } }
.tool-page-note{ color: var(--text-dimmer); font-size:12.5px; margin: 10px 0 0; line-height:1.6; }
.faq-item{ margin: 0 0 14px; }
.faq-item h3{ font-size:14px; font-weight:600; margin: 0 0 3px; }
.faq-item p{ margin:0; color: var(--text-dim); font-size:13.5px; line-height:1.65; }
.tool-related{ margin:0; padding-left: 20px; color: var(--text-dim); font-size:14px; line-height:1.8; }
.tool-related a{ color: var(--accent); text-decoration:none; }
.tool-related a:hover{ text-decoration: underline; }
.tool-page-links{ font-size:13px; color: var(--text-dimmer); margin: -8px 0 18px; line-height:1.9; }
.tool-page-links a{ color: var(--accent); text-decoration:none; margin-right: 12px; white-space: nowrap; }
.tool-page-links a:hover{ text-decoration: underline; }

/* v9.6 — sidebar tool navigation */
.tool-nav-toggle{
  display:flex; align-items:center; gap:10px; width:100%; text-align:left;
  background: var(--bg-card); border:1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 10px 12px; font: inherit; font-size:13.5px; cursor:pointer;
}
.tool-nav-toggle:hover{ border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tool-nav-toggle-label{ font-family: var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color: var(--text-dimmer); }
.tool-nav-current{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color: var(--accent); }
.tool-nav-chevron{ flex-shrink:0; transition: transform .15s ease; color: var(--text-dim); }
.tool-nav.open .tool-nav-chevron{ transform: rotate(180deg); }
.tool-nav-list{ display:none; margin-top: 8px; }
.tool-nav.open .tool-nav-list{ display:block; }
.tool-nav-list ul{ list-style:none; margin:0; padding:0; }
.tool-nav-list a{
  display:block; padding: 7px 10px 7px 11px; border-left:2px solid transparent;
  border-radius: var(--radius-sm); font-size:13px; line-height:1.35; color: var(--text-dim); text-decoration:none;
}
.tool-nav-list a:hover{ background: var(--bg-card-hover); color: var(--text); }
.tool-nav-list a:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }
.tool-nav-list a.active{
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left-color: var(--accent); color: var(--accent);
}
.tool-nav-all{ font-weight:600; margin-bottom: 4px; }
.tool-nav-heading{
  display:flex; align-items:center; gap:7px; margin: 16px 0 4px; padding-left: 11px;
  font-family: var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color: var(--text-dimmer);
}
.tool-nav-heading svg{ flex-shrink:0; }
.tool-nav-group[hidden], .tool-nav-list li[hidden]{ display:none; }
@media (min-width: 900px){
  .tool-nav-toggle{ display:none; }
  .tool-nav-list{ display:block; margin-top:0; }
  .tool-nav{ max-height: calc(100vh - 96px); overflow-y:auto; padding-right:6px; scrollbar-width: thin; }
}
/* single-tool view: the chosen tool gets the whole workspace */
.tool-focus .tool-grid{ grid-template-columns: 1fr; }
.tool-focus .tool-grid .span-2{ grid-column: auto; }
.tool-focus .tool-grid > .panel:not(.is-active-tool){ display:none; }
.tool-focus .tool-group.no-active{ display:none; }
.tool-focus .tool-group{ margin-top:0; }
.tool-focus .group-title{ display:none; }
.discord-tools .panel:focus{ outline:none; }
.tool-search-row, .tool-nav-toggle{ scroll-margin-top: var(--scroll-offset); }

/* v9.7 — consistent copy-card layout + example box toggle */
.cheatsheet-list, .case-convert-grid{ container-type: inline-size; }
@container (max-width: 400px){
  .cheatsheet-row{ grid-template-columns: minmax(0,1fr) auto; }
  .cheatsheet-preview{ grid-column: 1 / -1; grid-row: 2; }
  .case-convert-row{ grid-template-columns: minmax(0,1fr) auto; }
  .case-convert-value{ grid-column: 1 / -1; grid-row: 2; }
}
.example-hidden .live-text-wrap{ display:none; }
:root.example-hidden{ --scroll-offset: calc(var(--header-h) + 16px); }
.example-toggle .off-slash{ opacity:0; }
.example-toggle[aria-pressed="false"] .off-slash{ opacity:1; }
.example-toggle[aria-pressed="false"]{ color: var(--accent); }
.example-toggle:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
@media (pointer: coarse){ .example-toggle{ width:40px; height:40px; } }

/* ============ v9.8 — Presets & Templates library ============ */
.lib-panel{ padding:16px; }
.snapshot-details{ margin-top:14px; }
.snapshot-details .panel{ margin-top:6px; }
.snapshot-details .json-box{ margin: 10px 0; }

/* central toolbar */
.lib-toolbar{ display:grid; gap:10px; margin-bottom:10px; }
.lib-search{ margin-bottom:0; }
.lib-search input{ flex:1; min-width:0; background:transparent; border:none; color:var(--text); font-size:14px; font-family:var(--sans); }
.lib-search input:focus{ outline:none; }
.lib-filters{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.lib-filters .select-input{ width:auto; flex:1 1 140px; min-width:0; margin:0; padding:7px 10px; font-size:13px; }
.lib-seg{ display:flex; gap:4px; }
.lib-manage{ display:flex; flex-wrap:wrap; gap:8px; }
.lib-manage .btn-outline.small, .lib-manage .copy-btn.small{ margin-top:0; }
.lib-count{ font-family:var(--mono); font-size:11.5px; color:var(--text-dimmer); margin:2px 0 12px; }
.lib-notice{ border:1px solid color-mix(in srgb, #fbbf24 50%, var(--border)); background:color-mix(in srgb, #fbbf24 8%, transparent); color:var(--text); border-radius:var(--radius-sm); padding:9px 12px; font-size:13px; line-height:1.5; margin:0 0 12px; }
.lib-empty{ color:var(--text-dimmer); font-size:13.5px; grid-column:1/-1; margin:8px 0; }

/* cards */
.lib-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:12px; }
.lib-card{ border:1px solid var(--border); background:var(--bg); border-radius:var(--radius-md); padding:14px; display:flex; flex-direction:column; gap:8px; min-width:0; }
.lib-card:hover{ border-color:var(--text-dimmer); }
.lib-card-head h4{ margin:0; font-size:14.5px; font-weight:600; overflow-wrap:anywhere; }
.lib-badges{ display:flex; flex-wrap:wrap; gap:5px; margin:0; }
.lib-badge{ font-family:var(--mono); font-size:10.5px; letter-spacing:.02em; color:var(--text-dim); border:1px solid var(--border); border-radius:4px; padding:1px 6px; white-space:nowrap; }
.lib-badge-preset{ color:var(--accent); border-color:color-mix(in srgb, var(--accent) 45%, var(--border)); }
.lib-badge-template{ color:#a78bfa; border-color:color-mix(in srgb, #a78bfa 45%, var(--border)); }
.lib-badge-mine{ color:#34d399; border-color:color-mix(in srgb, #34d399 45%, var(--border)); }
.lib-desc{ margin:0; color:var(--text-dim); font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.lib-effect{ margin:0; color:var(--text-dimmer); font-size:12px; line-height:1.45; }
.lib-preview{ position:relative; max-height:150px; overflow:hidden; border:1px solid var(--border-soft); border-radius:var(--radius-sm); padding:8px; background:var(--bg-card); font-size:12.5px; }
.lib-preview::after{ content:''; position:absolute; left:0; right:0; bottom:0; height:28px; background:linear-gradient(transparent, var(--bg-card)); pointer-events:none; }
.lib-preview-full{ max-height:min(48vh, 360px); overflow:auto; }
.lib-preview-full::after{ display:none; }
.lib-preview .embed-preview{ margin-top:0; font-size:12.5px; }
.lib-preview .md-preview-box{ border:none; padding:0; background:transparent; font-size:12.5px; }
.lib-ghost{ opacity:.5; }
.lib-msg-content{ margin-bottom:6px; font-size:12.5px; }
.lib-msg-head{ display:flex; align-items:center; gap:6px; margin-bottom:3px; font-size:13px; }
.lib-bot{ font-family:var(--mono); font-size:9.5px; background:#5865f2; color:#fff; border-radius:3px; padding:0 4px; }
.lib-chips{ display:flex; flex-wrap:wrap; gap:4px; }
.lib-chip{ font-size:11.5px; border:1px solid var(--border); border-radius:4px; padding:1px 6px; color:var(--text-dim); }
.lib-line{ margin:0 0 6px; color:var(--text); overflow-wrap:anywhere; }
.lib-color-row{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.lib-swatch{ width:26px; height:26px; border-radius:6px; border:1px solid var(--border); flex-shrink:0; }
.lib-palette{ padding:10px; border-radius:var(--radius-sm); }
.lib-palette div{ padding:10px 12px; border-radius:6px; font-size:15px; }
.lib-tags{ display:flex; flex-wrap:wrap; gap:6px; margin:0; font-family:var(--mono); font-size:11px; color:var(--text-dimmer); }
.lib-card-actions{ display:flex; flex-wrap:wrap; gap:6px; margin-top:auto; padding-top:4px; }
.lib-card-actions .btn-outline.small, .lib-card-actions .copy-btn.small{ margin-top:0; }
.lib-del:hover{ border-color:#f87171; color:#f87171; }

/* compact bar inside tools */
.lib-bar{ margin:0 0 14px; }
.lib-bar-row{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.lib-bar-row .btn-outline.small{ margin-top:0; }
.lib-bar-n{ font-family:var(--mono); font-size:11px; color:var(--text-dimmer); margin-left:2px; }
.lib-caret{ font-size:10px; margin-left:2px; }
.lib-bar-body{ margin-top:8px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg); padding:10px; }
.lib-bar-body[hidden]{ display:none; }
.lib-bar-q{ margin-bottom:8px; }
.lib-bar-opts{ display:flex; flex-wrap:wrap; gap:8px 14px; align-items:center; margin-bottom:8px; }
.lib-bar-showall{ margin:0; }
.lib-list{ list-style:none; margin:0; padding:0; max-height:300px; overflow-y:auto; border-top:1px solid var(--border-soft); }
.lib-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 2px; border-bottom:1px solid var(--border-soft); }
.lib-row-main{ min-width:0; flex:1; display:flex; flex-direction:column; gap:4px; }
.lib-row-name{ font-size:13.5px; font-weight:600; overflow-wrap:anywhere; }
.lib-row-sub{ display:flex; flex-wrap:wrap; gap:5px; align-items:center; min-width:0; }
.lib-row-desc{ font-size:12px; color:var(--text-dimmer); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; flex:1 1 100%; }
.lib-row-actions{ display:flex; gap:6px; flex-shrink:0; }
.lib-row-actions .btn-outline.small, .lib-row-actions .copy-btn.small{ margin-top:0; }
.lib-list-empty{ color:var(--text-dimmer); font-size:13px; padding:12px 2px; }
.lib-bar-link{ display:inline-block; margin-top:10px; font-size:12.5px; color:var(--accent); text-decoration:none; }
.lib-bar-link:hover{ text-decoration:underline; }
@media (max-width: 480px){
  .lib-row{ flex-direction:column; align-items:stretch; }
  .lib-row-actions{ justify-content:flex-end; }
}

/* dialog */
.lib-dialog{ border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--bg-raised); color:var(--text); padding:18px; width:min(560px, calc(100vw - 24px)); max-height:calc(100dvh - 32px); overflow:auto; font-family:var(--sans); }
.lib-dialog::backdrop{ background:rgba(0,0,0,.6); }
.lib-dlg-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.lib-dlg-head h3{ margin:0; font-size:16px; font-weight:700; overflow-wrap:anywhere; }
.lib-dlg-x{ border:none; background:transparent; color:var(--text-dimmer); font-size:22px; line-height:1; cursor:pointer; width:32px; height:32px; border-radius:6px; flex-shrink:0; }
.lib-dlg-x:hover{ color:var(--text); background:var(--border-soft); }
.lib-form .text-input{ margin-bottom:10px; }
.lib-label{ display:block; font-size:12px; font-weight:600; color:var(--text-dim); margin:0 0 5px; }
.lib-two{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
@media (max-width: 480px){ .lib-two{ grid-template-columns:1fr; } }
.lib-textarea-sm{ min-height:56px; }
.lib-hint{ color:var(--text-dim); font-size:13px; line-height:1.55; margin:0 0 12px; }
.lib-error{ color:#f87171; font-size:13px; margin:0 0 10px; }
.lib-error[hidden]{ display:none; }
.lib-check{ margin:2px 0 12px; align-items:flex-start; }
.lib-file{ display:block; width:100%; margin-bottom:12px; font-size:13px; color:var(--text-dim); }
.lib-dlg-actions{ display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; margin-top:12px; }
.lib-dlg-actions .btn-outline, .lib-dlg-actions .copy-btn{ padding:9px 14px; font-size:13px; margin-top:0; }
.lib-dlg-actions .copy-btn:disabled{ opacity:.45; cursor:not-allowed; transform:none; }
.lib-danger{ background:#f87171; color:#2a0a0a; }
.lib-summary{ font-size:13px; color:var(--text-dim); margin:12px 0 6px; }
.lib-review-list{ list-style:none; margin:0 0 4px; padding:0; max-height:200px; overflow:auto; border:1px solid var(--border-soft); border-radius:var(--radius-sm); font-size:12.5px; }
.lib-review-list li{ padding:6px 10px; border-bottom:1px solid var(--border-soft); overflow-wrap:anywhere; }
.lib-review-list li:last-child{ border-bottom:none; }
.lib-review-list li.ok::before{ content:'+ '; color:#34d399; font-family:var(--mono); }
.lib-review-list li.skip::before{ content:'– '; color:var(--text-dimmer); font-family:var(--mono); }
.lib-review-list li span{ color:var(--text-dimmer); }

/* undo toast */
.lib-toast{ position:fixed; left:50%; bottom:72px; transform:translateX(-50%); z-index:300; display:flex; align-items:center; gap:10px; max-width:min(520px, calc(100vw - 24px)); background:var(--bg-raised); border:1px solid var(--border); border-radius:var(--radius-md); padding:9px 10px 9px 14px; font-size:13px; box-shadow:0 10px 24px -10px rgba(0,0,0,.6); }
.lib-toast[hidden]{ display:none; }
.lib-toast-msg{ min-width:0; overflow-wrap:anywhere; }
.lib-toast-btn{ border:1px solid var(--accent); background:transparent; color:var(--accent); border-radius:5px; padding:4px 10px; font-size:12px; font-weight:600; cursor:pointer; flex-shrink:0; }
.lib-toast-x{ border:none; background:transparent; color:var(--text-dimmer); font-size:18px; line-height:1; cursor:pointer; padding:0 4px; flex-shrink:0; }
.lib-bar button:focus-visible, .lib-card button:focus-visible, .lib-dialog button:focus-visible, .lib-toast button:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.lib-dialog .lib-badges{ margin-bottom:10px; }
.lib-dialog .lib-desc{ margin-bottom:10px; }
.lib-dialog .lib-effect, .lib-dialog .lib-tags{ margin-top:10px; }

/* ============ v9.9 — counters, empty states, touch targets, small layout fixes ============ */
.length-sep{ position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.length-row{ display:flex; justify-content:space-between; align-items:baseline; gap:12px; font-size:12px; color: var(--text-dim); }
.length-label{ min-width:0; overflow-wrap:anywhere; }
.length-value{ font-family: var(--mono); color: var(--text); text-align:right; white-space:nowrap; flex-shrink:0; }
.length-bar-item.is-over .length-value{ color: var(--danger); }
.length-stats{ display:flex; flex-direction:column; gap:6px; margin-top:4px; padding-top:10px; border-top:1px solid var(--border-soft); }

.perm-note{ margin:-4px 0 10px; font-size:12px; line-height:1.45; color: var(--text-dimmer); }
.perm-note.is-error{ color: var(--danger); }
.perm-note[hidden]{ display:none; }
#perm-integer-input[aria-invalid="true"]{ border-color: var(--danger); }

/* A long search is echoed back in the empty message; it must wrap instead of widening the page. */
.results-empty, #empty-query{ overflow-wrap:anywhere; }
.tool-output:empty::before{ content:'Result appears here'; color: var(--text-dimmer); font-family: var(--sans); font-size:12px; }

/* The title sat directly on its description because the description pulls up by 6px. */
.panel-title.small + .panel-sub{ margin-top:4px; }

/* UUID rows: the id wraps, the Copy link keeps its shape. */
.tool-output .uuid-line > span{ min-width:0; overflow-wrap:anywhere; }
.tool-output .copy-link{ white-space:nowrap; flex-shrink:0; }

/* The native file picker button matched nothing else in the dark theme. */
.lib-file{ max-width:100%; color: var(--text-dim); font-size:13px; }
.lib-file::file-selector-button{
  font: inherit; font-size:12px; margin-right:10px; padding:6px 11px; cursor:pointer;
  color: var(--text); background: var(--bg); border:1px solid var(--border); border-radius: var(--radius-sm);
}
.lib-file::file-selector-button:hover{ border-color: var(--accent); color: var(--accent); }
.lib-dlg-head h3:focus{ outline:none; }

@media (max-width: 520px){
  /* Send takes the first row; Clear and Reset share the second instead of Reset sitting alone. */
  .embed-actions .btn-solid{ flex-basis:100%; }
  .embed-actions .btn-outline{ flex:1 1 0; margin-top:0; }
}

@media (pointer: coarse){
  .btn-outline.small, .copy-btn.small, .case-btn, .filter-pill{ min-height:36px; }
  .fav-heart, .clear-btn, .tz-remove{ min-width:34px; min-height:34px; }
  .perm-item, .checkbox-row, .field-inline-toggle{ min-height:36px; }
  .color-input-row input[type="color"]{ width:30px; height:30px; }
  .field-move, .embed-field-remove{ min-width:34px; min-height:34px; }
}

/* ============ v9.9 — narrow header and touch targets ============ */
.icon-btn{ flex-shrink:0; }
@media (max-width: 380px){
  .header-inner{ gap:8px; padding:12px 12px; }
  .header-actions{ gap:2px; }
  .logo{ gap:6px; }
  .logo-text{ font-size:13.5px; }
}
/* Checkboxes are small by nature; on touch screens the whole row (box and label) is the tap area. */
@media (pointer: coarse){
  .checkbox-row input[type="checkbox"], .perm-item input[type="checkbox"]{ width:18px; height:18px; flex-shrink:0; }
  .tool-output .copy-link{ min-height:32px; padding:0 8px; display:inline-flex; align-items:center; }
}
.tool-output .muted{ color: var(--text-dimmer); font-size:12.5px; }

/* ============ v9.9 — spacing and alignment fixes found in the audit ============ */
/* A mode toggle (Format/Minify, Encode/Decode, SHA-1/256/512) sat flush against the text box below it. */
.case-group + .text-input, .case-group + textarea{ margin-top:8px; }
.panel > .case-group:not(:last-child){ margin-bottom:0; }

/* The copy icon on a template card dropped under the text; it belongs at the right edge. */
.template-card{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.template-card > div{ min-width:0; }
.template-card svg{ flex-shrink:0; margin-top:2px; color: var(--text-dimmer); }
.template-card:hover svg, .template-card.active svg{ color: var(--accent); }

/* Cheat sheet previews used the browser's default quote and list indents, which made those rows look broken. */
.cheatsheet-preview blockquote{ margin:0; padding-left:10px; border-left:3px solid var(--border); color: var(--text-dim); }
.cheatsheet-preview ul, .cheatsheet-preview ol{ margin:0; padding-left:22px; }

/* Plain text links are only about 20px tall; on a touch screen give them a proper tap area without moving them. */
@media (pointer: coarse){
  .logo, .changelog-back, .footer-support-link{ display:inline-flex; align-items:center; min-height:36px; }
}

/* Light theme: the coloured badges and the contrast pill were pale on a white card (about 2:1). */
[data-theme="light"] .lib-badge-template{ color:#6240c9; border-color:color-mix(in srgb, #6240c9 45%, var(--border)); }
[data-theme="light"] .lib-badge-mine{ color:#0d6e4d; border-color:color-mix(in srgb, #0d6e4d 45%, var(--border)); }
[data-theme="light"] .contrast-pill{ border-color:#2f9a60; color:#17703f; }


/* ---- v9.9: ANSI output, touch-sized text links ---- */
.ansi-code{ white-space: pre-wrap; overflow-wrap: anywhere; }
.ansi-note{ margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-dimmer); }
@media (pointer: coarse), (max-width: 700px){
  .tool-page-links{ line-height: 1.3; }
  .tool-page-links a, .tool-related a, .tool-breadcrumb a{ display: inline-block; padding: 5px 0; min-height: 24px; }
  .tool-related li{ margin: 2px 0; }
}

/* v9.9 — error state for output boxes (copying is blocked while it shows) */
[data-state="error"].output-text{ color: var(--danger); }
.lib-seg{ align-items:center; }
.lib-seg-label{ font-family: var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color: var(--text-dimmer); margin-right:6px; }
/* v9.9 — role colours are meant for Discord's dark surface, so the preview keeps one in the light theme too */
[data-theme="light"] .role-pill{ background:#313338; border-color:#1e1f22; }
