/* Extracted from styles.css during client modularization. */
/* Load order matters; keep this file in the same relative position. */

:root {
  color-scheme: light;
  font-family: "Marcellus", ui-serif, Georgia, "Times New Roman", Times, serif;
  line-height: 1.45;

  --bg-1: #2a2016;
  --bg-2: #140f0a;

  --paper-bg-0: url("../assets/paper/paperBG_0.png");
  --paper-bg-1: url("../assets/paper/paperBG_1.png");
  --paper-bg-2: url("../assets/paper/paperBG_2.png");
  --paper-bg-3: url("../assets/paper/paperBG_3.png");
  --paper-bg-4: url("../assets/paper/paperBG_4.png");
  --ns-logo: url("../assets/logo/LogoNC.png");
  --ns-stage-bg-image: url("https://i.postimg.cc/Qx1qRKxw/Netherscrolls-Bg.png");
  --ns-stage-overlay:
    radial-gradient(1200px 900px at 50% 18%, rgba(255, 255, 255, 0.24), rgba(0, 0, 0, 0.42) 72%),
    radial-gradient(900px 600px at 50% 72%, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.48)),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.32));

  --paper: #ede1c8;
  --paper-2: #e8d7b8;
  --paper-3: #ddc9a2;

  --ink: #191712;
  --ink-2: #2a251d;
  --muted: #5f523f;

  --border: #927d5d;
  --border-2: #b59263;

  --accent: #7a4e2a;
  --accent-2: #9a6a38;

  --blue-ink: #1f4d7a;
  --red-ink: #8c2f2a;
  --violet-ink: #5b2f7a;
  --green-ink: #2b6a4a;

  --radius-lg: 0.95rem;
  --radius-md: 0.7rem;
  --radius-sm: 0.55rem;

  --shadow-soft: 0 16px 44px rgba(0, 0, 0, 0.28);
  --shadow-deep: 0 26px 70px rgba(0, 0, 0, 0.34);
  --shadow-tint: 0 18px 55px rgba(31, 77, 122, 0.10), 0 14px 45px rgba(140, 47, 42, 0.08), 0 16px 50px rgba(91, 47, 122, 0.07);
}

* { box-sizing: border-box; }

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--ink);
  position: relative;
  isolation: isolate;
  background: #221e1a var(--ns-stage-bg-image) center / cover no-repeat fixed;
}
body::after{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: var(--ns-stage-overlay);
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.88));
  border-bottom: 1px solid rgba(201, 176, 138, 0.70);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18), 0 10px 25px rgba(31, 77, 122, 0.06);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem 0.75rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.4rem 1rem;
  align-items: center;
  position: relative;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  justify-self: start;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.header-nav { justify-self: center; }
#header-actions {
  justify-self: end;
  align-self: start;
  width: auto;
}

.title-block h1 {
  margin: 0;
  font-size: 1.90rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.119);
  white-space: nowrap;
}

.title-block p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.title-block:hover {
  opacity: 0.9;
}

.title-block:focus-visible {
  outline: 2px solid rgba(181, 146, 99, 0.88);
  outline-offset: 6px;
  border-radius: 0.45rem;
}

.summary-pill {
  font-size: 0.8rem;
  padding: 0.28rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(181, 146, 99, 0.75);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.96), rgba(234, 214, 178, 0.90));
  color: var(--ink-2);
  display: none;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14), 0 10px 26px rgba(140, 47, 42, 0.06);
}

.summary-dot {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: var(--green-ink);
  box-shadow: 0 0 0 3px rgba(43, 106, 74, 0.18);
}

.add-spell-btn {
  border-radius: 999px;
  border: 1px solid rgba(122, 78, 42, 0.78);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.96), rgba(234, 214, 178, 0.90));
  color: var(--ink);
  padding: 0.38rem 0.95rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14), 0 12px 28px rgba(31, 77, 122, 0.06);
  transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.add-spell-btn:hover {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18), 0 18px 40px rgba(31, 77, 122, 0.08);
  transform: translateY(-1px);
}

/* main layout */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  position: relative;
  z-index: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 0.95rem;
}

#view-home > main {
  max-width: min(92vw, 1280px);
  padding-top: 1.35rem;
  gap: 1.1rem;
}

.home-main {
  position: relative;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.2rem;
  align-items: end;
  overflow: hidden;
}

.home-hero-copy,
.home-announcement-slot {
  position: relative;
  z-index: 1;
}

.home-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(122, 78, 42, 0.86);
}

.home-title {
  margin: 0;
  font-family: "Cinzel", "Marcellus", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(36, 31, 25, 0.95);
}

.home-lede {
  margin: 0.8rem 0 0;
  max-width: 42rem;
  font-size: 1rem;
  color: rgba(78, 67, 54, 0.95);
}

.home-seal {
  width: clamp(6.4rem, 13vw, 9rem);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  justify-self: end;
  align-self: center;
  border: 1px solid rgba(122, 78, 42, 0.45);
  background:
    radial-gradient(circle at 32% 30%, rgba(255, 243, 217, 0.92), rgba(214, 169, 98, 0.92) 42%, rgba(122, 78, 42, 0.96) 78%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.36), rgba(122, 78, 42, 0.18));
  box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.34), 0 18px 38px rgba(0, 0, 0, 0.14);
}

.home-seal::before,
.home-seal::after {
  content: "";
  position: absolute;
  inset: 0.65rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 235, 202, 0.42);
}

.home-seal::after {
  inset: 1.1rem;
  border-style: dashed;
  border-color: rgba(93, 49, 25, 0.36);
}

.home-seal-ring {
  position: absolute;
  inset: 0.45rem;
  border-radius: 50%;
  border: 1px solid rgba(93, 49, 25, 0.28);
}

.home-seal-text {
  position: relative;
  z-index: 1;
  font-family: "Cinzel", "Marcellus", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 247, 231, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.home-announcements-panel {
  overflow: hidden;
}

.home-panel-header {
  margin-bottom: 0.95rem;
}

.home-announcement-slot {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-announcement-entry,
.home-announcement-aside,
.home-announcement-stamp,
.home-announcement-state {
  background-color: var(--paper-2);
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.56), rgba(235, 215, 184, 0.78)),
    var(--paper-bg-1);
  background-size: auto, 440px 440px;
  background-repeat: no-repeat, repeat;
  background-position: 0 0, center;
}

.home-announcement-entry {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(181, 146, 99, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 18px 38px rgba(0, 0, 0, 0.10);
}

.home-announcement-entry-header {
  display: grid;
  gap: 0.28rem;
}

.home-announcement-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(122, 78, 42, 0.9);
}

.home-announcement-entry h3 {
  margin: 0;
  font-family: "Cinzel", "Marcellus", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  letter-spacing: 0.04em;
  color: rgba(36, 31, 25, 0.96);
}

.home-announcement-byline {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(95, 82, 63, 0.92);
}

.home-announcement-body {
  display: grid;
  gap: 0.75rem;
  font-size: 1rem;
  color: rgba(47, 42, 34, 0.95);
}

.home-announcement-body p,
.home-announcement-footer,
.home-announcement-aside {
  margin: 0;
}

.home-announcement-aside {
  padding: 0.95rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(122, 78, 42, 0.26);
  color: rgba(78, 67, 54, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.home-announcement-footer {
  display: flex;
  justify-content: flex-start;
}

.home-announcement-stamp {
  display: inline-flex;
  align-items: center;
  padding: 0.44rem 0.82rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 78, 42, 0.4);
  color: rgba(78, 67, 54, 0.94);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.home-announcement-state {
  min-height: 12rem;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  border-radius: 1rem;
  border: 1px dashed rgba(181, 146, 99, 0.72);
  color: rgba(95, 82, 63, 0.96);
}

/* The broad catalog views benefit from using more of the desktop canvas than the editor-heavy pages.
   Keep the widening scoped to the requested views so Characters/Scribe/Archives stay on their existing rhythm. */
#view-races > main,
#view-spells > main,
#view-feats > main,
#view-items > main,
#view-scribe > main,
#view-characters > main{
  max-width: min(96vw, 1820px);
  padding-inline: clamp(1rem, 1.6vw, 1.7rem);
}

#view-spells .content-grid,
#view-feats .content-grid,
#view-items .content-grid,
#view-races .content-grid{
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 4.85rem;
  align-self: flex-start;
}

/* parchment paper base */
.panel,
.spell-card,
.sheet {
  /* Old parchment without dot pattern */
  background-image:
    var(--noise-coarse),
    var(--noise-fine),
    radial-gradient(980px 320px at 18% 0%, rgba(255, 255, 255, 0.62), transparent 64%),
    radial-gradient(880px 560px at 86% 18%, rgba(154, 106, 56, 0.22), transparent 66%),
    radial-gradient(680px 520px at 26% 92%, rgba(122, 78, 42, 0.16), transparent 70%),
    radial-gradient(520px 420px at 76% 88%, rgba(0, 0, 0, 0.12), transparent 72%),
    radial-gradient(520px 380px at 70% 56%, rgba(31, 77, 122, 0.09), transparent 72%),
    radial-gradient(520px 380px at 32% 54%, rgba(140, 47, 42, 0.07), transparent 74%),
    linear-gradient(to bottom, var(--paper), var(--paper-2) 62%, var(--paper-3));
  background-size:
    560px 560px,
    260px 260px,
    auto,
    auto,
    auto,
    auto,
    auto,
    auto,
    auto;
  background-repeat:
    repeat,
    repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat;
  background-position:
    0 0,
    0 0,
    18% 0%,
    86% 16%,
    26% 92%,
    76% 88%,
    70% 56%,
    32% 54%,
    0 0;
  background-blend-mode:
    multiply,
    overlay,
    normal,
    multiply,
    multiply,
    multiply,
    multiply,
    multiply,
    normal;
  background-clip: padding-box;
}

.panel {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 176, 138, 0.92);
  box-shadow: var(--shadow-deep), var(--shadow-tint);
  padding: 0.9rem 0.95rem 0.95rem;
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.panel::before,
.panel::after,
.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.panel::before,
.sheet::before {
  background:
    radial-gradient(1200px 420px at 40% 0%, rgba(255, 255, 255, 0.25), transparent 60%),
    radial-gradient(780px 520px at 55% 115%, rgba(0, 0, 0, 0.10), transparent 62%);
  opacity: 0.90;
}

.panel::after,
.sheet::after {
  background:
    radial-gradient(900px 520px at 50% 15%, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.16) 78%),
    radial-gradient(520px 260px at 14% 92%, rgba(0, 0, 0, 0.10), transparent 62%);
  opacity: 0.60;
  mix-blend-mode: multiply;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.65rem;
  position: relative;
  z-index: 1;
}

.panel-title {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(47, 42, 34, 0.72);
}

.panel-sub {
  font-size: 0.76rem;
  color: rgba(106, 91, 73, 0.92);
  margin-top: 0.15rem;
}

/* fields */
.filters-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
  position: relative;
  z-index: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.78rem;
}

.field label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(47, 42, 34, 0.68);
}

input[type="text"],
input[type="number"],
select,
textarea {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(181, 146, 99, 0.78);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.30));
  color: var(--ink);
  padding: 0.42rem 0.58rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

textarea { min-height: 5rem; resize: vertical; }

input[type="number"]{
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: 0 0 0 3px rgba(122, 78, 42, 0.15), 0 10px 25px rgba(31, 77, 122, 0.06);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.34));
}

input::placeholder,
textarea::placeholder { color: rgba(106, 91, 73, 0.78); }

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  padding: 0.4rem 0.45rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(201, 176, 138, 0.78);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.82), rgba(234, 214, 178, 0.72));
}

.checkbox-row label {
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(27, 26, 23, 0.90);
}

.checkbox-row input { margin: 0; accent-color: rgba(122, 78, 42, 0.98); }

.stats {
  font-size: 0.82rem;
  color: rgba(106, 91, 73, 0.92);
}

.stats strong { color: var(--ink); }

/* spells column */
.spell-column {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.spell-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

  .spell-card {
    position: relative;
    border-radius: var(--radius-md);
    border: 1px solid rgba(201, 176, 138, 0.92);
    padding: 0.7rem 0.85rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft), var(--shadow-tint);
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
  overflow: hidden;
}

.spell-card.no-expand {
  cursor: default;
}

.spell-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.0;
  background:
    radial-gradient(900px 360px at 50% 0%, rgba(255, 255, 255, 0.25), transparent 55%),
    linear-gradient(to right, transparent, rgba(122, 78, 42, 0.25), transparent);
  transition: opacity 0.12s ease;
}

.spell-card:hover {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: var(--shadow-deep), var(--shadow-tint);
  transform: translateY(-1px);
}

.spell-card:hover::before { opacity: 1; }

.spell-card.expanded {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: var(--shadow-deep), var(--shadow-tint);
}

.spell-header {
  display: flex;
  justify-content: space-between;
  gap: 0.55rem;
  align-items: baseline;
  position: relative;
  z-index: 1;
}

.spell-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.spell-header-actions .feat-card-actions {
  margin-left: 0;
  margin-top: 0;
}

.spell-name {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.spell-source{
  font-weight: 600;
  font-size: 0.78rem;
  color: rgba(106, 91, 73, 0.85);
  margin-left: 0.45rem;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

/* pills */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.08rem 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid rgba(181, 146, 99, 0.88);
  background: rgba(255, 255, 255, 0.34);
  color: rgba(47, 42, 34, 0.92);
  white-space: nowrap;
}

.pill-level {
  border-color: rgba(140, 47, 42, 0.55);
  background: rgba(140, 47, 42, 0.10);
  color: rgba(140, 47, 42, 0.92);
}

.pill-school {
  border-color: rgba(31, 77, 122, 0.50);
  background: rgba(31, 77, 122, 0.10);
  color: rgba(31, 77, 122, 0.92);
}

.pill-warning {
  border-color: rgba(140, 47, 42, 0.55);
  background: rgba(140, 47, 42, 0.10);
  color: rgba(140, 47, 42, 0.92);
}

.pill-ritual {
  border-color: rgba(43, 106, 74, 0.55);
  background: rgba(43, 106, 74, 0.10);
  color: rgba(43, 106, 74, 0.92);
}

.pill-save {
  border-color: rgba(91, 47, 122, 0.55);
  background: rgba(91, 47, 122, 0.10);
  color: rgba(91, 47, 122, 0.92);
}

.pill-damage {
  border-color: rgba(140, 47, 42, 0.55);
  background: rgba(140, 47, 42, 0.10);
  color: rgba(140, 47, 42, 0.92);
}

.pill-components {
  border-color: rgba(122, 78, 42, 0.62);
  background: rgba(122, 78, 42, 0.08);
  color: rgba(122, 78, 42, 0.98);
}

.pill-material {
  border-color: rgba(31, 77, 122, 0.55);
  background: rgba(31, 77, 122, 0.08);
  color: rgba(31, 77, 122, 0.92);
  text-transform: none;
  letter-spacing: 0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spell-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  font-size: 0.78rem;
  color: rgba(106, 91, 73, 0.92);
  position: relative;
  z-index: 1;
}

.spell-meta-row span { white-space: nowrap; }

.spell-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.12rem;
  position: relative;
  z-index: 1;
}

.spell-class-pill {
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  font-size: 0.72rem;
  border: 1px solid rgba(201, 176, 138, 0.92);
  background: rgba(255, 255, 255, 0.26);
  color: rgba(47, 42, 34, 0.92);
  white-space: nowrap;
}

.spell-description {
  margin-top: 0.1rem;
  font-size: 0.88rem;
  color: rgba(27, 26, 23, 0.92);
  max-height: 4.9em;
  overflow: hidden;
  position: relative;
  transition: max-height 0.12s ease;
  z-index: 1;
}

.spell-card.expanded .spell-description { max-height: none; }

.fade-bottom { display: none; }

.spell-card.expanded .fade-bottom { display: none; }

.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.3rem;
  font-size: 0.86rem;
  color: rgba(106, 91, 73, 0.92);
}

.count-pill {
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 176, 138, 0.88);
  background: rgba(255, 255, 255, 0.26);
  font-size: 0.78rem;
  color: rgba(47, 42, 34, 0.90);
}

/* active filters */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.filter-pill {
  border-radius: 999px;
  border: 1px solid rgba(201, 176, 138, 0.96);
  background: rgba(255, 255, 255, 0.30);
  color: rgba(47, 42, 34, 0.95);
  padding: 0.22rem 0.62rem;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  white-space: nowrap;
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10), 0 10px 25px rgba(31, 77, 122, 0.05);
}

.filter-pill .x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.08rem;
  height: 1.08rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 176, 138, 0.96);
  color: rgba(47, 42, 34, 0.80);
  font-size: 0.85rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.25);
}

.filter-pill:hover {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14), 0 16px 35px rgba(31, 77, 122, 0.07);
  transform: translateY(-1px);
}

.filter-pill:hover .x {
  border-color: rgba(122, 78, 42, 0.98);
  color: rgba(47, 42, 34, 0.95);
}

.filter-clear {
  border-radius: 0.7rem;
  border: 1px solid rgba(201, 176, 138, 0.96);
  background: rgba(255, 255, 255, 0.28);
  color: rgba(47, 42, 34, 0.95);
  padding: 0.26rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10);
}

.filter-clear:hover {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

.material-chip {
  border-radius: 0.75rem;
  border: 1px solid rgba(31, 77, 122, 0.35);
  background: rgba(31, 77, 122, 0.08);
  color: rgba(31, 77, 122, 0.92);
  padding: 0.35rem 0.65rem;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
  margin-top: 0.4rem;
  box-shadow: 0 12px 28px rgba(31, 77, 122, 0.05);
}

/* add spell */
.add-spell-form {
  display: none;
  margin-top: 0.65rem;
  border-top: 1px solid rgba(201, 176, 138, 0.75);
  padding-top: 0.65rem;
  position: relative;
  z-index: 1;
}

#add-spell-form .filters-grid{
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  z-index: 20;
}

#add-spell-form .field.span-2{
  grid-column: span 2;
}

#add-spell-form .field.span-3{
  grid-column: 1 / -1;
}

#add-spell-form{
  margin-top: 0.45rem;
  padding-top: 0.45rem;
}

#add-spell-form .field{
  gap: 0.2rem;
  font-size: 0.74rem;
}

#add-spell-form .field label{
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

#add-spell-form input[type="text"],
#add-spell-form select,
#add-spell-form textarea{
  padding: 0.34rem 0.55rem;
  font-size: 0.86rem;
}

#add-spell-form .combo{
  position: relative;
}

#add-spell-form .combo input{
  width: 100%;
  padding-right: 1.6rem;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(47, 42, 34, 0.65) 50%),
    linear-gradient(135deg, rgba(47, 42, 34, 0.65) 50%, transparent 50%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.30));
  background-position:
    calc(100% - 0.85rem) 55%,
    calc(100% - 0.65rem) 55%,
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
}

#add-spell-form .combo input:focus{
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(47, 42, 34, 0.7) 50%),
    linear-gradient(135deg, rgba(47, 42, 34, 0.7) 50%, transparent 50%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.34));
}

#add-spell-form .combo-list{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  z-index: 35;
  border-radius: 0.5rem;
  border: 1px solid rgba(120, 120, 120, 0.65);
  background: #e6e6e6;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  padding: 0.3rem 0;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}

#add-spell-form .combo.is-open .combo-list{
  display: block;
}

#add-spell-form .combo-option{
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #1a1a1a;
  text-align: left;
  padding: 0.3rem 0.7rem;
  font-size: 0.86rem;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
}

#add-spell-form .combo-option:hover,
#add-spell-form .combo-option:focus,
#add-spell-form .combo-option.is-active{
  background: #1f6fd0;
  color: #ffffff;
  outline: none;
}

#add-spell-form .checkbox-row{
  padding: 0.3rem 0.4rem;
  gap: 0.35rem 0.6rem;
}

#add-spell-form .checkbox-row label{
  font-size: 0.78rem;
}

@media (max-width: 980px){
  #add-spell-form .filters-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px){
  #add-spell-form .filters-grid{
    grid-template-columns: minmax(0, 1fr);
  }
  #add-spell-form .field.span-2{
    grid-column: 1 / -1;
  }
}

.spell-editor-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: start;
}

#add-spell-form .spell-editor-grid{
  gap: 0.6rem;
  margin-top: 0.55rem;
  position: relative;
  z-index: 0;
}

.spell-preview-wrap{
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.spell-preview-card{
  cursor: default;
  height: auto;
  content-visibility: visible;
  contain-intrinsic-size: auto;
}

.spell-preview-card:hover{
  transform: none;
  box-shadow: var(--shadow-soft), var(--shadow-tint);
}

.spell-preview-card .spell-description{
  max-height: none;
  overflow: visible;
}

.spell-preview-card .fade-bottom{
  display: none;
}

.spell-preview-summary{
  font-size: 0.82rem;
  color: rgba(106, 91, 73, 0.88);
  font-style: italic;
  margin-top: 0.2rem;
}

@media (max-width: 980px){
  .spell-editor-grid{
    grid-template-columns: minmax(0, 1fr);
  }
}

.add-spell-form.visible { display: block; }

.add-spell-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.55rem;
}

#add-spell-form .add-spell-actions{
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.btn-secondary,
.btn-primary {
  border-radius: 0.75rem;
  padding: 0.38rem 0.9rem;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: rgba(47, 42, 34, 0.95);
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.btn-secondary {
  border-color: rgba(201, 176, 138, 0.96);
  background: rgba(255, 255, 255, 0.26);
}

.btn-secondary:hover {
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: rgba(122, 78, 42, 0.98);
  background: rgba(122, 78, 42, 0.12);
}

.btn-primary:hover {
  background: rgba(122, 78, 42, 0.18);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

.add-output {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: rgba(106, 91, 73, 0.92);
}

.add-output textarea {
  margin-top: 0.35rem;
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}



/* inline panel header actions */
.panel-title-row{
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.add-inline{
  padding: 0.42rem 0.7rem;
  font-size: 0.78rem;
  line-height: 1;
}

  /* Spells: hide add panel until opened */
  #add-spell-panel{ display: none; }

  /* Items: add panel */
  #add-item-panel{ display: none; }

  /* Feats: add panel */
  #add-feat-panel{ display: none; }

  .add-feat-form .feat-hint{
    font-size: 0.72rem;
  color: rgba(106, 91, 73, 0.90);
  margin-top: 0.3rem;
}

.feat-editor-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: start;
}

.feat-preview-wrap{
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.feat-preview-card{
  cursor: default;
  height: auto;
}

#view-feats .feat-preview-card{
  height: auto;
}

.feat-preview-card:hover{
  transform: none;
  box-shadow: var(--shadow-soft), var(--shadow-tint);
}

.feat-preview-card .spell-description{
  max-height: none;
}

.feat-preview-pills{
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

  .feat-preview-empty{
    color: rgba(106, 91, 73, 0.82);
    font-style: italic;
  }

  .item-form-grid{
    display: grid;
    gap: 0.4rem;
    margin-top: 0.3rem;
  }

  .item-form-grid.item-form-split{
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    align-items: start;
  }

  .item-form-col{
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  @media (max-width: 980px){
    .item-form-grid.item-form-split{
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .item-form-row{
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: flex-start;
  }

  .item-form-row .field{
    flex: 1 1 220px;
  }

  .field-tight,
  .field-tiny{
    width: 100%;
  }

  .field-tight{
    max-width: 200px;
    flex: 0 1 200px;
  }

  .field-tiny{
    max-width: 110px;
    flex: 0 1 96px;
  }

  .item-form-row .field-wide{
    flex: 1 1 360px;
    min-width: 240px;
  }

  .field-tight input,
  .field-tight select,
  .field-tiny input,
  .field-tiny select{
    width: 100%;
  }

  .field-compact input,
  .field-compact select{
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
  }

  .item-editor-grid{
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    gap: 0.6rem;
    margin-top: 0.55rem;
    align-items: start;
  }

  @media (max-width: 980px){
    .item-editor-grid{
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .item-preview-wrap{
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.15rem;
  }

  .item-preview-empty{
    color: rgba(106, 91, 73, 0.82);
    font-style: italic;
  }

  .add-item-form .field{
    gap: 0.2rem;
    font-size: 0.74rem;
  }

  .add-item-form .field label{
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .add-item-form .checkbox-row{
    padding: 0.3rem 0.45rem;
  }

  .add-item-form .item-form-message{
    margin-top: 0.3rem;
    min-height: 0.9rem;
  }

  .add-item-form .add-spell-actions{
    margin-top: 0.4rem;
  }

.feat-form-message,
.spell-form-message{
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: rgba(106, 91, 73, 0.92);
  min-height: 1.1rem;
}

  .feat-form-message[data-tone="error"],
  .spell-form-message[data-tone="error"]{ color: var(--red-ink); }
  .feat-form-message[data-tone="success"],
  .spell-form-message[data-tone="success"]{ color: var(--green-ink); }
  .feat-form-message[data-tone="warn"],
  .spell-form-message[data-tone="warn"]{ color: var(--accent); }

  .item-form-message{
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: rgba(106, 91, 73, 0.92);
    min-height: 1.1rem;
  }

  .item-form-message[data-tone="error"]{ color: var(--red-ink); }
  .item-form-message[data-tone="success"]{ color: var(--green-ink); }
  .item-form-message[data-tone="warn"]{ color: var(--accent); }

.feat-permission-note,
.spell-permission-note{
  margin-bottom: 0.55rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(140, 47, 42, 0.45);
  background: rgba(140, 47, 42, 0.08);
  color: rgba(140, 47, 42, 0.92);
  font-size: 0.8rem;
}

#add-spell-form .spell-permission-note{
  margin-bottom: 0.4rem;
  padding: 0.32rem 0.55rem;
  font-size: 0.76rem;
}

  .feat-permission-note[data-tone="ok"],
  .spell-permission-note[data-tone="ok"]{
    border-color: rgba(43, 106, 74, 0.40);
    background: rgba(43, 106, 74, 0.08);
    color: rgba(28, 84, 72, 0.95);
  }

  .item-permission-note{
    margin-bottom: 0.55rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(140, 47, 42, 0.45);
    background: rgba(140, 47, 42, 0.08);
    color: rgba(140, 47, 42, 0.92);
    font-size: 0.8rem;
  }

  .item-permission-note[data-tone="ok"]{
    border-color: rgba(43, 106, 74, 0.40);
    background: rgba(43, 106, 74, 0.08);
    color: rgba(28, 84, 72, 0.95);
  }

.feat-editor-wrap .tox-tinymce,
.spell-editor-wrap .tox-tinymce{
  border-radius: var(--radius-sm);
  border: 1px solid rgba(181, 146, 99, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  overflow: hidden;
  background: rgba(246, 237, 216, 0.88);
}

.feat-editor-wrap .tox .tox-toolbar,
.feat-editor-wrap .tox .tox-toolbar__primary,
.spell-editor-wrap .tox .tox-toolbar,
.spell-editor-wrap .tox .tox-toolbar__primary{
  background: rgba(246, 237, 216, 0.90);
  border-bottom: 1px solid rgba(201, 176, 138, 0.80);
}

.feat-editor-wrap .tox .tox-toolbar__group,
.spell-editor-wrap .tox .tox-toolbar__group{
  border-right: 1px solid rgba(201, 176, 138, 0.60);
}

.feat-editor-wrap .tox .tox-tbtn,
.spell-editor-wrap .tox .tox-tbtn{
  color: rgba(47, 42, 34, 0.92);
}

.feat-editor-wrap .tox .tox-tbtn:hover,
.spell-editor-wrap .tox .tox-tbtn:hover{
  background: rgba(122, 78, 42, 0.12);
}

.feat-editor-wrap .tox .tox-edit-area__iframe,
.spell-editor-wrap .tox .tox-edit-area__iframe{
  background: #efe1c8;
}

.item-editor-wrap .tox-tinymce{
  border-radius: var(--radius-sm);
  border: 1px solid rgba(181, 146, 99, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  overflow: hidden;
  background: rgba(246, 237, 216, 0.88);
}

.item-editor-wrap .tox .tox-toolbar,
.item-editor-wrap .tox .tox-toolbar__primary{
  background: rgba(246, 237, 216, 0.90);
  border-bottom: 1px solid rgba(201, 176, 138, 0.80);
}

.item-editor-wrap .tox .tox-toolbar__group{
  border-right: 1px solid rgba(201, 176, 138, 0.60);
}

.item-editor-wrap .tox .tox-tbtn{
  color: rgba(47, 42, 34, 0.92);
}

.item-editor-wrap .tox .tox-tbtn:hover{
  background: rgba(122, 78, 42, 0.12);
}

.item-editor-wrap .tox .tox-edit-area__iframe{
  background: #efe1c8;
}

/* Feats: remove clear + results + active filters */
#view-feats #feat-clear-filters{ display: none !important; }
#view-feats #feat-active-filters{ display: none !important; }
#view-feats .feat-results-panel{ display: none !important; }

/* Classes: cooler, bigger select */
#view-classes #classSelect{
  min-height: 52px;
  font-size: 1.02rem;
  padding: 0.6rem 2.4rem 0.6rem 0.9rem;
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(201, 176, 138, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 22px rgba(0, 0, 0, 0.10);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 20 20'%3E%3Cpath fill='rgba(47,42,34,0.75)' d='M5.7 7.8a1 1 0 0 1 1.4 0L10 10.7l2.9-2.9a1 1 0 1 1 1.4 1.4l-3.6 3.6a1 1 0 0 1-1.4 0L5.7 9.2a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
  background-size: 16px 16px;
}

#view-classes #classSelect:focus{
  outline: none;
  border-color: rgba(122, 78, 42, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 12px 26px rgba(0, 0, 0, 0.12);
}
@media (max-width: 880px) {
  .content-grid,
  #view-spells .content-grid,
  #view-feats .content-grid,
  #view-items .content-grid,
  #view-races .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  #view-spells .sidebar,
  #view-feats .sidebar,
  #view-items .sidebar,
  #view-races .sidebar {
    position: static;
  }

  .home-hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .home-seal {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .header-inner { padding-inline: 1rem; }
  main { padding-inline: 1rem; }

  #view-home > main {
    max-width: 100%;
    padding-top: 1rem;
  }

  .home-hero,
  .home-announcement-entry {
    padding: 1rem;
  }

  .home-title {
    letter-spacing: 0.05em;
  }

  .home-lede,
  .home-announcement-body {
    font-size: 0.95rem;
  }

  .home-announcement-aside {
    padding: 0.85rem 0.9rem;
  }
}

/* token styling injected (save/dmg/cond/dice/section headers) */
.spell-description p,
.character-entry-text p { margin: 0 0 0.6rem; }
.spell-description p:last-child,
.character-entry-text p:last-child { margin-bottom: 0; }

.spell-description .save,
.spell-description .dmg,
.spell-description .cond,
.spell-description .dice,
.character-entry-text .save,
.character-entry-text .dmg,
.character-entry-text .cond,
.character-entry-text .dice {
  display: inline-block;
  padding: 0.08rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 176, 138, 0.95);
  background: rgba(255, 255, 255, 0.28);
  font-size: 0.82em;
  line-height: 1.35;
  vertical-align: baseline;
  white-space: nowrap;
}

.spell-description .dice,
.character-entry-text .dice {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.02em;
  border-color: rgba(31, 77, 122, 0.42);
  background: rgba(31, 77, 122, 0.08);
  color: rgba(31, 77, 122, 0.92);
}

.spell-description .save,
.character-entry-text .save {
  border-color: rgba(91, 47, 122, 0.42);
  background: rgba(91, 47, 122, 0.08);
  color: rgba(91, 47, 122, 0.92);
}

.spell-description .dmg,
.character-entry-text .dmg {
  border-color: rgba(140, 47, 42, 0.42);
  background: rgba(140, 47, 42, 0.08);
  color: rgba(140, 47, 42, 0.92);
}

.spell-description .cond,
.character-entry-text .cond {
  border-color: rgba(122, 78, 42, 0.45);
  background: rgba(122, 78, 42, 0.07);
  color: rgba(122, 78, 42, 0.98);
}

.spell-description .sec,
.spell-description .lbl,
.character-entry-text .sec,
.character-entry-text .lbl {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.12rem 0.5rem;
  background: rgba(122, 78, 42, 0.08);
  letter-spacing: 0.08em;
  color: rgba(106, 91, 73, 0.95);
  font-style: italic;
  font-size: 0.78rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(201, 176, 138, 0.85);
}

.spell-description .lbl,
.character-entry-text .lbl {
  background: rgba(31, 77, 122, 0.07);
  border-color: rgba(31, 77, 122, 0.28);
  color: rgba(31, 77, 122, 0.92);
}

/* per-damage-type styling via data-dmg */
.spell-description .dmg[data-dmg="fire"] {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.10);
  color: rgba(249, 115, 22, 0.95);
}

.spell-description .dmg[data-dmg="cold"] {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.08);
  color: rgba(34, 197, 94, 0.95);
}

.spell-description .dmg[data-dmg="lightning"] {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.08);
  color: rgba(31, 77, 122, 0.92);
}

.spell-description .dmg[data-dmg="necrotic"] {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.08);
  color: rgba(91, 47, 122, 0.92);
}

.spell-description .dmg[data-dmg="radiant"] {
  border-color: rgba(250, 204, 21, 0.60);
  background: rgba(250, 204, 21, 0.12);
  color: rgba(122, 78, 42, 0.98);
}

.spell-description .dmg[data-dmg="psychic"] {
  border-color: rgba(244, 114, 182, 0.55);
  background: rgba(244, 114, 182, 0.08);
  color: rgba(91, 47, 122, 0.92);
}

.spell-description .dmg[data-dmg="force"] {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.08);
  color: rgba(31, 77, 122, 0.92);
}

.spell-description .dmg[data-dmg="thunder"] {
  border-color: rgba(196, 181, 253, 0.55);
  background: rgba(196, 181, 253, 0.08);
  color: rgba(91, 47, 122, 0.92);
}


/* ===== Heavier "old parchment" texture pass (more stains, grain, decoloration) ===== */
:root {
  --noise-fine: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22220%22%20height=%22220%22%20viewBox=%220%200%20220%20220%22%3E%0A%20%20%3Cfilter%20id=%22n%22%3E%0A%20%20%20%20%3CfeTurbulence%20type=%22fractalNoise%22%20baseFrequency=%220.9%22%20numOctaves=%222%22%20stitchTiles=%22stitch%22/%3E%0A%20%20%20%20%3CfeColorMatrix%20type=%22matrix%22%20values=%22%0A%20%20%20%20%20%201%200%200%200%200%0A%20%20%20%20%20%200%201%200%200%200%0A%20%20%20%20%20%200%200%201%200%200%0A%20%20%20%20%20%200%200%200%200.75%200%22/%3E%0A%20%20%3C/filter%3E%0A%20%20%3Crect%20width=%22220%22%20height=%22220%22%20filter=%22url(%23n)%22%20opacity=%220.28%22/%3E%0A%3C/svg%3E");
  --noise-coarse: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22220%22%20height=%22220%22%20viewBox=%220%200%20220%20220%22%3E%0A%20%20%3Cfilter%20id=%22n%22%3E%0A%20%20%20%20%3CfeTurbulence%20type=%22fractalNoise%22%20baseFrequency=%220.35%22%20numOctaves=%223%22%20stitchTiles=%22stitch%22/%3E%0A%20%20%20%20%3CfeColorMatrix%20type=%22matrix%22%20values=%22%0A%20%20%20%20%20%201%200%200%200%200%0A%20%20%20%20%20%200%201%200%200%200%0A%20%20%20%20%20%200%200%201%200%200%0A%20%20%20%20%20%200%200%200%200.75%200%22/%3E%0A%20%20%3C/filter%3E%0A%20%20%3Crect%20width=%22220%22%20height=%22220%22%20filter=%22url(%23n)%22%20opacity=%220.32%22/%3E%0A%3C/svg%3E");
}

/* The texture pass should affect parchment surfaces, not replace the shared application stage.
   Keep the login-style stage background as the single source of truth for the page backdrop. */
body {
  background: #221e1a var(--ns-stage-bg-image) center / cover no-repeat fixed;
}

.panel,
.spell-card {
  /* Old parchment without dot pattern */
  background-image:
    var(--noise-coarse),
    var(--noise-fine),
    radial-gradient(980px 320px at 18% 0%, rgba(255, 255, 255, 0.62), transparent 64%),
    radial-gradient(880px 560px at 86% 18%, rgba(154, 106, 56, 0.22), transparent 66%),
    radial-gradient(680px 520px at 26% 92%, rgba(122, 78, 42, 0.16), transparent 70%),
    radial-gradient(520px 420px at 76% 88%, rgba(0, 0, 0, 0.12), transparent 72%),
    radial-gradient(520px 380px at 70% 56%, rgba(31, 77, 122, 0.09), transparent 72%),
    radial-gradient(520px 380px at 32% 54%, rgba(140, 47, 42, 0.07), transparent 74%),
    linear-gradient(to bottom, var(--paper), var(--paper-2) 62%, var(--paper-3));
  background-size:
    560px 560px,
    260px 260px,
    auto,
    auto,
    auto,
    auto,
    auto,
    auto,
    auto;
  background-repeat:
    repeat,
    repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat;
  background-position:
    0 0,
    0 0,
    18% 0%,
    86% 16%,
    26% 92%,
    76% 88%,
    70% 56%,
    32% 54%,
    0 0;
  background-blend-mode:
    multiply,
    overlay,
    normal,
    multiply,
    multiply,
    multiply,
    multiply,
    multiply,
    normal;
  background-clip: padding-box;
}

.panel {
  border-color: rgba(201, 176, 138, 0.88);
}

.spell-card {
  border-color: rgba(201, 176, 138, 0.85);
}

header {
  background:
    var(--noise-fine),
    radial-gradient(900px 260px at 20% 0%, rgba(255, 255, 255, 0.40), transparent 62%),
    linear-gradient(to bottom, rgba(214, 198, 170, 0.92), rgba(196, 174, 140, 0.90));
  background-size: 260px 260px, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat;
  background-blend-mode: overlay, normal, normal;
}

.summary-pill, .add-spell-btn {
  background-image:
    var(--noise-fine),
    linear-gradient(to bottom, rgba(246, 237, 216, 0.96), rgba(234, 214, 178, 0.90));
  background-size: 240px 240px, auto;
  background-repeat: repeat, no-repeat;
  background-blend-mode: overlay, normal;
}



  /* Fade the truncated text without painting a flat rectangle (avoids those weird bands) */
  .spell-card.is-expandable:not(.expanded) .spell-description {
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 72%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 72%, transparent 100%);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
  }
  .spell-card.expanded .spell-description {
    -webkit-mask-image: none;
    mask-image: none;
  }


/* App navigation */
.header-nav{
  display:flex;
  gap:0.45rem;
  align-items:center;
  flex-wrap:wrap;
  justify-content:center;
  min-width: 0;
}

.nav-tab{
  appearance:none;
  border: 1px solid rgba(201, 176, 138, 0.92);
  background: linear-gradient(to bottom, rgba(255,255,255,0.55), rgba(255,255,255,0.20));
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor:pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16), 0 10px 22px rgba(31, 77, 122, 0.06);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.nav-tab:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18), 0 18px 40px rgba(31, 77, 122, 0.08);
}

.nav-tab.is-active{
  border-color: rgba(122, 78, 42, 0.95);
  filter: saturate(1.1);
}

@media (max-width: 1180px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "nav nav";
    row-gap: 0.55rem;
  }

  .title-block { grid-area: title; }
  header #header-actions {
    grid-area: actions;
    width: auto;
    align-self: start;
  }
  header .header-nav {
    grid-area: nav;
    justify-self: center;
    flex-wrap: wrap;
  }
  header .nav-tab { font-size: 0.74rem; padding: 0.4rem 0.65rem; }
}

@media (max-width: 980px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "nav nav";
    row-gap: 0.55rem;
  }

  .title-block { grid-area: title; }
  header #header-actions {
    grid-area: actions;
    width: auto;
    align-self: start;
  }
  header .header-nav {
    grid-area: nav;
    justify-self: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  header .header-nav::-webkit-scrollbar { height: 0; }
  header .nav-tab { font-size: 0.72rem; padding: 0.38rem 0.65rem; }
}

@media (max-width: 720px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title";
    justify-items: center;
  }

  header .header-nav { display:none; }
  header .menu-toggle { display:inline-flex; }

  header #header-actions {
    position: absolute;
    left: 0.55rem;
    right: auto;
    top: 0.45rem;
    width: auto;
    justify-content: flex-start;
  }

  header #header-actions > :not(.menu-toggle){
    display:none !important;
  }

  header .title-block{
    justify-self: center;
    text-align: center;
    padding-inline: 3.25rem;
    max-width: 100%;
  }

  header .title-block h1{
    font-size: 1.5rem;
    letter-spacing: 0.12em;
  }

  header .mobile-menu{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-top: 0.6rem;
  }

  body.menu-open header .mobile-menu{ display:block; }
}

@media (max-width: 520px) {
  .mobile-nav{ gap: 0.28rem; }
  .mobile-menu .nav-tab{
    font-size: 0.72rem;
    padding: 0.38rem 0.65rem;
  }
}

  .nav-tab:disabled,
  .nav-tab.is-disabled{
    opacity: 0.55;
    cursor: not-allowed;
    transform:none;
    box-shadow: none;
  }

  body.preloading .nav-tab{
    pointer-events: none;
    opacity: 0.6;
  }
  body.preloading .nav-tab.is-active{
    opacity: 1;
  }

/* View toggling */
.view{ display:none; }
.view.is-active{ display:block; }

/* Header actions wrapper so we can hide them per view */
#header-actions{
  display:flex;
  align-items:center;
  gap:0.6rem;
  width:100%;
  justify-content:flex-end;
}
#spellbook-header-actions,
#classes-header-actions,
#feats-header-actions{
  display:flex;
  align-items:center;
  gap:0.5rem;
}

.user-actions{
  position: relative;
  display:flex;
  align-items:center;
  gap: 0.55rem;
}

.user-name-btn{
  appearance:none;
  background:none;
  border:none;
  padding:0;
  margin:0;
  font-family: "Cinzel", "Marcellus", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  cursor: default;
}

.user-name-btn:focus-visible{
  outline: 2px solid rgba(122, 78, 42, 0.6);
  outline-offset: 4px;
  border-radius: 0.4rem;
}

.user-menu{
  position:absolute;
  right:0;
  top: calc(100% + 0.45rem);
  padding: 0.4rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(181, 146, 99, 0.8);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.96), rgba(234, 214, 178, 0.92));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  display:flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 30;
}

.user-menu[hidden]{
  display:none;
}

.menu-action{
  appearance:none;
  border-radius: 999px;
  border: 1px solid rgba(140, 47, 42, 0.55);
  background: rgba(255, 255, 255, 0.26);
  color: rgba(140, 47, 42, 0.92);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.logout-icon{
  appearance:none;
  border: none;
  background: transparent;
  width: 38px;
  height: 36px;
  padding: 0;
  position: relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor: pointer;
}

.logout-icon::before{
  content:"";
  width: 14px;
  height: 18px;
  border-radius: 2px;
  border: 2px solid rgba(140, 47, 42, 0.82);
  display:block;
  box-sizing: border-box;
}

.logout-icon::after{
  content:"";
  position:absolute;
  width: 4px;
  height: 4px;
  background: rgba(140, 47, 42, 0.9);
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  border-radius: 50%;
}

.logout-icon:not(.menu-action){
  border: 1px solid rgba(140, 47, 42, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.menu-action:hover{
  border-color: rgba(140, 47, 42, 0.85);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.menu-toggle{
  display:none;
  align-items:center;
  justify-content:center;
  width: 40px;
  height: 36px;
  border-radius: 0.75rem;
  border: 1px solid rgba(181, 146, 99, 0.75);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.96), rgba(234, 214, 178, 0.90));
  cursor:pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  position: relative;
  z-index: 30;
}

.menu-toggle:hover{
  border-color: rgba(122, 78, 42, 0.95);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.menu-icon{
  position: relative;
  display:block;
  width: 18px;
  height: 2px;
  background: rgba(47, 42, 34, 0.92);
}

.menu-icon::before,
.menu-icon::after{
  content:"";
  position:absolute;
  left:0;
  width:100%;
  height:2px;
  background: rgba(47, 42, 34, 0.92);
}

.menu-icon::before{ top:-6px; }
.menu-icon::after{ top:6px; }

.mobile-menu{
  position:absolute;
  left:0;
  right:0;
  top:100%;
  z-index: 25;
  padding: 0.9rem 1.25rem 1.1rem;
  background:
    var(--noise-fine),
    radial-gradient(900px 260px at 20% 0%, rgba(255, 255, 255, 0.40), transparent 62%),
    linear-gradient(to bottom, rgba(214, 198, 170, 0.96), rgba(196, 174, 140, 0.94));
  background-size: 260px 260px, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat;
  background-blend-mode: overlay, normal, normal;
  border-bottom: 1px solid rgba(201, 176, 138, 0.7);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  display:none;
}

.mobile-user{
  position: relative;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  padding: 0.4rem 0.6rem 0.6rem;
}

.mobile-user-label{
  font-size:0.6rem;
  letter-spacing:0.18em;
  text-transform:uppercase;
  color: rgba(47, 42, 34, 0.62);
}

.mobile-user-name{
  font-family: "Cinzel", "Marcellus", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  text-align: center;
}

.mobile-user .logout-icon{
  margin-left: auto;
}

.mobile-nav{
  display:flex;
  flex-direction: column;
  gap: 0.22rem;
}

.mobile-menu .nav-tab{
  width:100%;
  justify-content:center;
}

/* Classes view layout */
.classes-wrap{
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.8rem;
  position: relative;
  z-index: 1;
}

#view-classes .classes-wrap,
#view-classes .wrap{
  max-width: min(96vw, 1820px);
  padding-inline: clamp(1rem, 1.6vw, 1.7rem);
  position: relative;
  z-index: 1;
}

.classes-controls{
  align-items:end;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:0.35rem;
  padding: 0.44rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 176, 138, 0.88);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18));
  color: rgba(47, 42, 34, 0.82);
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

