
:root { color-scheme: dark; --rail: #1e1f22; --side: #2b2d31; --main: #313338; --raised: #383a40; --hover: #3a3c42; --line: #3f4147;
  --ink: #dbdee1; --strong: #f2f3f5; --muted: #949ba4; --accent: #5b6ef5; --accent-ink: #fff; --danger: #f23f43; --mention: rgba(250,166,26,.12); --mention-ink: #f0b232; --ok: #23a55a; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; color: var(--ink); background: var(--main); }
a { color: #00a8fc; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { color: var(--strong); }
.muted { color: var(--muted); } .small { font-size: .8rem; }
.error { background: rgba(242,63,67,.12); color: #ffb3b5; border: 1px solid rgba(242,63,67,.4); padding: 8px 12px; border-radius: 6px; }
button, .button { font: inherit; display: inline-block; padding: 6px 14px; border-radius: 4px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; line-height: 1.4; }
button:hover, .button:hover { filter: brightness(1.1); text-decoration: none; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.link { background: none; padding: 0; color: var(--muted); }
button.link:hover { color: var(--ink); text-decoration: underline; }
button.danger { color: var(--danger); }
.button.full { width: 100%; text-align: center; }
.icon-button { background: transparent; color: var(--muted); padding: 4px 8px; font-size: 1.1rem; }
.icon-button:hover { color: var(--strong); background: var(--hover); }
form.inline { display: inline; }
input, textarea, select { font: inherit; color: var(--ink); background: #1e1f22; border: 1px solid #1e1f22; border-radius: 6px; padding: 8px 10px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); }
input[type=radio], input[type=checkbox] { width: auto; }
label { display: grid; gap: 4px; color: var(--muted); font-size: .85rem; }
.panel { background: var(--side); border-radius: 8px; padding: 16px; margin: 12px 0; display: grid; gap: 12px; }
.avatar { border-radius: 50%; display: block; flex: none; background: #1e1f22; }
.avatar.sm { width: 32px; height: 32px; } .avatar.md { width: 40px; height: 40px; }
.badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 8px; padding: 0 6px; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--strong); margin-right: 6px; flex: none; }

/* App shell: games rail, channel sidebar, content, members. */
body.app { display: grid; grid-template-columns: 72px 240px minmax(0, 1fr) 240px; height: 100vh; overflow: hidden; }
.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; overflow-y: auto; }
.rail-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--main); color: var(--strong); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; transition: border-radius .15s; }
.rail-icon:hover, .rail-icon.active { border-radius: 16px; background: var(--accent); text-decoration: none; }
/* Desktop: the drawer wrapper is transparent to the grid; phone-only parts are hidden. */
.nav-drawer { display: contents; }
.drawer-toggle { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.backdrop, .tabbar, .mobile-only { display: none; }
.sidebar { background: var(--side); display: flex; flex-direction: column; min-height: 0; height: 100vh; }
.sidebar-header { padding: 0 16px; height: 48px; display: flex; align-items: center; font-weight: 700; color: var(--strong); border-bottom: 1px solid #1f2023; box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px; }
.channel-group { margin-top: 12px; }
.channel-group ul, .members ul { list-style: none; margin: 0; padding: 0; }
.channel-group-title { font-size: .72rem; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin: 8px 8px 4px; font-weight: 700; }
.category-toggle { all: unset; display: flex; align-items: center; gap: 2px; width: 100%; cursor: default; }
.js .category-toggle { cursor: pointer; }
.js .category-caret { display: inline-block; }
.js .category-toggle:hover { color: var(--ink); }
.category-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.category-caret { display: none; width: 12px; font-size: .7rem; transition: transform .12s; }
.channel-category.folded .category-caret { transform: rotate(-90deg); }
.channel-category.folded li:not(:has(> .channel.active, > .channel.unread)) { display: none; }
/* npm run demo:serve */
.demo-banner { position: fixed; right: 12px; bottom: 12px; z-index: 200; max-width: calc(100vw - 24px); padding: 6px 12px; border-radius: 999px; background: rgba(240,178,50,.95); color: #1e1f22; font-size: .8rem; font-weight: 600; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
@media (max-width: 720px) { .demo-banner { bottom: 68px; } }
[data-demo-off] { opacity: .5; cursor: not-allowed; }
.channel { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 4px; color: var(--muted); margin: 1px 0; }
.channel:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.channel.active { background: var(--raised); color: var(--strong); }
.channel.unread { color: var(--strong); font-weight: 600; }
.channel-icon { color: var(--muted); width: 18px; text-align: center; flex: none; }
.channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel { background: #232428; padding: 8px; display: flex; align-items: center; gap: 6px; }
.user-identity { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 2px 4px; border-radius: 4px; color: var(--ink); }
.user-identity:hover { background: var(--hover); text-decoration: none; }
.user-text { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: var(--strong); font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-sub { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }
.content-header { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid #26272b; box-shadow: 0 1px 0 rgba(0,0,0,.2); min-width: 0; }
.channel-title { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-topic { color: var(--muted); font-size: .85rem; border-left: 1px solid var(--line); padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }
.crumb { color: var(--muted); white-space: nowrap; } .crumb-sep { color: var(--muted); }
.content-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; }
.content-scroll > .composer { margin-top: auto; }
/* The composer sits on the very bottom edge: no scroller padding under it
   for messages to show through. */
.content-scroll:has(> .composer) { padding-bottom: 0; }
.members { background: var(--side); padding: 16px 8px; overflow-y: auto; height: 100vh; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; color: var(--ink); }
.member:hover { background: var(--hover); text-decoration: none; }

/* Channel: thread cards. */
.thread-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.thread-card .thread-link { display: flex; gap: 12px; align-items: center; background: var(--side); border-radius: 8px; padding: 12px 14px; color: var(--ink); }
.thread-card .thread-link:hover { background: var(--hover); text-decoration: none; }
.thread-text { display: flex; flex-direction: column; min-width: 0; }
.thread-title { color: var(--ink); font-weight: 600; display: flex; align-items: center; overflow-wrap: anywhere; }
.thread-card.unread .thread-title { color: var(--strong); font-weight: 700; }
.thread-badge { margin-right: 4px; font-size: 0.9em; }
.report-panel { max-width: 640px; }
.report-quote { margin: 0 0 16px; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--raised); border-radius: 4px; }
.report-quote p { margin: 6px 0 0; overflow-wrap: anywhere; }
.who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.admin-section { padding: 0 16px 16px; }
.admin-section h2 { font-size: 16px; margin: 16px 0 8px; }
.report-list, .mod-log, .report-reasons { list-style: none; margin: 0; padding: 0; }
.report-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; display: grid; gap: 8px; }
.report-target { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.report-target > p, .report-target > a { flex-basis: 100%; }
.report-body { margin: 4px 0; overflow-wrap: anywhere; }
.report-reasons li, .mod-log li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 2px 0; overflow-wrap: anywhere; }
.report-item button.danger { background: var(--danger); color: #fff; }
.report-item .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.mod-log li { padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
/* Tickets (GitHub-issue style) */
.ticket-page { padding: 16px; max-width: 1100px; display: grid; gap: 12px; }
.ticket-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ticket-filters select { width: auto; max-width: 100%; }
.ticket-box { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ticket-box-head { display: flex; gap: 16px; padding: 10px 14px; background: var(--side); border-bottom: 1px solid var(--line); }
.tab-link { color: var(--muted); text-decoration: none; font-weight: 600; }
.tab-link.active { color: var(--strong); }
.ticket-empty { padding: 24px; text-align: center; margin: 0; }
.ticket-rows { list-style: none; margin: 0; padding: 0; }
.ticket-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ticket-row:last-child { border-bottom: 0; }
.ticket-row:hover { background: var(--hover); }
.ticket-row-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ticket-row-title { color: var(--strong); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.ticket-row-title:hover { color: var(--accent); }
.ticket-row-meta { flex-basis: 100%; }
.ticket-row-counts { display: flex; gap: 10px; flex: none; }
.state-icon { flex: none; width: 18px; text-align: center; font-weight: 700; }
.state-icon.open, .state-badge.open { color: var(--ok); }
.state-icon.done { color: #a371f7; }
.state-icon.shut { color: var(--muted); }
.state-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: #fff; }
.state-badge.open { background: #238636; color: #fff; }
.state-badge.done { background: #8957e5; }
.state-badge.shut { background: #6e7681; }
.ticket-category { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.ticket-private { font-size: 12px; color: var(--mention-ink); }
.ticket-label { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 8px; margin: 1px 2px; border: 1px solid transparent; }
.label-red { background: rgba(248,81,73,.18); color: #ff7b72; border-color: rgba(248,81,73,.4); }
.label-orange { background: rgba(219,109,40,.18); color: #ffa657; border-color: rgba(219,109,40,.4); }
.label-yellow { background: rgba(210,153,34,.18); color: #e3b341; border-color: rgba(210,153,34,.4); }
.label-green { background: rgba(46,160,67,.18); color: #56d364; border-color: rgba(46,160,67,.4); }
.label-teal { background: rgba(32,178,170,.18); color: #4fd1c5; border-color: rgba(32,178,170,.4); }
.label-blue { background: rgba(56,139,253,.18); color: #79c0ff; border-color: rgba(56,139,253,.4); }
.label-purple { background: rgba(163,113,247,.18); color: #d2a8ff; border-color: rgba(163,113,247,.4); }
.label-gray { background: rgba(110,118,129,.2); color: #b1bac4; border-color: rgba(110,118,129,.4); }
.category-picker { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.category-picker a { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--side); color: var(--ink); text-decoration: none; }
.category-picker a:hover { border-color: var(--accent); }
.category-icon { font-size: 28px; }
.category-name { font-weight: 700; color: var(--strong); }
.ticket-form textarea { width: 100%; }
.ticket-form.dropping { outline: 2px dashed var(--accent); outline-offset: 4px; }
.ticket-images { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 6px; }
.upload-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-item { position: relative; }
.upload-item img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.upload-remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 12px; line-height: 22px; }
.ticket-title { margin: 0; font-size: 24px; font-weight: 600; color: var(--strong); overflow-wrap: anywhere; }
.ticket-subtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; align-items: start; }
.ticket-main { display: grid; gap: 12px; min-width: 0; }
.ticket-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ticket-comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-box { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ticket-comment.staff .comment-box { border-color: rgba(91,110,245,.6); }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; background: var(--side); border-bottom: 1px solid var(--line); }
.ticket-comment.staff .comment-head { background: rgba(91,110,245,.15); }
.comment-author { font-weight: 700; color: var(--strong); text-decoration: none; }
.comment-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.comment-body { padding: 10px 12px; overflow-wrap: anywhere; }
.staff-badge { font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
.role-badge { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.ticket-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ticket-gallery img { max-width: 240px; max-height: 180px; width: auto; height: auto; border-radius: 6px; border: 1px solid var(--line); display: block; }
.ticket-event { display: flex; gap: 8px; align-items: center; padding-left: 52px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.ticket-event strong { color: var(--ink); }
.ticket-timeline > li.fresh { animation: ticket-fresh 2.4s ease-out; border-radius: 8px; }
@keyframes ticket-fresh { from { background: rgba(91,110,245,.22); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .ticket-timeline > li.fresh { animation: none; outline: 1px solid rgba(91,110,245,.5); } }
.event-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.ticket-note { padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin: 0; }
.ticket-state-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ticket-side { display: grid; gap: 16px; font-size: 14px; }
.ticket-side section { border-bottom: 1px solid var(--line); padding-bottom: 12px; display: grid; gap: 6px; justify-items: start; }
.ticket-side h3 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.side-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.labels-form { display: grid; gap: 2px; }
.notify-icon { width: 32px; text-align: center; font-size: 20px; flex: none; }
@media (max-width: 720px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-event { padding-left: 0; }
  .ticket-comment > .avatar { display: none; }
}
.thread-meta { color: var(--muted); font-size: .8rem; }
.empty-state { text-align: center; padding: 48px 16px; }
.empty-state .big { font-size: 1.5rem; color: var(--strong); font-weight: 700; }

/* Thread: message stream. */
.messages { list-style: none; margin: 0; padding: 0; }
.message { padding: 6px 8px; border-radius: 4px; margin-top: 10px; }
.message:hover { background: #2e3035; }
.message:target { background: var(--mention); }
.message-row { display: flex; gap: 14px; align-items: flex-start; }
.message-main { flex: 1; min-width: 0; }
.message-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.message-author { color: var(--strong); font-weight: 600; }
.tag { font-size: .7rem; color: var(--muted); background: var(--raised); border-radius: 4px; padding: 0 5px; }
.tag.guild { color: #c9cdfb; background: rgba(91,110,245,.2); }
.message-time { color: var(--muted); font-size: .75rem; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
/* Markdown in messages (Discord-like: tight blocks, a line break stays one). */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 6px; }
.md .md-heading { color: var(--strong); margin: 8px 0 4px; line-height: 1.3; }
.md h3.md-heading { font-size: 1.25rem; } .md h4.md-heading { font-size: 1.1rem; } .md h5.md-heading, .md h6.md-heading { font-size: 1rem; }
.md ul, .md ol { margin: 0 0 6px; padding-left: 1.5em; white-space: normal; }
.md li > p { margin: 0; white-space: pre-wrap; }
.md li { white-space: pre-wrap; }
.md li.md-task { list-style: none; margin-left: -1.3em; }
.md li.md-task input { width: auto; margin: 0 6px 0 0; vertical-align: middle; }
.md blockquote { margin: 0 0 6px; padding: 0 0 0 10px; border-left: 4px solid #4e5058; }
.md code { font: .875em/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; background: #2b2d31; border-radius: 3px; padding: .1em .3em; }
.md pre.md-code { margin: 4px 0 6px; padding: 8px 10px; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; overflow-x: auto; white-space: pre; }
.md pre.md-code code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.md del { color: var(--muted); }
.md .md-table { overflow-x: auto; margin: 4px 0 6px; white-space: normal; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--line); padding: 3px 8px; white-space: pre-wrap; }
.md th { background: var(--raised); color: var(--strong); }
.md .md-left { text-align: left; } .md .md-center { text-align: center; } .md .md-right { text-align: right; }
.md .md-footnote { color: var(--muted); font-size: .85rem; }
/* Item tags: icon and the item's real name, like the game's item link. */
.item-tag { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; vertical-align: bottom; padding: 0 5px 0 2px; border-radius: 4px; background: rgba(240,178,50,.12); color: #f0c674; font-weight: 500; text-decoration: none; white-space: nowrap; }
.item-tag:hover { background: rgba(240,178,50,.25); text-decoration: none; }
.item-tag img { width: 24px; height: 24px; image-rendering: pixelated; flex: none; }
.item-tag-name { overflow: hidden; text-overflow: ellipsis; }
.item-tag.unknown { color: var(--muted); background: var(--raised); padding: 0 5px; }
.item-tag.owned { background: rgba(120,200,140,.14); color: #9fe0b0; }
.item-tag.owned:hover { background: rgba(120,200,140,.28); }
.item-tag-owner { color: var(--muted); font-size: .75rem; font-weight: 400; }
.card-tip { position: fixed; z-index: 70; max-width: 260px; padding: 3px 8px; border-radius: 4px; background: #111214; color: #f2f3f5; font-size: .8rem; pointer-events: none; box-shadow: 0 4px 10px rgba(0,0,0,.4); }
.item-desc.linked.card-linked { z-index: 50; }
.msg-toolbar { position: relative; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.msg-toolbar::-webkit-scrollbar { display: none; }
.tool-button { all: unset; box-sizing: border-box; flex: none; min-width: 32px; height: 30px; padding: 0 6px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: 1rem; cursor: pointer; }
.tool-button:hover, .tool-button:focus-visible, .tool-button[aria-expanded="true"] { background: var(--hover); color: var(--strong); }
.tool-button.bold { font-weight: 800; } .tool-button.italic { font-style: italic; font-family: Georgia, serif; } .tool-button.strike { text-decoration: line-through; } .tool-button.mono { font-family: ui-monospace, monospace; font-size: .8rem; }
.tool-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); flex: none; }
.compose-body { display: grid; gap: 4px; }
.compose .msg-toolbar { margin: 0; }
.tool-panel { position: absolute; z-index: 35; left: 0; bottom: calc(100% + 6px); width: min(420px, calc(100vw - 24px)); max-height: 340px; display: flex; flex-direction: column; background: var(--side); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.45); overflow: hidden; }
.msg-toolbar:has(.tool-panel) { overflow: visible; }
.tool-search { margin: 8px; width: auto; }
.tool-list { overflow-y: auto; padding: 0 4px 6px; }
.tool-heading { padding: 6px 8px 2px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.tool-item { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 4px; color: var(--ink); cursor: pointer; }
.tool-item:hover, .tool-item:focus-visible { background: var(--hover); color: var(--strong); }
.tool-item img { image-rendering: pixelated; }
.tool-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-item-note { margin-left: auto; color: var(--muted); font-size: .75rem; flex: none; }
.tool-empty { padding: 8px 12px; color: var(--muted); margin: 0; }
.emoji-panel { overflow-y: auto; padding-bottom: 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); padding: 0 6px; }
.emoji-grid button { all: unset; height: 36px; display: grid; place-items: center; border-radius: 6px; font-size: 1.35rem; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--hover); }
.tag-menu { position: fixed; z-index: 60; min-width: 140px; padding: 4px; background: var(--side); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 16px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.tag-menu button { all: unset; box-sizing: border-box; padding: 6px 10px; border-radius: 4px; color: var(--ink); cursor: pointer; font-size: .875rem; }
.tag-menu button:hover, .tag-menu button:focus-visible { background: var(--accent); color: #fff; }
.item-tag-owner::before { content: '・'; }
.item-suggest li.mine .item-suggest-id { color: #9fe0b0; }
.has-item-suggest { position: relative; }
.item-suggest { position: absolute; z-index: 30; left: 0; right: 0; bottom: calc(100% + 4px); max-height: 288px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--side); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 16px rgba(0,0,0,.35); }
.item-suggest[hidden] { display: none; }
.item-suggest li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; color: var(--ink); cursor: pointer; }
.item-suggest li[aria-selected="true"], .item-suggest li:hover { background: var(--hover); color: var(--strong); }
.item-suggest img, .item-suggest-blank { width: 24px; height: 24px; flex: none; image-rendering: pixelated; }
.item-suggest-id { margin-left: auto; color: var(--muted); font-size: .75rem; }
.item-suggest li.item-suggest-empty { color: var(--muted); cursor: default; }
.mention { background: rgba(91,110,245,.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.mention:hover { background: var(--accent); color: #fff; text-decoration: none; }
.reply-ref { display: block; margin: 0 0 2px 54px; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-ref-name { color: var(--ink); font-weight: 600; }
.message-actions { display: flex; gap: 10px; font-size: .78rem; flex: none; opacity: .55; }
.message:hover .message-actions, .message-actions:focus-within { opacity: 1; }
.message-actions a { color: var(--muted); }
.message-actions { align-items: center; }
.message-actions form { display: inline-flex; }
.message-actions button.link { font-size: inherit; line-height: inherit; }
.message-actions .reaction-picker summary { padding: 0; }
.message-actions { gap: 2px; }
.message-actions .action { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.message-actions .action:hover, .message-actions .action:focus-visible { background: var(--hover); color: var(--strong); text-decoration: none; }
.message-actions .action.danger { color: var(--muted); }
.message-actions .action.danger:hover, .message-actions .action.danger:focus-visible { color: var(--danger); }
.message-actions .action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sheet-items .action-icon { vertical-align: -3px; margin-right: 12px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.reaction { background: var(--raised); color: var(--ink); border: 1px solid transparent; border-radius: 8px; padding: 1px 8px; font-size: .85rem; }
.reaction.mine { background: rgba(91,110,245,.25); border-color: var(--accent); }
.reaction-picker { display: inline-block; position: relative; }
.reaction-picker summary { list-style: none; cursor: pointer; color: var(--muted); font-size: .85rem; padding: 1px 6px; border-radius: 8px; }
.reaction-picker summary::-webkit-details-marker { display: none; }
.reaction-picker summary:hover { background: var(--raised); color: var(--ink); }
.picker { position: absolute; right: 0; z-index: 5; display: flex; gap: 2px; background: #111214; padding: 4px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.picker-emoji { background: transparent; font-size: 1.2rem; padding: 2px 6px; }
.picker-emoji:hover { background: var(--hover); }
.composer { position: sticky; bottom: 0; background: var(--main); padding: 12px 0 16px; display: grid; gap: 8px; z-index: 5; }
.composer.guest { color: var(--muted); display: block; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; background: var(--raised); border-radius: 8px; padding: 6px; }
.composer-row button { white-space: nowrap; flex: none; }
.composer-row textarea { background: transparent; border: 0; resize: vertical; min-height: 44px; }
.composer-row textarea:focus { outline: none; }
.replying { background: #2b2d31; border-radius: 8px 8px 0 0; padding: 6px 10px; font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.replying .cancel { margin-left: auto; color: var(--muted); }
.speaker-select { max-width: 420px; font-size: .85rem; padding: 4px 8px; }
.compose textarea { min-height: 160px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pager { display: flex; gap: 12px; justify-content: center; margin: 12px 0; color: var(--muted); }

/* Grouped messages, text channels, live updates. */
.message.continued { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.gutter-time { width: 40px; flex: none; font-size: .65rem; color: var(--muted); text-align: right; padding-top: 4px; visibility: hidden; }
.message.continued:hover .gutter-time { visibility: visible; }
.message.continued .message-body { margin-top: 0; }
.channel-start { padding: 24px 8px 8px; }
.channel-start-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; font-size: 2rem; color: var(--strong); }
.channel-start h2 { margin: 12px 0 4px; font-size: 1.6rem; }
.load-older { text-align: center; }
.messages.chat .message { margin-top: 12px; }
.messages.chat .message.continued { margin-top: 0; }
.composer textarea[rows="1"] { min-height: 40px; }
.new-messages { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); z-index: 15; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.content { position: relative; }
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--side); border-radius: 16px 16px 0 0; padding: 12px 12px max(16px, env(safe-area-inset-bottom)); display: grid; gap: 12px; animation: sheet-up .15s ease-out; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-emoji { display: flex; justify-content: space-around; background: var(--raised); border-radius: 12px; padding: 8px; }
.sheet-emoji .picker-emoji { font-size: 1.6rem; }
.sheet-items { display: grid; background: var(--raised); border-radius: 12px; overflow: hidden; }
.sheet-item, .sheet-items button.sheet-item, .sheet-items form.sheet-item button { display: block; width: 100%; text-align: left; padding: 14px 16px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
.sheet-items > :last-child { border-bottom: 0; }
.sheet-items form.sheet-item { display: block; padding: 0; border-bottom: 1px solid var(--line); }
.sheet-items form.sheet-item button { border-bottom: 0; }
.sheet-items .danger, .sheet-items button.danger { color: var(--danger); }

/* Mentions and character pages. */
.dm-page { display: grid; gap: 12px; align-content: start; }
.dm-new { display: grid; gap: 8px; }
.dm-new h2 { margin: 0; font-size: 1rem; }
.dm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dm-item { display: flex; gap: 10px; align-items: center; background: var(--side); border-radius: 8px; }
.dm-item > a { display: flex; flex: 1; gap: 10px; align-items: center; padding: 10px 12px; color: var(--ink); min-width: 0; }
.dm-item > a:hover { text-decoration: none; background: var(--hover); border-radius: 8px; }
.dm-item > .user-text { padding: 10px 12px; flex: 1; }
.dm-item > form { padding-right: 12px; }
.dm-item .user-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item.unread .user-name { color: var(--strong); font-weight: 700; }
.dm-item.unread { border-left: 3px solid var(--mention-ink); }
.dm-origin { font-size: .7rem; color: var(--muted); }
.dm-tools { padding: 0 4px; }
.composer-row input[name="body"] { background: transparent; border: 0; flex: 1; min-height: 40px; }
.composer-row input[name="body"]:focus { outline: none; }
.byte-count { align-self: center; white-space: nowrap; }
.header-action { margin-left: auto; }
.mention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mention-item a { display: flex; gap: 10px; align-items: center; background: var(--side); padding: 10px 12px; border-radius: 8px; color: var(--ink); }
.mention-item.unread a { border-left: 3px solid var(--mention-ink); }
.mention-item a:hover { background: var(--hover); text-decoration: none; }
.character-head { grid-template-columns: 96px 1fr; align-items: center; }
.character-head .avatar { width: 96px; height: 96px; }
.character-name { margin: 0; font-size: 1.4rem; }
.character-head p { margin: 2px 0; color: var(--muted); }
/* Equipment window and item description, after the game client
   (TalerClientNative equipment.lua / equipment_view.cpp, item_desc.lua,
   ro_window_chrome.h). The window keeps the game's light palette. */
.ro-window { --ro-body: #fff; --ro-ink: #141414; --ro-muted: rgb(112,122,145); --ro-border: rgb(183,183,186);
  --ro-slot-shade: rgb(212,225,240); --ro-slot-border: rgb(190,203,226); --slot: 32px; --row: 34px;
  position: relative; width: 350px; max-width: 100%; background: var(--ro-body); color: var(--ro-ink); border: 1px solid var(--ro-border);
  border-radius: 4px; font-size: 11px; line-height: 1.2; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.ro-titlebar { height: 18px; padding: 0 8px; line-height: 18px; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.35);
  background: linear-gradient(rgb(130,148,200), rgb(217,238,252)); border-radius: 3px 3px 0 0; }
.equip-tab-input { position: absolute; opacity: 0; pointer-events: none; }
.ro-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--ro-slot-border); }
.ro-tab { padding: 3px 10px; border: 1px solid var(--ro-slot-border); border-bottom: none; border-radius: 3px 3px 0 0; color: var(--ro-muted); cursor: pointer; background: var(--ro-slot-shade); }
#equip-tab-normal:checked ~ .ro-tabs .tab-normal, #equip-tab-special:checked ~ .ro-tabs .tab-special { background: #fff; color: var(--ro-ink); font-weight: 600; }
.equip-tab-input:focus-visible ~ .ro-tabs { outline: 2px solid var(--accent); }
.equip-body { padding: 8px; }
.equip-page { display: none; grid-template-columns: 1fr minmax(60px, 20%) 1fr; grid-template-rows: repeat(5, var(--row)); column-gap: 6px; }
#equip-tab-normal:checked ~ .equip-body .equip-page-normal, #equip-tab-special:checked ~ .equip-body .equip-page-special { display: grid; }
.equip-slot { display: flex; align-items: center; gap: 4px; min-width: 0; color: var(--ro-ink); text-decoration: none; }
.equip-slot.side-L { grid-column: 1; }
.equip-slot.side-R { grid-column: 3; flex-direction: row-reverse; text-align: right; }
.equip-slot.side-C { grid-column: 2; flex-direction: column; justify-content: center; gap: 0; }
.equip-slot.side-C .slot-label { display: none; }
.equip-slot.row-0 { grid-row: 1; } .equip-slot.row-1 { grid-row: 2; } .equip-slot.row-2 { grid-row: 3; } .equip-slot.row-3 { grid-row: 4; } .equip-slot.row-4 { grid-row: 5; }
.slot-box { flex: none; display: grid; place-items: center; width: var(--slot); height: var(--slot); border: 1px solid var(--ro-slot-border); border-radius: 2px;
  background: linear-gradient(#fff, var(--ro-slot-shade)); }
.slot-box img { width: 24px; height: 24px; image-rendering: pixelated; }
.slot-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.equip-slot.empty .slot-label { color: var(--ro-muted); }
a.equip-slot:hover .slot-box, a.equip-slot:focus-visible .slot-box, a.equip-slot.active .slot-box { border-color: #5b7bd5; box-shadow: 0 0 0 1px #5b7bd5; }
a.equip-slot:hover .slot-label { text-decoration: underline; }
.equip-well { grid-column: 2; grid-row: 1 / span 3; margin-bottom: 4px; border: 1px solid var(--ro-slot-border); border-radius: 2px; background: linear-gradient(#fff, var(--ro-slot-shade));
  display: grid; place-items: center; overflow: hidden; }
.equip-preview { max-width: calc(100% - 8px); max-height: calc(100% - 8px); image-rendering: pixelated; }
.equip-well:has(.equip-preview.well), .equip-well.stage { border: 0; background: none; }
.equip-preview.well, .equip-preview.stage { width: 61px; height: 98px; max-width: none; max-height: none; image-rendering: auto; border: 1px solid var(--ro-slot-border); border-radius: 2px; }
.equip-well.stage { grid-row: 1 / span 4; }
.equip-preview.stage { width: 84px; height: 132px; }
/* The portrait waits in the frame until the browser has drawn the preview. */
img.equip-preview.well, img.equip-preview.stage { object-fit: contain; }
.equip-page:has(.equip-well.stage) { grid-template-columns: 1fr minmax(86px, 24%) 1fr; }
.equip-page:has(.equip-well.stage) .equip-slot.side-C { grid-row: 5; }
.item-descs > .item-desc { display: none; position: fixed; z-index: 40; top: 72px; right: 24px; }
.item-descs > .item-desc:target, .item-descs > .item-desc.open { display: block; }
.js .item-descs > .item-desc:target:not(.open) { display: none; }
.item-desc { --panel-bg: #fff; --outer: #c0c0c0; --inner: #fff; --tint: none;
  position: relative; width: 280px; color: #000; background: var(--panel-bg); border-radius: 5px; font-size: 12px; line-height: 18px;
  box-shadow: inset 0 0 0 3px var(--inner), 0 0 0 4px var(--outer), 0 4px 14px rgba(0,0,0,.45); padding-bottom: 3px; }
.item-desc.theme-official_purple { --panel-bg: #f8f2fd; --outer: #6b389e; --inner: #d6b8f0; --tint: #f0e0ff; }
.item-desc.theme-shadow_green { --panel-bg: #f0fbf3; --outer: #297a3d; --inner: #a6e0b3; --tint: #dbffe6; }
.item-desc.theme-legend_gold { --panel-bg: #fef9ea; --outer: #8a5c0d; --inner: #e3ba61; --tint: #fff0c7; }
.item-desc-top { position: relative; display: grid; grid-template-columns: 75px 1fr; gap: 4px; padding: 7px 14px 10px 10px; min-height: 121px; }
.item-desc-picture { position: static; padding-top: 4px; }
.item-desc-picture .collection-bg { position: absolute; left: 0; top: 0; width: 280px; height: 112px; object-fit: cover; object-position: top; border-radius: 5px 5px 0 0; pointer-events: none; }
.theme-official_purple .collection-bg, .theme-shadow_green .collection-bg, .theme-legend_gold .collection-bg { mix-blend-mode: multiply; background: var(--tint); }
.collection-image { position: relative; display: block; width: 75px; height: 100px; image-rendering: pixelated; }
.collection-image.is-icon { width: 48px; height: 48px; margin: 26px auto 0; }
.item-desc-main { position: relative; min-width: 0; }
.item-desc-name { margin: 0 14px 4px 0; font-size: 13px; line-height: 16px; font-weight: 600; overflow-wrap: anywhere; }
.item-desc-text { max-height: 380px; overflow-y: auto; overflow-wrap: anywhere; }
.ro-line { min-height: 18px; white-space: pre-wrap; }
.ro-icon { width: 24px; height: 24px; vertical-align: middle; image-rendering: pixelated; }
.ro-link { color: #0000ff !important; text-decoration: underline; }
.item-desc-close { position: absolute; z-index: 2; top: 3px; right: 4px; width: 14px; height: 14px; line-height: 12px; text-align: center; color: #555; text-decoration: none; font-size: 14px; }
.item-desc-close:hover { color: #000; }
.item-desc-affix { position: relative; margin: 3px 1px 0; background: #f9f5fd; border: 1px solid #784fb5; border-radius: 5px; overflow: hidden; }
.item-desc-affix h4 { margin: 0; height: 27px; line-height: 27px; padding: 0 8px; background: #4f337a; color: #fff; font-size: 12px; border-radius: 4px 4px 0 0; }
.affix-row { min-height: 25px; padding: 3px 7px; box-sizing: border-box; border-top: 1px solid #fff; overflow-wrap: anywhere; }
.affix-row.prominent { min-height: 49px; }
.item-desc-cards { position: relative; display: flex; gap: 2px; height: 30px; margin: 3px 1px 0; padding: 2px 5px; box-sizing: border-box; background: #fff; border: 1px solid #c1c6c2; border-radius: 5px; }
.card-slot { position: relative; width: 24px; height: 24px; }
.card-slot img { position: absolute; inset: 0; width: 24px; height: 24px; image-rendering: pixelated; }
a.card-slot:hover, a.card-slot:focus-visible { outline: 1px solid #5b7bd5; }
.effect-purple_glow { filter: drop-shadow(0 0 4px rgba(117,10,199,.88)) drop-shadow(0 0 3px rgba(191,31,255,.45)); }
.item-desc.linked { position: fixed; z-index: 41; top: 72px; right: 24px; }
.item-page { padding: 16px; }
/* Skill and monster cards: the client's skill card (ui_system.cpp make_skill_card_window_): 316 px, white, brown edge. */
.gd-page { padding: 16px; }
.gd-card { position: relative; width: 316px; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 6px 8px 7px; background: #fff; border: 1px solid #8c7340; border-radius: 3px; color: #262626; font-size: 12px; line-height: 16px; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.gd-card h2, .gd-card h3, .gd-card p { margin: 0; }
.gd-card a { color: #2b4ea8; }
.gd-head { display: flex; gap: 6px; align-items: flex-start; padding-right: 16px; }
.gd-icon { width: 24px; height: 24px; image-rendering: pixelated; flex: none; margin-top: 1px; }
.skill-card-title { color: #262e73; font-size: 14px; line-height: 18px; font-weight: 700; }
.skill-card-meta { color: #595959; font-size: 11px; line-height: 15px; }
.skill-card-body { margin-top: 4px; overflow-wrap: anywhere; }
.skill-card-needs { margin-top: 4px; font-size: 11px; line-height: 15px; }
.skill-card-needs h3 { color: #8c700f; font-size: 11px; font-weight: 700; }
.skill-card-needs ul { margin: 4px 0 0; padding: 0; list-style: none; }
.mob-card { width: 340px; }
.mob-card-head { display: flex; gap: 8px; align-items: center; padding-right: 16px; }
.mob-picture { flex: none; width: 96px; min-height: 64px; display: grid; place-items: center; background: #f4efe2; border-radius: 3px; }
.mob-picture img { max-width: 96px; max-height: 120px; image-rendering: pixelated; }
.mob-card-title h2 { color: #262e73; font-size: 14px; line-height: 18px; font-weight: 700; overflow-wrap: anywhere; }
.mob-card-meta { color: #404040; }
.mob-card-id { color: #8a8a8a; font-size: 11px; }
.gd-badge { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 3px; background: #6b5a2e; color: #fff; font-size: 10px; line-height: 15px; vertical-align: 2px; }
.gd-badge.mvp { background: #b3261e; }
.gd-stats { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 1px 8px; margin: 6px 0 0; padding-top: 5px; border-top: 1px solid #e6dcc4; }
.gd-stats dt { color: #777; white-space: nowrap; }
.gd-stats dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gd-section { margin-top: 6px; padding-top: 5px; border-top: 1px solid #e6dcc4; }
.gd-section h3 { color: #8c700f; font-size: 11px; font-weight: 700; }
.gd-card.linked { position: fixed; z-index: 41; top: 72px; right: 24px; }
.gd-card.linked.card-linked { z-index: 50; }
.map-card-head { display: flex; gap: 8px; align-items: center; padding-right: 16px; }
.map-picture { flex: none; width: 128px; height: 128px; display: grid; place-items: center; background: #f4efe2; border: 1px solid #e0d6bd; border-radius: 3px; overflow: hidden; }
.map-picture img { width: 128px; height: 128px; }
.map-card-title h2 { color: #262e73; font-size: 14px; line-height: 18px; font-weight: 700; overflow-wrap: anywhere; }
.map-card-sub { color: #404040; }
.gd-h-note { margin-left: 6px; color: #8a8a8a; font-weight: 400; }
.gd-mob-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 48px)); gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.gd-mob { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; box-sizing: border-box; border: 1px solid #e0d6bd; border-radius: 3px; background: #faf7ef; text-decoration: none; outline: none; }
.gd-mob.boss { border-color: #c9a227; }
.gd-mob.mvp { border-color: #b02a2a; box-shadow: inset 0 0 0 1px #b02a2a; }
.gd-mob:hover, .gd-mob:focus-visible { background: #f1e8d0; border-color: #8c7340; }
.gd-mob img { position: absolute; left: 4%; top: 4%; width: 92%; height: 92%; object-fit: contain; image-rendering: pixelated; }
.gd-mob:hover .gd-tip, .gd-mob:focus-visible .gd-tip { display: flex; gap: 6px; }
.gd-tip-mvp { color: #ff8a80; font-weight: 700; }
.gd-mvp-mark { position: absolute; z-index: 1; left: -1px; top: -1px; padding: 0 3px; border-radius: 3px 0 3px 0; background: #b02a2a; color: #fff; font-size: 8px; font-weight: 700; line-height: 11px; letter-spacing: .02em; }
.gd-stats.six { grid-template-columns: repeat(3, auto 1fr); }
.gd-map-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 48px)); gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.gd-map { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; box-sizing: border-box; border: 1px solid #e0d6bd; border-radius: 3px; background: #faf7ef; outline: none; }
.gd-map { text-decoration: none; }
.gd-map:hover, .gd-map:focus-visible { border-color: #8c7340; }
.gd-map img { width: 100%; height: 100%; border-radius: 2px; }
.gd-map-code { padding: 0 2px; color: #888; font-size: 9px; line-height: 11px; text-align: center; word-break: break-all; }
.gd-count { position: absolute; right: 1px; bottom: 1px; padding: 0 3px; border-radius: 2px; background: rgba(0,0,0,.6); color: #fff; font-size: 9px; line-height: 12px; }
.gd-map:hover .gd-tip, .gd-map:focus-visible .gd-tip { display: flex; gap: 6px; }
.gd-tip .gd-map-id { color: #aaa; }
.gd-more { margin: 4px 0 0; font-size: 11px; }
.gd-more > summary { display: inline-block; color: #8c700f; cursor: pointer; list-style: none; user-select: none; }
.gd-more > summary::-webkit-details-marker { display: none; }
.gd-more > summary::after { content: ' ▾'; }
.gd-more[open] > summary::after { content: ' ▴'; }
.gd-more > summary:hover { text-decoration: underline; }
.gd-more-open, .gd-more[open] .gd-more-closed { display: none; }
.gd-more[open] .gd-more-open { display: inline; }
.gd-more .gd-map-grid { margin-top: 4px; }
.gd-drop-grid { display: grid; grid-template-columns: repeat(auto-fill, 30px); gap: 3px; margin: 4px 0 0; padding: 0; list-style: none; }
.gd-drop { position: relative; display: grid; place-items: center; width: 30px; height: 30px; box-sizing: border-box; border: 1px solid #e0d6bd; border-radius: 3px; background: #faf7ef; text-decoration: none; outline: none; }
.gd-drop:hover, .gd-drop:focus-visible { border-color: #8c7340; background: #f1e8d0; }
.gd-drop img, .gd-blank { width: 24px; height: 24px; image-rendering: pixelated; }
.gd-blank { display: grid; place-items: center; color: #aaa; font-size: 12px; }
.gd-tip { display: none; position: absolute; z-index: 3; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); padding: 3px 6px; border-radius: 3px; background: #262626; color: #fff; font-size: 11px; line-height: 15px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.gd-drop:hover .gd-tip, .gd-drop:focus-visible .gd-tip { display: flex; gap: 6px; }
.gd-tip .gd-rate { color: #f0c674; }
.gd-rate { color: #777; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gd-card .muted { color: #8a8a8a; }
.item-tag.skill-tag { background: rgba(90,140,230,.14); color: #9fc0ff; }
.item-tag.skill-tag:hover { background: rgba(90,140,230,.28); }
.item-tag.mob-tag { background: rgba(230,110,110,.14); color: #ffaaa0; }
.item-tag.mob-tag:hover { background: rgba(230,110,110,.28); }
.item-tag.mob-tag img { object-fit: contain; image-rendering: auto; }
.item-suggest li.kind-skill .item-suggest-id { color: #9fc0ff; }
.item-suggest li.kind-mob .item-suggest-id { color: #ffaaa0; }
.item-suggest li.kind-mob img { object-fit: contain; }
.item-tag.map-tag { background: rgba(110,190,120,.14); color: #a5dca9; }
.item-tag.map-tag:hover { background: rgba(110,190,120,.28); }
.item-suggest li.kind-map .item-suggest-id { color: #a5dca9; }
.item-page .item-desc { margin: 4px; }
.my-items input { width: 100%; font: inherit; font-size: .75rem; }
.my-items { list-style: none; margin: 0; padding: 0; }
.my-items li { display: grid; grid-template-columns: 24px 1fr auto; gap: 4px 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.my-items li img { image-rendering: pixelated; }
.my-items li input { grid-column: 1 / -1; }
.siblings { list-style: none; padding: 0; display: grid; gap: 6px; }
.siblings li { display: flex; align-items: center; gap: 6px; background: var(--side); border-radius: 8px; padding: 6px 10px; }
.siblings li a { display: flex; align-items: center; gap: 8px; color: var(--strong); }
.siblings li.current { outline: 1px solid var(--accent); }

/* Account pages: a centred card. */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 30% 20%, #3b3f8a 0, #1e1f22 60%); }
body.auth main { width: min(480px, 100%); background: var(--main); border-radius: 8px; padding: 24px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
body.auth header.site { display: none; }
body.auth h1 { margin-top: 0; text-align: center; font-size: 1.4rem; }
.cards, .char-list { list-style: none; padding: 0; margin: 0; }
.cards li a { display: block; background: var(--side); padding: 12px; border-radius: 8px; margin-bottom: 8px; color: var(--strong); }
.char-list li { padding: 8px; border-radius: 6px; }
.char-pick { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.char-card { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--side); border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.char-card:hover, .char-card:focus-visible { background: var(--hover); border-color: var(--accent); }
.char-card.current { border-color: var(--accent); }
.char-card-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--raised); flex: none; image-rendering: pixelated; object-fit: cover; }
.char-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.char-card-text strong { color: var(--strong); }
.char-card-badge { margin-left: auto; padding: 2px 8px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .75rem; flex: none; }
.char-list li:hover { background: var(--hover); }
.char-list label { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: .95rem; }

@media (max-width: 1100px) { body.app { grid-template-columns: 72px 240px minmax(0, 1fr); } body.app > .members { display: none; } }
/* Phone: Discord-app style. Full-screen content with a sticky top bar;
   games rail + channels slide in from the left, members from the right,
   toggled by labels for hidden checkboxes (no script); a bottom tab bar. */
@media (max-width: 720px) {
  /* Horizontal swipes open the drawers; without this the browser treats an
     edge swipe as history back/forward and leaves the page. */
  html, body.app { overscroll-behavior-x: none; }
  body.app { display: block; height: auto; overflow: visible; background: var(--main); }
  body.app:has(.drawer-toggle:checked) { overflow: hidden; }
  .content { height: auto; min-height: 100dvh; }
  .content-header { position: sticky; top: 0; z-index: 10; background: var(--main); height: 52px; padding: 0 6px; gap: 4px; flex-wrap: nowrap; }
  .mobile-only { display: grid; }
  .header-button { place-items: center; width: 40px; height: 40px; flex: none; border-radius: 8px; color: var(--ink); font-size: 1.2rem; cursor: pointer; user-select: none; }
  .header-button:active { background: var(--hover); }
  .members-button { margin-left: auto; }
  .header-actions { margin-left: auto; } .header-actions + .members-button { margin-left: 0; }
  .header-actions .ghost { display: none; }
  .header-actions .ghost.mod { display: inline-flex; padding: 4px 8px; font-size: 13px; }
  .header-actions .button { padding: 4px 10px; font-size: .85rem; }
  .channel-topic, .crumb, .crumb-sep { display: none; }
  .content-scroll { padding: 8px 12px 16px; }
  body.with-tabbar .content-scroll { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  .nav-drawer { display: flex; position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); z-index: 30; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 4px 0 16px rgba(0,0,0,.4); }
  .nav-drawer .rail { flex-direction: column; width: 72px; flex: none; height: 100%; padding-top: max(12px, env(safe-area-inset-top)); }
  .nav-drawer .sidebar { flex: 1; min-width: 0; height: 100%; border-top-left-radius: 12px; }
  .nav-drawer .user-panel { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .nav-drawer .channel { padding: 9px 8px; font-size: 1rem; }
  #nav-toggle:checked ~ .nav-drawer { transform: none; }

  body.app > .members { display: block; position: fixed; top: 0; bottom: 0; right: 0; width: min(80vw, 320px); height: 100%; z-index: 30; transform: translateX(102%); transition: transform .2s ease; box-shadow: -4px 0 16px rgba(0,0,0,.4); padding-top: max(16px, env(safe-area-inset-top)); }
  body.app > .members.empty { display: none; }
  #members-toggle:checked ~ .members { transform: none; }

  .backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.55); cursor: pointer; }
  #nav-toggle:checked ~ .backdrop-nav, #members-toggle:checked ~ .backdrop-members { display: block; }

  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--rail); border-top: 1px solid #111214; }
  .tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; cursor: pointer; user-select: none; }
  .tab:hover { text-decoration: none; color: var(--strong); }
  .tab-icon { font-size: 1.25rem; line-height: 1; }
  .tab-avatar { width: 24px; height: 24px; }
  .tab-badge { position: absolute; top: 6px; left: 54%; margin: 0; }

  .thread-card .thread-link { padding: 10px 12px; }
  .message { padding: 4px 0; margin-top: 10px; border-radius: 0; }
  .message:hover { background: transparent; }
  /* With the script, a long press opens the message sheet (which has "copy
     text"); keep the system text selection and callout from covering it. */
  .js .message { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .message-row { gap: 2px 10px; flex-wrap: wrap; }
  /* Phones scroll the page itself (app.js does too), so the composer sticks
     to the screen's bottom edge rather than to an inner box. */
  .content-scroll { min-height: calc(100dvh - 52px); overflow: visible; }
  .message-row > a > .avatar.md, .message-row > .avatar.md { width: 36px; height: 36px; }
  .message-main { flex: 1 1 calc(100% - 50px); }
  .message-actions { order: 3; width: 100%; padding-left: 46px; opacity: 1; gap: 14px; font-size: .75rem; }
  .reply-ref { margin-left: 46px; }
  .message-actions .picker { right: auto; left: 0; }
  .js .message-actions { display: none; }
  .gutter-time { width: 36px; }
  .new-messages { bottom: 150px; }
  .tag.guild { display: none; }
  .composer { position: sticky; bottom: 0; padding: 8px 0 max(8px, env(safe-area-inset-bottom)); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-top: 1px solid var(--line); }
  .composer-row textarea { min-height: 40px; }
  .speaker-select { max-width: 100%; }
  .ro-window { width: 100%; --slot: 44px; --row: 48px; font-size: 12px; }
  .equip-page { grid-template-columns: 1fr 72px 1fr; }
  .equip-preview.well { width: 70px; height: 112px; }
  .equip-page:has(.equip-well.stage) { grid-template-columns: 1fr 104px 1fr; }
  .equip-preview.stage { width: 102px; height: 160px; }
  .gd-card.linked { left: 50%; right: auto; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); }
  .item-descs > .item-desc, .item-desc.linked { position: fixed; left: 50%; right: auto; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    width: 280px; max-height: 72vh; overflow-y: auto; }
  .character-head { grid-template-columns: 72px 1fr; }
  .character-head .avatar { width: 72px; height: 72px; }
}
