body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(920px 280px at 18% 0%, color-mix(in srgb, var(--accent) 15%, transparent 85%), transparent 64%),
    radial-gradient(800px 240px at 84% 0%, var(--coral-soft), transparent 74%),
    radial-gradient(680px 210px at 60% 0%, var(--leaf-soft), transparent 78%),
    linear-gradient(180deg, rgba(11, 18, 32, 0.06) 0%, rgba(11, 18, 32, 0) 360px),
    var(--paper);
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: -0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background:
    radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.16) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 35%, rgba(34, 197, 94, 0.12) 0 1px, transparent 2px),
    radial-gradient(circle at 44% 78%, rgba(251, 113, 133, 0.10) 0 1px, transparent 2px);
  background-size: 520px 520px;
  filter: blur(.25px);
  mix-blend-mode: normal;
}

/* --- Rahu-style fixed backdrop layers --- */
.bg-fixed {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(760px 260px at 18% 0%, color-mix(in srgb, var(--accent) 13%, transparent 87%), transparent 66%),
    radial-gradient(720px 220px at 82% 0%, var(--coral-soft), transparent 72%),
    radial-gradient(560px 180px at 60% 0%, var(--leaf-soft), transparent 74%),
    linear-gradient(180deg, rgba(11, 18, 32, 0.06) 0%, rgba(11, 18, 32, 0) 360px),
    var(--paper);
}

.watermark {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.04;
  background:
    radial-gradient(circle at 14% 22%, rgba(37, 99, 235, 0.12) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 35%, rgba(34, 197, 94, 0.10) 0 1px, transparent 2px),
    radial-gradient(circle at 44% 78%, rgba(251, 113, 133, 0.10) 0 1px, transparent 2px);
  background-size: 520px 520px;
  filter: blur(.25px);
  mix-blend-mode: normal;
}

/* --- .wrap container sizing --- */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 14px 28px;
}

/* --- Hero header (Rahu-style) --- */
.hero {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
}

.hero-banner {
  height: 140px;
  background-size: cover;
  background-position: center;
  filter: saturate(1.05) contrast(1.02);
  opacity: 0.85;
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 14px 14px;
}

.hero-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.titleblock h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
}

@media (max-width: 820px) {
  .hero-top {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  display: none;
}

.header-banner {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  max-width: 1200px;
  margin: 0 auto;
}

.hero .toolbar {
  padding: 0;
  max-width: none;
  margin: 0;
}

.hero .status {
  margin-left: 0;
  padding: 0 10px;
  border: 1px solid var(--header-chip-border);
  border-radius: 999px;
  background: var(--header-chip-bg);
}

.status {
  margin-left: auto;
  opacity: 0.85;
  color: var(--text-2);
  display: inline-flex;
  gap: 8px;
  align-items: center;
}


.app-root {
  padding: 16px 0;
  max-width: none;
  margin: 0;
}

/* --- Gameplay sheet layout (official-sheet inspired) --- */

.sheet-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr; /* left | mid | right (right will span 2 cols) */
  gap: 16px;
  align-items: start;
}

.sheet-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Make the right column span the middle + right space (2/3 width) */
.sheet-layout .col-right {
  grid-column: 2 / 4;
}

/* Middle column is currently unused; hide it to remove empty space */
.sheet-layout .col-mid {
  display: none;
}

.sheet-header {
  margin-bottom: 16px;
}

.sheet-bottom {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

@media (max-width: 1100px) {
  .sheet-layout {
    grid-template-columns: 1fr; /* stack on narrower screens */
  }
  .sheet-layout .col-right {
    grid-column: auto;
  }
  .sheet-layout .col-mid {
    display: none;
  }
}

@media (max-width: 720px) {
  .sheet-layout,
  .sheet-bottom {
    grid-template-columns: 1fr; /* mobile: single column */
  }
}

/* --- Editor UI (v1 minimal styles) --- */

/* Two-column card row (Proficiencies + Classes & Levels) */
.cards-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* Ensure cards inside the 2-col row don't add extra bottom margin */
.cards-2col .card {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .cards-2col {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Make cards inside sheet columns slightly denser */
.sheet-col .card {
  margin-bottom: 0;
}

/* Reduce perceived emptiness in Abilities and similar dense sections */
.sheet-col .table {
  max-width: 100%;
}

/* Slightly tighten vertical rhythm inside the main gameplay grid */
.sheet-layout .card-body {
  padding: 10px 12px 12px;
}

.card.collapsed > .card-body {
  display: none;
}

.card > h2 {
  margin: 0;
  padding: 14px 16px;
  font-size: 13px;
  letter-spacing: 0.34px;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 10%, var(--surface) 90%),
    color-mix(in srgb, var(--surface-2) 82%, transparent 18%)
  );
  border-bottom: 1px solid var(--border);
}

.card > h2::after {
  content: "▾";
  position: absolute;
  right: 16px;
  font-size: 0.9rem;
  opacity: 0.6;
}

.card.collapsed > h2::after {
  content: "▸";
}

/* Header rows that include action buttons: reserve space for the chevron */
.card > h2.card-title-row {
  padding-right: 56px; /* leaves room for the ::after chevron at right:16px */
}

/* Nudge header action buttons left so they don't sit under the chevron */
.card > h2.card-title-row .prof-edit-btn {
  margin-right: 18px;
}

.card-body {
  padding: 12px 14px 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.12px;
}

.field input {
  padding: 10px 12px;
  font-size: 0.95rem;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-raised);
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border-2) 54%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent 76%);
}

.readonly {
  padding: 10px 12px;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

/* Visually anchor tables to the left inside cards (reduces perceived emptiness) */
.card .table-wrap {
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 720px) {
  .table {
    min-width: 520px;
  }
}

.table {
  width: 100%;
  max-width: 720px; /* prevent huge empty right side */
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 8px;
  text-align: left;
}

.table th {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.25px;
  text-transform: uppercase;
  opacity: 1;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface-raised) 28%);
}

.table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-raised) 96%);
}

/* Ability-style tables: tighten columns */
.table th:first-child,
.table td:first-child {
  width: 120px;
}

.table th:nth-child(2),
.table td:nth-child(2) {
  width: 140px;
}

.hint {
  font-size: 0.85rem;
  color: var(--faint);
  margin-top: 8px;
  line-height: 1.45;
}

/* --- Tracker UI refinements (v1) --- */

.table input[type="number"] {
  width: 4.5em;
  text-align: center;
}

.table button {
  padding: 4px 6px;
  font-size: 0.85rem;
  line-height: 1;
}

.table button + button {
  margin-left: 4px;
}

button,
select,
input[type="number"],
input[type="text"],
textarea {
  min-height: var(--tap);
}

button {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: transform 0.06s ease, border-color 0.2s ease, background 0.2s ease;
}

button:hover {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border-2) 66%);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-raised) 94%);
}

button:active {
  transform: translateY(1px);
}

button.primary,
.btn-primary {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border-2) 54%);
  background: var(--accent);
  color: var(--accent-ink);
}

select,
input[type="text"],
input[type="number"],
textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-raised);
  color: var(--ink);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border-2) 54%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent 76%);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent 78%);
  border-radius: 10px;
}

/* --- Print / PDF export (in-page print mode, no popups) --- */

/* Hidden by default; becomes visible only during print-mode */
.print-root {
  display: none;
}

/* When exporting PDF, hide the normal app UI and show the print sheet */
body.print-mode .app-header,
body.print-mode .app-root,
body.print-mode .hero,
body.print-mode .wrap {
  display: none;
}

body.print-mode .print-root {
  display: block;
  padding: 0;
  color: #111;
}

body.print-mode {
  background: #fff;
}

body.print-mode .print-sheet {
  padding: 0;
}

/* Print-specific tuning */
@media print {
  /* Ensure the app UI never prints */
  .app-header,
  .app-root,
  .hero,
  .wrap {
    display: none !important;
  }

  /* Print sheet becomes the only visible content */
  .print-root {
    display: block !important;
  }

  /* Hard isolation: hide everything except the print root */
  body * {
    visibility: hidden !important;
  }

  .print-root,
  .print-root * {
    visibility: visible !important;
  }

  .print-root {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  /* Avoid printing buttons/inputs if any slip through */
  button,
  input,
  select,
  textarea {
    display: none !important;
  }

  /* Allow hyperlinks to print without styling */
  a {
    color: inherit;
    text-decoration: none;
  }

  /* Page margins are controlled by the browser; keep body clean */
  body {
    margin: 0;
    background: #fff !important;
    color: #111 !important;
  }

  /* Try to keep tables readable across page breaks */
  table {
    break-inside: auto;
  }
  tr {
    break-inside: avoid;
    break-after: auto;
  }
}

:root {
  --font-sans: "Atkinson", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --accent: #2563eb;
  --accent-ink: #ffffff;
  --coral: #fb7185;
  --leaf: #22c55e;

  --paper: #f3f4f6;
  --surface: #fcfdff;
  --surface-2: #eef6ff;
  --surface-raised: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.84);
  --surface-glass-border: rgba(255, 255, 255, 0.62);
  --coral-soft: rgba(251, 113, 133, 0.08);
  --leaf-soft: rgba(34, 197, 94, 0.08);

  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --border: #e5e7eb;
  --border-2: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 22px rgba(15, 23, 42, 0.10);
  --shadow: var(--shadow-md);

  --radius: 16px;
  --radius-sm: 12px;
  --pad: 14px;
  --gap: 12px;
  --tap: 44px;
  --focus: color-mix(in srgb, var(--accent) 32%, transparent 68%);

  --header-bg:
    linear-gradient(180deg, rgba(226, 232, 240, 0.92) 0%, rgba(241, 245, 249, 0.88) 100%),
    rgba(226, 232, 240, 0.92);
  --header-chip-bg: rgba(255, 255, 255, 0.84);
  --header-chip-border: rgba(15, 23, 42, 0.18);

  /* compatibility aliases for existing selectors */
  --ink: var(--text);
  --surface2: var(--surface-2);
  --border2: var(--border-2);
}

body[data-class="wizard"] { --accent: #4f46e5; }
body[data-class="cleric"] { --accent: #b0891f; }
body[data-class="druid"] { --accent: #2f9e44; }
body[data-class="fighter"] { --accent: #8d6e63; }
body[data-class="rogue"] { --accent: #455a64; }
body[data-class="bard"] { --accent: #be185d; }
body[data-class="paladin"] { --accent: #ca8a04; }
body[data-class="ranger"] { --accent: #558b2f; }
body[data-class="sorcerer"] { --accent: #e53935; }
body[data-class="warlock"] { --accent: #6d28d9; }

/* --- Modal / New Character overlay (contrast + theme) --- */

/* Support both <dialog> and div-based modals */
dialog,
.modal,
.overlay,
.dialog {
  color: var(--ink);
}

/* Native dialog element */
dialog {
  border: 1px solid var(--border-2);
  border-radius: calc(var(--radius) + 6px);
  padding: 18px;
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background:
    radial-gradient(560px 180px at top left, color-mix(in srgb, var(--accent) 8%, transparent 92%), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.24);
  max-width: min(980px, calc(100vw - 32px));
}

dialog[open] {
  display: block;
}

/* Backdrop for dialog */
dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

/* If you use a custom overlay element */
.modal-backdrop,
.overlay-backdrop,
.modal-overlay,
.overlay {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

/* Headings inside modals */
dialog h1,
dialog h2,
.modal h1,
.modal h2,
.dialog h1,
.dialog h2 {
  color: var(--ink);
  margin: 0 0 14px;
}

/* Make labels readable */
dialog label,
.modal label,
.dialog label {
  color: var(--muted);
}

/* Inputs/selects in modal: increase contrast */
dialog input,
dialog select,
dialog textarea,
.modal input,
.modal select,
.modal textarea,
.dialog input,
.dialog select,
.dialog textarea {
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  color: var(--ink);
}

/* Placeholder contrast */
dialog input::placeholder,
dialog textarea::placeholder,
.modal input::placeholder,
.modal textarea::placeholder,
.dialog input::placeholder,
.dialog textarea::placeholder {
  color: var(--faint);
}

/* Modal buttons: readable + consistent */
dialog button,
.modal button,
.dialog button {
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  color: var(--ink);
}

dialog button.primary,
.modal button.primary,
.dialog button.primary {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border-2) 54%);
  background: var(--accent);
  color: var(--accent-ink);
}

/* Optional: make the modal layout breathe on small screens */
@media (max-width: 720px) {
  dialog {
    padding: 14px;
  }
}


/* --- Checkbox readability + touch targets (safe, native checkbox) --- */
input[type="checkbox"] {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  accent-color: var(--accent);
}

/* Make the whole label area easier to tap when wrapped */
label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, var(--accent) 14%);
  border: 1px solid var(--border-2);
}

label:has(input[type="checkbox"]):hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-2) 60%);
}


input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 28%, transparent);
  border-radius: 6px;
}

/* --- Proficiencies card (redesigned) --- */
.prof-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prof-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.prof-head-title {
  font-size: 12.5px;
  letter-spacing: 0.22px;
  text-transform: uppercase;
  color: var(--text-2);
}

.prof-edit-btn {
  padding: 8px 12px;
  min-height: 38px;
  border-radius: 999px;
  font-weight: 650;
}

.prof-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prof-line {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
}

.prof-line-label {
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 2px;
}

.prof-line-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-raised);
  font-size: 0.9rem;
  line-height: 1;
  color: var(--text);
}

.chip-muted {
  opacity: 0.72;
}

/* --- Cross-module component convergence (phase 2) --- */

.titleblock h1 {
  font-size: clamp(1.6rem, 2.2vw, 2.05rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.toolbar.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar.actions > button {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-raised) 92%);
  color: var(--text-2);
  font-size: 0.84rem;
  line-height: 1.15;
  white-space: nowrap;
}

.cantrip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface-raised) 28%);
  border: 1px solid var(--border);
}

.inv-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: start;
  margin-bottom: 10px;
}

.inv-currency {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface-raised) 30%);
  min-width: min(100%, 460px);
}

.inv-currency-label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.inv-currency-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.inv-currency-row label {
  display: grid;
  gap: 4px;
  color: var(--text-2);
  font-size: 0.78rem;
}

.inv-currency-row input {
  min-height: 36px;
  padding: 7px 9px;
}

.profs {
  margin-top: 12px;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
}

.profs > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  color: var(--text);
  padding: 4px 0;
}

.profs > summary:hover {
  color: var(--accent);
}

/* Spell edit dialog (editor.js) */
.dlg {
  border: none;
  padding: 0;
  max-width: min(760px, calc(100vw - 28px));
}

.dlg .dlg-form {
  margin: 0;
}

.dlg .dlg-card {
  border: 1px solid var(--border-2);
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(520px 180px at top left, color-mix(in srgb, var(--accent) 7%, transparent 93%), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.dlg .dlg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 72%, transparent 28%);
}

.dlg .dlg-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.dlg .dlg-x {
  width: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0;
}

.dlg .dlg-body {
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 84%, transparent 16%);
}

.dlg .dlg-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 68%, transparent 32%);
}

.btn {
  font-weight: 650;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
  }

  .card:hover {
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  }
}

.prof-edit {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 94%, var(--accent) 6%);
  padding: 12px;
}

.prof-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.prof-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.prof-block-title {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.12px;
}

.prof-edit input[type="text"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Compact saving-throw toggles */
.prof-saves-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prof-save {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-raised);
}

.prof-save-lab {
  font-size: 12px;
  letter-spacing: 0.22px;
  text-transform: uppercase;
  color: var(--text);
}

/* Avoid global label:has() from over-styling the new prof-save pill */
.prof-save:has(input[type="checkbox"]) {
  padding: 8px 10px;
  border-radius: 999px;
}

@media (max-width: 900px) {
  .prof-line {
    grid-template-columns: 1fr;
  }
  .prof-edit-grid {
    grid-template-columns: 1fr;
  }
  .inv-top {
    grid-template-columns: 1fr;
  }
  .inv-currency-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .inv-currency-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
