/* handy.moe: one shared stylesheet. No external requests.
   The look: true black for OLED screens, set in the IBM VGA 8x16 pixel font.
   A pixel font stays crisp only on its grid, so type sizes are 16, 32 or 48px and spacing steps in 8px.
   GNU Unifont fills kana, kanji and symbols the VGA font lacks, in the same 8x16 cell; its two parts load only when such a glyph appears.
   Two switches in the header: OLED / Day (data-theme) and Pixel / Legible type (data-font). */

@font-face { font-family: "HM VGA"; src: url("../fonts/vga-8x16.woff2") format("woff2"); font-display: swap; }
@font-face { /* kana, symbols, Greek, Cyrillic, extended Latin: 45 KB */
  font-family: "HM Unifont"; src: url("../fonts/unifont-kana.woff2") format("woff2"); font-display: swap;
  unicode-range: U+0100-02FF, U+0370-03FF, U+0400-052F, U+1E00-1FFF, U+2000-22FF, U+2460-27FF, U+2C60-2CFF, U+A720-A7FF, U+16A0-16FF, U+3000-30FF, U+31F0-31FF, U+FE30-FE4F, U+FF00-FFEF;
}
@font-face { /* kanji and hangul: 680 KB, loaded only when such a glyph is on screen */
  font-family: "HM Unifont"; src: url("../fonts/unifont-cjk.woff2") format("woff2"); font-display: swap;
  unicode-range: U+1100-11FF, U+2E80-2FDF, U+3100-31EF, U+3200-33FF, U+3400-4DBF, U+4E00-9FFF, U+AC00-D7AF, U+F900-FAFF;
}
@font-face { font-family: "Atkinson Next"; src: url("../fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("../fonts/atkinson-hyperlegible-next-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("../fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- tokens: OLED is the default ---------- */
:root {
  --paper: #000;
  --paper-2: #0b0b0b;
  --card: #050505;
  --ink: #f2f2f2;
  --ink-2: #b4b4b4;
  --ink-3: #8c8c8c;
  --rule: #1e1e1e;
  --rule-2: #333;
  --fire: #f4949c;
  --fire-2: #f8b8be;
  --seal: #b8404e;
  --seal-ink: #fff;
  --link: #f8b8be;
  --hl: rgba(244, 148, 156, .18);
  --ok: #7ad79f;
  --warn: #f3bf62;
  --check-a: #161616;
  --check-b: #262626;
  /* canvas guides sit on top of pictures with dark label plates, so they keep the bright blush in both themes */
  --guide: #f4949c;
  --guide-2: #f8b8be;
  color-scheme: dark;

  --f-term: "HM VGA", "HM Unifont", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", ui-monospace, Menlo, Consolas, monospace;
  --f-legible: "Atkinson Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-system: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", "Meiryo", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --f-body: var(--f-term);
  --f-display: var(--f-term);
  --f-mono: var(--f-term);
  --f-jp: var(--f-term);

  --fs: 16px;
  --lh: 1.5;      /* 24px lines on 16px type */
  --h1: 32px;
  --h-hero: 48px;
  --h2: 32px;
  --h3: 16px;
  --small: 16px;  /* the pixel font never goes below its native size */

  --measure: 72ch;
  --wide: 1120px;
}

:root[data-theme="day"] {
  --paper: #f3ead6;
  --paper-2: #ebe0c6;
  --card: #f8f1e1;
  --ink: #2a2017;
  --ink-2: #4f412f;
  --ink-3: #6b5c45;
  --rule: #dccdab;
  --rule-2: #b8a47e;
  --fire: #b03a4a;
  --fire-2: #a33443;
  --seal: #b03a4a;
  --seal-ink: #fff;
  --link: #8e2c3a;
  --hl: rgba(176, 58, 74, .15);
  --ok: #2a6a40;
  --warn: #7f4a00;
  --check-a: #fff;
  --check-b: #e2dccd;
  color-scheme: light;
}

/* the easy-reading switch: Atkinson Hyperlegible, free sizes */
:root[data-font="legible"] {
  --f-body: var(--f-legible);
  --f-display: var(--f-legible);
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-jp: var(--f-system);
  --fs: 17px;
  --lh: 1.6;
  --h1: clamp(1.9rem, 1.5rem + 1.6vw, 2.4rem);
  --h-hero: clamp(2.2rem, 1.6rem + 2.6vw, 3.2rem);
  --h2: 1.5rem;
  --h3: 1.15rem;
  --small: .875rem;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: var(--fs); line-height: var(--lh);
}
:root:not([data-font="legible"]) body {
  -webkit-font-smoothing: none; font-smooth: never; font-kerning: none; font-variant-ligatures: none;
  font-synthesis: none; /* no fake bold or slanted pixels */
}
:root:not([data-font="legible"]) :is(strong, b, h1, h2, h3, summary, em, i) { font-weight: 400; font-style: normal; }
main { flex: 1; }
img, svg, video, canvas { max-width: 100%; }
a { color: var(--link); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--fire); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
::selection { background: var(--fire); color: #000; }

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; text-wrap: balance; color: var(--ink); }
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); margin-top: 48px; }
h3 { font-size: var(--h3); }
p { margin: 0 0 1em; }
strong { color: var(--ink); }
.wrap { width: min(100% - 32px, var(--wide)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose li + li { margin-top: 8px; }
.prose :is(p, li) { color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: var(--small); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 16px; z-index: 10; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.px { image-rendering: pixelated; shape-rendering: crispEdges; }

/* ---------- header ---------- */
.site-head { border-bottom: 1px solid var(--rule-2); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.site-head .wrap { display: flex; align-items: center; gap: 8px; min-height: 64px; position: relative; }
.brand { display: inline-flex; align-items: center; gap: 16px; color: var(--ink); text-decoration: none; font-family: var(--f-display); font-size: 32px; line-height: 1; font-weight: 700; white-space: nowrap; }
:root[data-font="legible"] .brand { font-size: 1.5rem; }
.brand:hover { color: var(--ink); }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand .mascot { width: 88px; height: 88px; flex: none; display: block; background: #fff; outline: 2px solid var(--fire); outline-offset: -1px; }
.brand .dot { color: var(--fire); }
.nav { display: flex; gap: 0; margin-left: auto; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; font-size: var(--small); white-space: nowrap; }
.nav a:hover { color: var(--fire); }
.nav a[aria-current="page"] { color: var(--fire); box-shadow: inset 0 -2px 0 var(--fire); }
.icon-btn {
  appearance: none; border: 1px solid var(--rule-2); background: var(--card); color: var(--ink-2);
  width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer; flex: none;
  font-family: var(--f-term); font-size: 16px; line-height: 1; padding: 0;
}
.icon-btn:hover { color: var(--fire); border-color: var(--fire); }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.icon-btn svg { width: 24px; height: 24px; }
.menu-btn { display: none; }
@media (max-width: 1100px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav { display: none; position: absolute; left: -16px; right: -16px; top: 100%; background: var(--paper); border-bottom: 1px solid var(--rule-2); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; border-bottom: 1px solid var(--rule); }
  .nav a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--fire); padding-left: 16px; }
}
@media (max-width: 400px) {
  .brand { font-size: 16px; gap: 8px; }
  :root[data-font="legible"] .brand { font-size: 1.15rem; }
}

/* ---------- footer ---------- */
.site-foot { margin-top: 64px; border-top: 1px solid var(--rule-2); background: var(--paper-2); font-size: var(--small); color: var(--ink-3); }
.site-foot .wrap { padding-block: 32px; display: grid; gap: 24px; grid-template-columns: 2fr 1fr 1fr; }
.site-foot h2 { font-size: var(--fs); margin: 0 0 8px; color: var(--ink); }
.site-foot p { color: var(--ink-3); }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin: 4px 0; }
.site-foot a { color: var(--ink-2); text-decoration: none; }
.site-foot a:hover { color: var(--fire); text-decoration: underline; }
@media (max-width: 700px) { .site-foot .wrap { grid-template-columns: 1fr 1fr; } .site-foot .about-col { grid-column: 1 / -1; } }

/* ---------- home ---------- */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: var(--h-hero); line-height: 1.17; max-width: 22ch; }
.hero .lede { color: var(--ink-2); max-width: 56ch; }
.finder { margin-top: 32px; position: relative; max-width: 640px; }
.finder input[type="search"] {
  width: 100%; font-family: var(--f-body); font-size: var(--fs); color: var(--ink);
  min-height: 56px; padding: 8px 16px 8px 48px; border: 1px solid var(--fire);
  background: var(--card); box-shadow: 4px 4px 0 var(--hl);
}
.finder input::placeholder { color: var(--ink-3); opacity: 1; }
.finder svg { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 24px; height: 24px; color: var(--fire); pointer-events: none; }
.finder-count { margin-top: 8px; color: var(--ink-3); font-size: var(--small); min-height: 24px; }
.kbd { display: inline-block; border: 1px solid var(--rule-2); padding: 0 6px; color: var(--ink-2); }

.shelves { display: grid; gap: 0; margin-top: 24px; }
/* home shelves are drawers (12-03): a row you click, subcategories inside */
.shelf { border-top: 2px solid var(--c, var(--fire)); }
.shelf + .shelf { margin-top: 0; }
.shelf > summary.shelf-tab { list-style: none; cursor: pointer; display: grid; grid-template-columns: 26ch 1fr auto; align-items: baseline; gap: 4px 24px; padding: 12px 4px; }
.shelf > summary::-webkit-details-marker, .sub > summary::-webkit-details-marker { display: none; }
.shelf > summary::after { content: "+"; color: var(--c, var(--fire)); font-size: var(--fs); line-height: 1; }
.shelf[open] > summary::after { content: "−"; }
.shelf > summary:hover, .shelf > summary:focus-visible { background: var(--paper-2); }
.shelf-tab h2 { font-size: var(--fs); margin: 0; display: flex; align-items: center; gap: 8px; color: var(--c, var(--fire)); }
.shelf-tab p { margin: 0; color: var(--ink-3); font-size: var(--small); }
.shelf .n { color: var(--ink-3); font-size: var(--small); margin-left: 4px; }
.shelf-body { padding: 4px 0 24px; }
.sub { margin-top: 12px; }
.sub > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: baseline; gap: 8px; padding: 2px 0; color: var(--ink-2); font-size: var(--small); text-transform: uppercase; letter-spacing: .06em; }
.sub > summary::before { content: "▾"; color: var(--c, var(--fire)); }
.sub:not([open]) > summary::before { content: "▸"; }
.sub > summary:hover .sub-name { color: var(--c, var(--fire)); }
.sub > .tool-list { margin-top: 8px; }
.swatch { width: 8px; height: 16px; background: var(--c, var(--fire)); flex: none; }
.tool-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.tool-list a { display: block; height: 100%; padding: 12px 16px; text-decoration: none; color: var(--ink); border: 1px solid var(--rule); background: var(--card); }
.tool-list a:hover, .tool-list a:focus-visible { border-color: var(--c, var(--fire)); background: var(--paper-2); color: var(--ink); }
.tool-list a:hover strong { color: var(--c, var(--fire)); }
.tool-list strong { display: block; }
.tool-list span { display: block; color: var(--ink-3); font-size: var(--small); line-height: 1.5; }
.tool-list li[hidden], .shelf[hidden], .sub[hidden] { display: none; }
.shelves > .shelf:last-child { border-bottom: 1px solid var(--rule-2); }
@media (max-width: 720px) { .shelf > summary.shelf-tab { grid-template-columns: 1fr auto; } .shelf-tab p { grid-column: 1; grid-row: 2; } .shelf > summary::after { grid-column: 2; grid-row: 1; } }

.soon { margin-top: 64px; padding: 24px; border: 1px dashed var(--rule-2); }
.soon h2 { margin-top: 0; }
.soon ul { padding-left: 24px; margin: 0; max-width: var(--measure); color: var(--ink-2); }
.soon li + li { margin-top: 8px; }

/* ---------- tool page ---------- */
.crumbs { font-size: var(--small); color: var(--ink-3); padding-top: 24px; margin-bottom: 8px; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--fire); text-decoration: underline; }
.tool-head { padding: 0 0 24px; }
.tool-head h1 { margin-bottom: 8px; }
.tool-head .lede { color: var(--ink-2); max-width: 64ch; margin: 0; }
.privacy-pill { display: inline-flex; gap: 8px; align-items: center; margin: 16px 0 0; padding: 4px 12px 4px 8px; border: 1px solid var(--ok); color: var(--ok); font-size: var(--small); }
.privacy-pill svg { width: 16px; height: 16px; flex: none; }

.panel { background: var(--card); border: 1px solid var(--rule-2); padding: clamp(16px, 3vw, 24px); }
.panel + .panel { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.row + .row { margin-top: 16px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span, .field > label, .label { font-size: var(--small); color: var(--ink-3); }
.field output { color: var(--fire); }
.grow { flex: 1 1 14rem; }
input[type="text"], input[type="number"], input[type="datetime-local"], input[type="search"], select, textarea {
  font-family: var(--f-body); font-size: var(--fs); line-height: 1.5; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule-2); border-radius: 0; padding: 7px 8px; min-height: 40px; width: 100%;
}
:is(input, select, textarea):hover { border-color: var(--ink-3); }
:is(input, select, textarea):focus-visible { border-color: var(--fire); outline: 2px solid var(--fire); outline-offset: 0; }
::placeholder { color: var(--ink-3); opacity: 1; }
textarea { min-height: 120px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--fire); min-height: 40px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--fire); width: 16px; height: 16px; }
input[type="color"] { border: 1px solid var(--rule-2); background: var(--paper); border-radius: 0; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 40px; font-size: var(--small); color: var(--ink-2); }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--f-body); font-size: var(--fs); line-height: 1.5; padding: 7px 16px; min-height: 40px; border-radius: 0;
  border: 1px solid var(--seal); background: var(--seal); color: var(--seal-ink); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--fire); border-color: var(--fire); color: #000; }
:root[data-theme="day"] .btn:hover { color: #fff; }
.btn.ghost { background: var(--card); border-color: var(--rule-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--fire); color: var(--fire); background: var(--card); }
.btn.small { font-size: var(--small); padding: 3px 12px; min-height: 32px; }
.btn[disabled], .btn[disabled]:hover { opacity: .45; cursor: not-allowed; background: var(--card); border-color: var(--rule-2); color: var(--ink-3); }
.btn svg { width: 16px; height: 16px; }

.seg { display: inline-flex; border: 1px solid var(--rule-2); flex-wrap: wrap; background: var(--paper); }
.seg label { position: relative; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.seg span { display: block; padding: 7px 12px; font-size: var(--small); color: var(--ink-2); line-height: 1.5; }
.seg label:hover span { color: var(--fire); }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--fire); outline-offset: -2px; }

/* drop zone */
.drop {
  display: grid; place-items: center; text-align: center; gap: 8px;
  border: 2px dashed var(--rule-2); padding: 40px 16px; background: var(--paper);
  cursor: pointer; position: relative;
}
.drop:hover, .drop.over { border-color: var(--fire); background: var(--hl); }
.drop:focus-within { outline: 2px solid var(--fire); outline-offset: 2px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop strong { font-family: var(--f-display); font-size: var(--fs); color: var(--ink); }
.drop .small { color: var(--ink-3); }
.drop svg { width: 48px; height: 48px; color: var(--fire); }
.drop.compact { padding: 8px 16px; grid-auto-flow: column; justify-content: center; gap: 12px; }
.drop.compact svg { width: 24px; height: 24px; }
.drop.compact .small { display: none; }

/* file rows */
.files { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.files li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px; background: var(--paper); border: 1px solid var(--rule); }
.files .thumb { width: 56px; height: 56px; object-fit: cover; background: var(--rule); }
.files .name { overflow-wrap: anywhere; line-height: 1.5; color: var(--ink); }
.files .meta { font-size: var(--small); color: var(--ink-3); }
.files .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.saved { color: var(--ok); }
.bigger { color: var(--warn); }
@media (max-width: 560px) { .files li { grid-template-columns: 40px 1fr; } .files .thumb { width: 40px; height: 40px; } .files .acts { grid-column: 1 / -1; justify-content: start; } }

.checker { background-color: var(--check-a); background-image: linear-gradient(45deg, var(--check-b) 25%, transparent 25%), linear-gradient(-45deg, var(--check-b) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--check-b) 75%), linear-gradient(-45deg, transparent 75%, var(--check-b) 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }

.note { padding: 8px 12px; font-size: var(--small); color: var(--ink-2); margin-top: 16px; border: 1px solid var(--rule-2); border-left: 4px solid var(--ink-3); background: var(--paper); }
.note.warn { border-color: var(--warn); color: var(--ink); }
.note.ok { border-color: var(--ok); color: var(--ink); }
.note:empty { display: none; }
.note a { color: var(--link); }

.progress { height: 16px; background: var(--paper); border: 1px solid var(--rule-2); margin-top: 16px; padding: 2px; }
.progress > i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--fire) 0 8px, transparent 8px 10px); }
.progress[hidden] { display: none; }

/* output rows (fancy text, timestamp) */
.outs { display: grid; gap: 8px; margin-top: 16px; }
.out { display: grid; grid-template-columns: 12rem 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; background: var(--paper); border: 1px solid var(--rule); }
.out:hover { border-color: var(--rule-2); }
.out .k { font-size: var(--small); color: var(--ink-3); }
.out .v { overflow-wrap: anywhere; min-width: 0; color: var(--ink); }
[aria-label="Fancy text generator"] .out .v { font-family: var(--f-system); font-size: 1.15rem; } /* fancy text shows as Discord will show it */
.out code { font-family: var(--f-mono); font-size: var(--fs); color: var(--fire-2); background: var(--paper-2); border: 1px solid var(--rule); padding: 0 6px; }
@media (max-width: 600px) { .out { grid-template-columns: 1fr auto; } .out .k { grid-column: 1 / -1; } }

/* kaomoji: faces are shown in the system font, as they will look once pasted */
.kao-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.kao-grid button { appearance: none; font: 400 1.05rem var(--f-system); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 0; padding: 12px 8px; cursor: pointer; min-height: 56px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kao-grid button:hover { border-color: var(--fire); background: var(--hl); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips button { appearance: none; font-family: var(--f-body); font-size: var(--small); line-height: 1.5; border: 1px solid var(--rule-2); background: var(--card); color: var(--ink-2); border-radius: 0; padding: 3px 12px; cursor: pointer; min-height: 32px; }
.chips button:hover { color: var(--fire); border-color: var(--fire); }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.jp { font-family: var(--f-jp); }
:root:not([data-font="legible"]) textarea.jp { font-size: 32px; line-height: 1.25; }

/* crop stage (discord resizer) */
.stage-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; margin-top: 16px; align-items: start; }
@media (max-width: 820px) { .stage-wrap { grid-template-columns: 1fr; } }
.stage { position: relative; overflow: hidden; touch-action: none; cursor: grab; display: grid; place-items: center; max-width: 520px; border: 1px solid var(--rule-2); }
.stage:active { cursor: grabbing; }
.stage canvas { display: block; height: auto; max-height: 62vh; width: auto; max-width: 100%; }
.previews { display: grid; gap: 12px; }
.preview-chat { display: flex; gap: 10px; align-items: center; padding: 12px; background: #313338; color: #dbdee1; font: .95rem/1.4 var(--f-system); }
.preview-chat.light { background: #fff; color: #313338; border: 1px solid var(--rule-2); }
.preview-chat img { image-rendering: auto; }
.size-badge { font-size: var(--small); padding: 0 8px; display: inline-block; border: 1px solid var(--rule-2); color: var(--ink-2); }
.size-badge.ok { border-color: var(--ok); color: var(--ok); }
.size-badge.over { border-color: var(--warn); color: var(--warn); }

/* pdf list */
.pdf-list li { grid-template-columns: 40px 1fr auto; }
.pdf-list .pg { width: 40px; height: 48px; background: var(--card); display: grid; place-items: center; font-family: var(--f-term); font-size: 16px; color: var(--ink-3); border: 1px solid var(--rule-2); }

/* media players sit on black either way */
#player { background: #000; border: 1px solid var(--rule-2); }

/* ---------- content below tools ---------- */
.below { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.howto ol { padding-left: 32px; }
.howto li::marker { color: var(--fire); }
.faq details { border-bottom: 1px solid var(--rule); padding: 12px 0; max-width: var(--measure); }
.faq details:first-of-type { border-top: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; color: var(--ink); }
.faq summary:hover { color: var(--fire); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "[+]"; font-family: var(--f-term); color: var(--fire); flex: none; }
.faq details[open] summary::after { content: "[-]"; }
.faq details p { margin: 8px 0 0; color: var(--ink-2); }

.related { margin-top: 48px; padding: 24px 0 0; border-top: 1px solid var(--rule-2); }
.related h2 { margin-top: 0; font-size: var(--fs); color: var(--ink-3); }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.related a { display: inline-block; padding: 7px 12px; background: var(--card); border: 1px solid var(--rule-2); color: var(--ink-2); text-decoration: none; font-size: var(--small); }
.related a:hover { border-color: var(--fire); color: var(--fire); }

/* ad slots: collapse to nothing while empty */
.ad-slot { margin: 32px auto; text-align: center; }
.ad-slot:empty { display: none; margin: 0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--ink); color: var(--paper); padding: 8px 16px; font-size: var(--small); opacity: 0; pointer-events: none; transition: opacity .2s, translate .2s; z-index: 20; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; translate: -50% -8px; }

.page { padding-top: 32px; }
.page h2 { font-size: var(--h2); }
:root:not([data-font="legible"]) .page h2 { font-size: 16px; color: var(--fire); margin-top: 32px; }
:root:not([data-font="legible"]) .page h2::before { content: "## "; color: var(--ink-3); }
.page code, .prose code { font-family: var(--f-mono); color: var(--fire-2); }
noscript .note { display: block; }

/* ---------- small screens: the pixel font keeps its grid ---------- */
@media (max-width: 640px) {
  :root { --h-hero: 32px; --h1: 32px; --h2: 16px; }
  :root:not([data-font="legible"]) h2 { color: var(--fire); }
  .hero { padding-top: 32px; }
  .finder input[type="search"] { padding-left: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  :root { --paper: #fff; --card: #fff; --paper-2: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --rule: #bbb; --rule-2: #999; --fire: #000; --link: #000; color-scheme: light; }
  .site-head, .site-foot, .ad-slot, .related, .panel { display: none !important; }
}

.mascot-fig { margin: 24px 0; max-width: 320px; }
.mascot-fig img { display: block; width: 100%; height: auto; border: 2px solid var(--fire); }
.mascot-fig figcaption { color: var(--ink-3); margin-top: 8px; }

.site-head .brand { font-size: 48px; }
@media (max-width: 760px) { .brand .mascot { width: 56px; height: 56px; } .site-head .brand { font-size: 32px; } }
@media (max-width: 400px) { .brand .mascot { width: 44px; height: 44px; } .site-head .brand { font-size: 24px; } }

/* ---------- Profile Studio and framing tools ---------- */
.studio-files { align-items: center; }
.drop-mini { position: relative; overflow: hidden; }
.drop-mini input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-mini.over { border-color: var(--fire); background: var(--hl); }
.mocks { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 16px; }
.mock { margin: 0; width: min(100%, var(--mw)); display: grid; gap: 8px; }
.mock figcaption { font-size: var(--small); color: var(--ink-3); }
.mock-canvas { display: block; width: 100%; height: auto; border: 1px solid var(--rule-2); touch-action: none; cursor: default; }
.mock-canvas.dragging { cursor: grabbing !important; }
.mock-canvas:focus-visible, .stage-canvas:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.mock.phone .mock-canvas { border: 8px solid #1b1b1b; border-radius: 28px; outline: 1px solid var(--rule-2); }
.seg.multi input[type="checkbox"]:checked + span { background: var(--ink); color: var(--paper); }
.stage-canvas { display: block; width: 100%; max-width: 480px; height: auto; border: 1px solid var(--rule-2); touch-action: none; cursor: grab; }
.stage-canvas.wide { max-width: 960px; }
.stage-canvas:active { cursor: grabbing; }
#pv { display: grid; gap: 8px; }
.pv-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px; border: 1px solid var(--rule-2); }
.pv-row img { image-rendering: auto; }
.pv-c { display: block; }

/* ---------- Animate ---------- */
.stage-wrap.anim { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
@media (max-width: 820px) { .stage-wrap.anim { grid-template-columns: 1fr; } }
.stage-wrap.anim .stage-canvas { max-width: 360px; }
.fx-opts .field { min-width: 8rem; }
.anim-out { display: block; max-width: 100%; height: auto; margin-top: 16px; border: 1px solid var(--rule-2); }
.meter { display: grid; gap: 6px; margin-top: 8px; }
.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 7rem; gap: 12px; align-items: center; font-size: var(--small); color: var(--ink-2); padding: 4px 8px; border: 1px solid var(--rule); background: var(--paper); }
.meter-row.current { border-color: var(--fire); }
.meter-row .bar { height: 10px; border: 1px solid var(--rule-2); padding: 1px; }
.meter-row .bar i { display: block; height: 100%; background: var(--ok); }
.meter-row .bar i.over { background: var(--warn); }
@media (max-width: 560px) { .meter-row { grid-template-columns: 1fr auto; } .meter-row .bar { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- emotes, badges and chat previews ---------- */
.chat-pv { display: grid; gap: 0; margin: 8px 0 16px; border: 1px solid var(--rule-2); }
.chat-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 12px; font: 13px/28px var(--f-system); }
.chat-line.dark { background: #18181b; color: #efeff1; }
.chat-line.light { background: #fff; color: #0e0e10; }
.chat-line b { font-weight: 700; color: #bf94ff; }
.chat-line.light b { color: #7a3fd6; }
.chat-emote { display: inline-block; vertical-align: middle; }
#sizes { display: grid; gap: 8px; margin-top: 8px; }
#sizes .pv-row { align-items: flex-end; }

/* ---------- background remover ---------- */
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.ba figure { margin: 0; display: grid; gap: 8px; }
.ba figcaption { font-size: var(--small); color: var(--ink-3); }
.ba img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; border: 1px solid var(--rule-2); }
@media (max-width: 640px) { .ba { grid-template-columns: 1fr; } }

/* ---------- Minecraft MOTD ---------- */
.mc-palette { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 12px; }
.mc-swatch { width: 40px; height: 40px; border: 1px solid var(--rule-2); background: var(--sw); cursor: pointer; display: grid; place-items: center; padding: 0; }
.mc-swatch span { font: 16px var(--f-term); color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.mc-swatch:hover, .mc-swatch:focus-visible { outline: 2px solid var(--fire); outline-offset: 1px; }
.mc-src, .mono { font-family: var(--f-term); }
.mc-list { display: flex; gap: 8px; align-items: flex-start; padding: 6px; background: #1d1d1d; border: 2px solid #000; outline: 1px solid #555; max-width: 640px; margin-top: 8px; font: 16px/18px var(--f-term); overflow: hidden; }
.mc-list canvas { width: 64px; height: 64px; flex: none; image-rendering: pixelated; background: #3a3a3a; }
.mc-name { color: #fff; text-shadow: 2px 2px 0 #3f3f3f; margin-bottom: 4px; white-space: pre; }
.mc-line { min-height: 18px; white-space: pre; }
.mc-line span { text-shadow: 2px 2px 0 var(--sh); }

/* the spinning 3D girl in the hero: VRoid beta sample "Darkness", CC0 by pixiv */
.hero { position: relative; }
.hero-tuzi { position: absolute; right: -32px; top: -24px; width: 460px; height: 460px; pointer-events: none; }
.hero-tuzi img { width: 100%; height: 100%; display: block; }
@media (max-width: 1000px) { .hero-tuzi { display: none; } }
.mc-line span.mc-b { text-shadow: 1px 0 0 currentColor, 2px 2px 0 var(--sh), 3px 2px 0 var(--sh); }

/* header sky: our own pixel aurora (12-03, after nirvana.moe's lights but in the hero's colours). Drawn by mascots/make_sky.py. */
.site-head { background: #000 url(/assets/img/sky-night.gif) 0 0 / auto 100% repeat-x; image-rendering: pixelated; }
:root[data-theme="day"] .site-head { background: var(--paper) url(/assets/img/sky-day.gif) 0 0 / auto 100% repeat-x; }
.site-head img { image-rendering: auto; }
@media (prefers-reduced-motion: reduce) {
  .site-head { background-image: url(/assets/img/sky-night.png); }
  :root[data-theme="day"] .site-head { background-image: url(/assets/img/sky-day.png); }
}
.site-head a, .site-head button { text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 0 6px #000; }
.site-head button { background-color: rgba(0, 0, 0, .72); }
:root[data-theme="day"] .site-head a, :root[data-theme="day"] .site-head button { text-shadow: 1px 1px 0 var(--paper), -1px -1px 0 var(--paper), 1px -1px 0 var(--paper), -1px 1px 0 var(--paper), 0 0 6px var(--paper); }
:root[data-theme="day"] .site-head button { background-color: rgba(243, 234, 214, .8); }

/* ---------- wave 3: noise mixer, image markup, tier list ---------- */
.nz-mixer { display: grid; gap: 8px; margin: 8px 0 16px; }
.nz-row { display: grid; grid-template-columns: 9.5rem 1fr 2.5rem; gap: 12px; align-items: center; }
.nz-row output { text-align: right; color: var(--ink-2); }
.nz-level { margin-top: 12px; height: 12px; }
.nz-level > i { transition: width .1s linear; }
@media (max-width: 480px) { .nz-row { grid-template-columns: 1fr 2.5rem; } .nz-row > span { grid-column: 1 / -1; } .nz-row input { grid-column: 1; } }
.mk-colors button { width: 32px; padding: 0; }
.mk-colors button[aria-pressed="true"] { outline: 2px solid var(--fire); outline-offset: 2px; }
.mk-wrap { position: relative; margin-top: 16px; display: flex; justify-content: center; background: var(--paper); border: 1px solid var(--rule); padding: 8px; }
.mk-canvas { display: block; max-width: 100%; max-height: 75vh; width: auto; height: auto; touch-action: none; cursor: crosshair; }
.mk-canvas:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.mk-text { position: absolute; font: 600 16px system-ui, sans-serif; padding: 2px 4px; min-width: 8rem; background: var(--card); color: var(--ink); border: 1px solid var(--fire); }
.tl-board { border: 1px solid var(--rule-2); }
.tl-row { display: grid; grid-template-columns: 6.5rem 1fr auto; border-top: 1px solid var(--rule-2); background: var(--paper-2); }
.tl-row:first-child { border-top: 0; }
.tl-label { display: flex; align-items: center; justify-content: center; padding: 4px; }
.tl-label input { width: 100%; background: transparent; border: 0; color: inherit; text-align: center; font: 700 20px system-ui, sans-serif; padding: 4px 0; }
.tl-label input:focus-visible { outline: 2px solid #000; outline-offset: -2px; }
.tl-items { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 2px; padding: 2px; min-height: calc(var(--tile, 88px) + 4px); }
.tl-tray { border: 1px dashed var(--rule-2); background: var(--paper-2); margin: 8px 0 16px; }
.tl-ctl { display: grid; grid-template-columns: repeat(2, 32px); gap: 2px; padding: 4px; align-content: center; }
.tl-ctl button, .tl-ctl input { width: 32px; height: 32px; min-height: 0; padding: 0; }
.tl-tile { width: var(--tile, 88px); height: var(--tile, 88px); position: relative; background: #222; color: #fff; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; font: 600 13px/1.2 system-ui, sans-serif; padding: 0; }
.tl-tile img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; display: block; }
.tl-tile span { padding: 4px; overflow-wrap: anywhere; }
.tl-tile:focus-visible { outline: 3px solid var(--fire); outline-offset: -3px; }
.tl-tile.dragging { opacity: .3; }
.tl-ghost { position: fixed; pointer-events: none; z-index: 50; opacity: .9; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
@media (max-width: 560px) { .tl-row { grid-template-columns: 4rem 1fr auto; } .tl-label input { font-size: 16px; } }

/* ---------- Wave 4: creator image kit (watermark, Instagram, wallpaper, Steam) ---------- */
.wm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; margin-top: 16px; align-items: start; }
@media (max-width: 860px) { .wm-grid { grid-template-columns: 1fr; } }
.wm-canvas, .wp-canvas { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule-2); touch-action: none; cursor: grab; }
.wm-canvas:active, .wp-canvas:active { cursor: grabbing; }
.wm-canvas:focus-visible, .wp-canvas:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.wm-ctl { display: grid; gap: 12px; }
.wm-ctl .row + .row { margin-top: 0; }
.wm-pos { display: grid; grid-template-columns: repeat(3, 44px); border: 1px solid var(--rule-2); width: max-content; background: var(--paper); }
.wm-pos label { position: relative; }
.wm-pos input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.wm-pos span { display: grid; place-items: center; height: 40px; color: var(--ink-2); border: 1px solid var(--rule); }
.wm-pos input:checked + span { background: var(--ink); color: var(--paper); }
.wm-pos input:focus-visible + span { outline: 2px solid var(--fire); outline-offset: -2px; }
.wm-pos label:hover span { color: var(--fire); }
.files li.current { border-color: var(--fire); }
.ig-phone { max-width: 420px; padding: 12px; border: 1px solid var(--rule-2); background: var(--paper); }
.ig-grid-pv { display: block; width: 100%; height: auto; }
.ig-swipe { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; max-width: 420px; border: 1px solid var(--rule-2); background: #000; scroll-behavior: smooth; overscroll-behavior-x: contain; }
.ig-swipe img { flex: 0 0 100%; width: 100%; height: auto; scroll-snap-align: start; display: block; }
.ig-swipe:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.wp-groups { display: grid; gap: 8px; margin-top: 8px; }
.wp-group { border: 1px solid var(--rule); background: var(--paper); padding: 4px 12px; }
.wp-group > summary { cursor: pointer; color: var(--ink); padding: 4px 0; }
.wp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; padding: 4px 0 8px; }
.wp-list .check { align-items: start; }
.wp-stage { margin-top: 8px; display: grid; justify-items: start; }
.wp-canvas { max-height: 520px; width: auto; }
.st-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 24px; margin-top: 16px; align-items: start; }
@media (max-width: 860px) { .st-wrap { grid-template-columns: 1fr; } }
.st-mock { background: #1b2838; padding: 12px; border: 1px solid var(--rule-2); max-height: 560px; overflow: auto; }
.st-mock canvas { display: block; width: 100%; height: auto; }
.st-assets { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .st-assets { grid-template-columns: 1fr; } }
.st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.st-list li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--rule); background: var(--paper); }
.st-list .st-where { grid-column: 1 / -1; }
.st-pick[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media (prefers-reduced-motion: reduce) { .ig-swipe { scroll-behavior: auto; } }
/* AI wave (subtitles, upscaler, line art, depth) */
.sub-media video, .sub-media audio { display: block; width: 100%; max-height: 50vh; background: #000; border: 1px solid var(--rule-2); }
.sub-media audio { background: transparent; border: 0; }
.sub-lines { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 4px; max-height: 60vh; overflow: auto; }
.sub-row { display: grid; grid-template-columns: 2.2rem auto 6.5rem auto 6.5rem minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 4px 6px; border: 1px solid var(--rule); background: var(--paper); }
.sub-row.flagged { border-color: var(--warn); }
.sub-row .sub-t { width: 100%; font-family: var(--f-mono); }
.sub-row .sub-text { width: 100%; min-height: 2.6em; resize: vertical; }
.sub-flag { grid-column: 1 / -1; color: var(--warn); }
@media (max-width: 640px) {
  .sub-row { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .sub-row .sub-n { display: none; }
  .sub-row .sub-t { padding-left: 4px; padding-right: 4px; }
  .sub-row .sub-text { grid-column: 1 / -1; order: 9; }
}
.ai-compare { position: relative; border: 1px solid var(--rule-2); line-height: 0; }
.ai-compare img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.ai-compare #cmp-before { position: absolute; inset: 0; height: 100%; image-rendering: auto; }
.ai-pv { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; border: 1px solid var(--rule-2); background: var(--paper); }

/* ---- Irasutoya page decoration (いらすとや, みふねたかし). Terms: ideas/17-irasutoya-terms.md. Decoration only; never offered for download. ---- */
.ira { display: block; height: auto; max-width: 100%; user-select: none; -webkit-user-drag: none; }
.ira-tool { float: right; width: auto; max-width: 140px; max-height: 150px; margin: 0 0 8px 20px; }
.ira-shelf { float: right; width: 120px; margin: 4px 0 8px 24px; }
.shelf > summary.shelf-tab { position: relative; padding-right: 76px; }
.shelf > summary.shelf-tab .ira-tab { position: absolute; right: 34px; top: 50%; width: auto; height: 44px; transform: translateY(-50%); }
.shelf-body::after { content: ""; display: block; clear: both; }
.tool-head::after { content: ""; display: block; clear: both; }
.ira-credit-wrap, .site-foot .ira-credit-wrap { display: block; padding-block: 0 24px; }
.ira-credit { margin: 0; font-size: var(--small); }
@media (max-width: 720px) { .shelf > summary.shelf-tab .ira-tab { display: none; } .shelf > summary.shelf-tab { padding-right: 28px; } .ira-shelf { width: 84px; } }
@media (max-width: 480px) { .ira-tool { max-width: 84px; max-height: 96px; margin-left: 12px; } .ira-shelf { width: 72px; } }

/* Kasane 12-03: long file paths in prose (e.g. /licenses/) wrap on phones */
.prose code{overflow-wrap:anywhere}
.ja-extras{border:1px solid var(--rule-2);padding:8px 12px 4px;margin:0 0 12px}.ja-extras legend{padding:0 6px;font-weight:700}.sub-media video::cue{line-height:1.5}
