/**
 * Magus Hub — Grimoire UI theme + shared mh-* component primitives.
 * Classic tokens live in app.css; Grimoire overrides below.
 */

/* ── Classic mh aliases (mirror --hub-* for migration) ── */

:root,
[data-mh-ui="classic"] {
    --mh-bg: var(--hub-bg, #faf7f2);
    --mh-surface: #ffffff;
    --mh-surface-muted: var(--hub-surface, #f0f4ec);
    --mh-parchment: var(--hub-bg, #faf7f2);
    --mh-border: var(--hub-border, #e5e7df);
    --mh-border-accent: rgba(107, 143, 113, 0.35);
    --mh-accent: var(--hub-accent, #6b8f71);
    --mh-accent-dark: var(--hub-accent-dark, #4a6b50);
    --mh-accent-soft: var(--hub-accent-light, #e4efe6);
    --mh-accent-on: #ffffff;
    --mh-crimson: #dc2626;
    --mh-text: var(--hub-ink, #3d4035);
    --mh-text-muted: var(--hub-muted, #6b7280);
    --mh-text-on-parchment: var(--hub-ink, #3d4035);
    --mh-focus-ring: rgba(107, 143, 113, 0.22);
    --mh-font-serif: "DM Sans", system-ui, sans-serif;
    --mh-font-sans: "Source Sans 3", system-ui, sans-serif;
    --mh-shadow-soft: 0 1px 3px rgba(61, 64, 53, 0.08);
}

/* ── Grimoire tokens ── */

[data-mh-ui="grimoire"] {
    --mh-bg: #121417;
    --mh-surface: #1a1d23;
    --mh-surface-muted: #22262e;
    --mh-parchment: #f9f6ee;
    --mh-border: rgba(197, 160, 89, 0.22);
    --mh-border-accent: rgba(197, 160, 89, 0.45);
    --mh-accent: #c5a059;
    --mh-accent-dark: #a68444;
    --mh-accent-soft: rgba(197, 160, 89, 0.12);
    --mh-accent-on: #121417;
    --mh-crimson: #991b1b;
    --mh-text: #f5f2eb;
    --mh-text-muted: #9ca3af;
    --mh-text-on-parchment: #1f2937;
    --mh-focus-ring: rgba(197, 160, 89, 0.28);
    --mh-font-serif: "Cinzel", "Times New Roman", serif;
    --mh-font-sans: "Inter", system-ui, sans-serif;
    --mh-shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.35);
    background-color: #121417;
    color: #f5f2eb;
}

html[data-mh-ui="grimoire"] body.app-shell {
    background-color: #121417;
    background-image: none;
    color: #f5f2eb;
}

/* ── Grimoire themed scopes: wizard + character pages (Phase 4) ── */

[data-mh-ui="grimoire"] .mh-themed-shell {
    color: var(--mh-text);
    background: var(--mh-bg);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--mh-border);
    box-shadow: var(--mh-shadow-soft);
}

/* ── Flash messages ── */

.mh-flash {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    color: var(--mh-text);
}

.mh-flash--error {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(244, 63, 94, 0.08);
    color: #991b1b;
}

.mh-flash--success {
    border-color: var(--mh-border-accent);
    background: var(--mh-accent-soft);
    color: var(--mh-accent-dark);
}

.mh-flash--warning {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(251, 191, 36, 0.12);
    color: #92400e;
}

.mh-flash--info {
    background: var(--mh-surface-muted);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-flash--error {
    border-color: rgba(252, 165, 165, 0.35);
    background: rgba(153, 27, 27, 0.2);
    color: #fecaca;
}

[data-mh-ui="grimoire"] .mh-flash--success {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-flash--warning {
    border-color: rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.1);
    color: #fde68a;
}

/* ── Wizard shell ── */

.mh-themed-shell {
    font-family: var(--mh-font-sans);
}

.mh-themed-shell__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
}

/* ── Typography ── */

.mh-heading {
    font-family: var(--mh-font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: var(--mh-text);
}

.mh-subheading {
    margin-top: 0.35rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--mh-text-muted);
    font-family: var(--mh-font-sans);
}

.mh-section-title {
    font-family: var(--mh-font-serif);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--mh-accent-dark);
}

[data-mh-ui="grimoire"] .mh-section-title {
    color: var(--mh-accent);
}

/* ── Cards & panels ── */

.mh-card {
    border-radius: 0.625rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    box-shadow: var(--mh-shadow-soft);
    color: var(--mh-text);
}

.mh-card--wizard {
    padding: 1.5rem;
}

.mh-card--muted {
    background: var(--mh-surface-muted);
    border-color: var(--mh-border-accent);
}

.mh-panel-divider {
    border: none;
    border-top: 1px solid var(--mh-border);
    margin: 0.75rem 0;
}

/* ── Forms ── */

.mh-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-text);
    font-family: var(--mh-font-sans);
}

.mh-hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--mh-text-muted);
}

.mh-readonly-value {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    border-radius: 0.5rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    font-family: var(--mh-font-sans);
    color: var(--mh-text-muted);
    line-height: 1.4;
}

[data-mh-ui="classic"] .mh-readonly-value {
    background: #f8f9f6;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-readonly-value {
    background: var(--mh-accent-soft);
    border-color: var(--mh-border-accent);
    color: var(--mh-text);
    font-family: var(--mh-font-serif);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.mh-input {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    border-radius: 0.5rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--mh-font-sans);
    color: var(--mh-text);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

[data-mh-ui="classic"] .mh-input {
    background: #fff;
}

.mh-input:focus {
    outline: none;
    border-color: var(--mh-accent);
    box-shadow: 0 0 0 3px var(--mh-focus-ring);
}

/* ── Buttons ── */

.mh-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.mh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--mh-font-sans);
    border: 1px solid transparent;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
    cursor: pointer;
}

.mh-btn--primary {
    background: var(--mh-accent);
    color: #fff;
}

[data-mh-ui="grimoire"] .mh-btn--primary {
    color: #121417;
}

.mh-btn--primary:hover {
    background: var(--mh-accent-dark);
}

.mh-btn--secondary {
    background: transparent;
    border-color: var(--mh-border);
    color: var(--mh-text);
}

.mh-btn--secondary:hover {
    background: var(--mh-surface-muted);
    border-color: var(--mh-border-accent);
}

.mh-btn:disabled,
.mh-btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.mh-link-danger {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-crimson);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--mh-font-sans);
}

.mh-link-danger:hover {
    opacity: 0.85;
}

/* ── Grimoire wizard header overrides ── */

[data-mh-ui="grimoire"] .mh-themed-shell .mh-heading {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-card--muted {
    background: rgba(197, 160, 89, 0.06);
}

[data-mh-ui="grimoire"] .mh-themed-shell strong {
    color: var(--mh-accent);
    font-weight: 600;
}

/* ── Back link ── */

.mh-back-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-accent);
    text-decoration: none;
    font-family: var(--mh-font-sans);
    transition: color 160ms ease, opacity 160ms ease;
}

.mh-back-link:hover {
    color: var(--mh-accent-dark);
    opacity: 0.9;
}

/* ── Autosave hint ── */

.mh-autosave-hint {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--mh-text-muted);
    font-family: var(--mh-font-sans);
}

.mh-autosave-hint .is-saved {
    color: var(--mh-accent-dark);
    font-weight: 600;
}

[data-mh-ui="grimoire"] .mh-autosave-hint .is-saved {
    color: var(--mh-accent);
}

.mh-autosave-hint .is-error {
    color: var(--mh-crimson);
    font-weight: 600;
}

/* ── Wizard interior: auto-theme legacy Tailwind in form partials ── */

.mh-themed-shell .text-hub-ink {
    color: var(--mh-text);
}

.mh-themed-shell .text-hub-accent,
.mh-themed-shell a.text-hub-accent,
.mh-themed-shell button.text-hub-accent {
    color: var(--mh-accent);
}

.mh-themed-shell .text-hub-accent-dark,
.mh-themed-shell .hover\:text-hub-accent-dark:hover {
    color: var(--mh-accent-dark);
}

[data-mh-ui="grimoire"] .mh-themed-shell .text-hub-accent-dark,
[data-mh-ui="grimoire"] .mh-themed-shell .hover\:text-hub-accent-dark:hover {
    color: var(--mh-accent);
}

.mh-themed-shell .text-stone-400,
.mh-themed-shell .text-stone-500,
.mh-themed-shell .text-stone-600 {
    color: var(--mh-text-muted);
}

.mh-themed-shell .text-stone-700 {
    color: var(--mh-text);
}

.mh-themed-shell .border-stone-100,
.mh-themed-shell .border-stone-200,
.mh-themed-shell .border-stone-300 {
    border-color: var(--mh-border);
}

.mh-themed-shell .bg-white {
    background-color: var(--mh-surface);
}

.mh-themed-shell .bg-stone-50,
.mh-themed-shell .hover\:bg-stone-50:hover,
.mh-themed-shell .hover\:bg-stone-50\/80:hover {
    background-color: var(--mh-surface-muted);
}

.mh-themed-shell thead.bg-stone-50 {
    background-color: var(--mh-surface-muted);
}

.mh-themed-shell tbody tr.hover\:bg-stone-50\/80:hover {
    background-color: var(--mh-surface-muted);
}

.mh-themed-shell input.border-stone-200,
.mh-themed-shell select.border-stone-200,
.mh-themed-shell textarea.border-stone-200,
.mh-themed-shell input[type="search"].border-stone-200 {
    border-color: var(--mh-border);
    background-color: var(--mh-surface-muted);
    color: var(--mh-text);
}

[data-mh-ui="classic"] .mh-themed-shell input.border-stone-200,
[data-mh-ui="classic"] .mh-themed-shell select.border-stone-200,
[data-mh-ui="classic"] .mh-themed-shell textarea.border-stone-200,
[data-mh-ui="classic"] .mh-themed-shell input[type="search"].border-stone-200 {
    background-color: #fff;
}

.mh-themed-shell input:focus,
.mh-themed-shell select:focus,
.mh-themed-shell textarea:focus {
    outline: none;
    border-color: var(--mh-accent);
    box-shadow: 0 0 0 3px var(--mh-focus-ring);
}

.mh-themed-shell .rounded-xl.border.border-stone-200.bg-white,
.mh-themed-shell .rounded-lg.border.border-stone-200.bg-white,
.mh-themed-shell .rounded-lg.border.border-stone-200 {
    border-color: var(--mh-border);
    background-color: var(--mh-surface);
}

.mh-themed-shell .bg-stone-50\/50 {
    background-color: var(--mh-surface-muted);
}

.mh-themed-shell .border-hub-accent\/30.bg-hub-accent-light\/40 {
    border-color: var(--mh-border-accent);
    background-color: var(--mh-accent-soft);
}

.mh-themed-shell .bg-hub-accent,
.mh-themed-shell a.bg-hub-accent,
.mh-themed-shell button.bg-hub-accent {
    background-color: var(--mh-accent) !important;
    color: #fff !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .bg-hub-accent,
[data-mh-ui="grimoire"] .mh-themed-shell a.bg-hub-accent,
[data-mh-ui="grimoire"] .mh-themed-shell button.bg-hub-accent {
    color: #121417 !important;
}

.mh-themed-shell .hover\:bg-hub-accent-dark:hover,
.mh-themed-shell a.hover\:bg-hub-accent-dark:hover,
.mh-themed-shell button.hover\:bg-hub-accent-dark:hover {
    background-color: var(--mh-accent-dark) !important;
}

.mh-themed-shell .cursor-not-allowed.bg-stone-300,
.mh-themed-shell button.cursor-not-allowed.bg-stone-300 {
    background-color: var(--mh-surface-muted) !important;
    color: var(--mh-text-muted) !important;
}

.mh-themed-shell .cursor-not-allowed.text-stone-500 {
    color: var(--mh-text-muted) !important;
}

.mh-themed-shell .bg-amber-50,
.mh-themed-shell .border-amber-200.bg-amber-50 {
    background-color: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.35);
}

.mh-themed-shell .text-amber-900,
.mh-themed-shell .text-amber-800 {
    color: #b45309;
}

[data-mh-ui="grimoire"] .mh-themed-shell .bg-amber-50,
[data-mh-ui="grimoire"] .mh-themed-shell .border-amber-200.bg-amber-50 {
    background-color: rgba(197, 160, 89, 0.12);
    border-color: rgba(197, 160, 89, 0.35);
}

[data-mh-ui="grimoire"] .mh-themed-shell .text-amber-900,
[data-mh-ui="grimoire"] .mh-themed-shell .text-amber-800 {
    color: var(--mh-accent);
}

.mh-themed-shell .border-amber-300.bg-amber-50 {
    border-color: rgba(251, 191, 36, 0.4);
}

[data-mh-ui="grimoire"] .mh-themed-shell .border-amber-300.bg-amber-50 {
    border-color: rgba(197, 160, 89, 0.35);
}

.mh-themed-shell .bg-rose-50,
.mh-themed-shell .border-rose-300.bg-rose-50 {
    background-color: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.35);
}

.mh-themed-shell .text-rose-800,
.mh-themed-shell .text-rose-900,
.mh-themed-shell .text-rose-700 {
    color: var(--mh-crimson);
}

[data-mh-ui="grimoire"] .mh-themed-shell .bg-rose-50,
[data-mh-ui="grimoire"] .mh-themed-shell .border-rose-300.bg-rose-50 {
    background-color: rgba(153, 27, 27, 0.18);
}

[data-mh-ui="grimoire"] .mh-themed-shell .text-rose-800,
[data-mh-ui="grimoire"] .mh-themed-shell .text-rose-900,
[data-mh-ui="grimoire"] .mh-themed-shell .text-rose-700 {
    color: #fca5a5;
}

.mh-themed-shell .bg-violet-100 {
    background-color: rgba(139, 92, 246, 0.14);
}

[data-mh-ui="grimoire"] .mh-themed-shell .text-violet-900 {
    color: #c4b5fd;
}

.mh-themed-shell fieldset legend {
    color: var(--mh-text);
    font-weight: 500;
    font-size: 0.875rem;
}

.mh-themed-shell label.text-sm,
.mh-themed-shell label.flex {
    color: var(--mh-text);
}

.mh-themed-shell .mh-review-panel p {
    font-size: 0.875rem;
    color: var(--mh-text);
}

.mh-themed-shell .mh-review-panel .mh-review-label {
    color: var(--mh-text-muted);
}

.mh-themed-shell .mh-review-warning {
    border-color: rgba(251, 191, 36, 0.4);
    background-color: rgba(251, 191, 36, 0.1);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-review-warning {
    border-color: rgba(197, 160, 89, 0.35);
    background-color: rgba(197, 160, 89, 0.08);
}

.mh-themed-shell .mh-review-warning strong {
    color: var(--mh-accent);
}

.mh-themed-shell table {
    color: var(--mh-text);
}

.mh-themed-shell thead.text-stone-500 {
    color: var(--mh-text-muted);
}

.mh-themed-shell code {
    font-size: 0.75rem;
    color: var(--mh-accent);
    background: var(--mh-accent-soft);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
}

[data-mh-ui="grimoire"] .mh-themed-shell tbody tr:hover {
    background-color: rgba(197, 160, 89, 0.06);
}

.mh-themed-shell .block.text-sm.font-medium.text-stone-700 {
    color: var(--mh-text);
}

.mh-themed-shell .mt-1.block.w-full.rounded-md.border.border-stone-200 {
    border-color: var(--mh-border);
    background-color: var(--mh-surface-muted);
    color: var(--mh-text);
}

[data-mh-ui="classic"] .mh-themed-shell .mt-1.block.w-full.rounded-md.border.border-stone-200 {
    background-color: #fff;
}

.mh-themed-shell .mh-step-icon-btn {
    border: 1px solid var(--mh-border);
    color: var(--mh-text);
    background: transparent;
    border-radius: 0.375rem;
    transition: background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.mh-themed-shell .mh-step-icon-btn:hover:not(:disabled) {
    background: var(--mh-surface-muted);
    border-color: var(--mh-border-accent);
}

.mh-themed-shell .mh-step-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Wizard shared — selected rows ── */

.mh-selected-row {
    border-radius: 0.5rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    transition: border-color 160ms ease, background-color 160ms ease;
}

.mh-selected-row--mandatory {
    border-width: 2px;
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(251, 191, 36, 0.1);
}

.mh-selected-row--house-grant {
    border-width: 2px;
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.08);
}

.mh-house-grant-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.12);
    color: rgb(3, 105, 161);
}

.mh-selected-row--bundled-grant {
    border-width: 2px;
    border-color: rgba(167, 139, 250, 0.45);
    background: rgba(167, 139, 250, 0.08);
}

.mh-bundled-grant-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    border: 1px solid rgba(167, 139, 250, 0.35);
    background: rgba(167, 139, 250, 0.12);
    color: rgb(91, 33, 182);
}

tr.mh-catalog-row--bundled-grant {
    background: rgba(167, 139, 250, 0.06);
}

tr.mh-catalog-row--bundled-grant:hover {
    background: rgba(167, 139, 250, 0.1);
}

.mh-vf-class-separator {
    border-top: 3px double var(--mh-border, #d6d3d1);
    margin: 0.25rem 0;
    height: 0;
    line-height: 0;
}

.mh-selected-row--flaw-section-start {
    border-top: 3px double var(--mh-border, #d6d3d1);
    margin-top: 0.25rem;
    padding-top: calc(0.375rem + 0.25rem);
}

.mh-vf-class-separator-row td {
    border-top: 3px double var(--mh-border, #d6d3d1);
    padding: 0;
    height: 0;
    line-height: 0;
}

[data-mh-ui="grimoire"] .mh-vf-class-separator,
[data-mh-ui="grimoire"] .mh-vf-class-separator-row td,
[data-mh-ui="grimoire"] .mh-selected-row--flaw-section-start {
    border-top-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-selected-row {
    background: rgba(26, 29, 35, 0.95);
    border-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-selected-row--mandatory {
    border-color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.1);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] .mh-selected-row--house-grant {
    border-color: rgba(125, 211, 252, 0.45);
    background: rgba(56, 189, 248, 0.08);
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.12);
}

[data-mh-ui="grimoire"] .mh-house-grant-badge {
    border-color: rgba(125, 211, 252, 0.35);
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
}

[data-mh-ui="grimoire"] .mh-selected-row--bundled-grant {
    border-color: rgba(196, 181, 253, 0.45);
    background: rgba(167, 139, 250, 0.08);
    box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.12);
}

[data-mh-ui="grimoire"] .mh-bundled-grant-badge {
    border-color: rgba(196, 181, 253, 0.35);
    background: rgba(167, 139, 250, 0.12);
    color: #c4b5fd;
}

[data-mh-ui="grimoire"] tr.mh-catalog-row--bundled-grant {
    background: rgba(167, 139, 250, 0.06);
}

[data-mh-ui="grimoire"] tr.mh-catalog-row--bundled-grant:hover {
    background: rgba(167, 139, 250, 0.1);
}

.mh-selected-row--highlight {
    border-width: 2px;
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(251, 191, 36, 0.1);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.12);
}

[data-mh-ui="grimoire"] .mh-selected-row--highlight {
    border-color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.1);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

.mh-highlight-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(251, 191, 36, 0.25);
    color: #92400e;
}

[data-mh-ui="grimoire"] .mh-highlight-badge {
    background: rgba(197, 160, 89, 0.22);
    color: var(--mh-accent);
}

.mh-highlight-icon {
    color: #d97706;
}

[data-mh-ui="grimoire"] .mh-highlight-icon {
    color: var(--mh-accent);
}

.mh-remove-btn {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--mh-crimson);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--mh-font-sans);
    transition: opacity 160ms ease;
}

.mh-remove-btn:hover {
    opacity: 0.85;
}

[data-mh-ui="grimoire"] .mh-remove-btn {
    color: #fca5a5;
}

.mh-param-chip {
    display: inline-block;
    border-radius: 0.375rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-param-chip {
    background: rgba(34, 38, 46, 0.95);
    border-color: var(--mh-border-accent);
    color: var(--mh-text);
}

.mh-themed-shell .divide-stone-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--mh-border);
}

.mh-themed-shell .rounded.border.border-stone-300.px-2.py-1 {
    border-color: var(--mh-border);
    color: var(--mh-text);
    background: transparent;
}

.mh-themed-shell .rounded.border.border-stone-300.px-2.py-1:hover:not(:disabled) {
    background: var(--mh-surface-muted);
    border-color: var(--mh-border-accent);
}

.mh-themed-shell .rounded.bg-hub-accent.px-2.py-0\.5.text-xs {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

/* ── Wizard shared — catalog table ── */

.mh-catalog-panel {
    border-color: var(--mh-border);
    background: var(--mh-surface);
}

.mh-catalog-table {
    color: var(--mh-text);
}

.mh-catalog-table thead {
    background: var(--mh-surface-muted) !important;
    border-bottom: 1px solid var(--mh-border);
}

.mh-themed-shell .mh-catalog-table thead th {
    background: transparent !important;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
}

.mh-catalog-th {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
    background: transparent !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-table thead .mh-catalog-th {
    color: rgba(197, 160, 89, 0.55);
}

tr.mh-catalog-row--mandatory {
    background: rgba(251, 191, 36, 0.1);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.18);
}

[data-mh-ui="grimoire"] tr.mh-catalog-row--mandatory {
    background: rgba(197, 160, 89, 0.1);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] tr.mh-catalog-row--mandatory:hover {
    background: rgba(197, 160, 89, 0.14);
}

tr.mh-catalog-row--highlight {
    background: rgba(251, 191, 36, 0.1);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.18);
}

[data-mh-ui="grimoire"] tr.mh-catalog-row--highlight {
    background: rgba(197, 160, 89, 0.1);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] tr.mh-catalog-row--highlight:hover {
    background: rgba(197, 160, 89, 0.14);
}

.mh-mandatory-notice {
    border-radius: 0.5rem;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
    color: #92400e;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-mandatory-notice {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.08);
    color: var(--mh-text);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.08);
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-amber-200.bg-amber-50 {
    border-color: rgba(197, 160, 89, 0.4) !important;
    background: rgba(197, 160, 89, 0.12) !important;
    color: var(--mh-accent) !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-rose-200.bg-rose-50 {
    border-color: rgba(252, 165, 165, 0.35) !important;
    background: rgba(153, 27, 27, 0.15) !important;
    color: #fca5a5 !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-violet-200.bg-violet-50 {
    border-color: rgba(196, 181, 253, 0.35) !important;
    background: rgba(139, 92, 246, 0.14) !important;
    color: #c4b5fd !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-sky-200.bg-sky-50 {
    border-color: rgba(125, 211, 252, 0.35) !important;
    background: rgba(14, 165, 233, 0.12) !important;
    color: #7dd3fc !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-emerald-200.bg-emerald-50 {
    border-color: rgba(110, 231, 183, 0.35) !important;
    background: rgba(16, 185, 129, 0.12) !important;
    color: #6ee7b7 !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-indigo-200.bg-indigo-50 {
    border-color: rgba(165, 180, 252, 0.35) !important;
    background: rgba(99, 102, 241, 0.14) !important;
    color: #a5b4fc !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .blocker-pill.border-stone-200.bg-stone-50 {
    border-color: var(--mh-border) !important;
    background: var(--mh-surface-muted) !important;
    color: var(--mh-text-muted) !important;
}

.mh-catalog-sort-btn {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--mh-font-sans);
    transition: color 160ms ease;
}

.mh-catalog-sort-btn:hover {
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-catalog-panel {
    background: rgba(18, 20, 23, 0.92);
    border-color: var(--mh-border-accent);
}

.mh-catalog-picker-list > :not([hidden]) ~ :not([hidden]) {
    border-top: 1px solid var(--mh-border);
}

.mh-catalog-picker-row {
    transition: background-color 150ms ease;
}

.mh-catalog-picker-row:hover {
    background: var(--mh-surface-muted);
}

.mh-catalog-picker-row:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}

.mh-catalog-picker-checkbox {
    accent-color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-catalog-picker-row:hover {
    background: rgba(197, 160, 89, 0.06);
}

[data-mh-ui="grimoire"] .mh-catalog-picker-list > :not([hidden]) ~ :not([hidden]) {
    border-top-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-table thead {
    background: linear-gradient(
        180deg,
        rgba(40, 44, 52, 1) 0%,
        rgba(26, 29, 35, 1) 100%
    ) !important;
    border-bottom: 1px solid rgba(197, 160, 89, 0.4) !important;
    box-shadow: inset 0 1px 0 rgba(197, 160, 89, 0.06);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-sort-btn {
    color: rgba(197, 160, 89, 0.55);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-sort-btn:hover {
    color: var(--mh-accent);
}

.mh-catalog-row {
    transition: background-color 150ms ease;
}

.mh-catalog-row:hover {
    background: var(--mh-surface-muted);
}

[data-mh-ui="grimoire"] .mh-catalog-row:hover {
    background: rgba(197, 160, 89, 0.06);
}

.mh-catalog-table .divide-stone-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--mh-border);
}

/* ── Wizard shared — catalog hint bubbles ── */

.mh-themed-shell .vf-catalog-hint-btn {
    background: var(--mh-accent-soft);
    color: var(--mh-accent-dark);
}

.mh-themed-shell .vf-catalog-hint-btn:hover,
.mh-themed-shell .vf-catalog-hint-wrap:focus-within .vf-catalog-hint-btn,
.mh-themed-shell .vf-catalog-hint-wrap.is-open .vf-catalog-hint-btn {
    background: var(--mh-accent);
    color: #fff;
    transform: scale(1.05);
}

[data-mh-ui="grimoire"] .mh-themed-shell .vf-catalog-hint-btn:hover,
[data-mh-ui="grimoire"] .mh-themed-shell .vf-catalog-hint-wrap:focus-within .vf-catalog-hint-btn,
[data-mh-ui="grimoire"] .mh-themed-shell .vf-catalog-hint-wrap.is-open .vf-catalog-hint-btn {
    color: #121417;
}

.mh-themed-shell .vf-catalog-hint-card {
    background-color: var(--mh-surface);
    border-color: var(--mh-border-accent);
    box-shadow: var(--mh-shadow-soft);
    scrollbar-color: rgba(197, 160, 89, 0.35) transparent;
}

[data-mh-ui="grimoire"] .mh-themed-shell .vf-catalog-hint-card {
    background-color: #1a1d23;
    border-color: var(--mh-border-accent);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.mh-themed-shell .vf-catalog-hint-title {
    color: var(--mh-text);
    font-family: var(--mh-font-serif);
}

.mh-themed-shell .vf-catalog-hint-meta {
    color: var(--mh-text-muted);
}

.mh-themed-shell .vf-catalog-hint-desc {
    color: var(--mh-text-muted);
}

.mh-themed-shell .vf-catalog-hint-modifiers {
    border-top-color: var(--mh-border);
}

.mh-themed-shell .vf-catalog-hint-modifiers-label {
    color: var(--mh-accent-dark);
}

[data-mh-ui="grimoire"] .mh-themed-shell .vf-catalog-hint-modifiers-label {
    color: var(--mh-accent);
}

.mh-themed-shell .vf-catalog-hint-modifiers li {
    color: var(--mh-text-muted);
}

.mh-themed-shell .vf-search-hit {
    background: rgba(197, 160, 89, 0.35);
    color: inherit;
}

[data-mh-ui="grimoire"] .mh-themed-shell .vf-search-hit {
    background: rgba(197, 160, 89, 0.28);
    color: var(--mh-text);
}

/* ── Wizard shared — catalog sort th (clickable header) ── */

.mh-catalog-sort-th {
    padding: 0.375rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
    cursor: pointer;
    user-select: none;
    transition: color 160ms ease;
}

.mh-catalog-sort-th:hover {
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-sort-th {
    color: rgba(197, 160, 89, 0.55);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-sort-th:hover {
    color: var(--mh-accent);
}

/* ── Arts grid cells ── */

.mh-art-cell {
    border-radius: 0.5rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    padding: 0.5rem;
    transition: border-color 160ms ease, background-color 160ms ease;
}

[data-mh-ui="grimoire"] .mh-art-cell {
    background: rgba(26, 29, 35, 0.95);
    border-color: var(--mh-border);
}

.mh-art-cell--highlight {
    border-width: 2px;
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(251, 191, 36, 0.1);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.12);
}

[data-mh-ui="grimoire"] .mh-art-cell--highlight {
    border-color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.1);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

.mh-art-badge {
    display: inline-block;
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
    font-size: 0.625rem;
    background: rgba(139, 92, 246, 0.14);
    color: #5b21b6;
}

[data-mh-ui="grimoire"] .mh-art-badge {
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
}

/* ── Characteristics stat cards ── */

.mh-stat-card {
    border-radius: 0.5rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    padding: 0.75rem;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.mh-stat-card--error {
    border-color: rgba(244, 63, 94, 0.45);
    background: rgba(244, 63, 94, 0.08);
}

.mh-stat-card--highlight {
    border-width: 2px;
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(251, 191, 36, 0.1);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.12);
}

[data-mh-ui="grimoire"] .mh-stat-card {
    background: rgba(26, 29, 35, 0.95);
    border-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-stat-card--error {
    border-color: rgba(252, 165, 165, 0.45);
    background: rgba(153, 27, 27, 0.15);
}

[data-mh-ui="grimoire"] .mh-stat-card--highlight {
    border-color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.1);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

.mh-stat-cost-chip {
    display: inline-block;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-stat-cost-chip {
    background: rgba(34, 38, 46, 0.95);
    border-color: var(--mh-border-accent);
    color: var(--mh-text-muted);
}

/* ── Season XP banner (abilities / arts sheet tabs) ── */

.mh-season-xp-banner {
    margin-bottom: 1rem;
    border-radius: 0.625rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.45;
    border: 1px solid rgba(139, 92, 246, 0.22);
    background: rgba(139, 92, 246, 0.08);
    color: #4c1d95;
}

.mh-season-xp-banner__label {
    font-weight: 600;
}

.mh-season-xp-banner__value {
    margin-left: 0.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #5b21b6;
}

[data-mh-ui="grimoire"] .mh-season-xp-banner {
    border-color: rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.12);
    color: #ddd6fe;
}

[data-mh-ui="grimoire"] .mh-season-xp-banner__label {
    color: #c4b5fd;
}

[data-mh-ui="grimoire"] .mh-season-xp-banner__value {
    color: #e9d5ff;
}

.mh-last-season-practice {
    border-radius: 0.5rem;
    border: 1px solid rgba(197, 160, 89, 0.28);
    background: rgba(197, 160, 89, 0.08);
    padding: 0.625rem 0.75rem;
}

.mh-last-season-practice__title {
    margin: 0 0 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #78716c;
}

.mh-last-season-practice__group {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #57534e;
}

.mh-last-season-practice__label {
    font-weight: 600;
    margin-right: 0.35rem;
}

.mh-last-season-practice__chip {
    display: inline-flex;
    align-items: center;
    margin: 0.125rem 0.25rem 0.125rem 0;
    padding: 0.125rem 0.45rem;
    border-radius: 9999px;
    border: 1px solid rgba(197, 160, 89, 0.35);
    background: rgba(255, 255, 255, 0.65);
    font-size: 0.6875rem;
    font-weight: 600;
    color: #44403c;
}

.mh-last-season-practice__chip--attempt {
    border-color: rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.08);
    color: #5b21b6;
}

.mh-last-season-practice-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    border: 1px solid rgba(197, 160, 89, 0.45);
    background: rgba(197, 160, 89, 0.12);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #92400e;
}

[data-mh-ui="grimoire"] .mh-last-season-practice {
    border-color: rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.1);
}

[data-mh-ui="grimoire"] .mh-last-season-practice__title {
    color: #d6d3d1;
}

[data-mh-ui="grimoire"] .mh-last-season-practice__group {
    color: #a8a29e;
}

[data-mh-ui="grimoire"] .mh-last-season-practice__chip {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(26, 29, 35, 0.55);
    color: #f5f2eb;
}

[data-mh-ui="grimoire"] .mh-last-season-practice__chip--attempt {
    border-color: rgba(167, 139, 250, 0.45);
    background: rgba(91, 33, 182, 0.18);
    color: #ddd6fe;
}

[data-mh-ui="grimoire"] .mh-last-season-practice-badge {
    border-color: rgba(197, 160, 89, 0.5);
    background: rgba(197, 160, 89, 0.14);
    color: #fde68a;
}

.mh-sg-maintenance-banner {
    border-radius: 0.5rem;
    border: 1px solid rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.1);
    padding: 0.75rem;
}

.mh-sg-maintenance-banner__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #92400e;
}

.mh-sg-maintenance-banner__body {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #57534e;
}

.mh-sg-maintenance-picker {
    border-radius: 0.5rem;
    border: 1px solid rgba(214, 211, 209, 0.65);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.75rem;
}

.mh-sg-maintenance-picker__list {
    max-height: 12rem;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.mh-sg-maintenance-picker__item {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem;
    text-align: left;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

.mh-sg-maintenance-picker__item:hover {
    background: rgba(240, 244, 236, 0.85);
}

.mh-sg-maintenance-art-card {
    border-radius: 0.5rem;
    border: 1px solid rgba(214, 211, 209, 0.65);
    padding: 0.75rem;
}

[data-mh-ui="grimoire"] .mh-sg-maintenance-banner {
    border-color: rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] .mh-sg-maintenance-banner__title {
    color: #fde68a;
}

[data-mh-ui="grimoire"] .mh-sg-maintenance-banner__body {
    color: #d6d3d1;
}

[data-mh-ui="grimoire"] .mh-sg-maintenance-picker {
    border-color: var(--mh-border);
    background: rgba(34, 38, 46, 0.95);
}

[data-mh-ui="grimoire"] .mh-sg-maintenance-picker__item:hover {
    background: rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] .mh-sg-maintenance-art-card {
    border-color: var(--mh-border);
    background: rgba(34, 38, 46, 0.55);
}

.mh-xp-spend-preview {
    color: #57534e;
}

.mh-xp-affinity-help summary::-webkit-details-marker {
    display: none;
}

.mh-xp-affinity-help summary::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s ease;
}

.mh-xp-affinity-help[open] summary::before {
    transform: rotate(90deg);
}

[data-mh-ui="grimoire"] .mh-xp-spend-preview {
    color: #c4b5fd;
}

[data-mh-ui="grimoire"] .mh-xp-affinity-help {
    border-color: rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.1);
    color: #ddd6fe;
}

[data-mh-ui="grimoire"] .mh-xp-affinity-help summary,
[data-mh-ui="grimoire"] .mh-xp-affinity-help strong {
    color: #e9d5ff;
}

.mh-input--compact {
    padding: 0.25rem 0.5rem;
    min-height: 0;
}

/* Catalog filter row: search + dropdowns share one horizontal toolbar */
.mh-catalog-toolbar .mh-input {
    width: auto;
    margin-top: 0;
}

.mh-catalog-toolbar .mh-input.flex-1 {
    flex: 1 1 auto;
    min-width: 10rem;
}

/* Affirmative flags in reference admin catalog tables (Specialty / Repeatable / Childhood) */
.mh-catalog-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.mh-catalog-flag--required {
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.14);
    color: #92400e;
}

.mh-catalog-flag--repeatable {
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.mh-catalog-flag--childhood {
    border: 1px solid rgba(14, 165, 233, 0.35);
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-flag--required {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-flag--repeatable {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-catalog-flag--childhood {
    border-color: rgba(125, 211, 252, 0.35);
    background: rgba(14, 165, 233, 0.12);
    color: #7dd3fc;
}

.mh-restriction-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: nowrap;
}

.mh-restriction-badge--none {
    background: var(--mh-surface-muted);
    color: var(--mh-text-muted);
    box-shadow: inset 0 0 0 1px var(--mh-border);
}

.mh-restriction-badge--blockers {
    border: 1px solid rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.12);
    color: #be123c;
}

.mh-restriction-badge--player {
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.14);
    color: #92400e;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-badge--none {
    background: var(--mh-surface-muted);
    color: var(--mh-text-muted);
    box-shadow: inset 0 0 0 1px var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-badge--blockers {
    border-color: rgba(252, 165, 165, 0.35);
    background: rgba(153, 27, 27, 0.15);
    color: #fca5a5;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-badge--player {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

.mh-restriction-panel {
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    color: var(--mh-text);
}

.mh-restriction-panel--none {
    border-color: var(--mh-border);
    background: var(--mh-surface-muted);
}

.mh-restriction-panel--blockers {
    border-color: rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.08);
}

.mh-restriction-panel--player {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.08);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-panel--none {
    background: var(--mh-surface-muted);
    border-color: var(--mh-border);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-panel--blockers {
    border-color: rgba(252, 165, 165, 0.35);
    background: rgba(153, 27, 27, 0.12);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-panel--player {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.08);
    color: var(--mh-text);
}

.mh-restriction-panel__notice {
    border-radius: 0.5rem;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.12);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-panel__notice {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.1);
    color: #fde68a;
}

.mh-restriction-panel__section {
    border-top: 1px solid var(--mh-border);
    padding-top: 0.75rem;
}

.mh-restriction-panel__section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #be123c;
}

.mh-restriction-panel__section-count {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0.85;
}

.mh-restriction-panel__hint {
    font-size: 0.75rem;
    opacity: 0.85;
    color: #be123c;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-panel__section-label,
[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-panel__hint {
    color: #fca5a5;
}

.mh-restriction-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 9999px;
    border: 1px solid rgba(244, 63, 94, 0.35);
    background: var(--mh-surface);
    padding: 0.125rem 0.25rem 0.125rem 0.625rem;
    font-size: 0.8125rem;
    color: #be123c;
}

.mh-restriction-chip__meta {
    font-size: 0.6875rem;
    opacity: 0.8;
}

.mh-restriction-chip__remove {
    margin-left: 0.125rem;
    border-radius: 9999px;
    padding: 0.125rem 0.375rem;
    font-size: 0.875rem;
    line-height: 1;
    color: inherit;
    opacity: 0.7;
    transition: opacity 120ms ease, background 120ms ease;
}

.mh-restriction-chip__remove:hover {
    opacity: 1;
    background: rgba(244, 63, 94, 0.12);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-chip {
    border-color: rgba(252, 165, 165, 0.35);
    background: rgba(26, 29, 35, 0.65);
    color: #fca5a5;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-restriction-chip__remove:hover {
    background: rgba(153, 27, 27, 0.25);
}

.mh-vf-admin-panel {
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    color: var(--mh-text);
}

.mh-vf-admin-panel__section {
    border-top: 1px solid var(--mh-border);
    padding-top: 0.75rem;
}

.mh-vf-admin-panel__section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
}

.mh-option-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 9999px;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    padding: 0.125rem 0.25rem 0.125rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--mh-text);
}

.mh-option-chip__remove {
    margin-left: 0.125rem;
    border-radius: 9999px;
    padding: 0.125rem 0.375rem;
    font-size: 0.875rem;
    line-height: 1;
    color: var(--mh-text-muted);
    transition: opacity 120ms ease, background 120ms ease;
}

.mh-option-chip__remove:hover {
    opacity: 1;
    background: var(--mh-surface-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-option-chip {
    background: rgba(26, 29, 35, 0.65);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-option-chip__remove:hover {
    background: rgba(197, 160, 89, 0.15);
    color: var(--mh-text);
}

.mh-modifier-panel {
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
}

.mh-confidence-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    border-radius: 9999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    color: var(--mh-text-muted);
}

.mh-confidence-badge--high {
    border-color: rgba(107, 143, 113, 0.45);
    background: rgba(107, 143, 113, 0.12);
    color: var(--mh-text);
}

.mh-confidence-badge--medium {
    border-color: rgba(166, 124, 82, 0.45);
    background: rgba(166, 124, 82, 0.12);
    color: var(--mh-text);
}

.mh-confidence-badge--low {
    border-color: rgba(153, 27, 27, 0.35);
    background: rgba(153, 27, 27, 0.08);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-confidence-badge--high {
    border-color: rgba(197, 160, 89, 0.45);
    background: rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-confidence-badge--medium {
    border-color: rgba(197, 160, 89, 0.28);
    background: rgba(197, 160, 89, 0.08);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-confidence-badge--low {
    border-color: rgba(153, 27, 27, 0.45);
    background: rgba(153, 27, 27, 0.14);
}

.mh-modifier-hint {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--mh-border);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-modifier-hint {
    border-top-color: var(--mh-border);
    color: var(--mh-text-muted);
}

.mh-modifier-empty {
    border-radius: 0.625rem;
    border: 1px dashed var(--mh-border);
    padding: 1.5rem 1rem;
    font-size: 0.875rem;
    color: var(--mh-text-muted);
    text-align: center;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-modifier-panel {
    background: rgba(34, 38, 46, 0.85);
}

/* ── Ability / Art advancement (Score · Progress · Required) ── */

.mh-advancement-stats {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.5rem;
    row-gap: 0.15rem;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    line-height: 1.35;
}

.mh-advancement-stats__row {
    display: contents;
}

.mh-advancement-stats dt {
    margin: 0;
    color: var(--mh-text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.mh-advancement-stats dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    color: var(--mh-text);
    text-align: right;
}

.mh-advancement-stats__row--score dd {
    font-size: 0.8125rem;
    font-weight: 700;
}

.mh-advancement-stats__effective {
    margin: 0.35rem 0 0;
    font-size: 0.625rem;
    line-height: 1.35;
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-advancement-stats dt {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-advancement-stats dd {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-advancement-stats__row--score dd {
    color: var(--mh-accent);
}

/* ── Characteristics — virtue bonus callout ── */

.mh-virtue-bonus-callout {
    border-radius: 0.375rem;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(255, 255, 255, 0.72);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #92400e;
}

.mh-virtue-bonus-callout strong {
    color: inherit;
    font-weight: 600;
}

.mh-virtue-bonus-heading {
    color: inherit;
}

.mh-virtue-bonus-icon {
    color: #e11d48;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-virtue-bonus-callout {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(26, 29, 35, 0.95);
    color: var(--mh-text);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.08);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-virtue-bonus-callout strong {
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-virtue-bonus-heading {
    color: var(--mh-accent);
    font-family: var(--mh-font-serif);
    letter-spacing: 0.02em;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-virtue-bonus-icon {
    color: var(--mh-accent);
}

/* ── Phase 4 — character sheet section tabs & cards ── */

[data-mh-ui="grimoire"] .mh-themed-shell .app-section-tabs.app-card,
[data-mh-ui="grimoire"] .mh-themed-shell .app-card {
    background: var(--mh-surface);
    border-color: var(--mh-border);
    box-shadow: var(--mh-shadow-soft);
}

[data-mh-ui="grimoire"] .mh-themed-shell .app-section-tablist {
    background: linear-gradient(
        180deg,
        rgba(34, 38, 46, 0.98) 0%,
        rgba(18, 20, 23, 0.98) 100%
    );
    border-bottom-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-themed-shell .app-section-tab {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell .app-section-tab:hover {
    color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.06);
}

[data-mh-ui="grimoire"] .mh-themed-shell .app-section-tab-icon {
    background: var(--mh-accent-soft);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .app-section-panel {
    background: var(--mh-surface);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-section-panel-heading h2 {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell .btn-primary,
[data-mh-ui="grimoire"] .mh-themed-shell .btn-primary.mh-btn--primary {
    background-color: var(--mh-accent) !important;
    color: #121417 !important;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

[data-mh-ui="grimoire"] .mh-themed-shell .btn-primary:hover,
[data-mh-ui="grimoire"] .mh-themed-shell .btn-primary.mh-btn--primary:hover {
    background-color: var(--mh-accent-dark) !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell a.rounded-lg.text-hub-accent {
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell a.rounded-lg.text-hub-accent:hover {
    background: var(--mh-accent-soft);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .bg-hub-accent-light {
    background-color: var(--mh-accent-soft) !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .text-hub-accent-dark {
    color: var(--mh-accent) !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .bg-stone-100 {
    background-color: var(--mh-surface-muted) !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell details summary {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell details summary.cursor-pointer.text-amber-800 {
    color: var(--mh-accent);
}

/* ── Phase 5: Global chrome (active only on migrated pages) ── */

[data-mh-ui="grimoire"] .app-shell {
    background: var(--mh-bg);
    background-image:
        radial-gradient(ellipse 80% 45% at 50% -12%, rgba(197, 160, 89, 0.08), transparent),
        radial-gradient(ellipse 55% 35% at 100% 100%, rgba(153, 27, 27, 0.06), transparent);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-page-content {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-main-nav {
    background: rgba(26, 29, 35, 0.92);
    border-bottom: 1px solid rgba(197, 160, 89, 0.22);
    border-bottom-color: rgba(197, 160, 89, 0.22);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
}

[data-mh-ui="grimoire"] .brand-text {
    color: var(--mh-accent);
    font-family: var(--mh-font-serif);
}

[data-mh-ui="grimoire"] .brand-text:hover {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-nav-desktop-divider {
    background: rgba(197, 160, 89, 0.28);
}

[data-mh-ui="grimoire"] .mh-nav-desktop-group {
    background: rgba(34, 38, 46, 0.95);
    border: 1px solid var(--mh-border);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.08);
}

[data-mh-ui="grimoire"] .nav-link {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .nav-link:hover:not(.nav-link-active) {
    color: var(--mh-text);
    background: rgba(197, 160, 89, 0.1);
}

[data-mh-ui="grimoire"] .nav-link-active,
[data-mh-ui="grimoire"] .nav-link-active:hover {
    color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.14);
    border-color: rgba(197, 160, 89, 0.35);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] .mh-nav-icon-slot {
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .nav-link-active .mh-nav-icon-slot,
[data-mh-ui="grimoire"] .nav-link:hover:not(.nav-link-active) .mh-nav-icon-slot {
    background: rgba(197, 160, 89, 0.18);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .nav-dropdown {
    background: var(--mh-surface);
    border-color: var(--mh-border);
    box-shadow: var(--mh-shadow-soft);
}

[data-mh-ui="grimoire"] .nav-dropdown-item {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .nav-dropdown-item:hover {
    background: rgba(197, 160, 89, 0.1);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .nav-dropdown-item-active {
    background: rgba(197, 160, 89, 0.14);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-nav-notifications-btn {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-nav-notifications-btn:hover,
[data-mh-ui="grimoire"] .mh-nav-notifications-btn.is-active {
    color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.1);
}

[data-mh-ui="grimoire"] .mh-nav-live-play-btn {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
}

[data-mh-ui="grimoire"] .mh-nav-live-play-btn:hover,
[data-mh-ui="grimoire"] .mh-nav-live-play-btn.is-active {
    border-color: rgba(52, 211, 153, 0.55);
    background: rgba(16, 185, 129, 0.22);
    color: #a7f3d0;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

[data-mh-ui="grimoire"] .mh-nav-live-play-dot {
    background: #34d399;
}

[data-mh-ui="grimoire"] .mh-nav-menu-btn {
    color: var(--mh-text-muted);
    background: rgba(34, 38, 46, 0.95);
    border: 1px solid var(--mh-border);
    box-shadow: none;
}

[data-mh-ui="grimoire"] .mh-nav-menu-btn:hover {
    color: var(--mh-text);
    background: rgba(197, 160, 89, 0.1);
}

[data-mh-ui="grimoire"] .mh-nav-mobile-drawer {
    background: linear-gradient(180deg, #1a1d23 0%, #121417 100%);
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.45);
}

[data-mh-ui="grimoire"] .mh-nav-mobile-drawer-head {
    background: rgba(26, 29, 35, 0.95);
    border-bottom: 1px solid var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-nav-mobile-drawer-title,
[data-mh-ui="grimoire"] .mh-nav-mobile-drawer-sub {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-nav-mobile-drawer-sub {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-nav-mobile-section-label {
    color: var(--mh-accent);
    opacity: 0.85;
}

[data-mh-ui="grimoire"] .nav-link-mobile {
    background: rgba(34, 38, 46, 0.95);
    border-color: var(--mh-border);
    color: var(--mh-text-muted);
    box-shadow: none;
}

[data-mh-ui="grimoire"] .nav-link-mobile:hover {
    border-color: rgba(197, 160, 89, 0.35);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .nav-link-mobile.nav-link-active {
    border-color: rgba(197, 160, 89, 0.45);
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-user-menu-btn {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-user-menu-btn:hover {
    background: rgba(197, 160, 89, 0.1);
}

[data-mh-ui="grimoire"] .mh-user-menu-btn__name {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-user-menu-btn__chevron {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-user-menu-panel {
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    box-shadow: var(--mh-shadow-soft);
}

[data-mh-ui="grimoire"] .mh-user-menu-panel__header {
    border-bottom-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-user-menu-panel__name {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-user-menu-panel__username,
[data-mh-ui="grimoire"] .mh-user-menu-panel__email-label {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-user-menu-panel__email {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-user-menu-link {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-user-menu-link:hover {
    background: rgba(197, 160, 89, 0.1);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-user-menu-link--danger {
    color: #fca5a5;
}

[data-mh-ui="grimoire"] .mh-user-menu-link--danger:hover {
    background: rgba(153, 27, 27, 0.2);
    color: #fecaca;
}

[data-mh-ui="grimoire"] .btn-secondary {
    border-color: var(--mh-border);
    background: rgba(34, 38, 46, 0.95);
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .btn-secondary:hover {
    border-color: rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.1);
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .avatar-badge {
    background: rgba(197, 160, 89, 0.18);
    color: var(--mh-accent);
    box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.25);
}

[data-mh-ui="grimoire"] .mh-page-back {
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-page-back:hover {
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-brand-logo__icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

[data-mh-ui="grimoire"] .mh-impersonation-banner {
    border-bottom-color: #d97706;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

[data-mh-ui="grimoire"] .mh-impersonation-banner__btn {
    background: rgba(255, 255, 255, 0.95);
}

[data-mh-ui="grimoire"] .mh-app-footer {
    background: rgba(26, 29, 35, 0.95);
    border-top: 1px solid rgba(197, 160, 89, 0.22);
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .loading-overlay {
    background: rgba(18, 20, 23, 0.82);
}

[data-mh-ui="grimoire"] .loading-panel {
    background: var(--mh-surface);
    border-color: var(--mh-border);
    box-shadow: var(--mh-shadow-soft);
}

[data-mh-ui="grimoire"] .loading-text {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .loading-spinner {
    border-color: rgba(197, 160, 89, 0.2);
    border-top-color: var(--mh-accent);
}

/* ── Global dialog (MhDialog) ── */

.mh-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(18, 20, 23, 0.72);
    backdrop-filter: blur(4px);
}

.mh-dialog-wrap {
    position: fixed;
    inset: 0;
    z-index: 201;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
}

.mh-dialog {
    pointer-events: auto;
    width: 100%;
    max-width: 28rem;
    border-radius: 0.75rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    box-shadow: var(--mh-shadow-soft);
    padding: 1.25rem 1.5rem 1.5rem;
}

.mh-dialog__title {
    font-family: var(--mh-font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0 0 0.75rem;
}

.mh-dialog__message {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--mh-text-muted);
    margin: 0 0 1.25rem;
    white-space: pre-wrap;
}

.mh-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

[data-mh-ui="grimoire"] .mh-dialog {
    border-color: rgba(197, 160, 89, 0.28);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

[data-mh-ui="grimoire"] .mh-dialog__message {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .version-text {
    color: var(--mh-text-muted);
}

/* ── Phase 6: Saga pages & home dashboard ── */

.mh-card--link {
    display: block;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.mh-card--link:hover {
    border-color: var(--mh-border-accent);
    box-shadow: var(--mh-shadow-soft);
}

.mh-card--dashed {
    border-style: dashed;
    background: var(--mh-surface-muted);
    text-align: center;
}

.mh-callout {
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    border: 1px solid var(--mh-border);
}

.mh-callout--warning {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(251, 191, 36, 0.12);
    color: #92400e;
}

.mh-callout--admin {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(251, 191, 36, 0.08);
    color: #78350f;
}

[data-mh-ui="grimoire"] .mh-callout--warning,
[data-mh-ui="grimoire"] .mh-callout--admin {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.1);
    color: #fde68a;
}

.mh-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.mh-badge--sg {
    background: rgba(139, 92, 246, 0.14);
    color: #5b21b6;
}

.mh-badge--player {
    background: var(--mh-accent-soft);
    color: var(--mh-accent-dark);
}

.mh-badge--spectator,
.mh-badge--neutral {
    background: var(--mh-surface-muted);
    color: var(--mh-text-muted);
    box-shadow: inset 0 0 0 1px var(--mh-border);
}

.mh-badge--pending {
    background: rgba(251, 191, 36, 0.2);
    color: #92400e;
}

[data-mh-ui="grimoire"] .mh-badge--sg {
    background: rgba(139, 92, 246, 0.22);
    color: #c4b5fd;
}

[data-mh-ui="grimoire"] .mh-badge--player {
    background: rgba(197, 160, 89, 0.18);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-badge--pending {
    background: rgba(197, 160, 89, 0.2);
    color: #fde68a;
}

.mh-text-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-accent);
    text-decoration: none;
    transition: color 160ms ease, opacity 160ms ease;
}

.mh-text-link:hover {
    color: var(--mh-accent-dark);
    opacity: 0.9;
}

.mh-table-panel {
    overflow: hidden;
    border-radius: 0.625rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    box-shadow: var(--mh-shadow-soft);
}

.mh-table-panel table {
    width: 100%;
    font-size: 0.875rem;
}

.mh-table-panel thead {
    background: var(--mh-surface-muted) !important;
    border-bottom: 1px solid var(--mh-border);
}

.mh-table-panel thead th,
.mh-table-th {
    padding: 0.625rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
    background: transparent !important;
    text-align: left;
}

.mh-table-panel td {
    padding: 0.75rem 1rem;
    color: var(--mh-text);
}

.mh-table-panel tbody tr + tr {
    border-top: 1px solid var(--mh-border);
}

.mh-table-panel tbody tr:hover {
    background: var(--mh-accent-soft);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-table-panel thead {
    background: linear-gradient(
        180deg,
        rgba(40, 44, 52, 1) 0%,
        rgba(26, 29, 35, 1) 100%
    ) !important;
    border-bottom: 1px solid rgba(197, 160, 89, 0.4) !important;
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-table-panel thead .mh-table-th,
[data-mh-ui="grimoire"] .mh-themed-shell .mh-table-panel thead th.mh-table-th {
    color: rgba(197, 160, 89, 0.55);
}

.mh-saga-log-wall {
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    padding: 1.25rem;
}

[data-mh-ui="grimoire"] .mh-themed-shell .saga-log-entry {
    border-bottom-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-themed-shell .saga-log-entry-headline {
    color: var(--mh-text);
}

[data-mh-ui="grimoire"] .mh-themed-shell .saga-log-entry-body,
[data-mh-ui="grimoire"] .mh-themed-shell .saga-log-entry-text,
[data-mh-ui="grimoire"] .mh-themed-shell .saga-log-entry-meta {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell .saga-log-entry-icon {
    background: rgba(197, 160, 89, 0.12);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel {
    background: var(--mh-surface);
    border-color: var(--mh-border);
    box-shadow: var(--mh-shadow-soft);
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel:hover {
    border-color: var(--mh-border-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel-title {
    color: var(--mh-text);
    font-family: var(--mh-font-serif);
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel-sub {
    color: var(--mh-text-muted);
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel-icon--primary {
    background: rgba(197, 160, 89, 0.14);
    color: var(--mh-accent);
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel-icon--secondary {
    background: rgba(139, 92, 246, 0.14);
    color: #c4b5fd;
}

[data-mh-ui="grimoire"] .mh-themed-shell .dash-v2-panel-icon--tertiary {
    background: rgba(107, 143, 113, 0.14);
    color: #86efac;
}

.mh-link-danger--sm {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ── Phase 8: settings, users, notifications ── */

.mh-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--mh-border);
    padding-bottom: 1rem;
}

.mh-subnav__link {
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--mh-text-muted);
    transition: background-color 160ms ease, color 160ms ease;
}

.mh-subnav__link:hover {
    background: var(--mh-surface-muted);
    color: var(--mh-text);
}

.mh-subnav__link--active {
    background: var(--mh-accent-soft);
    color: var(--mh-accent-dark);
    font-weight: 600;
}

[data-mh-ui="grimoire"] .mh-subnav__link--active {
    background: rgba(197, 160, 89, 0.16);
    color: var(--mh-accent);
}

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

.mh-filter-chip {
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface-muted);
    color: var(--mh-text-muted);
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.mh-filter-chip:hover {
    border-color: var(--mh-border-accent);
    color: var(--mh-text);
}

.mh-filter-chip--active {
    background: var(--mh-accent);
    border-color: var(--mh-accent);
    color: #fff;
}

.mh-filter-chip--action.mh-filter-chip--active {
    background: #b45309;
    border-color: #b45309;
    color: #fff;
}

[data-mh-ui="grimoire"] .mh-filter-chip--active {
    color: #121417;
}

.mh-notification-card {
    border-radius: 0.75rem;
    border: 1px solid var(--mh-border);
    background: var(--mh-surface);
    padding: 1.25rem;
}

.mh-notification-card--action {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(251, 191, 36, 0.06);
}

.mh-notification-card--unread {
    border-color: rgba(197, 160, 89, 0.35);
}

[data-mh-ui="grimoire"] .mh-notification-card--action {
    border-color: rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.08);
}

.mh-notification-card__icon {
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--mh-surface-muted);
    color: var(--mh-text-muted);
}

.mh-notification-card--action .mh-notification-card__icon {
    background: rgba(251, 191, 36, 0.2);
    color: #92400e;
}

[data-mh-ui="grimoire"] .mh-notification-card--action .mh-notification-card__icon {
    background: rgba(197, 160, 89, 0.2);
    color: var(--mh-accent);
}

.mh-danger-zone {
    border-radius: 0.75rem;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: rgba(254, 226, 226, 0.35);
    padding: 1.5rem;
}

.mh-danger-zone__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #991b1b;
}

.mh-danger-zone__text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #b91c1c;
}

[data-mh-ui="grimoire"] .mh-danger-zone {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.18);
}

[data-mh-ui="grimoire"] .mh-danger-zone__title {
    color: #fca5a5;
}

[data-mh-ui="grimoire"] .mh-danger-zone__text {
    color: #fecaca;
}

.mh-danger-zone .mh-input {
    border-color: rgba(220, 38, 38, 0.35);
}

.mh-btn--danger {
    background: #b91c1c;
    color: #fff;
}

.mh-btn--danger:hover {
    background: #991b1b;
}

.mh-user-avatar {
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--mh-surface-muted);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mh-text-muted);
}

.mh-plugin-toggle {
    color: var(--mh-text);
}

.mh-plugin-toggle .mh-label {
    margin-bottom: 0;
}

.mh-settings-plugin-card__category {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
}

.mh-settings-plugin-card__title {
    margin-top: 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--mh-text);
}

.mh-card--link:hover .mh-settings-plugin-card__title {
    color: var(--mh-accent);
}

.mh-callout--success {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
}

.mh-callout--error {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(254, 226, 226, 0.4);
    color: #991b1b;
}

[data-mh-ui="grimoire"] .mh-callout--success {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(6, 78, 59, 0.25);
    color: #6ee7b7;
}

[data-mh-ui="grimoire"] .mh-callout--error {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.22);
    color: #fca5a5;
}

.mh-btn--test {
    border-color: rgba(197, 160, 89, 0.4);
    background: rgba(197, 160, 89, 0.1);
    color: var(--mh-accent-dark);
}

[data-mh-ui="grimoire"] .mh-btn--test {
    color: var(--mh-accent);
}

.mh-btn--test:hover {
    background: rgba(197, 160, 89, 0.18);
}

.mh-security-banner {
    border-radius: 0.75rem;
    border: 1px solid rgba(197, 160, 89, 0.35);
    background: rgba(197, 160, 89, 0.08);
    padding: 1rem 1.25rem;
}

[data-mh-ui="grimoire"] .mh-security-banner {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.35);
}

.mh-security-banner__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mh-accent-dark);
}

[data-mh-ui="grimoire"] .mh-security-banner__title {
    color: var(--mh-accent);
}

.mh-status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.mh-status-pill--active {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.25);
}

.mh-status-pill--off {
    background: var(--mh-surface-muted);
    color: var(--mh-text-muted);
    box-shadow: inset 0 0 0 1px var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-status-pill--active {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

[data-mh-ui="grimoire"] .mh-timezone-dropdown {
    background: var(--mh-surface);
    border-color: var(--mh-border);
}

[data-mh-ui="grimoire"] .mh-themed-shell .mh-desc-toolbar {
    background: var(--mh-surface-muted);
    border-color: var(--mh-border);
}

.mh-desc-toolbar button {
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    color: var(--mh-text);
}

.mh-desc-toolbar button:hover {
    background: var(--mh-surface);
}

/* Character portrait (Overview tab) */

.mh-overview-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

.mh-overview-layout__body {
    flex: 1 1 16rem;
    min-width: 0;
}

.mh-portrait-panel {
    flex: 0 0 auto;
    width: min(100%, 13.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mh-character-portrait {
    overflow: hidden;
    border-radius: 0.75rem;
    background: var(--mh-surface-muted, #22262e);
}

.mh-character-portrait--display {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid rgba(197, 160, 89, 0.35);
    box-shadow:
        inset 0 0 0 1px rgba(197, 160, 89, 0.12),
        0 4px 18px rgba(0, 0, 0, 0.22);
}

.mh-character-portrait__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
}

.mh-character-portrait--thumb {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(197, 160, 89, 0.28);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.mh-character-portrait--thumb .mh-character-portrait__image {
    width: 100%;
    height: 100%;
}

.mh-character-card__link:hover .mh-character-portrait--thumb {
    border-color: rgba(197, 160, 89, 0.5);
}

@media (min-width: 640px) {
    .mh-character-portrait--thumb {
        width: 3.5rem;
        height: 3.5rem;
    }
}

.mh-character-portrait--display .mh-character-portrait__image {
    aspect-ratio: 1;
}

.mh-character-portrait__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    padding: 1rem;
    text-align: center;
}

.mh-character-portrait__empty-label {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-portrait-panel__upload {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mh-portrait-panel__file {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-portrait-panel__file::file-selector-button {
    margin-right: 0.5rem;
    border: 1px solid rgba(197, 160, 89, 0.35);
    border-radius: 0.375rem;
    background: var(--mh-surface, #1a1d23);
    color: var(--mh-text, #f5f2eb);
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.mh-portrait-panel__hint {
    font-size: 0.6875rem;
    line-height: 1.45;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-portrait-panel__remove {
    padding-top: 0.25rem;
    border-top: 1px solid rgba(197, 160, 89, 0.18);
}

.mh-portrait-panel__dropzone {
    position: relative;
    cursor: copy;
}

.mh-portrait-panel__dropzone.is-dragover {
    border-color: var(--mh-accent, #c5a059);
    box-shadow:
        inset 0 0 0 1px rgba(197, 160, 89, 0.35),
        0 0 0 2px rgba(197, 160, 89, 0.18);
}

.mh-portrait-panel__drop-hint {
    position: absolute;
    inset: auto 0.75rem 0.75rem;
    margin: 0;
    padding: 0.35rem 0.5rem;
    border-radius: 0.375rem;
    background: rgba(18, 20, 23, 0.72);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: var(--mh-text-muted, #9ca3af);
    pointer-events: none;
}

.mh-portrait-panel__dropzone.is-dragover .mh-portrait-panel__drop-hint,
.mh-portrait-panel__dropzone.has-local-preview .mh-portrait-panel__drop-hint {
    display: none;
}

.mh-character-portrait__preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
}

.mh-portrait-panel__dropzone.has-local-preview .mh-character-portrait__image--saved,
.mh-portrait-panel__dropzone.has-local-preview .mh-character-portrait__empty {
    visibility: hidden;
}

.mh-portrait-panel__dropzone.has-local-preview .mh-character-portrait__preview[hidden] {
    display: none;
}

.mh-portrait-panel__dropzone.has-local-preview .mh-character-portrait__preview:not([hidden]) {
    display: block;
}

.mh-portrait-panel__error {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--mh-crimson, #991b1b);
}

[data-mh-ui="grimoire"] .mh-character-portrait--display {
    background: linear-gradient(145deg, rgba(197, 160, 89, 0.08) 0%, var(--mh-surface-muted) 48%);
}

[data-mh-ui="grimoire"] .mh-portrait-panel__file::file-selector-button:hover {
    border-color: var(--mh-accent);
    color: var(--mh-accent);
}

/* Saga roster — driver's-license character cards */

.mh-roster-card {
    display: flex;
    align-items: stretch;
    min-height: 11.5rem;
    padding: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.mh-roster-card__portrait {
    flex: 0 0 6.75rem;
    width: 6.75rem;
    align-self: stretch;
    min-height: 100%;
    background: linear-gradient(180deg, rgba(197, 160, 89, 0.1) 0%, var(--mh-surface-muted, #22262e) 100%);
    border-right: 1px solid rgba(197, 160, 89, 0.28);
    overflow: hidden;
}

.mh-roster-card__portrait-image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 11.5rem;
    object-fit: cover;
    object-position: center top;
}

.mh-roster-card__portrait--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mh-roster-card__portrait-placeholder {
    font-family: var(--mh-font-heading, "Cinzel", serif);
    font-size: 2rem;
    font-weight: 600;
    color: rgba(197, 160, 89, 0.55);
}

.mh-roster-card__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.875rem 1rem 1rem;
}

.mh-roster-card__header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.mh-roster-card__eyebrow {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-accent, #c5a059);
}

.mh-roster-card__name {
    margin-top: 0.125rem;
    font-family: var(--mh-font-heading, "Cinzel", serif);
    font-size: 1.125rem;
    line-height: 1.25;
    font-weight: 600;
    color: var(--mh-text, #f5f2eb);
}

.mh-roster-card__name-age {
    font-family: var(--mh-font-body, "Source Sans 3", sans-serif);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-roster-card__player {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-roster-card__subtitle {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-roster-card-wrap {
    position: relative;
}

.mh-roster-card-wrap__delete {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
}

.mh-roster-card-wrap .mh-roster-card {
    width: 100%;
}

.mh-roster-card-wrap__delete + .mh-roster-card,
.mh-roster-card-wrap:has(.mh-roster-card-wrap__delete) .mh-roster-card__body {
    padding-right: 0.875rem;
}

@media (min-width: 640px) {
    .mh-roster-card-wrap:has(.mh-roster-card-wrap__delete) .mh-roster-card__body {
        padding-right: 6.5rem;
    }
}

.mh-roster-card__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 1rem;
    margin: 0;
}

.mh-roster-card__field {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.5rem;
    align-items: baseline;
    min-width: 0;
}

.mh-roster-card__field dt {
    margin: 0;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mh-text-muted, #9ca3af);
    white-space: nowrap;
}

.mh-roster-card__field dd {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--mh-text, #f5f2eb);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mh-roster-card__footer {
    margin-top: auto;
    padding-top: 0.125rem;
}

.mh-roster-card__divider {
    margin: 0;
    border: 0;
    border-top: 1px solid var(--mh-border, rgba(197, 160, 89, 0.2));
}

.mh-roster-card__created {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-roster-card:hover .mh-roster-card__name {
    color: var(--mh-accent, #c5a059);
}

.mh-roster-card:hover .mh-roster-card__portrait {
    border-right-color: rgba(197, 160, 89, 0.45);
}

.mh-covenant-roster-mini__link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: 0.375rem;
    padding: 0.25rem 0.375rem;
    margin: -0.25rem -0.375rem;
    color: inherit;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.mh-covenant-roster-mini__link:hover {
    background: rgba(197, 160, 89, 0.08);
    color: var(--mh-accent-dark, #8b7355);
}

.mh-covenant-roster-mini__portrait {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    overflow: hidden;
    border-radius: 0.375rem;
    border: 1px solid rgba(197, 160, 89, 0.24);
    background: rgba(26, 29, 35, 0.04);
}

.mh-covenant-roster-mini__portrait-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mh-covenant-roster-mini__portrait--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(197, 160, 89, 0.1);
}

.mh-covenant-roster-mini__portrait-placeholder {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--mh-accent-dark, #8b7355);
}

.mh-covenant-roster-mini__name {
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-ink, #1f2937);
}

[data-mh-ui="grimoire"] .mh-covenant-roster-mini__link:hover {
    background: rgba(197, 160, 89, 0.12);
}

[data-mh-ui="grimoire"] .mh-covenant-roster-mini__portrait {
    background: rgba(26, 29, 35, 0.95);
    border-color: rgba(197, 160, 89, 0.28);
}

[data-mh-ui="grimoire"] .mh-covenant-roster-mini__name {
    color: var(--mh-ink);
}

@media (max-width: 639px) {
    .mh-roster-card__portrait {
        flex-basis: 5.5rem;
        width: 5.5rem;
    }

    .mh-roster-card__fields {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    .mh-roster-card__portrait {
        flex-basis: 7.5rem;
        width: 7.5rem;
    }
}

/* Saga index — chronicle cards (driver's-license layout) */

.mh-saga-card {
    min-height: 12.5rem;
}

.mh-saga-card__spine {
    flex: 0 0 6.75rem;
    width: 6.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    border-right: 1px solid rgba(197, 160, 89, 0.28);
    background: linear-gradient(
        180deg,
        var(--mh-saga-season-accent, rgba(197, 160, 89, 0.16)) 0%,
        var(--mh-surface-muted, #22262e) 100%
    );
}

.mh-saga-card__season-icon {
    width: 1.35rem;
    height: 1.35rem;
    color: var(--mh-saga-season-accent-strong, rgba(197, 160, 89, 0.85));
}

.mh-saga-card__season {
    margin: 0;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-text-muted, #9ca3af);
}

.mh-saga-card__year {
    margin: 0;
    font-family: var(--mh-font-heading, "Cinzel", serif);
    font-size: 1.375rem;
    line-height: 1;
    font-weight: 600;
    color: var(--mh-text, #f5f2eb);
}

.mh-saga-card__description {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--mh-text-muted, #9ca3af);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.mh-saga-card .mh-roster-card__header {
    align-items: flex-start;
}

.mh-saga-card .mh-roster-card__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mh-saga-card[style*="--saga-season: spring"],
.mh-saga-card[style*="--saga-season:spring"] {
    --mh-saga-season-accent: rgba(107, 143, 113, 0.22);
    --mh-saga-season-accent-strong: #8fb996;
}

.mh-saga-card[style*="--saga-season: summer"],
.mh-saga-card[style*="--saga-season:summer"] {
    --mh-saga-season-accent: rgba(197, 160, 89, 0.24);
    --mh-saga-season-accent-strong: #d4b06a;
}

.mh-saga-card[style*="--saga-season: autumn"],
.mh-saga-card[style*="--saga-season:autumn"] {
    --mh-saga-season-accent: rgba(180, 120, 72, 0.22);
    --mh-saga-season-accent-strong: #c9956a;
}

.mh-saga-card[style*="--saga-season: winter"],
.mh-saga-card[style*="--saga-season:winter"] {
    --mh-saga-season-accent: rgba(120, 150, 190, 0.2);
    --mh-saga-season-accent-strong: #9eb8d9;
}

.mh-saga-card:hover .mh-saga-card__spine {
    border-right-color: rgba(197, 160, 89, 0.45);
}

.mh-saga-card:hover .mh-saga-card__year {
    color: var(--mh-accent, #c5a059);
}

@media (max-width: 639px) {
    .mh-saga-card__spine {
        flex-basis: 5.5rem;
        width: 5.5rem;
    }

    .mh-saga-card .mh-roster-card__fields {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    .mh-saga-card__spine {
        flex-basis: 7.5rem;
        width: 7.5rem;
    }
}

/* ── Live Play roll reveal ── */

/* ── Live Play — header roster avatars ── */

.lp-live-play-toolbar {
    position: relative;
    z-index: 50;
    overflow: visible;
}

.lp-live-play-toolbar .lp-live-play-meta,
.lp-live-play-toolbar .lp-roster,
.lp-live-play-toolbar .lp-roster__avatars {
    overflow: visible;
}

.lp-live-play-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem 1rem;
}

.lp-live-play-meta__session {
    min-width: 0;
}

.lp-roster {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.lp-roster__label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
}

.lp-roster__avatars {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.lp-roster__item {
    position: relative;
    display: inline-flex;
}

.lp-roster__item:hover,
.lp-roster__item:focus-within {
    z-index: 1;
}

.lp-roster__avatar {
    display: block;
    width: 1.75rem;
    height: 1.75rem;
    overflow: hidden;
    border-radius: 9999px;
    border: 2px solid rgba(120, 113, 108, 0.55);
    background: rgba(26, 29, 35, 0.65);
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.lp-roster__item--online .lp-roster__avatar {
    border-color: rgba(52, 211, 153, 0.75);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}

.lp-roster__item--sg .lp-roster__avatar {
    box-shadow: 0 0 0 1px rgba(197, 160, 89, 0.35);
}

.lp-roster__item:hover .lp-roster__avatar,
.lp-roster__item:focus-within .lp-roster__avatar {
    transform: translateY(-1px);
    border-color: var(--mh-accent);
}

.lp-roster__avatar-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lp-roster__avatar--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-roster__avatar-initial {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--mh-accent);
}

.lp-roster__tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 0.45rem);
    z-index: 30;
    display: none;
    min-width: 9rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    border: 1px solid var(--mh-border);
    background: rgba(26, 29, 35, 0.98);
    box-shadow: var(--mh-shadow-soft);
    transform: translateX(-50%);
    pointer-events: none;
    white-space: nowrap;
}

.lp-roster__tooltip::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -0.3rem;
    width: 0.5rem;
    height: 0.5rem;
    border-left: 1px solid var(--mh-border);
    border-top: 1px solid var(--mh-border);
    background: rgba(26, 29, 35, 0.98);
    transform: translateX(-50%) rotate(45deg);
}

.lp-roster__item:hover .lp-roster__tooltip,
.lp-roster__item:focus-within .lp-roster__tooltip {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.lp-roster__tooltip-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mh-text);
}

.lp-roster__tooltip-status {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--mh-text-muted);
}

.lp-roster__item--online .lp-roster__tooltip-status {
    color: #6ee7b7;
}

.lp-roster__tooltip-character {
    font-size: 0.6875rem;
    color: var(--mh-text-muted);
}

/* ── Live Play — sidebar tabs ── */

.lp-actions-tabs {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lp-actions-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lp-actions-tablist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.625rem 0.75rem 0;
    border-bottom: 1px solid var(--mh-border);
    background: linear-gradient(
        180deg,
        rgba(34, 38, 46, 0.55) 0%,
        rgba(26, 29, 35, 0.35) 100%
    );
}

.lp-actions-tab {
    display: inline-flex;
    align-items: center;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mh-text-muted);
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.lp-actions-tab:hover {
    color: var(--mh-accent);
    background: rgba(197, 160, 89, 0.06);
}

#lp-actions-tab-roll:checked ~ .lp-actions-tablist label[for="lp-actions-tab-roll"],
#lp-actions-tab-cast:checked ~ .lp-actions-tablist label[for="lp-actions-tab-cast"],
#lp-actions-tab-sg:checked ~ .lp-actions-tablist label[for="lp-actions-tab-sg"] {
    border-color: var(--mh-border);
    background: var(--mh-surface);
    color: var(--mh-text);
    box-shadow: inset 0 -3px 0 var(--mh-accent);
    font-weight: 700;
}

.lp-actions-panel {
    display: none;
    padding: 1rem;
}

.lp-actions-tabs:has(#lp-actions-tab-roll:checked) #lp-actions-panel-roll,
.lp-actions-tabs:has(#lp-actions-tab-cast:checked) #lp-actions-panel-cast,
.lp-actions-tabs:has(#lp-actions-tab-sg:checked) #lp-actions-panel-sg {
    display: block;
}

.lp-actions-tabs--single .lp-actions-tablist {
    display: none;
}

.lp-actions-tabs--single .lp-actions-panel {
    display: block;
}

.lp-actions-panel__heading {
    margin-bottom: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mh-text-muted);
}

.lp-roll-options {
    border: 1px solid rgba(197, 160, 89, 0.14);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.12);
}

.lp-roll-options summary {
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mh-text-muted);
    list-style: none;
}

.lp-roll-options summary::-webkit-details-marker {
    display: none;
}

.lp-roll-options[open] summary {
    margin-bottom: 0.25rem;
    color: var(--mh-accent);
}

#lp-spell-cast-fieldset:disabled {
    opacity: 0.45;
}

#lp-spell-cast-fieldset:disabled .mh-input,
#lp-spell-cast-fieldset:disabled .mh-btn {
    cursor: not-allowed;
}

.lp-prompt-card {
    border-radius: 0.5rem;
    border: 1px solid rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
    padding: 0.75rem;
    font-size: 0.875rem;
}

.lp-prompt-card__queue {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(253, 230, 138, 0.8);
    margin: 0 0 0.5rem;
}

.lp-prompt-card__title {
    font-weight: 500;
    color: #fef3c7;
    margin: 0;
}

.lp-prompt-card--botch-check {
    border-color: rgba(244, 114, 182, 0.55);
    background: linear-gradient(
        135deg,
        rgba(127, 29, 29, 0.35),
        rgba(190, 24, 93, 0.14)
    );
    box-shadow:
        0 0 0 1px rgba(244, 63, 94, 0.12),
        0 0 24px rgba(244, 63, 94, 0.12);
    animation: lp-prompt-botch-check-glow 2.4s ease-in-out infinite;
}

.lp-prompt-card--botch-check .lp-prompt-card__title {
    color: #fecdd3;
}

.lp-prompt-card--botch-check .lp-prompt-card__queue,
.lp-prompt-card__queue--urgent {
    color: #fda4af;
}

.lp-prompt-card__urgent {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fb7185;
}

.lp-unresolved-botches {
    border-radius: 0.5rem;
    border: 1px solid rgba(248, 113, 113, 0.45);
    background: linear-gradient(
        135deg,
        rgba(69, 10, 10, 0.45),
        rgba(127, 29, 29, 0.2)
    );
    padding: 0.75rem;
}

.lp-unresolved-botches__title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fca5a5;
}

.lp-unresolved-botches__target {
    margin: 0.35rem 0 0;
    font-family: var(--mh-font-serif);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fecaca;
}

.lp-unresolved-botches__detail {
    margin: 0.35rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgba(254, 202, 202, 0.85);
}

#lp-self-roll-fieldset:disabled {
    opacity: 0.45;
}

#lp-self-roll-fieldset:disabled .mh-input,
#lp-self-roll-fieldset:disabled .mh-btn {
    cursor: not-allowed;
}

.lp-roll-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: min(14vh, 5.5rem) 1rem 1rem;
}

.lp-roll-overlay.hidden {
    display: none;
}

.lp-roll-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 11, 13, 0.82);
    backdrop-filter: blur(6px);
}

.lp-roll-overlay__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 22rem;
    padding: 1.5rem 1.25rem 1.25rem;
    text-align: center;
    border-radius: 0.875rem;
    border: 1px solid rgba(197, 160, 89, 0.35);
    background: linear-gradient(165deg, rgba(32, 35, 42, 0.98), rgba(22, 24, 28, 0.98));
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.lp-roll-overlay__title {
    font-family: var(--mh-font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--mh-text);
    margin: 0 0 0.35rem;
}

.lp-roll-overlay__sub {
    font-size: 0.8125rem;
    color: var(--mh-text-muted);
    margin: 0 0 1.25rem;
}

.lp-roll-overlay__dice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 5.5rem;
    margin-bottom: 1rem;
}

.lp-die {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 0.75rem;
    border: 2px solid rgba(197, 160, 89, 0.45);
    background: linear-gradient(145deg, rgba(45, 48, 56, 1), rgba(28, 30, 36, 1));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 20px rgba(0, 0, 0, 0.35);
    font-family: var(--mh-font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: #f5f2eb;
    transition: transform 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.lp-die--rolling {
    animation: lp-die-shake 0.35s ease-in-out infinite;
}

.lp-die--reveal {
    animation: lp-die-pop 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.lp-die--botch {
    border-color: rgba(239, 68, 68, 0.75);
    color: #fca5a5;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 24px rgba(239, 68, 68, 0.25);
}

.lp-die--stress-one {
    border-color: rgba(251, 191, 36, 0.55);
}

.lp-die__chain {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(251, 191, 36, 0.9);
    letter-spacing: 0.04em;
}

.lp-roll-overlay__result {
    font-family: var(--mh-font-serif);
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: #f5f2eb;
    margin: 0 0 0.5rem;
}

.lp-roll-overlay__result--botch {
    color: #f87171;
    font-size: 1.75rem;
    letter-spacing: 0.06em;
}

.lp-roll-overlay__outcome {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 0.75rem;
}

.lp-roll-overlay__outcome--failed {
    color: #f87171;
}

.lp-roll-overlay__outcome--danger {
    color: #f87171;
    animation: lp-die-botch-check-pulse-danger 1.1s ease-in-out infinite;
}

.lp-roll-overlay__outcome--success {
    color: #4ade80;
}

.lp-roll-overlay__outcome--safe {
    color: #4ade80;
    animation: lp-die-botch-check-pulse-safe 1.35s ease-in-out infinite;
}

.lp-roll-overlay__detail {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--mh-text-muted);
    margin: 0 0 1.25rem;
}

.lp-roll-overlay__continue {
    min-width: 8rem;
}

.lp-log-scope-btn {
    color: var(--mh-text-muted);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lp-log-scope-btn:hover {
    color: var(--mh-text);
}

.lp-log-scope-btn--active {
    background: rgba(245, 242, 235, 0.08);
    color: var(--mh-text);
}

.lp-log-session-header {
    border-left: 3px solid rgba(245, 242, 235, 0.18);
    padding: 0.35rem 0 0.35rem 0.75rem;
    margin: 0.25rem 0 0.75rem;
}

.lp-log-session-header--active {
    border-left-color: rgba(52, 211, 153, 0.55);
}

.lp-log-session-header--archived {
    opacity: 0.72;
}

.lp-log-session-header__title {
    font-family: var(--mh-font-serif);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mh-text);
    margin: 0;
}

.lp-log-session-header__meta {
    font-size: 0.75rem;
    color: var(--mh-text-muted);
    margin: 0.15rem 0 0;
}

.lp-log-failed {
    margin-left: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f9a8d4;
}

.lp-log-botched,
.lp-log-event--botched .lp-log-botched {
    margin-left: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #f87171;
}

.lp-log-event--failed .lp-log-failed {
    color: #f472b6;
}

.lp-log-success {
    margin-left: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #86efac;
}

.lp-log-event--passed .lp-log-success {
    color: #4ade80;
}

.lp-log-danger,
.lp-log-event--danger .lp-log-danger {
    margin-left: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f87171;
}

.lp-log-zero,
.lp-log-zero-detail {
    color: #f87171;
    font-weight: 600;
}

.lp-log-safe,
.lp-log-event--safe .lp-log-safe {
    margin-left: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #4ade80;
}


.lp-roll-overlay__result--danger {
    color: #f87171;
}

.lp-roll-overlay__result--safe {
    color: #4ade80;
}

.lp-roll-overlay__result--failed {
    color: #f87171;
}

.lp-roll-overlay__result--passed {
    color: #4ade80;
}

.lp-roll-overlay__result--reveal.lp-roll-overlay__result--failed,
.lp-roll-overlay__result--reveal.lp-roll-overlay__result--passed {
    animation: lp-roll-result-reveal 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.lp-roll-overlay__result--reveal.lp-roll-overlay__result--danger,
.lp-roll-overlay__result--reveal.lp-roll-overlay__result--botch {
    animation:
        lp-roll-result-reveal 0.55s cubic-bezier(0.34, 1.4, 0.64, 1),
        lp-die-botch-check-pulse-danger 1.1s ease-in-out 0.55s infinite;
}

.lp-roll-overlay__result--reveal.lp-roll-overlay__result--safe {
    animation:
        lp-roll-result-reveal 0.55s cubic-bezier(0.34, 1.4, 0.64, 1),
        lp-die-botch-check-pulse-safe 1.35s ease-in-out 0.55s infinite;
}

.lp-die__chain--reveal {
    animation: lp-roll-result-reveal 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.lp-roll-overlay--botch-check {
    padding-top: min(10vh, 4rem);
}

.lp-roll-overlay--botch-check .lp-roll-overlay__backdrop {
    background: rgba(24, 8, 12, 0.88);
}

.lp-roll-overlay__panel--botch-check {
    max-width: min(36rem, 96vw);
    border-color: rgba(244, 114, 182, 0.45);
    background: linear-gradient(
        165deg,
        rgba(42, 22, 28, 0.98),
        rgba(24, 14, 18, 0.98)
    );
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(244, 63, 94, 0.12);
}

.lp-roll-overlay--botch-check .lp-roll-overlay__dice {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    overflow-x: visible;
    padding-bottom: 0;
}

.lp-die--botch-check-slot {
    opacity: 0.35;
    border-style: dashed;
    border-color: rgba(148, 163, 184, 0.35);
    color: rgba(148, 163, 184, 0.55);
    font-size: 1.5rem;
    transform: scale(0.92);
}

.lp-die--botch-check-rolling {
    animation: lp-die-shake 0.28s ease-in-out infinite;
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 18px rgba(251, 191, 36, 0.2);
}

.lp-die--botch-check-safe {
    border-color: rgba(74, 222, 128, 0.85);
    color: #bbf7d0;
    animation:
        lp-die-pop 0.45s cubic-bezier(0.34, 1.4, 0.64, 1),
        lp-die-botch-check-pulse-safe 1.35s ease-in-out 0.45s infinite;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 28px rgba(74, 222, 128, 0.35);
}

.lp-die--botch-check-danger {
    border-color: rgba(248, 113, 113, 0.9);
    color: #fecaca;
    animation:
        lp-die-pop 0.45s cubic-bezier(0.34, 1.4, 0.64, 1),
        lp-die-botch-check-pulse-danger 1.1s ease-in-out 0.45s infinite;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 32px rgba(248, 113, 113, 0.45);
}

.lp-roll-overlay__result--reveal {
    animation: lp-roll-result-reveal 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes lp-prompt-botch-check-glow {
    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(244, 63, 94, 0.12),
            0 0 20px rgba(244, 63, 94, 0.1);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(244, 63, 94, 0.22),
            0 0 28px rgba(244, 63, 94, 0.22);
    }
}

@keyframes lp-die-botch-check-pulse-safe {
    0%,
    100% {
        transform: scale(1);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 20px rgba(74, 222, 128, 0.25);
    }
    50% {
        transform: scale(1.06);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 0 36px rgba(74, 222, 128, 0.5);
    }
}

@keyframes lp-die-botch-check-pulse-danger {
    0%,
    100% {
        transform: scale(1);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.06),
            0 0 24px rgba(248, 113, 113, 0.35);
    }
    50% {
        transform: scale(1.08);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 44px rgba(248, 113, 113, 0.65);
    }
}

@keyframes lp-roll-result-reveal {
    0% {
        transform: scale(0.7);
        opacity: 0.35;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes lp-die-shake {
    0%,
    100% {
        transform: rotate(-4deg) translateY(0);
    }
    50% {
        transform: rotate(4deg) translateY(-3px);
    }
}

@keyframes lp-die-pop {
    0% {
        transform: scale(0.65);
        opacity: 0.4;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

