/* 40 — Content: announcements, ticket replies, welcome note, support card, chat switch, footer
   links / payment logos, cookie consent. Pairs with public/local/40-content.js. */
:root { --sg40-accent: #e2734f; --sg40-gold: #d6b05c; --sg40-text: #e8e4d6; --sg40-muted: #a9a596; --sg40-line: rgba(171, 169, 155, 0.24); }

/* ---- chat switched off (console: chatEnabled) */
html.sg40-nochat .shell-chat,
html.sg40-nochat button[aria-label^="Open chat"],
html.sg40-nochat div:has(> button[aria-label^="Open chat"]) { display: none !important; }

/* ---- uploaded logo replaces the castle mark next to the wordmark */
html.sg40-logo .fd-nav__mark { background: var(--sg40-logo) center / cover no-repeat; overflow: hidden; }
html.sg40-logo .fd-nav__mark > svg { opacity: 0; }

/* ---- footer slots (patched into SignedOutFooter) */
.sg40-footer-links { display: contents; }
.sg40-linkbtn { color: inherit; font: inherit; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.sg40-footer-links .sg40-linkbtn { font-size: 15px; color: #bfaf89; transition: color 0.16s ease; }
.sg40-footer-links .sg40-linkbtn:hover, .sg40-legal .sg40-linkbtn:hover { color: #eee9df; }
.sg40-footer-extra:empty { display: none; }
.sg40-footer-extra { order: 9; flex-basis: 100%; display: flex; justify-content: center; }
.sg40-pay { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; padding-top: 4px; }
.sg40-pay img { height: 24px; width: auto; border-radius: 4px; display: block; }

/* ---- shared bits */
.sg40-eyebrow { margin: 0; font-family: 'Alegreya SC', Cinzel, Georgia, serif; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sg40-accent); }
.sg40-muted { color: var(--sg40-muted); font-size: 13px; margin: 8px 0 0; }
.sg40-err { color: #f09a85; font-size: 13px; margin: 6px 0 0; min-height: 0; }
.sg40-err:empty { display: none; }
.sg40-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  padding: 10px 18px; border-radius: 9px; border: 1px solid #7a3420; color: #fff7f0;
  background: linear-gradient(180deg, #d8694a 0%, #b4502f 100%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 6px 18px rgba(201, 90, 56, 0.28);
  font: 700 13px/1 Cinzel, Georgia, serif; letter-spacing: 0.12em; text-transform: uppercase;
}
.sg40-btn:hover { filter: brightness(1.08); }
.sg40-btn:disabled { opacity: 0.55; cursor: default; }
.sg40-btn--ghost { background: linear-gradient(180deg, #34302b, #24211d); border-color: #48413a; box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); color: #ddd6c6; }
.sg40-btn--small { padding: 8px 12px; font-size: 11px; }
.sg40-btn:focus-visible, .sg40-x:focus-visible, .sg40-tk__head:focus-visible { outline: 2px solid var(--sg40-accent); outline-offset: 2px; }
.sg40-x {
  flex: none; width: 38px; height: 38px; padding: 0; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: #ddd6c6; border: 1px solid #161412; background: linear-gradient(180deg, #3e3933, #292622);
  box-shadow: inset 0 1px #f4f2eb2e, inset 0 -1px #00000080, 0 3px 8px #00000080;
}
.sg40-x svg { width: 16px; height: 16px; }
.sg40-x:hover { color: #fff; filter: brightness(1.15); }

/* Markdown written in the console */
.sg40-md { font-family: 'Alegreya Sans', Georgia, serif; color: #d8d2c3; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.sg40-md > :first-child { margin-top: 0; } .sg40-md > :last-child { margin-bottom: 0; }
.sg40-md p { margin: 0 0 0.7em; }
.sg40-md h1, .sg40-md h2, .sg40-md h3, .sg40-md h4, .sg40-md h5, .sg40-md h6 { font-family: Cinzel, Georgia, serif; color: #f1ead9; margin: 0.9em 0 0.35em; font-size: 1.05em; letter-spacing: 0.02em; }
.sg40-md ul, .sg40-md ol { margin: 0 0 0.7em; padding-left: 1.3em; } .sg40-md ul { list-style: disc; } .sg40-md ol { list-style: decimal; }
.sg40-md li { margin: 0.2em 0; }
.sg40-md a { color: #eea283; text-decoration: underline; text-underline-offset: 2px; }
.sg40-md a:hover { color: #ffc3aa; }
.sg40-md strong { color: #f6f1e4; }
.sg40-md code { background: #0f0d0c; border: 1px solid #35302a; border-radius: 4px; padding: 0 4px; font-size: 0.9em; }
.sg40-md pre { background: #0f0d0c; border: 1px solid #35302a; border-radius: 8px; padding: 8px 10px; overflow: auto; }
.sg40-md blockquote { margin: 0 0 0.7em; padding: 4px 12px; border-left: 3px solid var(--sg40-gold); background: rgba(214, 176, 92, 0.06); }
.sg40-md hr { border: 0; border-top: 1px solid var(--sg40-line); margin: 12px 0; }
/* news page: Markdown body keeps the original text style */
.fd-news__item-text.sg40-md { font-size: inherit; color: inherit; line-height: inherit; }
.sg40-chip--patch { color: #e9c77b; border-color: rgba(214, 176, 92, 0.55); }

/* ---- modal (announcement, ticket reply, ticket form) */
.sg40-modal-bg {
  position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(60% 60% at 50% 45%, rgba(10, 9, 8, 0.55), rgba(5, 4, 4, 0.82)); backdrop-filter: blur(3px);
  animation: sg40-fade 0.2s ease both;
}
.sg40-modal {
  width: min(34rem, 100%); max-height: min(88vh, 46rem); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 18px; border: 1px solid #4a433b; color: var(--sg40-text);
  background: linear-gradient(180deg, #2b2723 0%, #1c1a17 100%);
  box-shadow: 0 0 0 4px #121110, 0 0 0 5px #3a342e, 0 30px 70px rgba(0, 0, 0, 0.7), inset 0 1px rgba(255, 255, 255, 0.05);
  animation: sg40-pop 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
}
.sg40-modal__head { display: flex; align-items: center; gap: 14px; padding: 20px 20px 16px 22px; border-bottom: 1px solid rgba(171, 169, 155, 0.16);
  background: linear-gradient(180deg, rgba(226, 115, 79, 0.07), transparent); }
.sg40-modal__head > div { flex: 1 1 auto; min-width: 0; }
.sg40-modal__crest { flex: none; width: 54px; height: 54px; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: #efb79f;
  background: radial-gradient(circle at 50% 35%, #3a332d, #171513); border: 1px solid #5a4f44; box-shadow: 0 0 0 3px #141210, inset 0 2px 6px rgba(0, 0, 0, 0.5); }
.sg40-modal__crest svg { width: 28px; height: 28px; }
.sg40-modal--ann-warning .sg40-modal__crest { color: #f0c060; }
.sg40-modal--ann-maintenance .sg40-modal__crest { color: #b9c4cf; }
.sg40-modal--ann-event .sg40-modal__crest { color: #f3d27a; }
.sg40-modal--ann-warning .sg40-eyebrow { color: #f0c060; }
.sg40-modal__title { margin: 2px 0 0; font: 700 24px/1.2 Cinzel, Georgia, serif; color: #f6f4ef; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.sg40-modal__body { padding: 18px 22px 8px; overflow-y: auto; }
.sg40-modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; }
.sg40-modal__foot .sg40-btn { min-width: 9rem; }
.sg40-field { display: block; margin: 0 0 14px; }
.sg40-field span { display: block; font: 700 11px Cinzel, Georgia, serif; letter-spacing: 0.16em; text-transform: uppercase; color: #cdbf9f; margin-bottom: 6px; }
.sg40-field input, .sg40-field textarea, .sg40-tk__reply textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 9px; border: 1px solid #3a352f; background: #0b0a09; color: #ece7da;
  font: 15px/1.45 'Alegreya Sans', Georgia, serif; resize: vertical;
}
.sg40-field input:focus, .sg40-field textarea:focus, .sg40-tk__reply textarea:focus { outline: none; border-color: #b4502f; box-shadow: 0 0 0 2px rgba(226, 115, 79, 0.25); }
.sg40-out { animation: sg40-fade-out 0.18s ease-in both !important; }
@keyframes sg40-fade { from { opacity: 0; } }
@keyframes sg40-fade-out { to { opacity: 0; } }
@keyframes sg40-pop { from { opacity: 0; transform: translateY(14px) scale(0.97); } }

.sg40-toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 10060; padding: 10px 16px; border-radius: 10px;
  background: #22201c; border: 1px solid #4a433b; border-left: 3px solid #7fb069; color: #ece7da; font: 15px 'Alegreya Sans', Georgia, serif; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: sg40-fade 0.2s both; }

/* ---- welcome note */
.sg40-welcome {
  position: relative; border-radius: 14px; border: 1px solid rgba(171, 169, 155, 0.26); border-left: 3px solid var(--sg40-gold);
  background: linear-gradient(180deg, rgba(36, 33, 29, 0.97), rgba(21, 20, 17, 0.97)); color: var(--sg40-text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.04); padding: 14px 16px 14px 18px;
}
.sg40-welcome header { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sg40-welcome header .sg40-eyebrow { flex-basis: 100%; order: 0; color: var(--sg40-gold); margin-bottom: -6px; }
.sg40-welcome h2 { flex: 1 1 auto; margin: 4px 0 0; font: 700 18px/1.25 Cinzel, Georgia, serif; color: #f6f4ef; }
.sg40-welcome .sg40-x { width: 30px; height: 30px; margin: -18px -6px 0 0; }
.sg40-welcome .sg40-x svg { width: 13px; height: 13px; }
.sg40-welcome .sg40-md { font-size: 14px; }
.sg40-welcome--float { position: fixed; z-index: 240; left: 16px; top: 112px; width: min(22rem, calc(100vw - 32px)); max-height: calc(100vh - 240px); overflow-y: auto; animation: sg40-slide 0.4s cubic-bezier(0.2, 0.9, 0.25, 1.05) both; }
.dp-sheet .sg40-welcome { margin: 16px 24px 0; }
body:has(.st-backdrop--tut) .sg40-welcome--float, body:has([aria-modal="true"]) .sg40-welcome--float, body:has(.sg40-modal-bg) .sg40-welcome--float { visibility: hidden; }
@keyframes sg40-slide { from { opacity: 0; transform: translateX(-24px); } }
@media (max-width: 640px) {
  .sg40-welcome--float { left: 12px; right: 12px; width: auto; top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); max-height: 40vh; }
  .dp-sheet .sg40-welcome { margin: 12px 12px 0; }
  body:has(.sg40-consent) .sg40-welcome--float { visibility: hidden; }
}

/* ---- settings: support card */
.sg40-support { grid-column: 1 / -1; }
.sg40-support__head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; }
.sg40-support__head h3 { margin: 0; font: 700 16px Cinzel, Georgia, serif; letter-spacing: 0.1em; text-transform: uppercase; }
.sg40-support__body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.sg40-support__top { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.sg40-support__top p { margin: 0; flex: 1 1 18rem; color: #b5ae9e; font: 15px/1.45 'Alegreya Sans', Georgia, serif; }
.sg40-tklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sg40-tk--none { margin: 0; }
.sg40-tk { border: 1px solid #34302a; border-radius: 10px; background: rgba(10, 9, 8, 0.55); overflow: hidden; }
.sg40-tk.is-unread { border-color: rgba(226, 115, 79, 0.6); }
.sg40-tk__head { width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; text-align: left; padding: 11px 14px; background: none; border: 0; color: inherit; cursor: pointer; font: inherit; }
.sg40-tk__head:hover { background: rgba(255, 255, 255, 0.03); }
.sg40-tk__subj { flex: 1 1 12rem; min-width: 0; font: 700 15px 'Alegreya Sans', Georgia, serif; color: #efe9dc; overflow-wrap: anywhere; }
.sg40-tk.is-unread .sg40-tk__subj::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--sg40-accent); margin-right: 8px; vertical-align: 1px; }
.sg40-tk__date { color: #8f8a7d; font-size: 13px; }
.sg40-chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font: 700 10.5px Cinzel, Georgia, serif; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid #4a433b; color: #cfc6b4; }
.sg40-chip--open { color: #e0b04f; border-color: rgba(224, 176, 79, 0.5); }
.sg40-chip--answered { color: #8fcf7a; border-color: rgba(127, 176, 105, 0.55); }
.sg40-chip--closed { color: #9a958a; }
.sg40-tk__body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.sg40-msg { border-radius: 9px; padding: 9px 12px; background: #191714; border: 1px solid #2f2b26; }
.sg40-msg--staff { background: rgba(214, 176, 92, 0.07); border-color: rgba(214, 176, 92, 0.3); }
.sg40-msg__by { margin: 0 0 4px; font-size: 12px; color: #9d978a; letter-spacing: 0.03em; }
.sg40-msg--staff .sg40-msg__by { color: var(--sg40-gold); }
.sg40-tk__reply { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.sg40-legal { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; border-top: 1px solid rgba(171, 169, 155, 0.14); font: 14px 'Alegreya Sans', Georgia, serif; color: #aaa394; }
.sg40-legal a { color: #cfc8b8; text-decoration: none; } .sg40-legal a:hover, .sg40-legal .sg40-linkbtn:hover { color: #fff; }

/* ---- registration: terms consent */
.sg40-terms { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 10px; font: 14px/1.4 'Alegreya Sans', Georgia, serif; color: #cfc8b8; text-align: left; cursor: pointer; }
.sg40-terms input { margin-top: 3px; width: 16px; height: 16px; accent-color: #d8694a; flex: none; }
.sg40-terms a { color: #eea283; }
.sg40-terms__err { margin: -4px 0 10px; }

/* ---- cookie consent (game + public pages) */
.sg40-consent {
  position: fixed; z-index: 10070; left: 16px; bottom: 16px; width: min(26rem, calc(100vw - 32px)); padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 33, 29, 0.98), rgba(20, 19, 16, 0.98)); border: 1px solid #4a433b; color: #e8e4d6;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6); font: 15px/1.45 'Alegreya Sans', Georgia, serif; animation: sg40-pop 0.3s both;
}
.sg40-consent__text { margin: 6px 0 12px; color: #d2ccbd; }
.sg40-consent a { color: #eea283; }
.sg40-consent__btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sg40-consent__btns .sg40-btn { padding: 9px 14px; font-size: 11.5px; }
.sg40-consent__now { margin: 10px 0 0; font-size: 13px; color: #9d978a; }
@media (max-width: 640px) { .sg40-consent { bottom: calc(84px + env(safe-area-inset-bottom)); } .sg40-modal__title { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { .sg40-modal, .sg40-modal-bg, .sg40-welcome--float, .sg40-consent, .sg40-toast { animation: none; } }
