/* Rotation Master site. Loaded after viewer.css on viewer/share pages.
   Colors, type, shape and decoration all come from the design tokens in
   themes.css (imported here, so pages need only this one stylesheet); the
   embedded viewer uses the same token names (--stone, --surface, --text,
   --muted, --gold, --azure, --line), so it follows the page's theme.
   Theme = <html data-edition-theme>, light/dark = <html data-theme> or the
   system preference. Optional self-hosted fonts: see themes/fonts.css. */
@import url("themes.css");

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 16px/1.6 var(--font);
  background-color: var(--stone); background-image: var(--theme-texture);
  background-size: var(--theme-texture-size); background-repeat: repeat;
}
a { color: var(--azure); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--gold); color: var(--on-gold); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--azure); }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 10; padding: 8px 12px; background: var(--surface); color: var(--azure); }
.skip-link:focus { left: 8px; }
main { display: block; max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
main:focus { outline: none; }
h1, h2, h3, h4 { color: var(--gold); line-height: 1.25; }
h1 { font: normal clamp(28px, 5vw, 40px)/1.15 var(--font-display); margin: 8px 0 16px; overflow-wrap: break-word; }
h2, h3 { font-family: var(--serif); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); }
h2 { font-size: 22px; margin: 32px 0 12px; text-transform: var(--heading-case); }
h3 { font-size: 18px; margin: 24px 0 8px; }
h4 { font-size: 16px; margin: 16px 0 6px; }
p { margin: 8px 0 14px; }
code { font: 0.92em var(--mono); background: var(--code-bg); color: var(--text); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre { font: 13px/1.55 var(--mono); background: var(--code-bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; white-space: pre; }
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
/* Divider: a rule with the theme's ornament (an SVG mask) in a gap at the center. */
hr {
  position: relative; overflow: visible; height: 12px; margin: 28px 0; border: 0;
  background: linear-gradient(90deg, var(--line) calc(50% - 56px), transparent calc(50% - 56px) calc(50% + 56px), var(--line) calc(50% + 56px)) center / 100% 1px no-repeat;
}
.icon { width: 18px; height: 18px; vertical-align: -3px; flex: none; }
.hint, .fine, .byline, .result-count, .crumbs, .tag-source { color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); font-style: italic; }
.problem { color: var(--danger); }
.ok { color: var(--ok); }
.user-id { font-family: var(--mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

/* Header: the theme's rule runs along the bottom edge. */
.site-header {
  background-color: var(--surface); box-shadow: var(--shadow); padding-bottom: 3px;
  background-image: var(--theme-rule); background-size: 100% 3px; background-position: 0 100%; background-repeat: no-repeat;
}
.header-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font: 20px/1 var(--font-display); }
.brand picture { display: contents; }
.brand .logo { width: 40px; height: 40px; flex: none; }
.main-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; flex: 1 1 auto; }
.main-nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: var(--radius); transition: background-color var(--motion), color var(--motion); }
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.account { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; flex-wrap: wrap; }
.link-button { background: none; border: 0; color: var(--azure); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 4px; text-decoration: underline; min-height: 0; margin: 0; }

/* Buttons (also restyles the viewer's buttons) */
.button, button.button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; margin: 0; border: 1px solid var(--azure); border-radius: var(--radius); background: var(--surface); color: var(--azure); font: inherit; font-size: 15px; line-height: 1.3; text-decoration: none; cursor: pointer; min-height: 40px; transition: background-color var(--motion), border-color var(--motion), color var(--motion), box-shadow var(--motion); }
.button:hover { background: var(--surface-2); }
.button.primary { background: var(--azure); color: var(--on-accent); }
.button.primary:hover { filter: brightness(1.08); }
.button.discord { background: var(--discord); border-color: var(--discord); color: var(--on-discord); }
.button.danger { border-color: var(--danger); color: var(--danger); }
.button.danger.primary { background: var(--danger); color: var(--on-danger); }
.button:disabled { opacity: .55; cursor: default; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; margin: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--text); cursor: pointer; transition: background-color var(--motion); }
.icon-button:hover { background: var(--surface-2); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 20px 16px 28px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { display: inline-flex; align-items: center; gap: 4px; }
.dev-note { color: var(--danger); }

/* Home. The optional hero art sits behind the right column only, fading in
   from the left, so it never runs under the text; phones never load it. */
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center; padding: 16px 0 8px; }
.hero::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 0 55%; pointer-events: none;
  background-color: transparent; /* decorative layer: no text sits on it */
  background-image: var(--theme-hero-image); background-position: right center; background-size: cover; background-repeat: no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%); mask-image: linear-gradient(90deg, transparent, #000 30%);
}
.hero h1 { font-size: clamp(30px, 5vw, 46px); }
/* The addon's logo beside the headline: wide screens only (phones load no
   raster art; the header mark is already there). A missing file leaves an
   empty, transparent box. */
.hero-mark { display: none; }
@media (min-width: 721px) {
  .hero-text { display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: 24px; align-items: center; }
  .hero-text > * { grid-column: 1 / -1; }
  .hero-text > h1 { grid-column: 2; margin: 0; }
  .hero-mark {
    display: block; grid-column: 1; width: 160px; height: 160px; margin: 8px 0 16px;
    background-color: transparent; /* the logo has its own transparent edge */
    background-image: image-set(url("img/logo/logo-160.avif") type("image/avif") 1x, url("img/logo/logo-320.avif") type("image/avif") 2x, url("img/logo/logo-160.webp") type("image/webp") 1x, url("img/logo/logo-320.webp") type("image/webp") 2x, url("img/logo/logo-160.png") type("image/png") 1x);
    background-size: contain; background-repeat: no-repeat; background-position: center;
  }
}
.lead { font-size: 18px; max-width: 62ch; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-figure { margin: 0; }
.hero-figure pre { font-size: 13px; background: var(--surface); box-shadow: var(--shadow-raised); }
.hl { color: var(--on-gold); background: var(--gold); padding: 0 3px; border-radius: 3px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 32px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-top: var(--border-accent) solid var(--gold); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h2 { margin-top: 0; font-size: 20px; }
.card h2 a { color: var(--gold); text-decoration: none; }

/* Share listings */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.page-head h1 { margin-bottom: 8px; }
.share-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.share-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); transition: box-shadow var(--motion), border-color var(--motion); }
.share-card:hover { box-shadow: var(--shadow-raised); border-color: var(--line-strong); }
.share-card h3 { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.share-card h3 a { color: var(--text); text-decoration: none; }
.share-card h3 a:hover { color: var(--azure); }
.share-card .excerpt { color: var(--muted); overflow-wrap: anywhere; }
.share-card .byline { margin-bottom: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tag { display: inline-block; font-size: 12px; line-height: 1.4; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.tag-kind { border-color: var(--gold); color: var(--gold); }
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
/* The specialization filter waits for a class: disabled (skipped by Tab, not
   submitted) and visibly so in every theme, with its hint. */
.filters select:disabled { opacity: .6; color: var(--muted); background-color: var(--surface-2); border-style: dashed; cursor: not-allowed; }
/* Its hint is read with it (aria-describedby); on screen the grayed select's
   own "Choose a class first" says the same, so the row stays aligned. */
.filters .spec-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Administrators' account page */
.admin-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin: 8px 0 16px; }
.admin-form label:not(.check) { flex-basis: 100%; color: var(--muted); font-size: 14px; }
.admin-form fieldset { flex-basis: 100%; border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 8px 12px; }
.status-line:empty { display: none; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; max-width: 100%; min-height: 40px; }
textarea { width: 100%; resize: vertical; font: 14px/1.5 var(--mono); }
textarea#share-description, textarea#report-details { font-family: var(--font); font-size: 15px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 24px 0 8px; flex-wrap: wrap; }

/* Forms */
.share-form, .signin-form, .report-form { max-width: 820px; }
.share-form label, .signin-form label, .report-form label { display: block; margin: 16px 0 6px; font-weight: 600; }
.share-form input#share-title, .signin-form input { width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px 16px; margin: 20px 0; min-width: 0; }
fieldset:disabled { opacity: .6; }
legend { color: var(--gold); padding: 0 6px; font-weight: 600; }
fieldset.editions { padding: 8px 12px; }
label.check { display: inline-flex !important; align-items: center; gap: 6px; font-weight: normal !important; margin: 4px 16px 4px 0 !important; }
label.check input { min-height: 0; }
.detected { margin: 12px 0; }
.preview-box { margin: 10px 0; }
.preview-box summary { cursor: pointer; color: var(--azure); }
.preview-box .prose { border: 1px dashed var(--line); border-radius: var(--radius); padding: 4px 14px; margin-top: 8px; }

/* Callouts */
.callout { border-left: var(--border-accent) solid var(--azure); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 4px 16px; margin: 16px 0; }
.callout-tip { border-left-color: var(--ok); }
.callout-warning, .callout-important { border-left-color: var(--danger); }
blockquote { margin: 16px 0; padding: 2px 16px; border-left: var(--border-accent) solid var(--line); color: var(--muted); }

/* Prose (help pages and descriptions) */
.prose { max-width: 78ch; overflow-wrap: break-word; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose .table-wrap { overflow-x: auto; margin: 12px 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose .align-right { text-align: right; } .prose .align-center { text-align: center; }
.diagram { margin: 16px 0; }
.diagram pre { background: var(--surface); line-height: 1.45; }

/* Help */
.help-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 200px; gap: 32px; align-items: start; }
.help-nav, .help-outline { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; font-size: 14px; }
.help-nav summary { display: none; }
.help-nav h2, .help-outline h2 { font: 600 13px/1.25 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.help-nav ul, .help-outline ul { list-style: none; margin: 0; padding: 0; }
.help-nav a, .help-outline a { display: block; padding: 4px 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.help-nav a:hover, .help-outline a:hover { background: var(--surface-2); }
.help-nav a[aria-current="page"] { background: var(--surface-2); color: var(--gold); font-weight: 600; }
.help-article h1 { margin-top: 0; }
.help-article h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.help-footer { margin-top: 24px; color: var(--muted); }

/* Share page. The band above the title shows the edition's banner art over
   a CSS-only scene (--theme-band); with no art it is the scene alone, and
   phones never load the art. */
.share-head::before {
  content: ""; display: block; height: clamp(64px, 14vw, 168px); margin: 0 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  background-color: var(--surface-2); background-image: var(--theme-band);
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
@media (min-width: 721px) {
  .share-head::before { background-color: var(--surface-2); background-image: var(--theme-banner-image), var(--theme-band); }
}
.share-head h1 { margin-bottom: 4px; overflow-wrap: anywhere; }
.share-description { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; margin: 16px 0; }
.share-export textarea { font-size: 12px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 8px 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.kind-line { font-size: 17px; }
.source { border-top: 1px solid var(--line); margin-top: 16px; }
.code-block summary { cursor: pointer; color: var(--muted); font: 13px var(--mono); margin: 8px 0 4px; }
.code-block pre { max-height: 480px; }
.viewer-embed { margin-top: 24px; }
.viewer-embed > summary { cursor: pointer; color: var(--azure); }
.share-manage { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 12px; }
.report summary { cursor: pointer; color: var(--muted); }
.loading { color: var(--muted); }

/* Theme ornaments are SVG masks, so the theme color applies. Without mask
   support they are simply not drawn. */
@supports (mask-image: none) or (-webkit-mask-image: none) {
  hr::after {
    content: ""; position: absolute; left: 50%; top: 0; width: 96px; height: 12px; margin-left: -48px;
    background-color: var(--gold);
    -webkit-mask: var(--theme-divider) center / contain no-repeat; mask: var(--theme-divider) center / contain no-repeat;
  }
  .share-head .crumbs::before {
    content: ""; display: inline-block; width: 1.3em; height: 1.3em; margin-right: 6px; vertical-align: -.3em;
    background-color: var(--gold);
    -webkit-mask: var(--theme-emblem) center / contain no-repeat; mask: var(--theme-emblem) center / contain no-repeat;
  }
}

/* Viewer integration: viewer.css styles a bare <main>; the site owns layout. */
.viewer-host h1 { margin-top: 0; }
.viewer-host button, .share-visual button { min-height: 40px; border-radius: var(--radius); }
.result { color: var(--text); }

@media (max-width: 1000px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .help-outline { display: none; }
  .help-nav { position: static; max-height: none; }
  .help-nav summary { display: block; cursor: pointer; color: var(--azure); padding: 8px 0; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero::before { display: none; }
  .header-inner { gap: 6px 12px; }
  .main-nav { order: 3; flex-basis: 100%; }
  .main-nav a { white-space: nowrap; padding: 6px 8px; }
  .header-actions { margin-left: auto; }
  .button.discord span { display: none; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts dd { margin-bottom: 6px; }
  main { padding-top: 16px; }
}

/* Import warnings */
.risk-panel { border: 2px solid var(--danger); border-radius: var(--radius); background: var(--surface); padding: 6px 18px 10px; margin: 16px 0; }
.risk-panel h2 { margin: 8px 0; font-size: 19px; color: var(--danger); text-transform: none; letter-spacing: normal; }
.risk-panel.risk-none { border: 1px solid var(--ok); }
.risk-panel.risk-none p { color: var(--ok); margin: 8px 0; }
.risk-list { margin: 0; padding-left: 1.2em; }
.risk-list li { margin: 8px 0; }
.risk-danger strong { color: var(--danger); }
.risk-caution strong { color: var(--warn); }
.risk-info strong { color: var(--azure); }
.risk-where { display: block; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.tag-risk-danger { border-color: var(--danger); color: var(--danger); }
.tag-risk-caution { border-color: var(--warn); color: var(--warn); }
.tag-risk-info { color: var(--muted); }

/* Fully decoded rotation tree */
.full-decode { margin-top: 20px; }
.rotation-tree h4, .rotation-tree h5 { color: var(--gold); margin: 18px 0 6px; }
.steps { list-style: none; padding: 0; margin: 0; }
.tree-step { border-left: 3px solid var(--azure); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 6px 12px; margin: 8px 0; min-width: 0; overflow-wrap: anywhere; }
.tree-step.disabled { opacity: .65; border-left-color: var(--line); }
.tree-step.branch { border-left-color: var(--gold); }
.cooldown-steps .tree-step { border-left-color: var(--ok); }
.tree-step-head { margin: 2px 0 4px; }
.step-index { color: var(--muted); font-variant-numeric: tabular-nums; }
.cond-label { margin: 6px 0 2px; color: var(--muted); font-size: 14px; }
.cond-tree { list-style: none; margin: 0; padding-left: 14px; border-left: 1px dashed var(--line); }
.cond-tree > li { margin: 3px 0; }
.rotation-tree > .cond-tree, .tree-step > .cond-tree { border-left: 0; padding-left: 0; }
.cond-op { color: var(--gold); font-weight: 600; }
.cond-name { font-weight: 600; }
.flag { color: var(--danger); }
.muted { color: var(--muted); }
.arms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.arm { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 8px; min-width: 0; }
.arm-false { border-top: 3px solid var(--danger); }
.arm-true { border-top: 3px solid var(--ok); }
.arm-label { margin: 4px 0; font-weight: 600; font-size: 14px; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 4px 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
dl.kv.inline { display: flex; flex-wrap: wrap; gap: 0; margin: 2px 0 2px 2px; }
dl.kv.inline dt::after { content: ":"; }
dl.kv.inline dt, dl.kv.inline dd { display: inline; }
dl.kv.inline dd { margin: 0 14px 0 4px; }
dl.kv.inline > dd > dl.kv { display: grid; }
.envelope-fields, .profile-part { margin: 8px 0; }
.envelope-fields summary, .profile-part summary { cursor: pointer; color: var(--azure); }
@media (max-width: 720px) { .arms { grid-template-columns: minmax(0, 1fr); } dl.kv:not(.inline) { grid-template-columns: minmax(0, 1fr); } dl.kv:not(.inline) dd { margin-bottom: 4px; } }

/* ---- Community UI ------------------------------------------------------ */

/* Badges. .badge is a small neutral pill; .badge-mod and .badge-admin mark
   roles (with or without .badge). In the decoded tree's step heads .badge
   keeps its original inline-text look. */
.badge, .badge-mod, .badge-admin { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1.4; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.badge.warn { color: var(--warn); border-color: var(--warn); font-weight: 600; }
.badge-mod { color: var(--mod); border-color: var(--mod); font-weight: 600; }
.badge-admin { color: var(--admin); border-color: var(--admin); font-weight: 600; }
.tree-step-head > .badge { display: inline; padding: 0; border: 0; background: none; white-space: normal; vertical-align: baseline; }

/* Ratings: <div class="rating"><button class="vote-up" aria-pressed="false">…</button>
   <span class="score">12</span><button class="vote-down" aria-pressed="false">…</button></div>.
   Pressed shows as fill, a heavier border and bold text, not color alone. */
.rating { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rating .score, .rating output { min-width: 2ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.vote-up, .vote-down { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 40px; min-height: 40px; padding: 4px 10px; margin: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; transition: background-color var(--motion), border-color var(--motion), color var(--motion); }
.vote-up:hover { border-color: var(--ok); color: var(--ok); }
.vote-down:hover { border-color: var(--danger); color: var(--danger); }
.vote-up[aria-pressed="true"] { background: var(--ok-surface); border: 2px solid var(--ok); color: var(--ok); font-weight: 700; }
.vote-down[aria-pressed="true"] { background: var(--danger-surface); border: 2px solid var(--danger); color: var(--danger); font-weight: 700; }
.vote-up:disabled, .vote-down:disabled { opacity: .55; cursor: default; }
.vote-up .icon, .vote-down .icon { width: 16px; height: 16px; }

/* Small inline stats (downloads, comments, score) with an optional .icon. */
.stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0; }
.stat { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .icon { width: 16px; height: 16px; vertical-align: -2px; }
.stat strong, .stat b { color: var(--text); font-weight: 600; }

/* Comments */
.comments { margin: 32px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
ul.comments, ol.comments, .comments > ul, .comments > ol { list-style: none; padding-left: 0; }
.comments > ul, .comments > ol { margin: 0; }
.comment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; min-width: 0; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.comment > :last-child { margin-bottom: 4px; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.comment-meta strong, .comment-meta .author-name { color: var(--text); }
.comment-meta .flag-button { margin-left: auto; }
.comment-held { background: var(--warn-surface); border: 1px dashed var(--warn); box-shadow: none; }
.comment-form { max-width: 820px; margin: 16px 0; }
.comment-form label { display: block; margin: 12px 0 6px; font-weight: 600; }
.comment-form textarea { min-height: 96px; font-family: var(--font); font-size: 15px; }

/* Flag/report control: quiet until hovered or pressed. */
.flag-button { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 8px; margin: 0; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: color var(--motion), border-color var(--motion); }
.flag-button:hover, .flag-button[aria-pressed="true"] { color: var(--danger); border-color: var(--danger); }
.flag-button:disabled { opacity: .55; cursor: default; }

/* "Content hidden for review" */
.notice-hidden { position: relative; border: 2px dashed var(--warn); border-radius: var(--radius); background: var(--warn-surface); color: var(--text); padding: 12px 16px 12px 52px; margin: 16px 0; }
.notice-hidden > :first-child { margin-top: 0; }
.notice-hidden > :last-child { margin-bottom: 0; }
.notice-hidden :is(h2, h3, strong:first-child) { color: var(--warn); text-transform: none; letter-spacing: normal; }
.notice-hidden a { color: var(--text); }

/* The big Lua warning */
.lua-warning { position: relative; border: 2px solid var(--danger); border-left-width: calc(var(--border-accent) * 2); border-radius: var(--radius); background: var(--danger-surface); color: var(--text); padding: 14px 18px 14px 64px; margin: 20px 0; box-shadow: var(--shadow); }
.lua-warning > :first-child { margin-top: 0; }
.lua-warning > :last-child { margin-bottom: 0; }
.lua-warning :is(h2, h3, .lua-warning-title) { margin: 2px 0 8px; color: var(--danger); font-size: 21px; text-transform: none; letter-spacing: normal; }
.lua-warning a { color: var(--text); }
.lua-warning code { background: var(--code-bg); }

/* Icons for the controls above (masks, so they take the text color). */
@supports (mask-image: none) or (-webkit-mask-image: none) {
  .flag-button::before, .notice-hidden::before, .lua-warning::before, .status-ok::before, .status-error::before { content: ""; flex: none; background-color: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
  .flag-button::before { width: 14px; height: 14px; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 2h2v20H5zM8 3h11l-2.5 4.5L19 12H8z'/%3E%3C/svg%3E"); }
  .notice-hidden::before { position: absolute; left: 16px; top: 13px; width: 24px; height: 24px; background-color: var(--warn); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M3.3 2l18.7 18.7-1.3 1.3-3.5-3.5A11 11 0 0 1 12 20C6.5 20 2.6 16 1 12c.8-2 2.2-4 4-5.4L2 3.3zM7 8a9 9 0 0 0-3.8 4c1.5 3 4.6 5.8 8.8 5.8 1.3 0 2.5-.3 3.6-.8l-2-2A3.5 3.5 0 0 1 9 10.4zM12 4c5.5 0 9.4 4 11 8-.6 1.5-1.6 3-2.8 4.2l-1.5-1.5a9 9 0 0 0 1.9-2.7C19.3 9 16.2 6.2 12 6.2c-.8 0-1.6.1-2.3.3L8 4.8C9.3 4.3 10.6 4 12 4z'/%3E%3C/svg%3E"); }
  .lua-warning::before { position: absolute; left: 18px; top: 16px; width: 30px; height: 30px; background-color: var(--danger); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 1.5l11.5 20H.5zM10.8 8.5h2.4l-.4 7h-1.6zM12 17a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8z'/%3E%3C/svg%3E"); }
  .status-ok::before, .status-error::before { display: inline-block; width: 1em; height: 1em; margin-right: 6px; vertical-align: -.15em; }
  .status-ok::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.6 1.6L9 19.4 21 7.4l-1.6-1.6z'/%3E%3C/svg%3E"); }
  .status-error::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 1a11 11 0 1 1 0 22 11 11 0 0 1 0-22zm-1.2 5v8h2.4V6zM12 15.6a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z'/%3E%3C/svg%3E"); }
}

/* Author byline: display name, Discord name, BattleTag, optional character link. */
.author-card { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; max-width: 100%; min-width: 0; padding: 8px 12px; margin: 4px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.author-card > * { margin: 0; }
.author-card .author-name, .author-card strong { color: var(--text); font-weight: 700; }
.author-card .handle, .author-card .discord-name, .author-card .battletag { color: var(--muted); font-size: 14px; }
.author-card .character { font-size: 14px; }
.author-card img { width: 32px; height: 32px; border-radius: 50%; align-self: center; }

/* Admin and moderation. Wrap a wide .table in .table-wrap; cells also break
   anywhere so even an unwrapped table never pushes the page sideways. */
.table-wrap { max-width: 100%; overflow-x: auto; margin: 12px 0; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); }
.table caption { caption-side: top; text-align: left; color: var(--muted); padding: 6px 0; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.table thead th { background: var(--surface-2); color: var(--text); font-weight: 600; border-bottom: 2px solid var(--line-strong); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { gap: 6px; }
.queue { list-style: none; padding: 0; margin: 0; }
.queue-item { background: var(--surface); border: 1px solid var(--line); border-left: var(--border-accent) solid var(--warn); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; min-width: 0; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.queue-item.resolved { border-left-color: var(--ok); }
.queue-item :is(h2, h3) { margin: 0 0 6px; font-size: 17px; text-transform: none; letter-spacing: normal; }
.queue-item .actions { margin-top: 10px; }

/* Long legal prose (terms, privacy) */
.legal { max-width: 72ch; overflow-wrap: break-word; }
.legal p, .legal li { line-height: 1.7; }
.legal h2 { font-size: 20px; margin-top: 36px; padding-bottom: 4px; border-bottom: 1px solid var(--line); text-transform: none; letter-spacing: normal; }
.legal h3 { font-size: 17px; }
.legal ol, .legal ul { padding-left: 1.4em; }
.legal li { margin: 6px 0; }

/* Account settings */
.account-section { max-width: 820px; margin: 20px 0; padding: 4px 20px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.account-section > :is(h2, h3) { margin-top: 16px; font-size: 20px; }
.account-section label { display: block; margin: 14px 0 6px; font-weight: 600; }
.account-section input:not([type="checkbox"]):not([type="radio"]), .account-section select { width: 100%; max-width: 480px; }
.danger-zone { max-width: 820px; margin: 32px 0; padding: 4px 20px 16px; background: var(--danger-surface); border: 2px solid var(--danger); border-radius: var(--radius-lg); min-width: 0; }
.danger-zone > :is(h2, h3) { margin-top: 16px; color: var(--danger); text-transform: none; letter-spacing: normal; }

/* Status messages: color plus an icon. Block elements also get a panel. */
.status-ok { color: var(--ok); font-weight: 600; }
.status-error { color: var(--danger); font-weight: 600; }
:is(p, div, li).status-ok, :is(p, div, li).status-error { padding: 8px 12px; border: 1px solid currentColor; border-radius: var(--radius); }
:is(p, div, li).status-ok { background: var(--ok-surface); }
:is(p, div, li).status-error { background: var(--danger-surface); }

@media (max-width: 480px) {
  .lua-warning { padding: 54px 14px 14px; }
  .lua-warning::before { left: 14px; top: 14px; }
  .notice-hidden { padding: 46px 14px 12px; }
  .notice-hidden::before { left: 14px; top: 12px; }
  .account-section, .danger-zone { padding-left: 14px; padding-right: 14px; }
}

/* Windows high contrast: system colors replace the theme; keep the mask
   icons and ornaments visible by painting them in the text color. */
@media (forced-colors: active) {
  hr::after, .share-head .crumbs::before, .flag-button::before, .notice-hidden::before, .lua-warning::before, .status-ok::before, .status-error::before { forced-color-adjust: none; background-color: CanvasText; }
}

/* Reduced motion: no decorative animation or transition anywhere
   (themes.css also zeroes --motion). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
