/* Bulmaswatch Lux is a light-only theme, but Bulma 1.0's base CSS flips its
   scheme variables under @media (prefers-color-scheme: dark). Lux's hardcoded
   colors keep the main page light, but anything using var(--bulma-scheme-main)
   etc. (e.g. Tom Select dropdowns) turns dark on an OS dark-mode preference.
   Pin the scheme vars to their light-mode values so the whole UI stays light. */
:root {
  color-scheme: light;

  /* Character wizard stat-box gray ramp (see .wizard-stat-box states). */
  --wizard-stat-class: #1a1a1a;
  --wizard-stat-user: #595959;
  --wizard-stat-user-edge: #404040;
  --wizard-stat-empty: #f0f0f0;
  --wizard-stat-empty-hover: #e0e0e0;
  --wizard-stat-preview: #a8a8a8;

  /* Elevation scale — shared drop-shadow tokens. Prefer these over ad-hoc
     box-shadow recipes so raised surfaces stay visually consistent.
       --elevation-1: resting cards
       --elevation-2: raised surfaces (cards on hover, popovers/dropdowns) */
  --elevation-1: 0 1px 2px rgba(var(--bulma-black-rgb), 0.08);
  --elevation-2: 0 4px 12px rgba(var(--bulma-black-rgb), 0.15);

  /* Selection accent — Lux's "info" blue. NOTE: var(--bulma-primary) can't be
     used for this. Bulmaswatch Lux is a 0.9-era theme that paints components
     with hardcoded hex and never sets Bulma's CSS variables, so
     var(--bulma-primary) resolves to Bulma 1.0.4's default turquoise and
     clashes with Lux. Pin Lux's accent explicitly here instead. */
  --wizard-accent: #3298dc;
  --wizard-accent-rgb: 50, 152, 220;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bulma-scheme-brightness: light;
    --bulma-scheme-main-l: 100%;
    --bulma-scheme-main-bis-l: 98%;
    --bulma-scheme-main-ter-l: 96%;
    --bulma-background-l: 96%;
    --bulma-border-weak-l: 93%;
    --bulma-border-l: 86%;
    --bulma-text-weak-l: 48%;
    --bulma-text-l: 29%;
    --bulma-text-strong-l: 21%;
    --bulma-text-title-l: 14%;
    --bulma-scheme-invert-ter-l: 14%;
    --bulma-scheme-invert-bis-l: 7%;
    --bulma-scheme-invert-l: 4%;
    --bulma-hover-background-l-delta: -5%;
    --bulma-active-background-l-delta: -10%;
    --bulma-hover-border-l-delta: -10%;
    --bulma-active-border-l-delta: -20%;
  }
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 0.5rem 1rem;
  background-color: var(--bulma-link);
  color: var(--bulma-link-invert);
  text-decoration: none;
  font-weight: 600;
}

.skip-to-content:focus {
  left: 0;
}

/* Bulmaswatch Lux theme fixes */
.table,
.table td,
.table th {
  color: var(--bulma-text-strong);
}

.app-table {
  border-collapse: separate;
  border-spacing: 0;
}

.app-table th {
  color: #5f6b7a !important;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid #d7dde5;
}

.app-table td,
.app-table td .has-text-grey,
.app-table td a:not(.button) {
  color: #2f3742 !important;
}

.app-table td {
  vertical-align: middle;
  border-color: #e6eaf0;
}

.app-table tbody tr {
  background-color: #ffffff;
}

.app-table tbody tr:nth-child(even) {
  background-color: #f7f9fc;
}

.app-table.is-hoverable tbody tr:not(.is-selected):hover {
  background-color: #eef3f8;
}

.subtitle {
  color: var(--bulma-text);
}

.title + .subtitle {
  margin-top: 0.75rem !important;
}

/* HTMX transition styles */
.htmx-swapping {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Button loading spinner for HTMX requests */
.button {
  transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.htmx-request .button {
  position: relative;
  color: transparent !important;
}

.htmx-request .button::after {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-right-color: transparent;
  animation: button-loading-spinner 0.75s infinite linear;
}

@keyframes button-loading-spinner {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive video container */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.video-container iframe,
.video-container object,
.video-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Form loading overlay */
.has-form-overlay {
  position: relative;
}

.form-loading-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bulma-scheme-main) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.form-loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--bulma-border);
  border-top-color: var(--bulma-link);
  border-radius: 50%;
  animation: form-loading-spin 0.8s linear infinite;
}

@keyframes form-loading-spin {
  to { transform: rotate(360deg); }
}

/* Modal overrides (base styles provided by Bulmaswatch Lux) */
.modal-card {
  max-width: 500px;
}
.modal-card.is-double {
  /* width:100% (not a fixed 960px) so the wide level-up modal fills the
     viewport on phones/tablets and only caps at 960px once there's room.
     100% is needed to beat Bulma's desktop .modal-card width:640px. */
  max-width: 960px;
  width: 100%;
}

.modal .notification {
  margin-bottom: 0;
}

.modal .field .control {
  position: relative;
}

.modal .htmx-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.modal .field.has-addons .control:first-child .input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.modal .field.has-addons .control:last-child .button {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

body.modal-open {
  overflow: hidden;
}

/* Tom Select - Bulma integration */
.ts-wrapper {
  width: 100%;
  position: relative;
  z-index: 1;
}

.ts-wrapper.dropdown-active {
  z-index: 1000;
}

.ts-wrapper.single .ts-control {
  background-color: var(--bulma-scheme-main);
  border: 1px solid var(--bulma-border);
  border-radius: var(--bulma-control-radius);
  box-shadow: inset 0 1px 2px rgba(var(--bulma-black-rgb), 0.1);
  color: var(--bulma-text-strong);
  font-size: 1rem;
  height: 2.5em;
  padding: 0.375rem 0.75rem;
}

.ts-wrapper.single .ts-control:hover {
  border-color: var(--bulma-border-hover);
}

.ts-wrapper.focus .ts-control {
  border-color: var(--bulma-link);
  box-shadow: var(--bulma-focus-shadow-size) hsla(var(--bulma-focus-h), var(--bulma-focus-s), var(--bulma-focus-l), var(--bulma-focus-shadow-alpha));
}

.ts-dropdown {
  background-color: var(--bulma-scheme-main) !important;
  border: 1px solid var(--bulma-border);
  border-radius: var(--bulma-control-radius);
  box-shadow: var(--elevation-2);
  margin-top: 2px;
  z-index: 9999 !important;
  position: absolute;
}

.ts-dropdown-content {
  background-color: var(--bulma-scheme-main) !important;
  max-height: 300px;
  overflow-y: auto;
}

.ts-dropdown .optgroup {
  background-color: var(--bulma-scheme-main);
}

.ts-dropdown .optgroup-header {
  background-color: var(--bulma-background) !important;
  color: var(--bulma-grey);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bulma-border);
}

.ts-dropdown .option {
  padding: 0.5rem 0.75rem;
  color: var(--bulma-text-strong);
  background-color: var(--bulma-scheme-main);
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background-color: var(--bulma-link) !important;
  color: var(--bulma-link-invert) !important;
}

.ts-dropdown .option.selected {
  background-color: var(--bulma-background);
  color: var(--bulma-text-strong);
}

.ts-dropdown .option.selected:hover,
.ts-dropdown .option.selected.active {
  background-color: var(--bulma-link) !important;
  color: var(--bulma-link-invert) !important;
}

.field.has-addons .control.is-expanded .ts-wrapper {
  width: 100%;
}

.field.has-addons .control.is-expanded .ts-control {
  border-top-right-radius: var(--bulma-control-radius);
  border-bottom-right-radius: var(--bulma-control-radius);
}

.ts-wrapper + select {
  display: none;
}

/* Badge positioning */
.navbar-item span.badge,
.tabs a span.badge,
.table td span.badge {
  position: relative;
  top: -0.4em;
  margin-left: 0.25em;
}

.tabs ul {
  padding-top: 0.25em;
}

/* Navbar active state */
.navbar.is-dark .navbar-item.is-active,
.navbar.is-dark .navbar-link.is-active {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Navbar dropdown - Bulmaswatch Lux sets background:#222, which shows as
   dark bars in the top/bottom padding strips around the (light) items. */
.navbar-dropdown {
  background-color: var(--bulma-scheme-main);
  border-top-color: var(--bulma-border);
}

/* Bulma dropdown - Bulmaswatch Lux theme fix */
.dropdown-menu {
  background-color: var(--bulma-scheme-main) !important;
}

.dropdown-content {
  background-color: var(--bulma-scheme-main) !important;
  border-radius: var(--bulma-control-radius);
  box-shadow: 0 0.5em 1em -0.125em rgba(var(--bulma-black-rgb), 0.1), 0 0 0 1px rgba(var(--bulma-black-rgb), 0.02);
  padding-bottom: 0.5rem;
  padding-top: 0.5rem;
}

.dropdown-item {
  color: var(--bulma-text) !important;
  display: block;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.375rem 1rem;
  position: relative;
}

a.dropdown-item {
  background-color: var(--bulma-scheme-main) !important;
}

a.dropdown-item:hover {
  background-color: var(--bulma-background) !important;
  color: var(--bulma-scheme-invert) !important;
}

/* PDF viewer */
.pdf-viewer-container {
  padding: 1.5rem;
  background-color: var(--bulma-scheme-main-bis);
}

.pdf-viewer-toolbar {
  gap: 0.25rem;
}

.pdf-page-display {
  gap: 0.35rem;
}

.pdf-page-display #pdfPageInput {
  width: 3rem;
  text-align: center;
  padding: 0 0.25rem;
  height: 1.75rem;
  font-size: 0.75rem;
  border-radius: var(--bulma-control-radius);
  -moz-appearance: textfield;
}

.pdf-page-display #pdfPageInput::-webkit-outer-spin-button,
.pdf-page-display #pdfPageInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pdf-viewer-canvas-wrapper {
  overflow: auto;
  max-height: 75vh;
  border: 1px solid var(--bulma-border);
  background-color: #2f2f2f;
  padding: 1rem;
}

.pdf-viewer-canvas {
  display: block;
  margin: 0 auto;
  box-shadow: 0 0 12px rgba(var(--bulma-black-rgb), 0.4);
  background-color: var(--bulma-scheme-main);
}

.pdf-viewer-container .help {
  text-align: center;
}

/* Image editor / cropper */
.profile-image-editor {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.profile-image-editor__canvas {
  position: relative;
  min-height: 280px;
  border: 1px dashed var(--bulma-border-hover);
  border-radius: var(--bulma-box-radius);
  overflow: hidden;
  background: var(--bulma-scheme-main-bis);
  z-index: 0;
}

.profile-image-editor__canvas img {
  max-width: 100%;
  display: block;
}

.profile-image-editor__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--bulma-grey);
  text-align: center;
  padding: 1rem;
  font-style: italic;
  pointer-events: none;
  z-index: 1;
}

.profile-image-editor__placeholder[hidden] {
  display: none;
}

.profile-image-editor__preview {
  width: 100%;
  /* Anchor to the top so the grid's default `align-items: stretch` doesn't
     stretch this cell to match the tall canvas, which would override the
     aspect-ratio below and distort the crop preview. */
  align-self: start;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--bulma-border);
  border-radius: var(--bulma-box-radius);
  background-color: var(--bulma-scheme-main-bis);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  overflow: hidden;
}

.profile-image-render,
.image-crop-render {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--bulma-card-radius);
  overflow: hidden;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  border: 1px solid var(--bulma-border);
  box-shadow: 0 2px 6px rgba(var(--bulma-black-rgb), 0.08);
}

@media screen and (max-width: 768px) {
  .profile-image-editor {
    grid-template-columns: 1fr;
  }

  .pdf-viewer-canvas-wrapper {
    max-height: 65vh;
    padding: 0.5rem;
  }
}

/* ToastUI Editor - Bulma integration */
.toastui-editor-container,
[data-toast-editor-wrapper="true"] {
  margin-top: 0.5rem;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}

.field .control .toastui-editor-container {
  width: 100%;
}

.toastui-editor-defaultUI {
  border: 1px solid var(--bulma-border);
  border-radius: var(--bulma-control-radius);
}

.toastui-editor-defaultUI:hover {
  border-color: var(--bulma-border-hover);
}

.toastui-editor-defaultUI.focused {
  border-color: var(--bulma-link);
  box-shadow: var(--bulma-focus-shadow-size) hsla(var(--bulma-focus-h), var(--bulma-focus-s), var(--bulma-focus-l), var(--bulma-focus-shadow-alpha));
}

.toastui-editor-toolbar {
  background-color: var(--bulma-background);
  border-bottom: 1px solid var(--bulma-border);
}

.toastui-editor-contents {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bulma-text-strong);
}

.toastui-editor-contents pre {
  background-color: var(--bulma-background);
  border: 1px solid var(--bulma-border);
  border-radius: var(--bulma-control-radius);
  padding: 1rem;
  overflow-x: auto;
}

.toastui-editor-contents table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.toastui-editor-contents table th,
.toastui-editor-contents table td {
  border: 1px solid var(--bulma-border);
  padding: 0.5rem;
}

.toastui-editor-contents table th {
  background-color: var(--bulma-background);
  font-weight: 600;
}

/* ============================================
   Mission Editors & Collaboration Styles
   ============================================ */

/* Editor list */
.mission-editors {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 1rem;
}

.editor-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.editor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e8e8e8;
}

.editor-item:last-child {
  border-bottom: none;
}

.editor-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-avatar,
.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.editor-avatar-placeholder,
.profile-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3273dc;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.875rem;
}

.editor-name,
.profile-name {
  font-weight: 500;
}

.editor-added-by {
  color: #7a7a7a;
  font-size: 0.875rem;
}

.no-editors {
  color: #7a7a7a;
  font-style: italic;
  margin: 0;
}

/* Editor search results */
.editor-search-results {
  margin-top: 0.5rem;
}

.profile-search-results {
  max-height: 200px;
  overflow-y: auto;
}

.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: white;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
}

.profile-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.profile-item:hover {
  background-color: #f5f5f5;
}

.profile-item:not(:last-child) {
  border-bottom: 1px solid #f0f0f0;
}

/* Similar missions (deduplication) */
.similar-missions {
  background: #fffbeb;
  border: 1px solid #ffe08a;
  border-radius: 6px;
  padding: 1rem;
}

.similar-missions-header h4 {
  color: #946c00;
  margin-bottom: 0.25rem;
}

.similar-missions-hint {
  color: #7a7a7a;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.similar-mission-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.similar-mission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  background: white;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.similar-mission-item:last-child {
  margin-bottom: 0;
}

.similar-mission-info {
  flex: 1;
}

.similar-mission-name {
  font-weight: 500;
  display: block;
}

.similar-mission-date,
.similar-mission-creator {
  color: #7a7a7a;
  font-size: 0.875rem;
}

.similar-mission-characters {
  color: #7a7a7a;
  font-size: 0.875rem;
}

.no-similar {
  color: #7a7a7a;
  font-style: italic;
  margin: 0;
}

/* Merge preview styles */
.merged-summary {
  white-space: pre-wrap;
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 4px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .htmx-swapping {
    transition: none;
  }

  .htmx-indicator {
    transition: none;
  }

  .button {
    transition: none;
  }

  .htmx-request .button::after {
    animation: none;
  }

  .form-loading-spinner {
    animation: none;
  }

  .anchor-link {
    transition: none;
  }
}

/* Section anchor headings with hover-reveal copy-link icon */
.anchor-heading {
  scroll-margin-top: 1rem;
}

.anchor-link {
  margin-left: 0.4em;
  font-size: 0.7em;
  vertical-align: middle;
  color: var(--bulma-grey-light);
  opacity: 0;
  transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}

.anchor-heading:hover .anchor-link,
.anchor-heading:focus-within .anchor-link,
.anchor-link:focus {
  opacity: 1;
}

.anchor-link:hover,
.anchor-link:focus {
  color: var(--bulma-text-strong);
}

/* ============================================================
   Character Creator wizard
   ============================================================ */
.wizard-steps {
  margin: 1.5rem 0 1rem;
}
.wizard-steps ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: wiz;
}
.wizard-steps li {
  flex: 1 1 0;
  min-width: 9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--bulma-border, #dbdbdb);
  border-radius: 6px;
  background: var(--bulma-scheme-main, #fff);
  color: var(--bulma-text, #4a4a4a);
  font-size: 0.9rem;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.wizard-steps li .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--bulma-border, #dbdbdb);
  color: var(--bulma-text, #4a4a4a);
  font-weight: 600;
  font-size: 0.8rem;
}
.wizard-steps li.is-active {
  border-color: var(--wizard-accent);
  color: var(--wizard-accent);
}
.wizard-steps li.is-active .num {
  background: var(--wizard-accent);
  color: #fff;
}
.wizard-steps li.is-done {
  border-color: var(--bulma-success, #48c78e);
  color: var(--bulma-success, #48c78e);
}
.wizard-steps li.is-done .num {
  background: var(--bulma-success, #48c78e);
  color: #fff;
}
.wizard-steps li .lbl {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wizard-summary {
  background: var(--bulma-scheme-main-bis, #fafafa);
  margin-bottom: 1.5rem;
}
.wizard-summary p { margin: 0.15rem 0; }
.wizard-summary ul { margin: 0; padding-left: 1.25rem; }
.wizard-summary-meta {
  border-top: 1px solid var(--bulma-border, #dbdbdb);
}
/* The level / missions / successful cells sit on a is-gapless columns row;
   add a small column-gap so the three cells breathe. */
.wizard-summary-meta .columns {
  column-gap: 1rem;
}
/* Summary uses the same kiosk-card markup as the selector, but scaled down
   to a thumbnail (2:3 portrait) so the selected class is visible at a glance
   alongside the text summary. */
.wizard-kiosk-card.is-summary {
  width: 10rem;
  height: 15rem;
  border-radius: 6px;
}
.wizard-kiosk-card.is-summary .wizard-kiosk-ribbon-top { padding: 0.35rem 0.55rem 0.5rem; }
.wizard-kiosk-card.is-summary .wizard-kiosk-ribbon-name { font-size: 0.85rem; }
.wizard-kiosk-card.is-summary .wizard-kiosk-ribbon-pcc { font-size: 0.55rem; padding: 0.1rem 0.3rem; }
.wizard-kiosk-card.is-summary .wizard-kiosk-ribbon-bottom { padding: 0.35rem 0.55rem 0.45rem; font-size: 0.65rem; }

.wizard-step { margin-top: 1rem; }
/* The hidden attribute should hide the step, but layout classes (e.g.
   Bulma .box) or a future selector can override it. Belt-and-braces. */
.wizard-step[hidden] { display: none !important; }

/* Kiosk: single horizontal row of class cards. One card is centered in the
   frame at any time; the track scrolls horizontally and snaps card centers
   to the viewport center, so the center-frame overlay stays at 50% top.
   Each card is a single 2:3 portrait panel showing the class art, with a
   top-ribbon (class name) and bottom-ribbon (edition). */
.wizard-kiosk {
  position: relative;
  width: 100%;
  /* min-width:0 (not 20rem/320px) so the kiosk never forces horizontal page
     overflow inside a narrow container or sub-320px viewport — the track
     already scrolls horizontally, so it doesn't need a floor width. */
  min-width: 0;
  height: 29rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  border: 1px solid var(--bulma-border, #dbdbdb);
  border-radius: 8px;
  background: var(--bulma-scheme-main, #fff);
  padding: 0;
}
.wizard-kiosk-track {
  display: flex;
  flex-direction: row;
  align-items: center;
  /* Vertical padding (1rem) + card height (27rem) = kiosk height (29rem),
     so the card's vertical center lands on the kiosk's center line where the
     center-frame overlay sits. Horizontal padding (50% - 9rem) puts the
     first/last card's center on the kiosk's center line as well. */
  padding: 1rem calc(50% - 9rem);
  gap: 0.75rem;
  min-height: 27rem;
}
.wizard-kiosk-card {
  position: relative;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  flex: 0 0 auto;
  width: 18rem;
  height: 27rem;          /* 2:3 portrait (width:height) */
  border: 1px solid var(--bulma-border, #dbdbdb);
  border-radius: 8px;
  background: #1a1a1a;    /* dark fallback behind the class art */
  box-shadow: var(--elevation-1);
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.wizard-kiosk-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--elevation-2);
}
/* Selected vs not-selected state. Only applies inside the kiosk; the
   .is-summary card in the summary panel opts out via its own selector below. */
.wizard-kiosk-card.is-not-selected {
  opacity: 0.75;
}
.wizard-kiosk-card.is-selected {
  border-width: 3px;
  border-color: var(--wizard-accent);
}
/* The summary-panel thumbnail is a static "display only" copy of the kiosk
   card. It should never participate in the selected/not-selected dimming. */
.wizard-kiosk-card.is-summary.is-not-selected,
.wizard-kiosk-card.is-summary.is-selected {
  opacity: 1;
  border-width: 1px;
  border-color: var(--bulma-border, #dbdbdb);
}
.wizard-kiosk-art {
  position: absolute;
  inset: 0;
  background-color: #222;
  background-repeat: no-repeat;
}
/* Top ribbon: class name. */
.wizard-kiosk-ribbon-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem 0.75rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.62) 70%, rgba(0,0,0,0) 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}
.wizard-kiosk-ribbon-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wizard-kiosk-ribbon-pcc {
  flex: 0 0 auto;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.18);
  color: #fff;
}
/* Bottom ribbon: edition. */
.wizard-kiosk-ribbon-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem 0.7rem;
  background: linear-gradient(0deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.62) 70%, rgba(0,0,0,0) 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}
.wizard-kiosk-ribbon-edition {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The center frame: static overlay at 50% top, sized to match the card.
   Centered horizontally via left/right=0 + auto margins so it follows the
   card (which is itself centered in the track) on any kiosk width. The
   frame is invisible by itself; four absolutely-positioned corner spans
   inside it draw L-shaped brackets that clearly mark the selected card
   without a heavy full-card border. */
.wizard-kiosk-frame {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  width: 18rem;
  max-width: calc(100% - 2rem);
  height: 27rem;
  margin: 0 auto;
  transform: translateY(-50%);
  border: 0;
  border-radius: 0;
  pointer-events: none;
}
.wizard-kiosk-frame-corner {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border: 0 solid var(--wizard-accent);
  /* A single soft accent glow so the bracket reads against dark class art
     without the heavy multi-layer "neon" look. */
  filter: drop-shadow(0 0 8px rgba(var(--wizard-accent-rgb), 0.40));
}
.wizard-kiosk-frame-corner-tl {
  top: 0;
  left: 0;
  border-top-width: 5px;
  border-left-width: 5px;
}
.wizard-kiosk-frame-corner-tr {
  top: 0;
  right: 0;
  border-top-width: 5px;
  border-right-width: 5px;
}
.wizard-kiosk-frame-corner-bl {
  bottom: 0;
  left: 0;
  border-bottom-width: 5px;
  border-left-width: 5px;
}
.wizard-kiosk-frame-corner-br {
  bottom: 0;
  right: 0;
  border-bottom-width: 5px;
  border-right-width: 5px;
}
.wizard-kiosk-hint {
  margin: 0;
  padding: 0.4rem 0.75rem;
  text-align: center;
}
/* Empty state: shown (by JS) when a search filters out every class, so the
   kiosk isn't a silent blank scroller. Overlays the centred card area. */
.wizard-kiosk-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  pointer-events: none;
}
.wizard-kiosk-empty[hidden] { display: none; }

/* Fitting animation: brief pulse + glow when a card is "just picked"
   (initial random center or overscroll random pick). JS removes/re-adds
   the class to retrigger the keyframes. */
@keyframes wizard-kiosk-flash {
  0%   { transform: scale(1);     box-shadow: 0 0 0 0   rgba(var(--wizard-accent-rgb),0.0),  var(--elevation-1); }
  35%  { transform: scale(1.015); box-shadow: 0 0 0 3px rgba(var(--wizard-accent-rgb),0.30), var(--elevation-1); }
  100% { transform: scale(1);     box-shadow: 0 0 0 0   rgba(var(--wizard-accent-rgb),0.0),  var(--elevation-1); }
}
.wizard-kiosk-card.is-flash {
  animation: wizard-kiosk-flash 240ms ease-out;
  border-color: var(--wizard-accent);
}
@media (prefers-reduced-motion: reduce) {
  .wizard-kiosk-card.is-flash { animation: none; }
}

/* Tips block under the description in the selected-class panel. */
.wizard-tips {
  background: var(--bulma-scheme-main-bis, #fafafa);
  border-left: 3px solid var(--bulma-info, #3e8ed0);
  border-radius: 4px;
  padding: 0.6rem 0.9rem;
}
.wizard-tips h5 { color: var(--bulma-info, #3e8ed0); }
.wizard-tips .content p:last-child { margin-bottom: 0; }

/* Step 4 shop items: pickable cards in the right column. Hover lifts the
   card and shifts the cursor; picked cards keep a thin primary border so
   the user can see what they've already added. Disabled cards (over the
   merx budget) get a desaturated look and default cursor. */
.gear-shop-item {
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.gear-shop-item:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(var(--bulma-black-rgb),0.08); }
.gear-shop-item.is-picked { border-color: var(--wizard-accent); }
.gear-shop-item.is-disabled { cursor: not-allowed; opacity: 0.55; }
.gear-shop-item.is-disabled:hover { transform: none; box-shadow: none; }
/* Deselect control: stays clickable and legible even when its card is
   disabled (over budget), so the user can free Merx and pick something else. */
.gear-remove { cursor: pointer; text-decoration: underline; }
.gear-remove:hover { text-decoration: none; }
.gear-shop-item.is-disabled .gear-remove { cursor: pointer; opacity: 1; }
/* Custom common-item names are free text (up to 80 chars, possibly one long
   unbroken word). Without this, such a name overflows the shop card's flex
   row — shoving the cost tag out — and the narrow summary column. Let the
   name shrink and wrap; keep the cost/Custom tags from being squashed. */
.gear-shop-item .title { min-width: 0; overflow-wrap: anywhere; }
.gear-shop-item .tag { flex-shrink: 0; }
.wizard-summary li { overflow-wrap: anywhere; }

/* Step 2: personality & stats.
   - .wizard-stat-grid is a 4×3 grid (12 stats). Each cell is one stat.
   - .wizard-stat-row stacks the stat's name, boxes, and labels vertically
     so the cell reads top-to-bottom inside the grid.
   - .wizard-stat-box represents a single point slot. The four visual
     states match the spec:
       .is-class       filled black (class/personality assigned, not clickable)
       .is-user        dark gray    (user assigned, click to remove)
       .is-assignable  light gray w/ dark border (click to add)
       .is-locked      dashed border (above the per-stat max, not clickable) */
.wizard-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
/* Phones: the 4-up grid is cramped and the pips wrap raggedly. Drop to 2
   columns. This override MUST come after the base rule above — media queries
   add no specificity, so an earlier-in-file media rule would lose to the base
   declaration. 12 stats in a single column would scroll too much, so 2. */
@media screen and (max-width: 768px) {
  .wizard-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.wizard-stat-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  background: var(--bulma-scheme-main-bis, #fafafa);
}
.wizard-stat-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--bulma-text, #4a4a4a);
  text-align: center;
}
.wizard-stat-boxes {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
}
.wizard-stat-box {
  width: 1.4rem;
  height: 1.4rem;
  border: 2.5px solid var(--bulma-border, #1a1a1a);
  border-radius: 3px;
  background: var(--wizard-stat-empty);
  cursor: default;
  transition: transform 80ms ease, background 80ms ease, border-color 80ms ease;
}
.wizard-stat-box.is-class {
  background: var(--wizard-stat-class);
  border-color: var(--wizard-stat-class);
  cursor: default;
}
.wizard-stat-box.is-user {
  background: var(--wizard-stat-user);
  border-color: var(--wizard-stat-user-edge);
  cursor: pointer;
}
.wizard-stat-box.is-user:hover { background: var(--wizard-stat-user-edge); }
.wizard-stat-box.is-assignable {
  background: var(--wizard-stat-empty);
  border-color: var(--wizard-stat-user);
  cursor: pointer;
}
.wizard-stat-box.is-assignable:hover {
  background: var(--wizard-stat-empty-hover);
  transform: translateY(-1px);
}
.wizard-stat-box.is-locked {
  background: transparent;
  border: 2.5px dashed var(--bulma-border, #1a1a1a);
  cursor: not-allowed;
  opacity: 0.5;
}
/* Interactive stat block control (views/partials/stat-blocks.handlebars).
   Shares .wizard-stat-box with the wizard's grid so the two read as one
   control. States:
     .is-set      a committed point
     .is-empty    an unfilled slot
     .is-preview  what a click on the hovered block would produce -- used in
                  BOTH directions, so hovering below the current value shows
                  the drop rather than pretending nothing would change */
.stat-blocks {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.wizard-stat-box.is-set {
  background: var(--wizard-stat-user);
  border-color: var(--wizard-stat-user-edge);
  cursor: pointer;
}
.wizard-stat-box.is-empty {
  background: var(--wizard-stat-empty);
  border-color: var(--wizard-stat-user);
  cursor: pointer;
}
.wizard-stat-box.is-empty:hover {
  background: var(--wizard-stat-empty-hover);
}
/* SPECIFICITY, do not reorder: the wizard's grid keeps .is-assignable /
   .is-user on a box and LAYERS .is-preview on top, so the block under the
   pointer matches a :hover rule and this one at the same time. The three
   :hover rules above are (0,3,0); a bare `.wizard-stat-box.is-preview` is
   (0,2,0) and loses, which paints the hovered block as empty and previews
   N-1 filled instead of N -- an off-by-one in the exact gesture the preview
   exists for. Matching :hover here makes that case (0,3,0) too, and this
   block sits BELOW the :hover rules so the tie resolves in its favour. Same
   equal-specificity-plus-source-order mechanism .is-preview already uses to
   beat `.wizard-stat-box.is-assignable` (0,2,0) at :1272 for the blocks that
   are NOT under the pointer. Moving this above the :hover rules, or dropping
   the :hover selector, reintroduces the bug. */
.wizard-stat-box.is-preview,
.wizard-stat-box.is-preview:hover {
  background: var(--wizard-stat-preview);
  border-color: var(--wizard-stat-user-edge);
  cursor: pointer;
}
/* A point the hovered click would give BACK. Dimming it (rather than
   emptying it) keeps the row's shape stable while the pointer moves. */
.wizard-stat-box.is-preview-off {
  opacity: 0.4;
}
/* Roving tabindex means only one block per stat is in the tab order; that
   block must show where focus is or keyboard users are navigating blind. */
.stat-blocks [role="radio"]:focus-visible {
  outline: 2px solid var(--bulma-link, #2e63b8);
  outline-offset: 2px;
}
/* The numeral shown beside a full row when a stat exceeds its block count. */
.stat-blocks-over {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bulma-text, #4a4a4a);
  margin-left: 0.15rem;
}
.stat-blocks.is-readonly .wizard-stat-box { cursor: default; }
/* Touch devices: the 1.4rem pips are far too small to tap reliably. Adjacent
   pips can't each be a full 44px without overlapping their neighbours, so we
   enlarge the box and the gap to give a much bigger hit area on coarse
   pointers while leaving the dense desktop layout untouched.
 *
 * SOURCE ORDER, do not move this block up: it MUST stay below all three of
 * the rules it overrides -- `.wizard-stat-boxes` (gap), `.wizard-stat-box`
 * (width/height), and `.stat-blocks` (gap). A media query adds NO
 * specificity and NO priority; `@media (pointer: coarse) { .stat-blocks }`
 * and a plain `.stat-blocks` are both (0,1,0), so the later one in the file
 * simply wins. This block used to sit between `.wizard-stat-box` and
 * `.stat-blocks`, which made the .wizard-* half work and the .stat-blocks
 * gap silently dead -- 2rem blocks with 0.3rem between them, the exact
 * touch-target defect this block exists to prevent, hidden behind a rule
 * that looked like the fix. Keeping every base rule above this one is what
 * makes it apply. Same equal-specificity-plus-source-order mechanism the
 * `.is-preview` rules above depend on. */
@media (pointer: coarse) {
  .wizard-stat-box {
    width: 2rem;
    height: 2rem;
  }
  /* Both containers, not just the wizard's. .stat-blocks is the interactive
     control that replaced the stat number inputs on the stats editor, the
     level-up modal, the character form, and the class form. */
  .wizard-stat-boxes,
  .stat-blocks {
    gap: 0.5rem;
  }
}
/* Coming-soon / disabled mode buttons in the character-new selector. */
.is-disabled-mode {
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}
.is-disabled-mode::after {
  content: "Coming soon";
  position: absolute;
  top: -0.6rem;
  right: -0.4rem;
  background: var(--bulma-warning, #ffe08a);
  color: var(--bulma-text-strong, #363636);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(var(--bulma-black-rgb), 0.15);
}
.wizard-stat-labels {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  min-width: 0;
}
/* Step 2 box: dim everything while the user hasn't picked all 3 traits. */
#statsBox[aria-disabled="true"] .wizard-stat-boxes {
  opacity: 0.45;
  pointer-events: none;
}
#statsBox[aria-disabled="true"] .wizard-stat-labels {
  opacity: 0.45;
}
/* Let the wizard step content fill the page container so it lines up with
   the summary box on any viewport. The Bulma .container already caps the
   width per breakpoint. */
.wizard-step {
  max-width: 100%;
}
/* Alpine is deferred, so the browser can paint un-initialized markup
   before it runs. x-cloak hides those elements until Alpine strips the
   attribute during init. */
[x-cloak] { display: none !important; }
/* Sortable character-list headers (views/character-list.handlebars, driven
   by the sortableTable Alpine component). Every clickable header carries
   data-sort-key, so key the affordance off that attribute rather than a
   class -- matches what the old inline script set via el.style before it
   was deleted, just as a stylesheet rule instead of per-element JS. */
[data-sort-key] {
  cursor: pointer;
  user-select: none;
}
