/* SoloScape — base stylesheet
 * Parchment-on-dark theme. Mobile-first: 375px baseline.
 */

:root {
  --cs-bg: #0d0d0d;
  --cs-bg-2: #1f1f1f;
  --cs-bg-3: #2e2e2e;
  --cs-parchment: #d7c6a0;
  --cs-parchment-2: #c3b28d;
  --cs-panel-lite: #ded0ac;
  --cs-ink: #25190a;
  --cs-ink-soft: #4c381d;
  --cs-gold: #d7b15a;
  --cs-gold-dim: #8b6f37;
  --cs-accent: #806334;
  --cs-ok: #2e7a3d;
  --cs-warn: #c58a1a;
  --cs-err: #9c2a1a;
  --cs-muted: #5e5138;

  --cs-rule: #6f5a2f;
  --cs-rule-dark: #3f331c;
  --cs-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);

  --cs-font-ui: Georgia, 'Times New Roman', serif;
  --cs-font-body: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cs-bg);
  color: var(--cs-ink);
  font-family: var(--cs-font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    linear-gradient(180deg, #0c0c0c 0, #161616 160px, #101010 100%);
}

a { color: var(--cs-ink-soft); text-decoration: underline; }
a:hover { color: var(--cs-accent); }

/* ---------- header ---------- */

.cs-header {
  border: 1px solid #000;
  border-bottom-color: var(--cs-rule-dark);
  background: linear-gradient(180deg, #4f4f4f 0, #2f2f2f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.cs-header__utility {
  background: #151515;
  border-bottom: 1px solid #000;
  color: #d3c39d;
  font-size: 0.75rem;
}

.cs-header__utility-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.35rem 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.cs-header__utility-links {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.cs-header__utility-links a,
.cs-header__utility-links button {
  color: #e4cf95;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.cs-header__utility-links a:hover,
.cs-header__utility-links button:hover {
  text-decoration: underline;
}

.cs-header__logout {
  margin: 0;
}

.cs-header__masthead {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 0.75rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cs-header__brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-decoration: none;
}
.cs-header__brand img {
  display: block;
  max-width: min(100%, 280px);
  height: auto;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.55));
}
.cs-header__tagline {
  font-family: var(--cs-font-body);
  font-size: 0.82rem;
  color: #d9cbad;
}

.cs-header__account-count {
  padding: 0.45rem 0.7rem;
  border: 1px solid #1f1f1f;
  background: rgba(0, 0, 0, 0.28);
  color: #e9d5a0;
  font-size: 0.8rem;
}

.cs-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.55rem 0.75rem 0.7rem;
  max-width: 1100px;
  margin: 0 auto;
}

.cs-nav a {
  color: #f0e1bf;
  text-decoration: none;
  font-family: var(--cs-font-body);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.55rem 0.9rem;
  border: 1px solid #1d1d1d;
  background: linear-gradient(180deg, #5b533f 0, #403625 100%);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.cs-nav a:hover,
.cs-nav a:focus-visible {
  color: #fff3c6;
  border-color: var(--cs-gold-dim);
  background: linear-gradient(180deg, #6a6148 0, #4a3f2c 100%);
  outline: none;
}

/* ---------- main layout ---------- */

.cs-main {
  max-width: 1100px;
  margin: 0.9rem auto 1.4rem;
  padding: 0 0.75rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.cs-main__content {
  background: var(--cs-parchment);
  border: 1px solid var(--cs-rule-dark);
  padding: 1rem 1rem 1.35rem;
  box-shadow: var(--cs-shadow);
  min-width: 0;
}

.cs-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

@media (min-width: 900px) {
  .cs-main {
    grid-template-columns: 235px minmax(0, 1fr);
    gap: 0.9rem;
  }

  .cs-sidebar {
    grid-column: 1;
  }

  .cs-main__content {
    grid-column: 2;
  }
}

/* ---------- panels ---------- */

.cs-panel {
  background: var(--cs-panel-lite);
  border: 1px solid var(--cs-rule);
  padding: 0.8rem 0.95rem 0.95rem;
}

.cs-panel--highlight {
  border-color: var(--cs-gold-dim);
  background: linear-gradient(180deg, #eadcb8, #d4c095);
}

.cs-panel__title {
  margin: 0 0 0.5rem;
  font-family: var(--cs-font-ui);
  font-size: 1rem;
  color: var(--cs-ink);
  text-align: center;
  border: 1px solid var(--cs-rule-dark);
  background: linear-gradient(180deg, #80734d 0, #6a5c3d 100%);
  color: #f4e7c2;
  padding: 0.28rem 0.45rem;
}

.cs-list {
  margin: 0;
  padding-left: 1.1rem;
}

.cs-list li + li { margin-top: 0.2rem; }

/* ---------- scroll title ---------- */

.cs-scroll__title {
  font-family: var(--cs-font-ui);
  font-size: 1.5rem;
  color: var(--cs-ink);
  margin: 0 0 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--cs-rule);
  /* Equal top/bottom padding + a controlled line-height keeps the
   * serif title visually centered in its bordered bar. The heading's
   * default top margin and missing top padding made the glyphs sit
   * flush against the top edge across every page that uses this
   * class (profile, rules, disclaimer, news article, etc.). */
  padding: 0.45rem 0.5rem 0.45rem;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
}

/* ---------- shared page shell ---------- */

.cs-page-crumbs {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
  color: var(--cs-muted);
}

.cs-page-muted {
  color: var(--cs-muted);
  font-size: 0.95rem;
}

.cs-page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.cs-page-hero__copy {
  min-width: 0;
}

.cs-page-hero__copy .cs-scroll__title {
  margin-bottom: 0.2rem;
}

.cs-page-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cs-page-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  margin: 0 0 0.85rem;
  background: #d1be86;
  border: 1px solid var(--cs-rule);
  font-size: 0.92rem;
}

/* ---------- news ---------- */

.cs-news {
  padding: 0.8rem 0;
  border-bottom: 1px solid #b29a67;
}
.cs-news:last-of-type { border-bottom: none; }

.cs-news__head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cs-news__title {
  margin: 0;
  font-family: var(--cs-font-ui);
  font-size: 1.1rem;
}
.cs-news__title a { color: var(--cs-ink); text-decoration: none; }
.cs-news__title a:hover { color: var(--cs-accent); text-decoration: underline; }

.cs-news__date {
  color: var(--cs-muted);
  font-size: 0.85rem;
  margin-left: auto;
}

.cs-news__hp {
  color: var(--cs-err);
  font-weight: 700;
  font-size: 1.1rem;
}

.cs-news--hp {
  background: rgba(156,42,26,0.06);
  border-left: 3px solid var(--cs-err);
  padding-left: 0.6rem;
}

.cs-news__more {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
}

/* ---------- rules ---------- */

.cs-rules {
  padding-left: 1.25rem;
}
.cs-rules li { margin-bottom: 0.5rem; }

/* ---------- buttons ---------- */

.cs-badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.4em;
  margin-left: 0.4em;
  background: #b33a3a;
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.cs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  background: linear-gradient(180deg, #7f714e, #554730);
  color: #f5e8bf;
  border: 1px solid #2e261a;
  font-family: var(--cs-font-body);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.cs-btn:hover,
.cs-btn:focus-visible {
  background: linear-gradient(180deg, #8b7d58, #64553a);
  color: #fff5cb;
  outline: none;
}

.cs-btn--ghost {
  background: linear-gradient(180deg, #b49f6b, #8b7850);
  color: #25190a;
}

/* ---------- footer ---------- */

.cs-footer {
  max-width: 1100px;
  margin: 1.2rem auto 2rem;
  padding: 1rem 1rem 0;
  color: #d7c59d;
  text-align: center;
  font-size: 0.8rem;
  border-top: 1px solid var(--cs-rule-dark);
}
.cs-footer a { color: #ecd388; }
.cs-footer__brand {
  margin: 0 0 0.25rem;
  font-family: var(--cs-font-ui);
  font-size: 1rem;
  color: #f1e0af;
}
.cs-footer__legal {
  color: #99896a;
  margin-top: 0.35rem;
}

/* ---------- portal shell ---------- */

.cs-sidebox {
  border: 1px solid var(--cs-rule-dark);
  background: linear-gradient(180deg, #d4c39d 0, #beab84 100%);
  box-shadow: var(--cs-shadow);
}

.cs-sidebox__title {
  padding: 0.32rem 0.55rem;
  background: linear-gradient(180deg, #80734d 0, #685b3d 100%);
  color: #f7e8be;
  font-family: var(--cs-font-ui);
  font-size: 0.95rem;
  text-align: center;
  border-bottom: 1px solid var(--cs-rule-dark);
}

.cs-sidebox__list,
.cs-sidebox__rankings {
  list-style: none;
  margin: 0;
  padding: 0.45rem 0.6rem 0.6rem;
}

.cs-sidebox__list li,
.cs-sidebox__rankings li {
  font-size: 0.86rem;
  padding: 0.18rem 0;
  border-bottom: 1px solid rgba(63, 51, 28, 0.14);
}

.cs-sidebox__list li:last-child,
.cs-sidebox__rankings li:last-child {
  border-bottom: 0;
}

.cs-sidebox__list a,
.cs-sidebox__rankings a,
.cs-sidebox__linkbtn {
  color: var(--cs-ink-soft);
  text-decoration: none;
}

.cs-sidebox__list a:hover,
.cs-sidebox__rankings a:hover,
.cs-sidebox__linkbtn:hover {
  text-decoration: underline;
}

.cs-sidebox__rankings li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.cs-sidebox__logout {
  margin: 0;
  padding: 0 0.6rem 0.6rem;
}

.cs-sidebox__linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.cs-sidebox__empty {
  margin: 0;
  padding: 0.5rem 0.6rem 0.7rem;
  font-size: 0.85rem;
}

.cs-portal-hero {
  margin-bottom: 0.9rem;
  border: 1px solid var(--cs-rule);
  background: linear-gradient(180deg, #e2d3b0 0, #ccb98f 100%);
  text-align: center;
  padding: 1rem 0.9rem 1.1rem;
}

.cs-portal-hero__kicker {
  margin: 0 0 0.35rem;
  color: var(--cs-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cs-portal-hero__title {
  margin: 0 0 0.8rem;
  font-family: var(--cs-font-ui);
  font-size: 1.9rem;
  line-height: 1.15;
  color: var(--cs-ink);
}

.cs-portal-hero__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.cs-portal-hero__crest img {
  display: inline-block;
  max-width: min(100%, 260px);
  height: auto;
}

.cs-portal-hero__copy {
  max-width: 620px;
  margin: 0.7rem auto 0;
  color: var(--cs-ink-soft);
}

.cs-home-grid,
.cs-feature-grid,
.cs-auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.cs-auth-card {
  height: 100%;
}

.cs-linklist {
  margin: 0;
  padding-left: 1.1rem;
}

.cs-linklist li + li {
  margin-top: 0.3rem;
}

.cs-notice {
  margin: 0 0 0.7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cs-gold-dim);
  background: rgba(215, 177, 90, 0.12);
}

@media (max-width: 899px) {
  .cs-header__masthead {
    justify-content: center;
    text-align: center;
  }

  .cs-header__brand {
    align-items: center;
  }

  .cs-page-hero {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 700px) {
  .cs-home-grid,
  .cs-auth-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .cs-feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- forms ---------- */

.cs-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.cs-form__row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cs-form__row--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.cs-form__label {
  font-family: var(--cs-font-ui);
  font-weight: 700;
  color: var(--cs-ink);
  font-size: 0.95rem;
}

.cs-form input[type="text"],
.cs-form input[type="email"],
.cs-form input[type="password"] {
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  font-family: var(--cs-font-body);
  font-size: 1rem;
  color: var(--cs-ink);
  background: #f6ecc8;
  border: 1px solid var(--cs-rule);
  border-radius: 3px;
}

.cs-form input[type="text"]:focus-visible,
.cs-form input[type="email"]:focus-visible,
.cs-form input[type="password"]:focus-visible {
  outline: 2px solid var(--cs-gold);
  outline-offset: 1px;
  background: #fff6d9;
}

.cs-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cs-accent);
}

.cs-form small {
  color: var(--cs-muted);
  font-size: 0.8rem;
}

.cs-error {
  color: var(--cs-err);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

small.cs-error {
  font-weight: 600;
  font-size: 0.8rem;
}

/* ---------- character creator ---------- */

.cs-form-errors {
  background: rgba(156,42,26,0.08);
  border: 1px solid var(--cs-err);
  border-radius: 4px;
  padding: 0.6rem 0.9rem;
  margin: 0 0 1rem;
  color: var(--cs-err);
}
.cs-form-errors ul { margin: 0; padding-left: 1.2rem; }

.cs-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.cs-form-label {
  font-family: var(--cs-font-ui);
  font-weight: 700;
  color: var(--cs-ink);
  font-size: 0.95rem;
}

.cs-form-input {
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  font-family: var(--cs-font-body);
  font-size: 1rem;
  color: var(--cs-ink);
  background: #f6ecc8;
  border: 1px solid var(--cs-rule);
  border-radius: 3px;
}
.cs-form-input:focus-visible {
  outline: 2px solid var(--cs-gold);
  outline-offset: 1px;
  background: #fff6d9;
}

.cs-char-create {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.cs-char-create__preview {
  width: 100%;
  min-height: 320px;
  background: #1a120a;
  border: 1px solid var(--cs-rule);
  border-radius: 4px;
}

/* Profile-mode (read-only) preview: lock the canvas to the same 256x384
 * portrait aspect as the cached PNG so the Three.js render isn't stretched
 * horizontally to fill the panel width. The cached <img> already has these
 * dimensions baked in; we apply them to the live <div> too. */
.cs-char-create--readonly .cs-char-create__preview {
  position: relative;
  overflow: hidden;
  display: block;
  margin: 0 auto;
  width: 256px;
  max-width: 100%;
  aspect-ratio: 256 / 384;
  min-height: 0;
  height: auto;
}

.cs-profile-render-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(48, 35, 18, 0.42), rgba(12, 8, 4, 0.92)),
    radial-gradient(circle at 50% 24%, rgba(180, 130, 54, 0.24), transparent 42%);
  color: #f0e1bf;
  text-align: center;
  box-sizing: border-box;
}

.cs-profile-render-fallback__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #1a120a;
}

.cs-profile-render-fallback__summary {
  position: relative;
  z-index: 1;
  background: rgba(20, 14, 8, 0.78);
  border: 1px solid #5a3a14;
  padding: 8px;
}

.cs-profile-render-fallback__name {
  display: block;
  color: #ffd470;
  font-weight: bold;
}

.cs-profile-render-fallback__meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #c1a66a;
}

.cs-char-create__controls { display: flex; flex-direction: column; gap: 0.4rem; }

.cs-char-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.cs-char-arrow {
  min-width: 36px;
  min-height: 36px;
  background: linear-gradient(180deg, #8a5c23, #5a3a14);
  color: var(--cs-parchment);
  border: 1px solid var(--cs-ink);
  border-radius: 4px;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}
.cs-char-arrow:hover,
.cs-char-arrow:focus-visible {
  background: linear-gradient(180deg, #a46f2c, #6a461a);
  color: var(--cs-gold);
  outline: none;
}

.cs-char-label {
  flex: 1;
  font-family: var(--cs-font-ui);
  font-weight: 700;
}

.cs-char-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1px solid var(--cs-ink);
  border-radius: 3px;
  background: #888;
}

@media (min-width: 700px) {
  .cs-char-create { grid-template-columns: 320px 1fr; }
  .cs-char-create__preview { min-height: 420px; }
}

.cs-btn--ghost {
  background: transparent;
  color: var(--cs-ink);
  border: 1px solid var(--cs-ink-soft);
  align-self: flex-start;
}
.cs-btn--ghost:hover,
.cs-btn--ghost:focus-visible {
  background: rgba(74,47,18,0.1);
  color: var(--cs-accent);
}

.cs-build-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
@media (min-width: 600px) {
  .cs-build-grid { grid-template-columns: 1fr 1fr; }
}

.cs-build-option {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.7rem 0.7rem 2.1rem;
  border: 1px solid var(--cs-rule);
  border-radius: 4px;
  background: #f0e2b5;
  cursor: pointer;
  position: relative;
}
.cs-build-option input[type="radio"] {
  position: absolute;
  left: 0.7rem;
  top: 0.75rem;
  accent-color: var(--cs-accent);
}
.cs-build-option__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--cs-font-ui);
  font-weight: 700;
  font-size: 1rem;
  color: var(--cs-ink);
}
.cs-account-type-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  image-rendering: pixelated;
  object-fit: contain;
}
.cs-build-option__desc {
  font-size: 0.85rem;
  color: var(--cs-ink-soft);
}
.cs-build-option:has(input:checked) {
  border-color: var(--cs-gold-dim);
  background: linear-gradient(180deg, #f6e9bc, #dec88f);
  box-shadow: inset 0 0 0 1px var(--cs-gold-dim);
}

/* ---------- profile ---------- */

.cs-profile__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.cs-build-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--cs-ink);
  font-family: var(--cs-font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--cs-parchment-2);
  color: var(--cs-ink);
}
.cs-build-badge--main    { background: #c9b06b; }
.cs-build-badge--pure    { background: #d99a4f; color: #2a1a08; }
.cs-build-badge--skiller { background: #8fb56f; color: #1a2a10; }
.cs-build-badge--alt     { background: #a07cc2; color: #fff; }

.cs-profile__alt-goal {
  font-style: italic;
  color: var(--cs-ink-soft);
}

.cs-profile__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}
.cs-profile__stats > div {
  border-bottom: 1px dashed var(--cs-rule);
  padding-bottom: 0.4rem;
}
.cs-profile__stats dt {
  font-size: 0.8rem;
  color: var(--cs-muted);
  font-family: var(--cs-font-ui);
}
.cs-profile__stats dd {
  margin: 0.1rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cs-ink);
}
.cs-profile-clan__rank {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--cs-muted);
  font-weight: 700;
}
.cs-profile-clan__form {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 0;
}
.cs-profile-clan__select {
  max-width: 180px;
  min-width: 0;
  background: var(--cs-parchment-2);
  border: 1px solid var(--cs-rule);
  color: var(--cs-ink);
  font: inherit;
  font-size: 0.88rem;
}
.cs-profile-clan__button {
  border: 1px solid var(--cs-rule);
  background: var(--cs-gold-dim);
  color: #2a1a08;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 1px 6px;
}

.cs-char-create--readonly .cs-char-create__controls { display: none; }
.cs-char-create--readonly { grid-template-columns: 1fr; }

/* Equipment loadout panel: keep the slot grid centered horizontally
 * inside the panel regardless of the surrounding profile-grid width. The
 * inline `margin:0 auto` on the <table> already handles block centering;
 * adding `text-align: center` here covers any inline content (helper
 * text, empty-state messages) so the whole panel reads as centered. */
.cs-profile__loadout {
  text-align: center;
}
.cs-profile__loadout > table {
  margin-left: auto;
  margin-right: auto;
}

/* ---------- /play view ---------- */

.cs-play__desc {
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 1rem;
}

.cs-play__exits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.5rem;
  max-width: 380px;
  margin: 0.5rem 0 1rem;
}
.cs-play__exits form { margin: 0; }
.cs-play__exit { width: 100%; }

.cs-play__exit--north { grid-column: 1 / 3; grid-row: 1; }
.cs-play__exit--west  { grid-column: 1;     grid-row: 2; }
.cs-play__exit--east  { grid-column: 2;     grid-row: 2; }
.cs-play__exit--south { grid-column: 1 / 3; grid-row: 3; }

.cs-play__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.4rem 1rem;
  margin: 0;
}
.cs-play__stats > div {
  border-bottom: 1px dashed var(--cs-rule);
  padding-bottom: 0.3rem;
}
.cs-play__stats dt {
  font-size: 0.75rem;
  color: var(--cs-muted);
  font-family: var(--cs-font-ui);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cs-play__stats dd {
  margin: 0.1rem 0 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cs-ink);
}
.cs-play__tick {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--cs-muted);
}

.cs-form--inline { display: inline-block; margin-left: 0.5rem; }

/* ---------- flash + actions ---------- */

.cs-flash {
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  background: rgba(46,122,61,0.12);
  border: 1px solid var(--cs-ok);
  border-left-width: 3px;
  border-radius: 4px;
  color: var(--cs-ink);
  font-style: italic;
}

.cs-play__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.cs-play__actions form { margin: 0; }

/* ---------- inventory grid (28 slots, 4x7) ---------- */

.cs-inventory {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-width: 420px;
}

.cs-inventory__slot {
  position: relative;
  min-height: 56px;
  padding: 4px;
  background: #f0e2b5;
  border: 1px solid var(--cs-rule);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  font-size: 0.7rem;
  overflow: hidden;
}

.cs-inventory__slot--empty {
  background:
    linear-gradient(45deg, transparent 48%, rgba(106,74,29,0.15) 49%, rgba(106,74,29,0.15) 51%, transparent 52%),
    #e8d7a9;
}

.cs-inventory__sprite {
  image-rendering: pixelated;
  display: block;
}

.cs-inventory__name {
  font-size: 0.65rem;
  line-height: 1.1;
  color: var(--cs-ink);
  word-break: break-word;
}

.cs-inventory__qty {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.7rem;
  color: var(--cs-gold);
  text-shadow: 1px 1px 0 #000;
  font-weight: 700;
}

/* ---------- skills list ---------- */

.cs-skills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2px;
}

.cs-skills__item {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: #f0e2b5;
  border-bottom: 1px dashed var(--cs-rule);
  font-size: 0.85rem;
}

.cs-skills__icon {
  image-rendering: pixelated;
}

.cs-skills__name {
  font-family: var(--cs-font-ui);
  color: var(--cs-ink);
}

.cs-skills__level {
  font-weight: 700;
  color: var(--cs-gold-dim);
  min-width: 1.5em;
  text-align: right;
}

.cs-skills__xp {
  font-size: 0.7rem;
  color: var(--cs-muted);
}

/* ---------- accessibility ---------- */

/* Visually-hidden utility: keeps content in the accessibility tree but off
   the screen. Use for labels that are implicit from context visually but
   must be announced by screen readers. */
.cs-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--cs-gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- email verification nag ---------- */

.cs-nag {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.55rem 1rem;
  background: rgba(197,138,26,0.18);
  border-bottom: 1px solid var(--cs-warn);
  color: var(--cs-parchment);
  font-size: 0.9rem;
}
.cs-nag__msg { flex: 1 1 auto; }
.cs-nag__form { margin: 0; }
.cs-nag__btn {
  background: var(--cs-warn);
  color: var(--cs-ink);
  border: 1px solid var(--cs-gold-dim);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  cursor: pointer;
}
.cs-nag__btn:hover { background: var(--cs-gold); }
.cs-nag__dev {
  flex: 1 1 100%;
  font-size: 0.78rem;
  color: var(--cs-parchment-2);
  word-break: break-all;
}
.cs-nag__dev a { color: var(--cs-parchment); }

/* =====================================================================
 * Profile loadout row — 3-column OSRS-style worn-equipment screen.
 * Character render | paperdoll grid | bonuses panel, side by side.
 * ===================================================================== */
.cs-profile__loadout-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}
.cs-loadout__col { flex: 0 0 auto; }
.cs-loadout__col-character { flex: 0 0 256px; }
.cs-loadout__col-slots     { flex: 0 0 auto; }
.cs-loadout__col-bonuses   { flex: 0 0 220px; }

/* Paperdoll cells. The inline style on the <span> already sets the 42x42
 * box; we only need positioning context here so the tooltip can anchor. */
.cs-loadout__grid td { padding: 4px; }
.cs-loadout__slot {
  position: relative;
  /* The inline style sets display:inline-flex which already establishes
   * a containing block for the absolutely-positioned ::after tooltip. */
}
.cs-loadout__slot[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #2a1c0c;
  color: #f0e1bf;
  border: 1px solid #5a3a14;
  padding: 2px 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.cs-loadout__slot[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #5a3a14;
  z-index: 10;
  pointer-events: none;
}

/* Bonuses panel — section headers, rows, and signed/coloured numbers. */
.cs-loadout__bonuses {
  background: #1c1610;
  border: 1px solid #5a3a14;
  padding: 6px 8px;
  font-size: 12px;
  color: #f0e1bf;
}
.cs-loadout__bonus-section {
  font-style: italic;
  color: #c9a14a;
  border-bottom: 1px solid #5a3a14;
  margin-top: 4px;
  margin-bottom: 2px;
  padding-bottom: 1px;
}
.cs-loadout__bonus-section:first-child { margin-top: 0; }
.cs-loadout__bonus-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 4px;
  font-variant-numeric: tabular-nums;
}
.cs-loadout__bonus-row > :last-child { text-align: right; }
.cs-loadout__bonus-pos  { color: #b8e070; }
.cs-loadout__bonus-neg  { color: #f08070; }
.cs-loadout__bonus-zero { color: #a8a060; }
.cs-loadout__bonus-set {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #5a3a14;
  font-style: italic;
  font-size: 11px;
  color: #c9a14a;
  text-align: center;
}

/* When a visitor lands on /profile/<name>#skills (e.g. clicking a row
 * on /hiscores), give the skills section some breathing room above so
 * the heading isn't flush against the viewport top, and use smooth
 * scrolling at the document level so the anchor jump animates instead
 * of snapping. */
html { scroll-behavior: smooth; }
.cs-profile__skills { scroll-margin-top: 18px; }

/* ---------- Profile pets showcase ----------------------------------------
 * Each card mirrors the dark portrait box of the 3D character render
 * (.cs-char-create__preview): #1a120a base with a brown gradient interior
 * panel and a brown border. The grid auto-sizes so 1-49+ owned pets all
 * pack in cleanly. Metamorph buttons cycle which <img> in the wrap is
 * visible — the JS in profile.php handles the toggle. */
.cs-profile__pets { scroll-margin-top: 18px; }
/* 5 columns per row, smaller cards. Below 720px the grid collapses to
 * auto-fit so it stays usable on narrow viewports. */
.cs-pets-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}
@media (max-width: 720px) {
  .cs-pets-grid {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
}
.cs-pet-card {
  background: #1a120a;
  border: 1px solid var(--cs-rule);
  border-radius: 4px;
  padding: 5px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cs-pet-card--active {
  border-color: #c8a23b;
  box-shadow: 0 0 0 1px #c8a23b inset;
}
.cs-pet-card__image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2a1f10 0%, #1a120a 100%);
  border: 1px solid #5a3a14;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.cs-pet-card__image {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  image-rendering: auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}
.cs-pet-card__name,
.cs-pet-card__morph-label {
  font-family: var(--cs-font-serif, 'IM Fell English', Georgia, serif);
  font-size: 0.74rem;
  /* var(--cs-ink) resolves to #25190a (near-black brown) which is
   * invisible against the card's #1a120a dark gradient — force a cream
   * gold so the canonical pet/form name reads cleanly. */
  color: #f0d68a;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}
/* Player-set custom display name input/display under each pet card.
 * Own profile renders an editable <input> styled to look like a quiet
 * caption; public profile shows the saved name as italic text in
 * curly quotes if set, or nothing if the owner left it blank. */
.cs-pet-card__custom-name {
  display: block;
  width: 100%;
  margin-top: 1px;
  padding: 2px 4px;
  font-family: var(--cs-font-serif, 'IM Fell English', Georgia, serif);
  font-size: 0.7rem;
  font-style: italic;
  color: #c8a868;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: 2px;
  text-align: center;
  outline: none;
  box-sizing: border-box;
  word-break: break-word;
}
input.cs-pet-card__custom-name:hover,
input.cs-pet-card__custom-name:focus {
  border-color: #5a3a14;
  background: rgba(0, 0, 0, 0.25);
  color: #f0d68a;
}
input.cs-pet-card__custom-name::placeholder {
  color: #5a4a30;
  font-style: italic;
}
@keyframes cs-pet-saved-flash {
  0%   { background: rgba(144, 192, 64, 0.35); }
  100% { background: rgba(0, 0, 0, 0.25); }
}
input.cs-pet-card__custom-name--saved {
  animation: cs-pet-saved-flash 0.8s ease-out;
}
.cs-pet-card__custom-name--display {
  /* Public-view variant: not an input, just italic text */
  border: 0;
}
.cs-pet-card__morph {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.7rem;
}
.cs-pet-card__morph-btn {
  background: #4a3214;
  color: #f4e8c8;
  border: 1px solid #5a3a14;
  border-radius: 3px;
  padding: 0 4px;
  font-size: 0.75rem;
  line-height: 1.1;
  cursor: pointer;
  font-family: inherit;
}
.cs-pet-card__morph-btn:hover,
.cs-pet-card__morph-btn:focus-visible {
  background: #6a4a1c;
  outline: none;
}
.cs-pet-card__morph-label {
  flex: 1 1 auto;
  text-align: center;
  font-family: var(--cs-font-serif, 'IM Fell English', Georgia, serif);
  color: var(--cs-ink, #f4e8c8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
