:root {
  color-scheme: dark;
  --bg: #151515;
  --panel: #202020;
  --panel-raised: #292929;
  --panel-dark: #181818;
  --line: #3a3a3a;
  --line-dark: #101010;
  --text: #d0d0d0;
  --muted: #858585;
  --grape: #9a62d2;
  --grape-bright: #c79af0;
  --danger: #d66b6b;
  --yellow: #e0bf59;
  --role-admin: #c79af0;
  --role-moderator: #79b9e8;
  --role-member: #aaa;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 12px/1.45 Verdana, Geneva, sans-serif;
}
a { color: var(--grape-bright); text-decoration: none; }
a:hover { color: #fff; text-decoration: none; }
.hidden { display: none !important; }

.site-header { border-bottom: 1px solid #080808; background: #1b1b1b; }
.site-header-inner {
  position: relative;
  width: min(1070px, calc(100% - 32px));
  min-height: 48px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--line-dark);
  border-right: 1px solid #454545;
  background: #242424;
}
.top-grape {
  width: 48px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-dark);
  border-left: 1px solid #454545;
  background: #202020;
}
.top-grape img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.site-nav { display: flex; align-items: stretch; }
.site-nav a {
  display: grid;
  place-items: center;
  min-width: 74px;
  padding: 0 12px;
  color: #999;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 15px;
  letter-spacing: .2px;
  border-left: 1px solid #444;
  border-right: 1px solid var(--line-dark);
  background: linear-gradient(#303030, #181818);
}
.site-nav a:hover, .site-nav a.active { color: #fff; background: #282828; }
.site-search {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-self: center;
  width: min(420px, 40vw);
  height: 27px;
  margin: 0;
}
.site-search input { min-width: 0; flex: 1; border-right: 0; }
.roulette-banner {
  display: flex;
  align-items: stretch;
  width: min(420px, 40vw);
  min-height: 27px;
  margin: 6px auto;
  border-bottom: 2px solid var(--yellow);
  background: rgba(224, 191, 89, .30);
  color: #fff;
}
.roulette-banner span { flex: 1; align-self: center; padding: 4px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roulette-banner button { border-color: var(--yellow); border-width: 0 0 0 1px; background: rgba(224, 191, 89, .25); color: #fff; }
.roulette-banner button:hover { background: rgba(224, 191, 89, .45); }
.account-nav { display: flex; align-items: stretch; margin-left: auto; }
.account-nav > * {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid #444;
  border-right: 1px solid var(--line-dark);
}
#identity { color: var(--muted); white-space: nowrap; }
.account-name { font-weight: bold; }
.role-admin, .role-admin a { color: var(--role-admin) !important; }
.role-moderator, .role-moderator a { color: var(--role-moderator) !important; }
.role-member, .role-member a { color: var(--role-member) !important; }

main { width: min(1070px, calc(100% - 32px)); margin: 16px auto 0; }
.crumbs {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--grape);
  background: var(--panel-dark);
  color: var(--muted);
}
#notice:not(:empty) { margin-bottom: 10px; padding: 9px 11px; border: 1px solid #7650a0; background: #2b2132; }
.loading, .empty { padding: 28px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); text-align: center; }

.forum-chat, .board, .topic-list, .post, .composer, .profile-card, .docs {
  border: 1px solid var(--line);
  border-top: 3px solid #4d4d4d;
  background: var(--panel);
}
.forum-chat { margin-bottom: 14px; }
.forum-chat h2, .board-title {
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #2a2a2a;
  color: #bdbdbd;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}
.chat-log { height: 180px; overflow: auto; padding: 7px 10px; background: #1d1d1d; }
.chat-message { display: grid; grid-template-columns: 66px minmax(95px, auto) minmax(0, 1fr) 16px; align-items: start; gap: 8px; padding: 2px 0; font-size: 11px; }
.chat-message time, .metric, .activity { color: var(--muted); }
.chat-message time { text-align: left; white-space: nowrap; }
.chat-body { overflow-wrap: anywhere; }
.chat-name { font-weight: bold; }
.chat-name.role-admin { color: var(--role-admin); }
.chat-name.role-moderator { color: var(--role-moderator); }
.chat-name.role-member { color: var(--role-member); }
.chat-compose { display: flex; border-top: 1px solid var(--line); }
.chat-compose input { flex: 1; border: 0; border-right: 1px solid var(--line); }
.chat-compose button { min-width: 80px; border: 0; }
.chat-delete { width: 16px; height: 16px; padding: 0; border: 0; background: transparent; color: #e35f67; font: bold 15px/14px Verdana, sans-serif; }
.chat-delete:hover { background: transparent; color: #ff858b; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 7px; }
.section-head h1 { margin: 0; color: #bbb; font-size: 13px; text-transform: uppercase; }
.board .board-title, .board .category { display: grid; grid-template-columns: minmax(0, 1fr) 210px; align-items: center; }
.topic-list .board-title, .topic-list .topic-row { grid-template-columns: minmax(0, 1fr) 82px 180px; }
.category, .topic-row, .search-result { padding: 9px 10px; border-bottom: 1px solid var(--line); background: #202020; }
.category:last-child, .topic-row:last-child, .search-result:last-child { border-bottom: 0; }
.category:hover, .topic-row:hover { background: #252525; }
.category h2, .topic-row h2, .search-result h2 { margin: 0; font-size: 12px; font-weight: bold; }
.category h2 a, .topic-row h2 a, .search-result h2 a { color: #e1e1e1; }
.category p, .topic-row p, .search-result p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.category-stats { color: #777 !important; }
.metric { text-align: center; }
.activity { text-align: right; font-size: 11px; }
.topic-row, .category { position: relative; }
.topic-pin, .category-pin { position: absolute; top: 5px; left: 6px; color: var(--yellow); }
.topic-row:has(.topic-pin) h2, .category:has(.category-pin) h2 { padding-left: 14px; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 4px; border: 1px solid #77539c; color: var(--grape-bright); font-size: 9px; text-transform: uppercase; }
.pinned-topics { margin-bottom: 9px; border-top-color: var(--yellow); }
.category.archived, .topic-row.archived { opacity: .55; }
.board-controls, .post-actions, .reactions, .markdown-tools { display: flex; gap: 5px; flex-wrap: wrap; }
.board-controls { margin-top: 6px; }

.post { display: grid; grid-template-columns: 150px minmax(0, 1fr); margin-bottom: 10px; }
.post-author { padding: 11px; border-right: 1px solid var(--line); background: #1a1a1a; }
.post-author strong { display: block; }.role-name a { color: inherit; }
.post-author > span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.role { font-weight: bold; }
.uid { color: #777 !important; }
.post-body { min-width: 0; padding: 11px; }
.post-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.post:target { border-color: var(--grape); }
.reply-context { display: block; margin: 0 0 10px; padding: 6px 8px; border-left: 3px solid var(--grape); background: #25202a; color: var(--muted); }

.composer, .profile-card, .docs { margin: 14px 0; padding: 13px; }
.composer h2, .docs h1 { margin: 0 0 11px; color: #ddd; font-size: 14px; }
.composer label, dialog label { display: grid; gap: 4px; margin-bottom: 9px; color: #aaa; }
.composer textarea { min-height: 130px; resize: vertical; }
.composer .hint { margin: -4px 0 9px; color: var(--muted); font-size: 10px; }
.reply-target { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; padding: 6px 8px; border: 1px solid #725190; background: #27202d; color: var(--grape-bright); }

input, textarea, select, button {
  border: 1px solid #414141;
  border-radius: 0;
  background: #161616;
  color: var(--text);
  font: inherit;
  padding: 7px 8px;
}
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 1px solid var(--grape); outline-offset: 0; }
button, button.quiet, .quiet-link { background: #2b2b2b; border-color: #484848; color: #d5d5d5; cursor: pointer; }
button:hover, button.quiet:hover, .quiet-link:hover { background: #373737; color: #fff; }
button.small { padding: 3px 6px; font-size: 10px; }
.danger { color: var(--danger) !important; }
.icon-button { min-width: 42px; justify-content: center; padding: 0 !important; }
.icon-button img { width: 15px; height: 15px; filter: invert(50%) sepia(45%) saturate(920%) hue-rotate(240deg); }
.link-button { display: block; padding: 7px 0; border: 0; background: none; color: var(--grape-bright); }
.marker-tool { display: inline-grid; place-items: center; width: 29px; height: 27px; padding: 0 !important; }
.marker-tool img { width: 13px; height: 13px; filter: brightness(0) invert(1); transform: translateY(1px); }

.markdown { white-space: normal; overflow-wrap: anywhere; }
.markdown p { margin: .5em 0; }
.markdown h2, .markdown h3, .markdown h4, .markdown h5 { color: #eee; }
.markdown blockquote { margin: 9px 0; padding: 6px 9px; border-left: 3px solid var(--grape); background: #1a1a1a; color: #aaa; }
.markdown code, .markdown pre, .markdown-preview { border: 1px solid #383838; background: #151515; }
.markdown code { padding: 1px 4px; color: var(--grape-bright); }
.markdown pre { overflow: auto; padding: 10px; }
.markdown pre code { padding: 0; border: 0; }
.markdown-preview { margin: 0 0 9px; padding: 10px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.post-image { display: block; max-width: min(100%, 420px); max-height: 320px; border: 1px solid var(--line); object-fit: contain; }
.attachment { padding: 6px 8px; border: 1px solid var(--line); background: #181818; }
.reaction { padding: 3px 7px; font-weight: normal; }
.reaction.active { border-color: #895db5; background: #34243f; color: #ead9fb; }

.profile-heading { display: flex; align-items: center; gap: 9px; }
.profile-heading h1 { margin: 0; font-size: 16px; }
.profile-handle, .profile-bio { color: var(--muted); }
.profile-card dl { display: grid; grid-template-columns: 85px 1fr; gap: 6px; }
.profile-card dt { color: var(--muted); }.profile-card dd { margin: 0; }
.profile-form { max-width: 680px; }
.profile-tabs { display: flex; gap: 5px; margin: 0 0 10px; }
.profile-tabs button { min-width: 105px; }
.profile-tabs button.active { border-color: var(--grape); background: #34243f; color: #fff; }
.invite-list { display: grid; gap: 7px; margin-top: 12px; }
.invite-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line); background: var(--panel-dark); }
.invite-row code { overflow: hidden; text-overflow: ellipsis; color: var(--grape-bright); }
.invite-row span { color: var(--muted); }
.docs h2 { margin: 24px 0 7px; color: var(--grape-bright); font-size: 13px; }
.docs pre { padding: 10px; overflow: auto; }
.docs code { white-space: pre; }
.search-result { background: var(--panel); }

dialog { width: min(420px, calc(100% - 30px)); padding: 0; border: 1px solid #555; border-top: 3px solid var(--grape); border-radius: 0; background: var(--panel); color: var(--text); box-shadow: 0 20px 80px #000; }
dialog::backdrop { background: #000b; }
dialog form { position: relative; padding: 17px; }
dialog h2 { margin: 0 0 13px; font-size: 15px; }.dialog-close { position: absolute; top: 5px; right: 6px; border: 0; background: none; font-size: 19px; color: var(--muted); }
dialog input { width: 100%; }.error { color: #ef9999; min-height: 1.4em; }
.edit-dialog { width: min(760px, calc(100% - 30px)); }.edit-dialog .composer { margin: 0; border: 0; padding: 0; }
.roulette-dialog { width: min(820px, calc(100% - 28px)); max-height: min(760px, calc(100% - 28px)); padding: 0; border-color: var(--yellow); border-bottom: 3px solid var(--yellow); background: #211f18; overflow: auto; }
.roulette-dialog #roulette-dialog-content { padding: 20px; }
.roulette-heading { margin-top: -8px; padding-right: 25px; }
.roulette-dialog > .dialog-close { top: 12px; display: grid; width: 27px; height: 27px; padding: 0; place-items: center; border: 0 !important; outline: 0; background: none !important; box-shadow: none; line-height: 1; }
.roulette-dialog > .dialog-close:focus-visible { color: #fff; }
.roulette-heading > div { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.roulette-heading h2 { margin: 0; color: #fff; font-size: 18px; }
.roulette-heading p { margin: 5px 0 16px; color: #bcb49b; }
.roulette-tabs { display: flex; gap: 4px; }
.roulette-tabs button { height: 27px; padding: 4px 9px; }
.roulette-tabs button.active { border-color: var(--yellow); background: rgba(224, 191, 89, .25); color: #fff; }
.roulette-reel { position: relative; overflow: hidden; padding-top: 18px; border: 1px solid #ffffff18; background: #17150f; }
.roulette-reel-track { display: flex; gap: 9px; width: max-content; will-change: transform; }
.roulette-reel-track .roulette-prize { flex: 0 0 145px; }
.roulette-pointer { position: absolute; z-index: 2; top: 0; left: 50%; width: 0; height: 0; border-top: 16px solid var(--yellow); border-right: 9px solid transparent; border-left: 9px solid transparent; filter: drop-shadow(0 2px 2px #000); transform: translateX(-50%); }
.roulette-prize-catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 9px; }
.roulette-prize { position: relative; isolation: isolate; display: grid; min-height: 130px; place-items: center; align-content: center; gap: 5px; padding: 12px 8px; overflow: hidden; border: 1px solid #ffffff18; color: #fff; text-align: center; }
.roulette-prize-backdrop { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; }
.roulette-prize-image { width: 54px; height: 54px; object-fit: contain; }
.roulette-prize-placeholder { display: grid; width: 54px; height: 54px; place-items: center; color: #fff; font-size: 28px; }
.roulette-prize > span:last-child { color: #ddd; font-size: 10px; }
.roulette-prize.selected { border-color: #fff; box-shadow: 0 0 18px #fff5; }
.roulette-history { display: grid; gap: 8px; }
.roulette-history > article { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 12px; border: 1px solid #ffffff18; background: #17150f; }
.roulette-history > article > .roulette-prize { min-height: 82px; border: 0; }
.roulette-history > article > .roulette-prize .roulette-prize-image,
.roulette-history > article > .roulette-prize .roulette-prize-placeholder { width: 34px; height: 34px; }
.roulette-history > article > .roulette-prize strong { display: none; }
.roulette-history > article > div { display: grid; gap: 3px; padding-right: 10px; }
.roulette-history > article > div span { color: var(--muted); font-size: 10px; }
.roulette-spin { display: block; min-width: 170px; margin: 16px auto; border-color: var(--yellow); background: rgba(224, 191, 89, .25); color: #fff; }
.roulette-spin:hover:not(:disabled) { background: rgba(224, 191, 89, .45); }
.roulette-spin:disabled { cursor: not-allowed; opacity: .55; }
.roulette-reward { display: grid; gap: 4px; margin-top: 18px; padding: 13px; border-bottom: 3px solid var(--yellow); background: linear-gradient(to top, rgba(224, 191, 89, .35), transparent); color: #fff; }
.roulette-reward span { color: #d7cfae; font-size: 10px; text-transform: uppercase; }

footer { width: min(1070px, calc(100% - 32px)); margin: 24px auto; padding: 12px 0; border-top: 1px solid var(--line); color: #666; text-align: center; }

.admin-page main { margin-top: 28px; }
.admin-page h1, .admin-page h2 { color: #d8d8d8; font-size: 14px; text-transform: uppercase; }
.admin-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.admin-bar #key { min-width: 250px; }
.admin-tabs { display: flex; gap: 5px; margin: 14px 0 8px; }
.admin-tabs button.active { border-color: var(--grape); color: #fff; }
.admin-search { display: flex; width: min(520px, 100%); margin-bottom: 12px; }
.admin-search input { flex: 1; }
.roulette-create { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.roulette-create input { width: 120px; }
.roulette-create input[name="imageUrl"] { width: 260px; }
.table-scroll { overflow: auto; margin-bottom: 20px; border: 1px solid var(--line); border-top: 3px solid #4d4d4d; }
table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 11px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #2a2a2a; color: #bdbdbd; font-size: 10px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.spectrum { display: none; }

/* The landing view is intentionally separate from the authenticated forum shell.
   Component styles for it live in landing.css, scoped under .landing-page. */
body.landing-mode { background: #000; }
body.landing-mode .site-header, body.landing-mode footer, body.landing-mode #crumbs, body.landing-mode #notice { display: none !important; }
body.landing-mode main { width: 100%; margin: 0; }
.cube-field { display: none; }

@media (max-width: 760px) {
  .site-header-inner { width: 100%; min-height: 0; flex-wrap: wrap; }.top-grape { width: 42px; height: 42px; }.site-nav a { min-width: 50px; padding: 0 7px; font-size: 13px; }.site-search { position: static; order: 3; flex: 0 0 100%; width: 100%; max-width: none; height: 42px; margin: 0; padding: 6px 8px; border-top: 1px solid var(--line-dark); transform: none; }.site-search input { width: 0; min-width: 0; }.site-search button { flex: 0 0 68px; }.account-nav { margin-left: auto; height: 42px; }.account-nav > * { padding: 0 5px; }.account-nav #identity { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .roulette-banner { width: 100%; min-height: 42px; margin: 0; }
  .site-search button { padding-top: 5px; padding-bottom: 9px; }
  .board-title { display: none; }.board .category, .topic-row, .topic-list .topic-row { grid-template-columns: 1fr auto; gap: 6px; }.category .metric, .topic-row .metric { display: none; }.activity { text-align: right; }.post { grid-template-columns: 1fr; }.post-author { border-right: 0; border-bottom: 1px solid var(--line); }.chat-message { grid-template-columns: 58px minmax(70px, auto) minmax(0, 1fr) 16px; gap: 6px; }
  .invite-row { grid-template-columns: minmax(0, 1fr) auto; }.invite-row span { grid-column: 1 / -1; grid-row: 2; }
  .profile-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-tabs button { min-width: 0; }
  .admin-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-tabs button { width: 100%; min-height: 38px; }
  .roulette-dialog #roulette-dialog-content { padding: 16px 10px; }
  .roulette-dialog > .dialog-close { top: 8px; }
  .roulette-heading > div { align-items: flex-start; gap: 8px; }
  .roulette-tabs { flex: 1; }
  .roulette-tabs button { flex: 1; }
  .roulette-reel-track .roulette-prize { flex-basis: 130px; }
}
