/* Emote fusion page. Colours, fonts, radii and the header come from the Linkers design kit, which
   nginx adds to the page (linkers.ooo /kit/v1/kit-theme.css and kit.css); the .em-* blocks below are
   the same building blocks the emotes site uses (apps/emotes/web/app/globals.css). */
[hidden] { display: none !important; }
:root {
  --lk-font-inter: 'Inter';
  --lk-font-jetbrains: 'JetBrains Mono';
  --chat: #111318;       /* the DGG chat strip keeps its own dark look in every theme */
}
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
button, input { font: inherit; color: inherit; }
main { outline: none; display: flex; flex-direction: column; gap: 32px; }
.m0 { margin: 0; }

/* Emotes-site building blocks */
.em-kicker { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; margin: 0; }
.em-h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; font-size: clamp(1.6rem, 4vw, 2.25rem); margin: 0; overflow-wrap: anywhere; }
.em-h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.em-link { color: var(--accent); text-decoration: none; border-radius: 3px; overflow-wrap: anywhere; }
.em-link:hover { text-decoration: underline; }
.em-input { width: 100%; padding: 10px 12px; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; transition: border-color .15s; }
.em-input::placeholder { color: var(--text-secondary); }
.em-input:hover { border-color: var(--border-hover); }
.lk-body .em-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.em-footer { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12.5px;
  display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }

.top { display: flex; flex-direction: column; gap: 8px; }
.lede { margin: 0; color: var(--text-secondary); max-width: 60ch; }

/* Buttons: the emotes site's solid .em-btn for the main action, a quiet outlined button for the rest */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions button { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.actions button:hover:not(:disabled) { border-color: var(--border-hover); background: var(--bg-hover); }
.actions button:disabled { opacity: .5; cursor: not-allowed; }
.actions .primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.actions .primary:hover:not(:disabled) { background: var(--accent-hover); border-color: transparent; }
.toggle { display: inline-flex; gap: 8px; align-items: center; color: var(--text-secondary); font-size: 12px; margin-left: auto; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; cursor: pointer; }
.tw { font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent-border); background: var(--accent-dim);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap; }

/* Fusion lab */
.lab { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.lab > * { min-width: 0; }
@media (min-width: 760px) { .lab { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto auto; } .lab .actions { grid-column: 1 / -1; } }

.donors { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
@media (min-width: 760px) { .donors { grid-template-columns: 1fr; align-content: start; } .swap { justify-self: center; transform: rotate(90deg); } }
.slot { display: grid; justify-items: center; gap: 2px; text-align: center; background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; cursor: pointer; min-width: 0; transition: border-color .15s, background .15s; }
.slot:hover { border-color: var(--border-hover); }
.slot canvas { width: 100%; max-width: 120px; height: 64px; object-fit: contain; margin-bottom: 4px; }
@media (min-width: 760px) {
  .slot { grid-template-columns: 96px 1fr; grid-template-rows: auto auto; justify-items: start; text-align: left; column-gap: 12px; align-items: center; }
  .slot canvas { grid-row: 1 / 3; width: 96px; height: 72px; margin: 0; }
}
.slot-role { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; }
.slot-name { max-width: 100%; font-family: var(--font-mono); font-size: 14px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-dim); }
.slot[aria-pressed="true"] .slot-role { color: var(--accent); }
.swap { background: none; border: 0; font-size: 1.6rem; line-height: 1; padding: 8px; cursor: pointer; color: var(--text-secondary); }
.swap:hover { color: var(--accent); }

.result { margin: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: grid; gap: 14px; justify-items: center; min-width: 0; }
.stage { width: 100%; display: grid; place-items: center; min-height: 220px; border-radius: var(--radius);
  background: repeating-conic-gradient(var(--bg-input) 0% 25%, var(--bg-surface) 0% 50%) 0 0 / 16px 16px; }
#result { width: auto; height: min(240px, 50vw); max-width: 100%; }
.stage { position: relative; }
#compass { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; touch-action: none; cursor: crosshair; }
#compass .ring { fill: none; stroke: var(--text-secondary); stroke-width: 2; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
#compass .hand { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
#compass .knob { fill: var(--accent); stroke: var(--bg-base); stroke-width: 2; cursor: grab; vector-effect: non-scaling-stroke; }
#compass .knob:focus-visible { outline: none; stroke: var(--text-primary); stroke-width: 3; }
.dirbar { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.dirbar .hint { margin: 0; flex-basis: 100%; text-align: center; }
.link { background: none; border: 0; padding: 4px; color: var(--text-secondary); font-size: 0.875rem; text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--accent); }
.vote { display: flex; gap: 8px; }
.vote button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary);
  font-family: var(--font-mono); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.vote button:hover { border-color: var(--accent-border); background: var(--bg-hover); }
.vote button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
figcaption { width: 100%; display: grid; gap: 10px; justify-items: center; }
.fname { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 6vw, 2.6rem); line-height: 1.05; letter-spacing: -0.04em; text-align: center; overflow-wrap: anywhere; }

/* How it looks in DGG chat: always the dark chat strip, whatever the site theme */
.chatline { width: 100%; background: var(--chat); border-radius: var(--radius-sm); padding: 8px 12px; font: 400 14px/1.6 Roboto, var(--font-sans);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap; color: #b9b9b9; }
.chatline .flair { width: 16px; height: 16px; border-radius: 3px; background: linear-gradient(135deg, #5d9cec, #3b6fb6); }
.chatline .nick { color: #ffd66b; font-weight: 500; }
.chatline .colon { margin-right: 4px; }
#inchat { height: 32px; width: auto; }
.note { margin: 0; color: var(--text-secondary); font-size: 0.875rem; text-align: center; max-width: 52ch; }

/* Face shape editor */
.hint { color: var(--text-secondary); font-size: 0.875rem; margin: 0 0 12px; }
.actions .hint { margin: 0; }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; }
.seg button { padding: 6px 14px; border-radius: 999px; border: none; background: transparent; color: var(--text-secondary);
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; text-transform: lowercase; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text-primary); background: var(--bg-hover); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.framebar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; font-size: 12px; color: var(--text-secondary); }
.framebar input[type="range"] { flex: 1 1 200px; accent-color: var(--accent); }
.framebar output { font-family: var(--font-mono); min-width: 16ch; }
.framebar button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary);
  font-family: var(--font-mono); font-size: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.framebar button:hover:not(:disabled) { border-color: var(--accent-border); background: var(--bg-hover); }
.framebar button:disabled { opacity: 0.5; cursor: default; }
.framebar .hint { flex-basis: 100%; margin: 0; }
.shape-stage { position: relative; width: fit-content; max-width: 100%; margin-bottom: 12px; touch-action: none; border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  background: repeating-conic-gradient(var(--bg-input) 0% 25%, var(--bg-surface) 0% 50%) 0 0 / 16px 16px; }
#shapeCanvas { display: block; max-width: 100%; height: auto; }
#shapeSvg { position: absolute; inset: 0; width: 100%; height: 100%; }
#shapeSvg polygon { fill: var(--accent-dim); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
#shapeSvg circle { fill: var(--accent); stroke: var(--bg-base); stroke-width: 2; cursor: grab; vector-effect: non-scaling-stroke; }
#shapeSvg circle:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

/* Top fusions */
.board .em-h2 { margin-bottom: 12px; }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); counter-reset: rank; }
.board-list li { counter-increment: rank; min-width: 0; }
.board-item { width: 100%; display: grid; grid-template-columns: 2ch 56px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 8px 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.board-item:hover { border-color: var(--accent-border); background: var(--bg-hover); }
.board-item::before { content: counter(rank); grid-row: 1 / 3; color: var(--text-secondary); font-family: var(--font-mono); font-weight: 600; }
.board-item canvas { grid-row: 1 / 3; width: 56px; height: 48px; object-fit: contain; }
.board-item .bname { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item .bpair { grid-column: 3; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item .bscore { grid-column: 4; grid-row: 1 / 3; font-family: var(--font-mono); font-weight: 700; color: var(--accent); }

/* Emote picker */
.picker-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#search { width: min(100%, 280px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.tile { display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; min-width: 0; transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--accent-border); background: var(--bg-hover); }
.tile:hover span { color: var(--accent); }
.tile[aria-selected="true"] { border-color: var(--accent); background: var(--accent-dim); }
.tile img { height: 32px; width: auto; max-width: 64px; object-fit: cover; object-position: left; image-rendering: pixelated; }
.tile span { font-family: var(--font-mono); font-size: 11px; color: var(--text-primary); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot { color: var(--text-secondary); font-size: 12.5px; margin: 16px 0 0; }
.empty { color: var(--text-secondary); grid-column: 1 / -1; padding: 16px 0; }

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