/* TextMojis: year-2000 web utility look, system fonts only. */

:root {
  --bg: #fff;
  --text: #202020;
  --muted: #5c5c5c;
  --brand: #b00000;
  --link: #000099;
  --line: #c5c5c5;
  --head: #e8edf7;
  --accent: #7185aa;
  --selected: #fffbc8;
  --button: #e7e7e7;
  --edge: #858585;
  --focus: #155bc2;
  --field: #fff;
  --field-shadow: #d6d6d6;
  --placeholder: #6e6e6e;
  --btn-line: #a8a8a8;
  --btn-light: #fff;
  --btn-hover: #efefef;
  --btn-off: #f0f0f0;
  --btn-off-text: #6b6b6b;
  --code-bg: #f7f7f7;
  --ui: Arial, Helvetica, sans-serif;
  --brand-font: Georgia, "Times New Roman", serif;
  --expr: system-ui, -apple-system, "Segoe UI", "Segoe UI Symbol", "Noto Sans", "Noto Sans Symbols 2", "Noto Sans CJK JP", "Hiragino Sans", Meiryo, "Arial Unicode MS", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  color-scheme: light dark;
}

/* Dark: the same flat look with the colours inverted (no theme toggle; follows the system). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --text: #e4e4e4;
    --muted: #a9a9a9;
    --brand: #ff7a70;
    --link: #8db4ff;
    --line: #444;
    --head: #1d2636;
    --accent: #6f86b3;
    --selected: #3b3510;
    --button: #2d2d2d;
    --edge: #777;
    --focus: #6fa3ff;
    --field: #0c0c0c;
    --field-shadow: #000;
    --placeholder: #969696;
    --btn-line: #5c5c5c;
    --btn-light: #4a4a4a;
    --btn-hover: #383838;
    --btn-off: #222;
    --btn-off-text: #8c8c8c;
    --code-bg: #1e1e1e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--ui); }
a { color: var(--link); text-decoration: underline; }
a[aria-current="page"] { color: var(--text); font-weight: bold; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
/* Controls that need JS are hidden when scripting is off (no inline styles: the CSP forbids them). */
@media (scripting: none) { .js-only { display: none !important; } }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 8px; top: -100px; z-index: 10; padding: 8px 12px; background: var(--selected); border: 1px solid var(--text); }
.skip:focus { top: 8px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 32px; padding: 4px 12px; border: 1px solid var(--btn-line); border-radius: 0;
  background: var(--button); color: var(--text); cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--btn-light), inset -1px -1px 0 var(--edge);
}
.btn:hover { background: var(--btn-hover); }
.btn:active { box-shadow: inset 1px 1px 0 var(--edge), inset -1px -1px 0 var(--btn-light); }
.btn:disabled { color: var(--btn-off-text); cursor: default; background: var(--btn-off); box-shadow: none; }
.link-btn { padding: 0; border: 0; background: none; color: var(--link); text-decoration: underline; cursor: pointer; }
.link-btn:disabled { color: var(--muted); text-decoration: none; cursor: default; }

/* ---------- header ---------- */
.site-head .head-in {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding-top: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.logo { margin-right: auto; text-decoration: none; white-space: nowrap; }
.logo-name { font: italic bold 28px/1.1 var(--brand-font); color: var(--brand); }
.logo-face { font: 12px var(--expr); color: var(--muted); }
.top-nav ul { display: flex; flex-wrap: wrap; }
.top-nav li + li::before { content: "-"; padding: 0 8px; color: var(--muted); }
.top-nav a { font-size: 13px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 12px; padding-bottom: 24px; }
.main { min-width: 0; }
.main:focus { outline: none; }

/* ---------- panels ---------- */
.panel { border: 1px solid var(--line); border-top: 2px solid var(--accent); margin-bottom: 16px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: var(--head); border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: bold;
}
.panel-head h2 { font-size: inherit; }
h2.panel-head { justify-content: flex-start; gap: 0; }
.panel-head h2:focus { outline: none; }
h2.panel-head::before, .panel-head h2::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; vertical-align: 2px; background: var(--brand);
}
.panel-head .link-btn { font-size: 13px; font-weight: normal; }
.count { color: var(--muted); font-weight: normal; font-size: 13px; }

.nav-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.nav-list li:last-child { border-bottom: 0; }
.nav-list li:has(a[aria-current]) { background: var(--selected); }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; }
.type-grid li { border-bottom: 1px solid var(--line); text-align: center; }
.type-grid li:nth-child(odd) { border-right: 1px solid var(--line); }
.type-grid a { display: block; padding: 8px 4px; font-size: 13px; }
.type-grid a[aria-current] { background: var(--selected); }

.filters { display: grid; gap: 2px; padding: 6px 10px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--focus); }

/* ---------- intro + search ---------- */
.intro { margin-bottom: 8px; }
.intro h1 { font-size: 18px; }
.intro p { color: var(--muted); }
.search { margin-bottom: 14px; }
.search-box { position: relative; }
.search input {
  width: 100%; height: 44px; padding: 0 44px 0 10px; border: 1px solid var(--edge); border-radius: 0;
  background: var(--field); font-size: 17px; -webkit-appearance: none; appearance: none;
  box-shadow: inset 1px 1px 0 var(--field-shadow);
}
.search input::placeholder { color: var(--placeholder); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search .clear {
  position: absolute; top: 1px; right: 1px; width: 42px; height: 42px;
  border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}
.search .clear:hover { color: var(--text); }
.hint { margin-top: 4px; color: var(--muted); font-size: 12px; }
.hint kbd, .prose kbd { padding: 0 4px; border: 1px solid var(--edge); background: var(--button); font: 12px var(--mono); }
@media (hover: none) { .hint { display: none; } }
.note { margin-bottom: 12px; padding: 8px 10px; background: var(--selected); border: 1px solid var(--line); }

/* Mobile-only navigation (shown below 768px). */
.m-intents, .m-tools { display: none; }

/* ---------- result rows ---------- */
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 10px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row.is-random { background: var(--selected); outline: 2px dashed var(--text); outline-offset: -3px; }
.row-text { min-width: 0; }
.expr {
  position: relative; overflow-x: auto; white-space: pre;
  font: 24px/1.35 var(--expr); cursor: copy; padding-bottom: 2px;
}
.expr.is-art { font: 14px/1.2 var(--mono); padding: 2px 0 4px; }
.row-title { margin-top: 4px; font-size: 14px; }
.labels { margin-top: 2px; color: var(--muted); font-size: 13px; }
.row-desc { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  position: relative; min-height: 30px; max-width: 100%; padding: 3px 8px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 0; background: var(--field); cursor: copy;
  font: 14px/1.3 var(--expr); white-space: pre; text-align: left; text-overflow: ellipsis;
}
.chip.is-art { font: 9px/1.1 var(--mono); }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--selected); border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.row-actions { display: flex; gap: 8px; }
.star { width: 44px; min-height: 44px; padding: 0; font-size: 18px; }
.star[aria-pressed="true"] { color: var(--brand); }
.copy { position: relative; min-width: 76px; min-height: 44px; }

/* "Copied!" badge on the control that copied (text, not just colour). */
.is-copied { overflow: visible; }
.is-copied::after {
  content: "✓ Copied!"; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; min-width: 100%; padding: 0 6px;
  background: var(--selected); border: 1px solid var(--text); color: var(--text);
  font: bold 13px/1 var(--ui); white-space: nowrap; z-index: 1;
}
.expr.is-copied::after { left: auto; right: 0; bottom: auto; transform: none; min-width: 0; padding: 4px 8px; }

.empty { padding: 16px 10px; display: grid; gap: 6px; }

/* ---------- home: Recently copied ---------- */
.strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
.strip .chip { max-width: 220px; }

/* ---------- detail pages ---------- */
.crumbs { margin-bottom: 8px; font-size: 13px; }
.crumbs ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: "\203A"; padding: 0 6px; color: var(--muted); }
.detail-head h1 { font-size: 22px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.copy-link { position: relative; min-height: 44px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
.tags li { padding: 2px 8px; border: 1px solid var(--line); }

/* ---------- lab ---------- */
.lab-body { display: grid; gap: 12px; padding: 10px; }
.lab-body .chips { margin-top: 0; }
.lab .chip { cursor: pointer; }
.slots .chip { min-width: 44px; text-align: center; }
.lab-out { font-size: 40px; text-align: center; padding: 8px 0; }
.lab-fine { color: var(--muted); font-size: 13px; }
.slot { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 10px; }
.slot-label { font-weight: bold; }
.lab-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-btns .btn { min-height: 44px; }
.composer { display: grid; gap: 8px; }
.composer textarea {
  width: 100%; resize: vertical; padding: 6px; border: 1px solid var(--edge); border-radius: 0;
  background: var(--field); font: 16px/1.3 var(--expr); box-shadow: inset 1px 1px 0 var(--field-shadow);
}
.composer .hint { margin-top: 0; }
/* Chat preview styles: the only fixed colours on the site (generic, contrast >= 4.5:1). */
.convo { min-height: 120px; max-height: 360px; overflow-y: auto; padding: 10px; border: 1px solid var(--edge); background: #eceff3; }
.convo[data-style="dark"] { background: #1c1f24; }
.convo[data-style="term"] { background: #0c0c0c; }
.bubbles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.bubbles li { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble {
  max-width: 85%; padding: 6px 10px; border: 1px solid #b9c3d0; background: #fff; color: #1a1a1a;
  font: 16px/1.35 var(--expr); white-space: pre-wrap; overflow-wrap: anywhere;
}
.convo[data-style="dark"] .bubble { border-color: #4b5666; background: #2e3642; color: #f0f0f0; }
.convo[data-style="term"] .bubbles li { align-items: stretch; }
.convo[data-style="term"] .bubble { max-width: none; padding: 0; border: 0; background: none; color: #d8f5d0; font: 14px/1.3 var(--mono); white-space: pre; overflow-x: auto; }
.convo[data-style="term"] .copy { align-self: flex-end; }

/* ---------- analytics choice bar (non-modal, stays in the page flow at the end) ---------- */
.consent { position: sticky; bottom: 0; z-index: 15; background: var(--head); border-top: 2px solid var(--accent); }
.consent:focus { outline: none; }
.consent-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
.consent-in p { flex: 1 1 420px; }
.consent-btns { display: flex; gap: 8px; }
.consent-btns .btn { min-height: 44px; min-width: 150px; }

/* ---------- copy failure toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 20;
  width: min(560px, calc(100% - 24px)); display: grid; gap: 8px; padding: 12px;
  background: var(--selected); border: 1px solid var(--text); box-shadow: 3px 3px 0 var(--edge);
}
.toast textarea {
  width: 100%; resize: vertical; padding: 6px; border: 1px solid var(--edge); border-radius: 0;
  background: var(--field); font: 16px/1.3 var(--mono); white-space: pre; overflow-x: auto;
}
.toast .btn { justify-self: end; min-height: 44px; }

/* ---------- content pages ---------- */
.prose { max-width: 760px; padding-top: 20px; padding-bottom: 32px; }
.prose h1 { font-size: 22px; margin-bottom: 12px; }
.prose h2 { font-size: 17px; margin: 22px 0 8px; }
.prose h3 { font-size: 15px; margin: 16px 0 6px; }
.prose p, .prose ul, .prose ol, .prose pre { margin: 0 0 12px; }
.prose ul { list-style: square; padding-left: 22px; }
.prose ol { padding-left: 22px; }
.prose code, .prose kbd, .prose pre { font-family: var(--mono); font-size: 13px; }
.prose pre { overflow-x: auto; padding: 8px; border: 1px solid var(--line); background: var(--code-bg); }

/* ---------- footer ---------- */
.site-foot .wrap { padding-top: 12px; padding-bottom: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-foot ul { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- mobile ---------- */
/* Mini window: a small desktop-style window parked over the sidebar column, never over the results. */
.mini-win {
  position: fixed; left: max(16px, calc(50vw - 504px)); bottom: 16px; z-index: 14; width: 224px;
  background: var(--bg); border: 1px solid var(--edge); border-top: 2px solid var(--accent); box-shadow: 3px 3px 0 var(--edge);
}
.mini-win .panel-head { justify-content: space-between; }
.mini-win.is-min { width: auto; }
.mini-win.is-min .panel-head { border-bottom: 0; gap: 12px; }
.mini-x { min-width: 28px; min-height: 28px; padding: 0 6px; line-height: 1; }
.mini-body { padding: 8px 10px 10px; font-size: 13px; text-align: center; }
.mini-body p + p { margin-top: 6px; }
.mini-face { font-family: var(--expr); font-size: 22px; }

@media (max-width: 767px) {
  .mini-win { display: none; }
  .wrap { padding: 0 10px; }
  .site-head .head-in { padding-top: 10px; gap: 6px 10px; }
  .logo-name { font-size: 24px; }
  .top-nav { order: 3; flex-basis: 100%; }
  .top-nav a { display: inline-block; padding: 6px 0; }
  .random { min-height: 44px; }
  .layout { display: block; }
  .side { display: none; }
  .m-intents { display: block; margin: 0 -10px 10px; }
  .m-intents ul { display: flex; gap: 6px; overflow-x: auto; padding: 2px 10px 6px; scrollbar-width: thin; }
  .m-intents a {
    display: flex; align-items: center; min-height: 40px; padding: 0 12px; white-space: nowrap;
    border: 1px solid var(--line); background: var(--field);
  }
  .m-intents a[aria-current] { background: var(--selected); border-color: var(--text); }
  .m-tools { display: block; margin-bottom: 12px; border: 1px solid var(--line); }
  .m-tools summary { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--head); font-weight: bold; cursor: pointer; list-style: none; }
  .m-tools summary::-webkit-details-marker { display: none; }
  .m-tools summary::before { content: "+"; width: 14px; height: 14px; display: inline-grid; place-items: center; border: 1px solid var(--edge); background: var(--field); font: 12px/1 var(--mono); }
  .m-tools[open] summary::before { content: "\2212"; }
  .m-tools[open] summary { border-bottom: 1px solid var(--line); }
  .m-tools .type-grid a { padding: 12px 4px; }
  .m-tools .filters { padding: 6px 10px 10px; }
  .m-tools .check { min-height: 44px; }
  .row { gap: 8px; padding: 12px 8px; }
  .chips { gap: 8px; }
  .chip { min-height: 36px; }
  .copy { min-width: 64px; }
  .lab-out { font-size: 32px; }
  .consent-btns { flex: 1 1 100%; }
  .consent-btns .btn { flex: 1; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
