/* 1D3R Help desk: the public help portal and the website chat. Light by default, dark when the
   reader's device is. --hp-accent is each server's own color (set on the page). */
:root {
  --hp-accent: #e7b04a; --hp-ink: #1b1305;
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f1f3f6; --surface-3: #e7eaef; --line: #e2e5ea; --line-strong: #cfd4dc;
  --text: #171c26; --text-2: #4b5563; --text-3: #6b7280;
  --ok: #1f9d63; --ok-soft: rgba(31, 157, 99, .1); --danger: #d4343f; --danger-soft: rgba(212, 52, 63, .08); --info: #2f6fdd; --warn: #c8641c; --warn-soft: rgba(200, 100, 28, .1);
  --accent-soft: color-mix(in srgb, var(--hp-accent) 14%, transparent); --accent-line: color-mix(in srgb, var(--hp-accent) 45%, transparent);
  --accent-text: color-mix(in srgb, var(--hp-accent) 70%, #000);
  --r: 10px; --r-lg: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #151a22; --surface-2: #1b212b; --surface-3: #232a35; --line: #262e3a; --line-strong: #333c4a;
    --text: #e9edf2; --text-2: #a4aebb; --text-3: #7a8594;
    --ok: #3fbf86; --ok-soft: rgba(63, 191, 134, .12); --danger: #f0606a; --danger-soft: rgba(240, 96, 106, .12); --info: #6aa5ff; --warn: #f39a52; --warn-soft: rgba(243, 154, 82, .12);
    --accent-text: color-mix(in srgb, var(--hp-accent) 80%, #fff);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: var(--accent-text); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--hp-accent); outline-offset: 2px; }
label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }

.hp-wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 16px; }
.hp-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.hp-top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.hp-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; min-width: 0; }
.hp-brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-brand img, .hp-mark { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.hp-mark { display: grid; place-items: center; background: var(--hp-accent); color: var(--hp-ink); font-weight: 700; font-size: 13px; }
.hp-nav { display: flex; align-items: center; gap: 14px; font-size: 14px; flex: none; }
.hp-nav a { color: var(--text-2); text-decoration: none; }
.hp-nav a:hover { color: var(--text); }
.hp-nav form { margin: 0; }
.hp-link { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.hp-link:hover { color: var(--text); }
.hp-main { padding-top: 28px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 22px; }
.hp-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 28px; font-size: 12.5px; color: var(--text-3); }
.hp-foot a { color: inherit; }
.hp-narrow { max-width: 620px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.hp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.hp-faint { color: var(--text-3); font-size: 13.5px; }
.hp-h1 { font-size: 24px; }
.hp-back { font-size: 14px; color: var(--text-2); text-decoration: none; align-self: flex-start; }
.hp-eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.hp-sr, .hp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.hp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--r); background: var(--hp-accent); color: var(--hp-ink); font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap; }
.hp-btn:hover { filter: brightness(1.05); }
.hp-btn:disabled { opacity: .6; cursor: default; }
.hp-btn.is-secondary { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.hp-discord { background: #5865f2; color: #fff; width: 100%; }

.hp-hero { text-align: center; padding: 28px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hp-hero h1 { font-size: clamp(26px, 5vw, 36px); letter-spacing: -.01em; }
.hp-hero p { margin: 0; color: var(--text-2); max-width: 560px; }
.hp-search { display: flex; gap: 8px; width: 100%; max-width: 560px; margin-top: 8px; }
.hp-search input { min-height: 48px; font-size: 16px; }
.hp-search .hp-btn { min-height: 48px; }
.hp-search.is-inline { max-width: none; margin: 0; }

.hp-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.hp-action { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.hp-action:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.hp-action strong { display: block; }
.hp-action small { color: var(--text-3); font-size: 13.5px; }
.hp-action-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; flex: none; }

.hp-section { display: flex; flex-direction: column; gap: 12px; }
.hp-section h2 { font-size: 17px; }
.hp-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.hp-cat h3 { font-size: 15px; margin-bottom: 8px; }
.hp-cat ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.hp-cat a { text-decoration: none; color: var(--text); }
.hp-cat a:hover { color: var(--accent-text); text-decoration: underline; }
.hp-cat p { margin: 8px 0 0; }

.hp-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.hp-list li + li { border-top: 1px solid var(--line); }
.hp-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; color: var(--text); text-decoration: none; }
.hp-list a:hover { background: var(--surface-2); }
.hp-list a > span:first-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hp-list small { font-size: 12.5px; }
.hp-card .hp-list { border: 0; border-radius: 0; margin: 0 -20px; }
.hp-pill { flex: none; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.hp-pill.is-open { background: var(--accent-soft); color: var(--accent-text); }
.hp-pill.is-pending { background: var(--ok-soft); color: var(--ok); }

.hp-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hp-results a { color: var(--text); text-decoration: none; display: block; }
.hp-results p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.hp-results .hp-card:hover { border-color: var(--accent-line); }
.hp-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.hp-cta p { margin: 0; }

.hp-article h1 { font-size: 26px; margin-bottom: 14px; }
.hp-prose { font-size: 15.5px; line-height: 1.65; overflow-wrap: anywhere; }
.hp-prose h2, .hp-prose h3, .hp-prose h4 { margin: 20px 0 8px; }
.hp-prose p, .hp-prose ul, .hp-prose ol { margin: 0 0 12px; }
.hp-prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.hp-updated { margin: 16px 0 0; }

.hp-signin { display: flex; flex-direction: column; gap: 14px; }
.hp-signin h1 { font-size: 22px; }
.hp-signin p { margin: 0; color: var(--text-2); }
.hp-or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; }
.hp-or::before, .hp-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hp-form { display: flex; flex-direction: column; gap: 8px; }
.hp-form label { margin-top: 6px; }
.hp-form-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.hp-types { border: 0; padding: 0; margin: 0 0 6px; display: grid; gap: 8px; }
.hp-types legend { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.hp-type { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-weight: 400; color: var(--text); margin: 0 !important; }
.hp-type:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.hp-type input { width: auto; margin-top: 4px; }
.hp-type small { display: block; color: var(--text-3); }
.hp-alert { padding: 12px 14px; border-radius: var(--r); font-size: 14px; border: 1px solid; }
.hp-alert.is-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.hp-alert.is-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.hp-suggest { display: flex; flex-direction: column; gap: 12px; border-color: var(--accent-line); }
.hp-suggest h2 { font-size: 17px; }
.hp-suggest p { margin: 0; }
.hp-answer { background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; }
.hp-answer-label { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 4px; }
.hp-answer .hp-prose { white-space: pre-wrap; font-size: 15px; }
.hp-empty p { margin: 0; color: var(--text-2); }
.hp-empty h1 { font-size: 22px; margin-bottom: 8px; }
.hp-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hp-ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.hp-ticket-head p { margin: 4px 0 0; }
.hp-thread { display: flex; flex-direction: column; gap: 14px; }
.hp-closed { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.hp-closed p { margin: 0; }
.hp-missing .hp-main { min-height: 70vh; justify-content: center; }

/* the conversation (same markup as the staff inbox) */
.hd-msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; max-width: 680px; }
.hd-msg.is-team { margin-left: auto; grid-template-columns: minmax(0, 1fr) 32px; }
.hd-msg.is-team .hd-av { order: 2; }
.hd-av { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--text-2); overflow: hidden; }
.hd-av img { width: 100%; height: 100%; object-fit: cover; }
.hd-bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 13px; min-width: 0; }
.hd-msg.is-team .hd-bubble { background: var(--accent-soft); border-color: var(--accent-line); }
.hd-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.hd-meta strong { color: var(--text); font-size: 13.5px; }
.hd-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.hd-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.hd-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hd-img img { max-width: 220px; max-height: 160px; border-radius: 8px; display: block; border: 1px solid var(--line); }
.hd-sys { text-align: center; font-size: 12.5px; color: var(--text-3); }
.hd-sys span { padding: 3px 10px; border-radius: 99px; background: var(--surface-2); }

@media (max-width: 560px) {
  .hp-search { flex-direction: column; }
  .hp-card { padding: 16px; }
  .hp-card .hp-list { margin: 0 -16px; }
  .hp-nav { gap: 10px; font-size: 13.5px; }
}

/* ---------- the website chat (inside the iframe) ---------- */
body.hw { background: var(--surface); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.hw-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--hp-accent); color: var(--hp-ink); flex: none; }
.hw-top img { border-radius: 8px; }
.hw-top strong { display: block; font-size: 15px; }
.hw-top small { display: block; font-size: 12.5px; opacity: .8; }
.hw-start { padding: 16px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
.hw-greet { margin: 0 0 6px; font-size: 15px; }
.hw-start label { margin-top: 6px; font-size: 13px; }
.hw-start .hp-btn { margin-top: 10px; }
.hw-err { margin: 6px 0 0; color: var(--danger); font-size: 13.5px; }
.hw-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.hw-chat[hidden], .hw-start[hidden], .hw-reply[hidden] { display: none; }
.hw-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.hw-m { max-width: 85%; }
.hw-m.is-member { align-self: flex-end; }
.hw-m .hw-who { font-size: 11.5px; color: var(--text-3); margin: 0 4px 2px; }
.hw-m.is-member .hw-who { text-align: right; }
.hw-b { padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.hw-m.is-member .hw-b { background: var(--hp-accent); color: var(--hp-ink); border-color: transparent; }
.hw-m.is-system { align-self: center; font-size: 12px; color: var(--text-3); }
.hw-reply { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); flex: none; }
.hw-reply textarea { min-height: 42px; max-height: 120px; }
.hw-foot { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px 10px; font-size: 12.5px; flex: none; }
.hw-foot .hp-link { font-size: 12.5px; }
.hp-guide { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.hp-guide:hover { border-color: var(--accent-line); }
.hp-guide small { color: var(--text-3); font-size: 13.5px; }
.hw-top .hp-mark { flex: none; display: grid; place-items: center; background: var(--hp-ink); color: var(--hp-accent); border-radius: 8px; font-weight: 700; }
