:root {
  --ink: #0c0a0f;
  --soot: #16121c;
  --plum: #2a1f35;
  --moss: #3d2f4a;
  --gold: #c9a227;
  --gold-dim: #8a7020;
  --parchment: #e8dcc4;
  --parchment-muted: #b8a88c;
  --feather: #6b5b7a;
  --danger: #c44b4b;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-family: "EB Garamond", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--parchment);
  line-height: 1.55;
  font-size: 1.125rem;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(201, 162, 39, 0.12), transparent 55%),
    radial-gradient(circle at 85% 20%, rgba(107, 91, 122, 0.2), transparent 40%),
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 3px,
      rgba(255, 255, 255, 0.02) 3px,
      rgba(255, 255, 255, 0.02) 4px
    ),
    var(--ink);
  z-index: -1;
}

.site-header {
  position: relative;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  background: linear-gradient(180deg, rgba(22, 18, 28, 0.95), rgba(12, 10, 15, 0.85));
  backdrop-filter: blur(8px);
  text-align: center;
}

.mode-toggle-wrap {
  position: absolute;
  top: 1rem;
  right: clamp(1rem, 4vw, 2.5rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-label {
  font-size: 0.85rem;
  color: var(--parchment-muted);
  letter-spacing: 0.04em;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.mode-switch-label {
  color: var(--parchment-muted);
}

.mode-switch-ui {
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(42, 31, 53, 0.8);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.mode-switch-ui::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--parchment);
  transition: transform 0.2s ease;
}

.mode-switch input:checked + .mode-switch-ui::after {
  transform: translateX(0.95rem);
}

body.mode-dm .mode-switch-label:last-child,
body.mode-player .mode-switch-label:first-child {
  color: var(--gold);
}

body.mode-player .dm-only {
  display: none !important;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.brand-icon {
  font-size: 2.25rem;
  filter: drop-shadow(0 0 12px rgba(201, 162, 39, 0.35));
}

.brand-icon-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  border-radius: 999px;
}

.brand-icon-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.brand-text h1 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  letter-spacing: 0.04em;
  color: var(--gold);
  text-shadow: 0 2px 20px rgba(201, 162, 39, 0.25);
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--parchment-muted);
  font-style: italic;
  font-size: 1rem;
}

.brand-home-btn {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.brand-home-btn:hover,
.brand-home-btn:focus-visible {
  color: var(--parchment);
  text-shadow: 0 0 18px rgba(201, 162, 39, 0.45);
}

.brand-home-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
}

body.is-home .tabs {
  display: none;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.tab {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(42, 31, 53, 0.6);
  color: var(--parchment-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.tab:hover {
  color: var(--parchment);
  border-color: var(--gold-dim);
}

.tab.is-active {
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), #a6841c);
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(201, 162, 39, 0.35);
}

main {
  padding: clamp(1rem, 3vw, 2rem);
  max-width: 52rem;
  margin: 0 auto 3rem;
}

.landing-head {
  text-align: center;
}

.landing-kicker {
  margin: 0;
  font-family: "Cinzel", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parchment-muted);
  font-size: 0.85rem;
}

.landing-card {
  padding: clamp(1rem, 3vw, 1.75rem);
}

.landing-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.landing-tile {
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: linear-gradient(160deg, rgba(61, 47, 74, 0.65), rgba(12, 10, 15, 0.85));
  color: var(--parchment);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.landing-tile:hover,
.landing-tile:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

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

.landing-tile h3 {
  margin: 0 0 0.2rem;
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.landing-tile-icon {
  filter: drop-shadow(0 0 8px rgba(201, 162, 39, 0.25));
}

.landing-tile p {
  margin: 0;
  color: var(--parchment-muted);
  font-size: 0.96rem;
}

body.tab-wide main {
  max-width: min(96rem, 100%);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel-head h2 {
  font-family: "Cinzel", serif;
  color: var(--gold);
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
}

.lede {
  margin: 0;
  color: var(--parchment-muted);
}

.panel-head .lede a {
  color: #c4b4e8;
}

.panel-head .lede a:hover {
  color: var(--parchment);
}

.card {
  background: linear-gradient(145deg, rgba(42, 31, 53, 0.85), rgba(22, 18, 28, 0.9));
  border: 1px solid rgba(201, 162, 39, 0.2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: uppercase;
}

.field input {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(12, 10, 15, 0.8);
  color: var(--parchment);
}

.boopsum-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.boopsum-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.boopsum-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 999px;
  background: rgba(12, 10, 15, 0.45);
  color: var(--parchment);
}

.boopsum-choice input[type="radio"] {
  accent-color: var(--gold);
}

.boopsum-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#quest-tuning {
  width: 100%;
  accent-color: var(--gold);
}

.boopsum-slider-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--parchment-muted);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  padding: 0.55rem 2.1rem 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background:
    linear-gradient(45deg, transparent 50%, rgba(201, 162, 39, 0.8) 50%) calc(100% - 1.05rem) calc(50% - 0.1rem) / 0.5rem
      0.5rem no-repeat,
    linear-gradient(135deg, rgba(201, 162, 39, 0.8) 50%, transparent 50%) calc(100% - 0.75rem) calc(50% - 0.1rem) / 0.5rem
      0.5rem no-repeat,
    linear-gradient(180deg, rgba(61, 47, 74, 0.75), rgba(12, 10, 15, 0.9));
  color: var(--parchment);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.08);
}

.field input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.field select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.field select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.players-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.players-head h3 {
  margin: 0;
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 1.15rem;
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--parchment-muted);
}

.player-rows {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.player-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.player-tier-icon {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  text-align: center;
  font-size: 1.35rem;
  line-height: 1;
  user-select: none;
}

.player-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 7rem;
  min-width: 0;
}

.player-field-level {
  flex: 0 0 5.25rem;
}

.player-field span.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;
}

.player-row input {
  width: 100%;
  min-width: 0;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.2);
  background: rgba(12, 10, 15, 0.75);
  color: var(--parchment);
}

.player-row .btn.danger {
  flex: 0 0 auto;
  align-self: center;
}

.party-summary-box {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(12, 10, 15, 0.55);
}

.party-summary-label {
  margin: 0 0 0.35rem;
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.party-summary-text {
  margin: 0;
  font-size: 0.98rem;
  color: var(--parchment);
  word-break: break-word;
}

.party-summary-text.preformatted {
  white-space: pre-wrap;
}

.mono-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}

.copyable-output {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
}

.copyable-output:last-child {
  margin-bottom: 0;
}

.copyable-output > .party-summary-text,
.copyable-output > textarea {
  flex: 1;
  min-width: 0;
}

.copyable-output-btn {
  flex: 0 0 auto;
  min-width: 4.6rem;
}

.btn {
  font-family: "Cinzel", serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, var(--gold), #a6841c);
  color: var(--ink);
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.3);
}

.btn.primary:hover {
  box-shadow: 0 6px 28px rgba(201, 162, 39, 0.45);
}

.btn.ghost {
  background: transparent;
  color: var(--parchment-muted);
  border-color: rgba(201, 162, 39, 0.35);
}

.btn.ghost:hover {
  color: var(--parchment);
  border-color: var(--gold-dim);
}

.btn.danger {
  background: rgba(196, 75, 75, 0.15);
  color: #e8a0a0;
  border-color: rgba(196, 75, 75, 0.45);
}

.actions {
  display: flex;
  justify-content: flex-start;
}

.actions .btn.primary {
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid;
}

.alert.error {
  background: rgba(196, 75, 75, 0.12);
  border-color: rgba(196, 75, 75, 0.5);
  color: #f0c4c4;
}

.result h3.result-title {
  margin-top: 0;
  font-family: "Cinzel", serif;
  color: var(--gold);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  padding-bottom: 0.5rem;
}

.result h4 {
  font-family: "Cinzel", serif;
  color: var(--gold-dim);
  margin: 1.25rem 0 0.4rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.result h4:first-of-type {
  margin-top: 0.5rem;
}

.muted {
  color: var(--parchment-muted);
}

.fine-print {
  font-size: 0.98rem;
  color: var(--parchment-muted);
}

.loot-list,
.alloc-list {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
}

.construction {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.construction h2 {
  font-family: "Cinzel", serif;
  color: var(--gold);
  margin: 0.5rem 0;
}

.construction-icon {
  font-size: 3rem;
  display: block;
  opacity: 0.85;
}

.banner {
  display: inline-block;
  margin: 0.75rem 0 1rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 1px dashed rgba(201, 162, 39, 0.55);
  color: var(--gold);
  font-family: "Cinzel", serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--feather);
  font-size: 0.9rem;
  border-top: 1px solid rgba(107, 91, 122, 0.35);
}

.site-footer a {
  color: var(--gold);
  text-underline-offset: 0.18em;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--parchment);
}

small {
  font-size: 0.85em;
  opacity: 0.9;
}

.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;
}

.btn.toggle {
  background: rgba(12, 10, 15, 0.55);
  color: var(--parchment-muted);
  border-color: rgba(201, 162, 39, 0.28);
  text-transform: none;
  letter-spacing: 0.02em;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.95rem;
}

.btn.toggle:hover {
  color: var(--parchment);
  border-color: var(--gold-dim);
}

.btn.toggle.is-on {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.95), #8a7020);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201, 162, 39, 0.28);
}

.questinfo-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.questinfo-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.questinfo-fieldset legend {
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0;
  margin-bottom: 0.5rem;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.questinfo-rank-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.questinfo-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--parchment);
  font-size: 0.98rem;
}

.questinfo-inline-check input {
  accent-color: var(--gold);
}

.questinfo-cw-fieldset .questinfo-cw-hint {
  margin: 0 0 0.65rem;
}

.questinfo-cw-fieldset code {
  font-size: 0.88em;
  color: #c4b4e8;
}

.questinfo-cw-fieldset a {
  color: #c4b4e8;
}

.questinfo-cw-fieldset a:hover {
  color: var(--parchment);
}

.questinfo-cw-status {
  font-size: 0.92rem;
  color: var(--parchment-muted);
  margin-bottom: 0.5rem;
}

.questinfo-cw-filter {
  margin-bottom: 0.5rem;
}

.questinfo-cw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.questinfo-cw-list {
  max-height: min(40vh, 22rem);
  overflow: auto;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.18);
  background: rgba(12, 10, 15, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.questinfo-cw-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.98rem;
  color: var(--parchment);
}

.questinfo-cw-item input {
  margin-top: 0.35rem;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.questinfo-cw-text {
  line-height: 1.45;
}

.questinfo-output-title {
  margin: 0 0 0.35rem;
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 1.1rem;
}

.questinfo-output-hint {
  margin: 0 0 0.75rem;
}

.questinfo-md-output {
  width: 100%;
  min-height: 12rem;
  font: 0.95rem/1.45 ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(8, 7, 11, 0.92);
  color: #d8cbb8;
  resize: vertical;
}

.questinfo-md-output:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.loot-panel-inner {
  max-width: 100%;
}

.loot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 960px) {
  .loot-layout {
    grid-template-columns: 1fr;
  }
}

.loot-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.loot-controls .loot-budget-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.loot-budget-field {
  flex: 1 1 12rem;
  min-width: 0;
}

.loot-hint {
  margin: 0.75rem 0 0;
}

.loot-controls .loot-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 0.9rem;
}

.loot-filter-field {
  min-width: 0;
}

.loot-filter-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.loot-filter-toggle span {
  margin: 0;
}

.loot-status {
  margin-top: 0.75rem;
  font-size: 1rem;
  color: var(--parchment-muted);
}

.loot-table-card {
  padding: 0;
  overflow: hidden;
}

.loot-table-scroll {
  overflow-x: auto;
  max-height: min(70vh, 42rem);
  overflow-y: auto;
}

.loot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.loot-table th,
.loot-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
  vertical-align: top;
  text-align: left;
  max-width: 14rem;
}

.loot-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(42, 31, 53, 0.98), rgba(22, 18, 28, 0.95));
  box-shadow: 0 1px 0 rgba(201, 162, 39, 0.12);
}

.loot-table td a {
  color: #c4b4e8;
  word-break: break-all;
}

.loot-table td a:hover {
  color: var(--parchment);
}

.loot-actions-head {
  width: 10rem;
  max-width: 10rem;
  text-align: center;
}

.loot-row-main {
  cursor: pointer;
}

.loot-row-main:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.loot-row-main:hover td {
  background: rgba(201, 162, 39, 0.06);
}

.loot-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.loot-expand-ind {
  font-size: 0.85rem;
  color: var(--gold);
  width: 0.7rem;
}

.loot-row-detail td {
  background: rgba(12, 10, 15, 0.35);
  border-bottom: 1px solid rgba(201, 162, 39, 0.18);
}

.loot-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.4rem 1rem;
  padding: 0.35rem 0;
}

.loot-detail-row {
  font-size: 0.9rem;
}

.loot-detail-key {
  color: var(--gold);
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.loot-detail-value {
  color: var(--parchment);
}

.loot-actions-cell {
  max-width: 10rem;
  text-align: center;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
}

.loot-add-btn {
  font-size: 0.65rem;
  padding: 0.35rem 0.5rem;
  white-space: nowrap;
  line-height: 1.2;
  text-align: center;
}

.loot-add-btn-sell {
  border-color: rgba(107, 168, 112, 0.55);
  color: #b9e2bc;
}

.loot-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(201, 162, 39, 0.15);
  background: rgba(12, 10, 15, 0.5);
}

.loot-pag-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.loot-pag-meta {
  font-size: 0.9rem;
  color: var(--parchment-muted);
}

.loot-pag-info {
  font-size: 0.95rem;
}

.loot-cart {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 36rem);
}

.loot-cart-head h3 {
  margin: 0;
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 1.1rem;
}

.loot-cart-hint {
  margin: 0.35rem 0 0.75rem;
}

.loot-cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.loot-cart-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.35rem;
  border-radius: 8px;
  background: rgba(12, 10, 15, 0.45);
  border: 1px solid rgba(201, 162, 39, 0.12);
}

.loot-cart-item-info {
  min-width: 0;
  flex: 1;
}

.loot-cart-item-name {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.loot-cart-item-meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--parchment-muted);
}

.loot-cart-remove {
  flex-shrink: 0;
  padding: 0.2rem 0.45rem;
  min-width: 2rem;
  font-size: 1.1rem;
  line-height: 1;
}

.loot-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.loot-cart-qty-btn {
  flex-shrink: 0;
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.95rem;
  line-height: 1;
}

.loot-cart-footer {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(201, 162, 39, 0.2);
}

.loot-cart-total {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.loot-cart-novalue-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  font-size: 0.9rem;
  line-height: 1;
}

.loot-cart-novalue-warning[hidden] {
  display: none;
}

.loot-cart-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 960px) {
  .loot-cart {
    position: relative;
    top: auto;
    max-height: none;
  }
}

.staff-controls .staff-lookup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.staff-username-field {
  flex: 1 1 14rem;
  min-width: 0;
}

.staff-hint {
  margin: 0.75rem 0 0;
}

.staff-status {
  margin-top: 0.75rem;
  font-size: 1rem;
  color: var(--parchment-muted);
}

.staff-balance-card .staff-balance-line {
  margin: 0;
  font-size: 1.15rem;
}

.staff-balance-value {
  font-family: "Cinzel", serif;
  color: var(--gold);
  margin: 0 0.25rem 0 0.35rem;
}

.staff-rewards-title {
  margin: 0 0 0.35rem;
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 1.1rem;
}

.staff-rewards-hint {
  margin: 0 0 0.85rem;
}

.staff-table-scroll {
  overflow-x: auto;
}

.staff-rewards-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.staff-rewards-table th,
.staff-rewards-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.15);
  text-align: left;
}

.staff-rewards-table th {
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.staff-reward-row.is-unaffordable td {
  color: var(--feather);
  opacity: 0.45;
}

.avrae-frame-card {
  padding: 0;
  overflow: hidden;
}

.avrae-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.avrae-subtab {
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(42, 31, 53, 0.6);
  color: var(--parchment-muted);
  cursor: pointer;
}

.avrae-subtab.is-active {
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), #a6841c);
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(201, 162, 39, 0.35);
}

.avrae-frame-hint {
  margin: 1rem 1rem 0;
}

.avrae-frame {
  display: block;
  width: 100%;
  min-height: min(78vh, 64rem);
  border: 0;
  background: rgba(8, 7, 11, 0.92);
}

.questnotes-warning {
  margin: 0 0 1rem;
}

.questnotes-actions-row {
  display: flex;
  gap: 0.7rem;
  align-items: end;
  flex-wrap: wrap;
}

.questnotes-new-quest-field,
.questnotes-new-heading-field {
  flex: 1 1 22rem;
}

.questnotes-quest-tabs,
.questnotes-heading-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.questnotes-workspace {
  display: grid;
  gap: 0.9rem;
}

.questnotes-editor {
  padding: 1rem;
  background: linear-gradient(180deg, rgba(28, 20, 35, 0.9), rgba(17, 12, 22, 0.96));
  border: 1px solid rgba(201, 162, 39, 0.28);
}

.questnotes-text-wrap {
  margin-top: 0.7rem;
}

.questnotes-text-wrap textarea {
  min-height: 18rem;
  line-height: 1.45;
}

.questnotes-tab,
.questnotes-subtab {
  font-family: "Cinzel", serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(42, 31, 53, 0.6);
  color: var(--parchment-muted);
  cursor: pointer;
}

.questnotes-tab.is-active,
.questnotes-subtab.is-active {
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), #a6841c);
  border-color: var(--gold);
}

.questnotes-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.questnotes-editor-head h3 {
  margin: 0;
}

@media (min-width: 980px) {
  .questnotes-workspace {
    grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
    align-items: start;
  }

  .questnotes-quest-tabs {
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 9rem);
    overflow: auto;
    padding-right: 0.35rem;
  }

  .questnotes-tab {
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.9rem;
  }

  #qn-empty,
  .questnotes-editor {
    min-height: 30rem;
  }
}
