/* 7LOOP BOL themes
   Dark (DEFAULT): graphite + industrial yellow.
   Light: silver on blue (flat).
   Printable .bol-document stays formal black/white. */
:root,
html[data-theme="dark"] {
  --bg: #1a1c1e;
  --bg-elevated: #222528;
  --surface: #2a2d31;
  --surface-2: #32363b;
  --ink: #f4f5f6;
  --muted: #9aa0a6;
  --border: #3d4248;
  --border-light: #35393e;
  --accent: #f5c518;
  --accent-hover: #ffd54f;
  --accent-ink: #1a1c1e;
  --accent-dim: rgba(245, 197, 24, 0.16);
  --danger: #ff6b6b;
  --danger-bg: #3a1515;
  --warn: #f5a623;
  --warn-bg: #3a2a12;
  --ok: #8bc34a;
  --ok-bg: #1e2e14;
  --input-bg: #1e2124;
  --input-disabled: #26292d;
  --bubble-bg: #1e2124;
  --chrome-bg: #141618;
  --chrome-fg: #f4f5f6;
  --chrome-border: #2f3338;
  --radius: 4px;
  --glow-accent: 0 0 8px rgba(245, 197, 24, 0.28);
  --glow-accent-sm: 0 0 4px rgba(245, 197, 24, 0.22);
  --glow-text: none;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
html[data-theme="light"] {
  /* Cool silver on blue (flat) */
  --bg: #c5d4e8;
  --bg-elevated: #d4e0f0;
  --surface: #e8eef6;
  --surface-2: #f3f6fb;
  --ink: #152033;
  --muted: #4a5d78;
  --border: #90b4c8;
  --border-light: #b8c7dc;
  --accent: #1e5eff;
  --accent-hover: #3d75ff;
  --accent-ink: #ffffff;
  --accent-dim: rgba(30, 94, 255, 0.16);
  --danger: #c62828;
  --danger-bg: #ffebee;
  --warn: #e67a00;
  --warn-bg: #fff3e0;
  --ok: #1b7a3d;
  --ok-bg: #e8f5e9;
  --input-bg: #f7f9fc;
  --input-disabled: #dfe6f0;
  --bubble-bg: #f0f4fa;
  --chrome-bg: #1a3a6e;
  --chrome-fg: #f3f6fb;
  --chrome-border: #0f274d;
  --radius: 4px;
  --glow-accent: 0 0 8px rgba(30, 94, 255, 0.25);
  --glow-accent-sm: 0 0 4px rgba(30, 94, 255, 0.2);
  --glow-text: none;
  color-scheme: light;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0.01em;
  background-color: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
}
.screen.active { display: flex; }

/* Sticky bottom action bar (thumb-friendly) */
.bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background-color: var(--chrome-bg);
  border-top: 2px solid var(--accent);
  margin-top: auto;
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}
.bottom-bar .btn {
  flex: 1;
  width: 100%;
  min-height: 52px;
  font-size: 1.1rem;
}
.bottom-bar .btn-generate {
  background: var(--accent) !important;
  color: var(--accent-ink) !important;
  border-color: var(--accent) !important;
}
.bottom-bar-stack {
  flex-direction: column;
}
.bottom-bar-row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.bottom-bar-row .btn {
  flex: 1;
}
.bottom-bar-stack .btn-ocr {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bottom-bar-stack .btn-ocr:active {
  border-color: var(--accent);
  color: var(--accent);
}
.bottom-bar .btn-clear-stops-bar {
  background: transparent;
  color: #ff8a80;
  border: 2px solid #5a3030;
  min-height: 52px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: none !important;
  font-weight: 700;
}
.bottom-bar .btn-clear-stops-bar:active {
  background: rgba(255, 138, 128, 0.12);
  border-color: #ff8a80;
}
.bottom-bar .btn-save-draft {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--accent);
  min-height: 52px;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: none !important;
}
.bottom-bar .btn-save-draft:active {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}
.main-content.has-bottom-bar {
  padding-bottom: calc(16px + var(--safe-bottom));
}


.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: calc(52px + var(--safe-top));
  padding: var(--safe-top) 12px 8px;
  background-color: var(--chrome-bg);
  color: var(--chrome-fg);
  border-bottom: 2px solid var(--accent);
}
.topbar-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.app-version {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--chrome-fg, var(--ink));
  opacity: 0.38;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.app-version:active,
.app-version:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.topbar-spacer { width: 40px; }
.app-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact Save in Settings topbar — avoids overlap with title/version */
#btn-settings-save,
.btn-topbar-save {
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 2px 0 #9a9a9a,
    0 2px 6px rgba(0, 0, 0, 0.25);
}
#btn-settings-save:active,
.btn-topbar-save:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 transparent;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border: none;
  background: transparent;
  color: var(--chrome-fg);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { background: rgba(255,255,255,0.15); }

.main-content {
  flex: 1;
  padding: 10px 12px calc(20px + var(--safe-bottom));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(0, 0, 0, 0.12) 100%
  );
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 2px 0 rgba(0, 0, 0, 0.4),
    0 3px 8px rgba(0, 0, 0, 0.22);
  transition: box-shadow 0.12s, transform 0.12s, filter 0.12s;
}
.btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(0, 0, 0, 0.25),
    0 0 0 transparent;
  filter: brightness(0.96);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}
.btn-primary {
  background-color: #f2f2f2;
  background-image: linear-gradient(180deg, #ffffff 0%, #f0f0f0 45%, #d8d8d8 100%);
  color: #111;
  border-color: #c8c8c8;
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 2px 0 #9a9a9a,
    0 3px 8px rgba(0, 0, 0, 0.28);
}
.btn-primary:active {
  background-image: linear-gradient(180deg, #d0d0d0 0%, #e4e4e4 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.35),
    0 0 0 transparent;
  transform: translateY(2px);
}
.btn-primary:disabled {
  background: #888;
  border-color: #888;
  color: #ddd;
  opacity: 1;
  box-shadow: none;
}

/* Industrial raised CTAs (yellow dark / blue light) */
.btn-bright {
  background-color: var(--accent) !important;
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.12) 38%,
    rgba(0, 0, 0, 0.18) 100%
  ) !important;
  color: var(--accent-ink) !important;
  border: 1px solid rgba(0, 0, 0, 0.25) !important;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 3px 0 #8a7008,
    0 5px 14px rgba(245, 197, 24, 0.28);
}
.btn-bright:active {
  background-image: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.12) 0%,
    rgba(255, 255, 255, 0.08) 100%
  ) !important;
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(0, 0, 0, 0.2),
    0 0 0 #8a7008 !important;
  transform: translateY(2px);
}
.bottom-bar .btn-bright,
.bottom-bar .btn-generate,
html[data-theme="dark"] .btn-bright,
html[data-theme="dark"] .bottom-bar .btn-bright {
  color: var(--accent-ink) !important;
  border-color: rgba(0, 0, 0, 0.28) !important;
}
html[data-theme="light"] .btn-bright,
html[data-theme="light"] .bottom-bar .btn-bright,
html[data-theme="light"] .bottom-bar .btn-generate {
  border-color: rgba(0, 0, 0, 0.28) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 3px 0 #0d3a9e,
    0 5px 14px rgba(30, 94, 255, 0.3) !important;
}
html[data-theme="light"] .btn-bright:active {
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.35),
    0 0 0 #0d3a9e !important;
  transform: translateY(2px);
}
html[data-theme="light"] .home-bol-item {
  border-left-color: var(--accent);
}
html[data-theme="light"] .home-bol-date,
html[data-theme="light"] .section-title,
html[data-theme="light"] .equip-section-label {
  color: var(--accent);
}
html[data-theme="light"] .bottom-bar {
  border-top-color: var(--accent);
}
html[data-theme="light"] .topbar {
  border-bottom-color: var(--accent);
}

/* ========== Flat surfaces (no carbon/steel textures) ========== */
html[data-theme="dark"] body {
  background-color: var(--bg);
  background-image: none;
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .stop-card,
html[data-theme="dark"] .home-bol-item,
html[data-theme="dark"] .ticket-display,
html[data-theme="dark"] .fields-card {
  background-color: var(--surface);
  background-image: none;
}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .bottom-bar {
  background-color: var(--chrome-bg);
  background-image: none;
  box-shadow: 0 0 10px rgba(245, 197, 24, 0.08);
}
html[data-theme="dark"] .btn-bright,
html[data-theme="dark"] .bottom-bar .btn-bright {
  /* keep raised bevel; soft accent glow only */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 3px 0 #8a7008,
    var(--glow-accent),
    0 5px 12px rgba(0, 0, 0, 0.35) !important;
}
html[data-theme="dark"] .bubble.selected {
  box-shadow: var(--glow-accent-sm);
}
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .equip-section-label,
html[data-theme="dark"] .home-bol-date {
  text-shadow: none;
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
  box-shadow: var(--glow-accent-sm);
}

html[data-theme="light"] body {
  background-color: var(--bg);
  background-image: none;
}
html[data-theme="light"] .card,
html[data-theme="light"] .stop-card,
html[data-theme="light"] .home-bol-item,
html[data-theme="light"] .ticket-display,
html[data-theme="light"] .fields-card {
  background-color: var(--surface);
  background-image: none;
  border-color: #a8bcd4;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 1px 2px rgba(21, 40, 70, 0.1);
}
html[data-theme="light"] .home-bol-item {
  border-left-color: var(--accent);
}
html[data-theme="light"] .topbar,
html[data-theme="light"] .bottom-bar {
  background-color: var(--chrome-bg);
  background-image: none;
  box-shadow: 0 0 10px rgba(30, 94, 255, 0.1);
}
html[data-theme="light"] .btn-bright,
html[data-theme="light"] .bottom-bar .btn-bright {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 3px 0 #0d3a9e,
    var(--glow-accent),
    0 5px 12px rgba(21, 40, 70, 0.22) !important;
}
html[data-theme="light"] .bubble.selected {
  box-shadow: var(--glow-accent-sm);
}
html[data-theme="light"] .section-title,
html[data-theme="light"] .equip-section-label,
html[data-theme="light"] .home-bol-date {
  text-shadow: none;
}
html[data-theme="light"] input:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] select:focus {
  box-shadow: var(--glow-accent-sm);
}

/* Printable receipt stays clean */
.bol-document,
.bol-document * {
  background-image: none !important;
  text-shadow: none;
}




#screen-home .main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Clearance so last tickets aren't under the pinned Misty icon */
  padding-bottom: calc(36px + var(--safe-bottom));
}
.btn-home-generate {
  width: 100%;
  max-width: 420px;
  min-height: 56px;
  font-size: 1.15rem;
  margin-bottom: 12px;
}
.home-pending-wrap {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 16px;
}
.home-pending-wrap.hidden {
  display: none;
}
.home-pending-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-left: 3px solid #f0a020;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.home-pending-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  padding: 12px 10px 12px 14px;
  min-height: 72px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.home-pending-row:active {
  background-color: var(--surface-2);
}
.home-pending-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: #f0a020;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.home-pending-summary {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}
.home-pending-saved {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.home-pending-discard {
  flex-shrink: 0;
  align-self: center;
  margin: 0 8px 0 0;
  padding: 8px 10px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
}
.home-pending-discard:hover,
.home-pending-discard:focus-visible {
  color: var(--danger);
  border-color: var(--danger);
  outline: none;
}
.home-pending-discard:active {
  transform: scale(0.96);
  color: var(--danger);
}
.home-section-title {
  margin: 2px 0 8px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.home-bol-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: 100%;
  max-width: 420px;
}
#home-empty {
  max-width: 420px;
  text-align: center;
}
.home-bol-list > li,
.home-bol-item {
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
}
.home-bol-item .home-bol-row {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.home-bol-trash {
  flex-shrink: 0;
  align-self: center;
  width: 40px;
  height: 40px;
  margin: 0 6px 0 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.home-bol-trash:hover,
.home-bol-trash:focus-visible {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  outline: none;
}
.home-bol-trash:active {
  transform: scale(0.94);
  color: var(--danger);
}
.home-bol-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  text-align: center;
  padding: 12px 8px 12px 14px;
  min-height: 68px;
  border: none;
  background-color: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.home-bol-item:active .home-bol-row:active,
.home-bol-row:active {
  background-color: var(--surface-2);
}
.home-bol-date {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.home-bol-ticket {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.home-bol-place {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}
.preview-top-actions {
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preview-top-actions .btn {
  flex: 1 1 calc(50% - 4px);
  width: auto;
  min-width: 140px;
}

.btn-generate {
  width: 100%;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-add-stop {
  width: 100%;
  margin-top: 8px;
  background: var(--bg-elevated);
  border-style: dashed;
  border-color: var(--border);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}
.btn-secondary {
  width: 100%;
  background-color: var(--surface);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(0, 0, 0, 0.14) 100%
  );
}
.btn-danger-outline {
  width: 100%;
  border-color: var(--danger);
  color: var(--danger);
  margin-top: 8px;
}
.btn-sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.generate-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.ticket-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 14px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
}
.ticket-display.hidden { display: none; }
.ticket-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.ticket-number {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.section-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.hint {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85em;
}

.field-row {
  margin-bottom: 12px;
}
.field-row:last-child { margin-bottom: 0; }
.field-row label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  color: var(--muted);
}
.field-row {
  margin-bottom: 10px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font-size: 16px; /* prevent iOS zoom */
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.35;
}

/* Per-stop check-in / check-out (side-by-side without card overflow) */
.stop-times-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  gap: 8px;
  margin-bottom: 10px;
}
.stop-time-box {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}
.stop-time-box label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  color: var(--muted);
}
.stop-time-box input[type="datetime-local"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-left: 7px;
  padding-right: 7px;
  font-size: 14px;
}
.stop-notes-row textarea.stop-notes {
  min-height: 56px;
  resize: vertical;
}
.bol-stop-times {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 11px;
  margin-bottom: 4px;
  font-family: Arial, Helvetica, sans-serif;
}
.bol-stop-notes {
  font-size: 11px;
  margin: 4px 0;
  font-family: Arial, Helvetica, sans-serif;
}

/* ========== Per-stop signature accordion (generate) ========== */
.stop-sig-accordion {
  margin: 10px 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stop-sig-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  min-height: var(--tap);
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.95rem;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.stop-sig-summary::-webkit-details-marker { display: none; }
.stop-sig-summary::marker { content: ''; }
.stop-sig-summary-text {
  flex: 1;
  min-width: 0;
}
.stop-sig-badge {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--muted);
  border: 1px solid var(--border);
}
.stop-sig-badge.has-sig {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border-color: var(--accent);
}
.stop-sig-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.stop-sig-preview {
  margin-top: 12px;
  min-height: 96px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.stop-sig-preview.empty {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.stop-sig-preview img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}
/* Portrait ink on generate preview (same −90° as BOL) */
.stop-sig-preview img.bol-sig-ink {
  max-width: 100px;
  max-height: 160px;
}
.stop-sig-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.stop-sig-actions .stop-sig-btn {
  flex: 1;
  min-height: var(--tap);
}

/* Per-stop signature on BOL preview / PDF */
.bol-stop-sig {
  margin: 6px 0 4px;
  padding: 4px 6px 6px;
  border: 1.5px solid #000;
  background: #fff;
}
.bol-stop-sig-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: Arial, Helvetica, sans-serif;
  margin-bottom: 3px;
}
.bol-stop-sig-pad {
  min-height: 72px;
  height: 80px;
  border-bottom: 1.5px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bol-stop-sig-pad img.bol-sig-ink {
  max-width: 70px;
  max-height: 160px;
}

@media (max-width: 360px) {
  .stop-times-row {
    flex-direction: column;
    gap: 8px;
  }
  .stop-time-box {
    width: 100%;
  }
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
input:disabled, textarea:disabled {
  background: var(--input-disabled);
  color: var(--muted);
}

.input-with-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-with-confirm input { flex: 1; min-width: 0; }

/* ===== Confirm bang — compact horizontal glass neon (v114-test) ===== */
.confirm-bang,
.stop-confirm-bang {
  --confirm-neon: #ff9a1a;
  --confirm-neon-soft: rgba(255, 154, 26, 0.55);
  --confirm-fill-top: rgba(255, 140, 20, 0.22);
  --confirm-fill-bot: rgba(80, 35, 0, 0.55);
  flex-shrink: 0;
  width: auto;
  min-width: 126px;
  max-width: 156px;
  min-height: 44px;
  height: 44px;
  box-sizing: border-box;
  border: 2px solid var(--confirm-neon);
  border-radius: 12px;
  background:
    linear-gradient(165deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.04) 28%, transparent 48%),
    linear-gradient(180deg, var(--confirm-fill-top) 0%, var(--confirm-fill-bot) 100%),
    rgba(18, 14, 10, 0.72);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.05;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.35) inset,
    0 -8px 14px rgba(0,0,0,0.35) inset,
    0 0 0 1px rgba(0,0,0,0.45),
    0 4px 12px rgba(0,0,0,0.4),
    0 0 10px var(--confirm-neon-soft),
    0 0 20px color-mix(in srgb, var(--confirm-neon) 30%, transparent);
  animation: confirm-aura-orange 2.4s ease-in-out infinite;
  overflow: hidden;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.stop-confirm-bang {
  min-width: 126px;
  /* Own overflow:hidden on shared .confirm-bang rule clips neon glow — keep glow visible in header */
  overflow: visible;
}
.confirm-button-label {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: left;
  line-height: 1.05;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  text-shadow: 0 0 8px rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.6);
}
.confirm-mark {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--confirm-neon);
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  animation: none !important;
  filter: drop-shadow(0 0 6px var(--confirm-neon-soft));
}
.stop-confirm-bang .confirm-mark {
  flex-basis: auto;
  width: 28px;
  height: 28px;
}

.confirm-bang.hidden,
.stop-confirm-bang.hidden { display: none; }
.confirm-bang:active,
.stop-confirm-bang:active {
  filter: brightness(0.95);
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.2) inset,
    0 -4px 10px rgba(0,0,0,0.4) inset,
    0 3px 8px rgba(0,0,0,0.35),
    0 0 12px var(--confirm-neon-soft);
}
.confirm-bang.confirmed {
  display: none;
}
/* Pending: orange triangle + ? (left icon) */
.confirm-warn-glyph {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
}
.confirm-warn-glyph svg {
  display: block;
  width: 22px;
  height: 20px;
  filter: drop-shadow(0 0 4px var(--confirm-neon-soft));
}
.confirm-q {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(255,180,60,0.8), 0 1px 2px rgba(0,0,0,0.55);
}
.confirm-err-glyph {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2.5px solid currentColor;
  background: color-mix(in srgb, currentColor 18%, transparent);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 17px;
  text-align: center;
  box-sizing: border-box;
  color: var(--confirm-neon);
  filter: drop-shadow(0 0 6px var(--confirm-neon-soft));
}
.confirm-ok-glyph {
  display: none;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
}
.confirm-ok-glyph svg {
  display: block;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px var(--confirm-neon-soft));
}

/* Confirmed: green glass neon + check */
.confirm-bang.is-confirmed,
.stop-confirm-bang.is-confirmed {
  --confirm-neon: #3dff6a;
  --confirm-neon-soft: rgba(61, 255, 106, 0.55);
  --confirm-fill-top: rgba(40, 200, 80, 0.22);
  --confirm-fill-bot: rgba(10, 60, 25, 0.55);
  border-color: var(--confirm-neon);
  background:
    linear-gradient(165deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.04) 28%, transparent 48%),
    linear-gradient(180deg, var(--confirm-fill-top) 0%, var(--confirm-fill-bot) 100%),
    rgba(10, 18, 12, 0.72);
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.35) inset,
    0 -10px 18px rgba(0,0,0,0.35) inset,
    0 0 0 1px rgba(0,0,0,0.45),
    0 8px 18px rgba(0,0,0,0.45),
    0 0 14px var(--confirm-neon-soft),
    0 0 28px color-mix(in srgb, var(--confirm-neon) 35%, transparent);
  animation: confirm-aura-green-once 0.85s ease-out 1;
}
.confirm-bang.is-confirmed .confirm-mark,
.stop-confirm-bang.is-confirmed .confirm-mark {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit;
  animation: none !important;
}
.confirm-bang.is-confirmed .confirm-warn-glyph,
.stop-confirm-bang.is-confirmed .confirm-warn-glyph,
.confirm-bang.is-confirmed .confirm-err-glyph,
.stop-confirm-bang.is-confirmed .confirm-err-glyph {
  display: none !important;
}
.confirm-bang.is-confirmed .confirm-ok-glyph,
.stop-confirm-bang.is-confirmed .confirm-ok-glyph {
  display: inline-flex;
}
.confirm-bang.is-confirmed:active,
.stop-confirm-bang.is-confirmed:active {
  filter: brightness(0.92);
  color: #f1ffe8;
}
.confirm-bang.is-confirmed:active .confirm-mark,
.stop-confirm-bang.is-confirmed:active .confirm-mark {
  background: transparent !important;
}

/* Error state wins over confirmed */
.confirm-bang.field-error.is-confirmed .confirm-mark,
.stop-confirm-bang.field-error.is-confirmed .confirm-mark {
  border: none !important;
  background: transparent !important;
  color: inherit;
}
.confirm-bang.field-error.is-confirmed .confirm-ok-glyph,
.stop-confirm-bang.field-error.is-confirmed .confirm-ok-glyph {
  display: none !important;
}

/* Invalid: red glass neon + rounded-square ! — few fast flashes */
.confirm-bang.field-error,
.stop-confirm-bang.field-error {
  --confirm-neon: #ff3b3b;
  --confirm-neon-soft: rgba(255, 59, 59, 0.55);
  --confirm-fill-top: rgba(255, 60, 60, 0.22);
  --confirm-fill-bot: rgba(70, 10, 10, 0.55);
  border-color: var(--confirm-neon);
  background:
    linear-gradient(165deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.04) 28%, transparent 48%),
    linear-gradient(180deg, var(--confirm-fill-top) 0%, var(--confirm-fill-bot) 100%),
    rgba(18, 10, 10, 0.72);
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.35) inset,
    0 -10px 18px rgba(0,0,0,0.35) inset,
    0 0 0 1px rgba(0,0,0,0.45),
    0 8px 18px rgba(0,0,0,0.45),
    0 0 14px var(--confirm-neon-soft),
    0 0 28px color-mix(in srgb, var(--confirm-neon) 35%, transparent);
  animation: confirm-aura-red-flash 0.28s ease-in-out 4;
}
.confirm-bang.field-error .confirm-mark,
.stop-confirm-bang.field-error .confirm-mark {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit;
  animation: none !important;
}
.confirm-bang.field-error .confirm-warn-glyph,
.stop-confirm-bang.field-error .confirm-warn-glyph {
  display: none;
}
.confirm-bang.field-error .confirm-err-glyph,
.stop-confirm-bang.field-error .confirm-err-glyph {
  display: inline-block;
}
.confirm-bang.field-error:active,
.stop-confirm-bang.field-error:active {
  filter: brightness(0.92);
  color: #fff0f0;
}
.confirm-bang.field-error:active .confirm-mark,
.stop-confirm-bang.field-error:active .confirm-mark {
  background: transparent !important;
  color: inherit;
}

@keyframes confirm-aura-orange {
  0%, 100% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.45) inset,
      0 -2px 4px rgba(0,0,0,0.28) inset,
      0 4px 10px rgba(0,0,0,0.28),
      0 0 0 1px rgba(255,180,60,0.25),
      0 0 10px color-mix(in srgb, var(--warn) 30%, transparent);
  }
  50% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.5) inset,
      0 -2px 4px rgba(0,0,0,0.28) inset,
      0 4px 12px rgba(0,0,0,0.3),
      0 0 0 1px rgba(255,200,80,0.4),
      0 0 22px color-mix(in srgb, var(--warn) 65%, transparent);
  }
}
@keyframes confirm-aura-green-once {
  0% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.45) inset,
      0 -2px 4px rgba(0,0,0,0.28) inset,
      0 4px 10px rgba(0,0,0,0.28),
      0 0 0 1px rgba(120,220,100,0.2),
      0 0 8px color-mix(in srgb, var(--ok) 25%, transparent);
  }
  40% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.55) inset,
      0 -2px 4px rgba(0,0,0,0.28) inset,
      0 5px 14px rgba(0,0,0,0.32),
      0 0 0 2px rgba(160,255,140,0.55),
      0 0 28px color-mix(in srgb, var(--ok) 80%, transparent);
  }
  100% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.45) inset,
      0 -2px 4px rgba(0,0,0,0.28) inset,
      0 4px 10px rgba(0,0,0,0.28),
      0 0 0 1px rgba(120,220,100,0.28),
      0 0 14px color-mix(in srgb, var(--ok) 45%, transparent);
  }
}
@keyframes confirm-aura-red-flash {
  0%, 100% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.4) inset,
      0 -2px 4px rgba(0,0,0,0.3) inset,
      0 4px 10px rgba(0,0,0,0.28),
      0 0 0 1px rgba(255,100,100,0.25),
      0 0 8px color-mix(in srgb, var(--danger) 30%, transparent);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 1px 0 rgba(255,255,255,0.5) inset,
      0 -2px 4px rgba(0,0,0,0.3) inset,
      0 5px 14px rgba(0,0,0,0.35),
      0 0 0 2px rgba(255,160,160,0.7),
      0 0 30px color-mix(in srgb, var(--danger) 90%, transparent);
    filter: brightness(1.18);
  }
}

/* Stop cards — base padding keeps stop-confirm-bang glow inside the card */
.stop-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
  overflow: visible;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.stop-card.needs-confirm {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 55%, transparent);
}
.stop-card.needs-confirm.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.stop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  /* Room for neon glow/border on stop-confirm-bang (was clipped at top) */
  padding-top: 4px;
  padding-bottom: 2px;
  min-height: 48px;
  overflow: visible;
}
.stop-drag-handle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  letter-spacing: -0.12em;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.stop-drag-handle:active,
.stop-card.is-dragging .stop-drag-handle {
  cursor: grabbing;
  color: var(--text);
  background: color-mix(in srgb, var(--border) 55%, transparent);
}
.stop-drag-handle:focus-visible {
  outline: 2px solid var(--accent, #f0b020);
  outline-offset: 2px;
}
.stop-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  flex: 1;
}
.stop-card.is-dragging {
  opacity: 0.96;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  border-color: color-mix(in srgb, var(--accent, #f0b020) 55%, var(--border));
  z-index: 40;
  pointer-events: none;
}
.stop-card-placeholder {
  border: 2px dashed color-mix(in srgb, var(--accent, #f0b020) 55%, var(--border));
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--accent, #f0b020) 12%, transparent);
  box-sizing: border-box;
}
.stops-container.is-reordering {
  /* Avoid text selection while dragging stops on phone */
  -webkit-user-select: none;
  user-select: none;
}
.btn-remove-stop {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.type-bubbles, .load-bubbles {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.bubble {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bubble-bg);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.bubble.selected {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.bubble.bubble-disabled {
  opacity: 0.35;
  pointer-events: none;
}
.bubble input { display: none; }

.stop-details {
  display: none;
}
.stop-details.enabled { display: block; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin-bottom: 12px;
  padding: 4px 0;
}
/* Text label grows; switch label stays fixed oval (never width:100%) */
.toggle-row > label:not(.toggle) {
  font-size: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  max-width: 44px;
  flex: 0 0 44px;
  flex-grow: 0;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  vertical-align: middle;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 24px;
  max-width: 44px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 1px;
  top: 1px;
  background: linear-gradient(180deg, #ffffff 0%, #e8e8e8 100%);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  transition: transform 0.15s;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--glow-accent-sm, none);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
  border-color: transparent;
}

.divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

.stops-container { margin-top: 4px; }

/* Address book */
.address-book-list, .history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.address-book-list li, .history-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.address-book-list li span, .history-item-info {
  flex: 1;
  font-size: 0.9rem;
  word-break: break-word;
}
.history-item-info strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 2px;
}
.history-item-meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.history-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: var(--chrome-bg);
  color: var(--chrome-fg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  text-align: center;
}
.toast.hidden { display: none; }

.preview-main { max-width: 720px; }
.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.save-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 12px 0 0;
  text-align: center;
}

/* ========== BOL DOCUMENT (print / capture) — always white/black ========== */
.bol-document {
  background: #fff !important;
  color: #000 !important;
  border: 1.5px solid #000;
  color-scheme: light;
  padding: 16px;
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 11.5px;
  line-height: 1.25;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
  background-image: none !important;
  text-shadow: none;
}
.bol-document.bol-multipage {
  background: transparent !important;
  border: none;
  padding: 0;
  max-width: 680px;
}
.bol-page {
  background: #fff !important;
  color: #000 !important;
  border: 1.5px solid #000;
  box-sizing: border-box;
  padding: 14px 16px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto 18px;
  /* ~ US Letter aspect at preview width (680 × 11/8.5 ≈ 880) */
  min-height: 880px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.bol-page:last-child {
  margin-bottom: 0;
}
.bol-page-num {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #333;
}
.bol-cont-note {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  color: #444;
}
.bol-page-continued {
  margin-top: auto;
  padding-top: 10px;
  font-size: 10px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  text-align: right;
  color: #555;
  border-top: 1px dashed #999;
}
.bol-header-compact {
  margin-bottom: 6px;
  padding-bottom: 6px;
}
.bol-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.bol-company {
  flex: 1;
}
.bol-logo {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.15;
}
.bol-brand .bol-logo {
  font-size: 15px;
}
.bol-contact {
  font-size: 11px;
  line-height: 1.35;
}
.bol-title-block {
  text-align: right;
}
.bol-title {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 6px;
  letter-spacing: 0.04em;
  font-family: Arial, Helvetica, sans-serif;
}
.bol-comp-box,
.bol-alvys-box {
  display: inline-block;
  border: 1.5px solid #000;
  border-radius: 0;
  padding: 4px 10px;
  text-align: center;
  min-width: 120px;
}
.bol-alvys-box {
  display: block;
  margin: 0 0 6px auto;
  max-width: 200px;
}
.bol-alvys-box .bol-comp-label {
  color: #000;
}
.bol-stop-refs {
  font-size: 11px;
  margin: 0 0 4px;
  padding: 3px 0;
  border-bottom: 1px solid #000;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.bol-stop-refs strong {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bol-comp-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}
.bol-comp-no {
  font-size: 16px;
  font-weight: 800;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.03em;
}

.bol-header-meta {
  margin-top: 6px;
  text-align: right;
  font-size: 10px;
  line-height: 1.35;
  max-width: 220px;
  margin-left: auto;
}
.bol-meta-k {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: Arial, Helvetica, sans-serif;
  margin-right: 4px;
}
.bol-header-driver {
  margin-top: 1px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}
.bol-trailer-line {
  border: 1.5px solid #000;
  padding: 5px 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.01em;
  word-break: break-word;
  line-height: 1.35;
}
.bol-addr-row {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  border: 1.5px solid #000;
}
.bol-addr-row-tight .bol-addr-box {
  min-height: 0;
  padding: 4px 6px;
}
.bol-addr-row-tight .bol-addr-body {
  font-size: 11px;
}
.bol-addr-row .bol-addr-box {
  border: none;
  border-right: 1.5px solid #000;
}
.bol-addr-row .bol-addr-box:last-child {
  border-right: none;
}
.bol-addr-box {
  flex: 1;
  border: 1.5px solid #000;
  border-radius: 0;
  padding: 6px 8px;
  min-height: 48px;
}
.bol-addr-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  font-family: Arial, Helvetica, sans-serif;
}
.bol-addr-body {
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.bol-stops-list {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bol-stop-item {
  border: 1.5px solid #000;
  border-radius: 0;
  padding: 6px 8px;
  margin: 0;
}
.bol-stop-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: 11px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.bol-stop-badge {
  display: inline-block;
  border: 1px solid #000;
  border-radius: 0;
  padding: 1px 5px;
  font-size: 9px;
  margin-left: 6px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #fff;
}
.bol-stop-meta {
  font-size: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}

.bol-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1.5px solid #000;
  margin-bottom: 8px;
}
.bol-truck-grid {
  grid-template-columns: repeat(3, 1fr);
}
.bol-truck-grid .bol-grid-cell {
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}
.bol-truck-grid .bol-grid-cell:nth-child(3n) { border-right: none; }
.bol-truck-grid .bol-grid-cell:nth-last-child(-n+3) { border-bottom: none; }
.bol-grid-cell {
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 4px 6px;
  min-height: 36px;
}
.bol-grid-cell:nth-child(4n) { border-right: none; }
.bol-grid-label {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  display: block;
  margin-bottom: 2px;
}
.bol-grid-value {
  font-size: 12px;
  font-weight: 600;
  word-break: break-word;
}
.bol-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  margin-top: 2px;
}
.bol-check {
  white-space: nowrap;
}
.bol-check .box {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid #000;
  border-radius: 0;
  margin-right: 3px;
  vertical-align: -1px;
  text-align: center;
  font-size: 8px;
  line-height: 9px;
  font-weight: 900;
}

.bol-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #000;
  margin-bottom: 10px;
}
.bol-table th, .bol-table td {
  border: 1px solid #000;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.bol-table th {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  font-family: Arial, Helvetica, sans-serif;
  background: #f0f0f0;
}
.bol-table td { font-size: 12px; min-height: 28px; }
.bol-table .col-pcs { width: 12%; }
.bol-table .col-desc { width: 48%; }
.bol-table .col-wt { width: 20%; }
.bol-table .col-dmg { width: 20%; }

.bol-footer {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #000;
}
.bol-sig {
  flex: 2;
}
.bol-sig-line {
  border-bottom: 1.5px solid #000;
  min-height: 28px;
  margin-top: 4px;
  padding-bottom: 2px;
  font-size: 13px;
  font-weight: 600;
}
.bol-footer-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bol-footer-field .label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  font-family: Arial, Helvetica, sans-serif;
}
.bol-footer-field .value {
  border-bottom: 1.5px solid #000;
  min-height: 22px;
  font-size: 12px;
  padding-top: 2px;
}

@media (max-width: 400px) {
  .bol-addr-row { flex-direction: column; }
  .bol-grid { grid-template-columns: repeat(2, 1fr); }
  .bol-truck-grid { grid-template-columns: repeat(2, 1fr); }
  .bol-truck-grid .bol-grid-cell:nth-child(3n) { border-right: 1px solid #000; }
  .bol-truck-grid .bol-grid-cell:nth-child(2n) { border-right: none; }
  .bol-truck-grid .bol-grid-cell:nth-last-child(-n+3) { border-bottom: 1px solid #000; }
  .bol-truck-grid .bol-grid-cell:nth-last-child(-n+2) { border-bottom: none; }
  .bol-grid-cell:nth-child(2n) { border-right: none; }
  .bol-grid-cell:nth-child(4n) { border-right: 1px solid #000; }
  .bol-grid-cell:nth-child(2n) { border-right: none; }
  .bol-footer { flex-direction: column; }
  .bol-stop-meta { grid-template-columns: 1fr; }
}


/* ========== E-signature ========== */
.sig-settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.sig-preview {
  min-height: 72px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}
.sig-preview.empty {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.sig-preview img {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
}

.bol-sig-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 8px;
  padding-top: 0;
  border-top: 1.5px solid #000;
}
.bol-sig-row .bol-sig-box {
  border-right: none;
  border-top: none;
}
.bol-sig-row .bol-sig-box:first-child {
  border-left: none;
}
.bol-sig-row .bol-sig-box:last-child {
  border-right: none;
}
.bol-sig-box {
  flex: 1 1 28%;
  min-width: calc(33% - 8px);
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #000;
  border-radius: 0;
  padding: 6px 8px 8px;
  min-height: 150px;
  background: #fff;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.bol-sig-box:active {
  background: #f5f5f5;
}
.bol-sig-box .bol-sig-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: Arial, Helvetica, sans-serif;
  margin-bottom: 4px;
}
.bol-sig-box .bol-sig-pad {
  border-bottom: 1.5px solid #000;
  min-height: 120px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.bol-sig-box .bol-sig-pad img {
  max-width: 100%;
  max-height: 118px;
  object-fit: contain;
  display: block;
}
.bol-sig-box .bol-sig-tap-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #888;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  pointer-events: none;
}
.bol-sig-box.has-ink .bol-sig-tap-hint { display: none; }

.bol-footer-meta-row {
  display: flex;
  gap: 0;
  margin-top: 6px;
  border: 1.5px solid #000;
  border-bottom: none;
  align-items: stretch;
}
.bol-footer-meta-compact {
  min-height: 0;
}
.bol-footer-meta-row .bol-footer-field {
  flex: 1;
  padding: 2px 6px 3px;
  border-right: 1px solid #000;
}
.bol-footer-meta-row .bol-footer-field:last-child {
  border-right: none;
}
.bol-footer-meta-compact .bol-footer-field .label {
  font-size: 8px;
  line-height: 1.1;
  margin: 0;
}
.bol-footer-meta-compact .bol-footer-field .value {
  border-bottom: none;
  min-height: 14px;
  font-size: 11px;
  line-height: 1.15;
  padding-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bol-footer-driver {
  flex: 1.4;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}
.bol-footer-date,
.bol-footer-miles {
  flex: 0.7;
  max-width: 28%;
}
.bol-sig-row-three {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
}
.bol-sig-row-three .bol-sig-box {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  min-height: 150px;
  padding: 5px 6px 6px;
}
.bol-sig-row-three .bol-sig-pad {
  min-height: 120px;
  height: 128px;
}
.bol-sig-row-three .bol-sig-pad img,
.bol-sig-row-three .bol-sig-pad img.bol-sig-ink {
  max-width: 110px;
  max-height: 120px;
}
.bol-sig-row-two .bol-sig-box {
  flex: 1 1 45%;
  min-width: calc(50% - 4px);
}

.bol-footer-meta-row .bol-footer-field .value {
  border-bottom: none;
  min-height: 14px;
}


/* Classic sign-here guide: large X + vertical line (portrait pad) */
.sig-canvas-wrap {
  position: relative;
}
.sig-guide {
  position: absolute;
  inset: 6px;
  left: 56px; /* clear of left action bar */
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 10px 0 10px 8px;
  box-sizing: border-box;
}
.sig-guide-x {
  flex: 0 0 auto;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(48px, 14vw, 84px);
  font-weight: 900;
  line-height: 0.85;
  color: #111;
  margin-right: 10px;
  margin-top: 4px;
  user-select: none;
}
.sig-guide-line {
  flex: 0 0 3px;
  width: 3px;
  align-self: stretch;
  background: #111;
  border-radius: 1px;
  /* Leave a little air; action bar is on far left, not under the line */
  margin-bottom: 12px;
  margin-top: 8px;
}
#sig-canvas {
  position: relative;
  z-index: 1;
}

/* Portrait-captured ink shown landscape on BOL / settings preview (−90°) */
.bol-sig-ink,
.sig-preview img.bol-sig-ink,
.bol-sig-pad img.bol-sig-ink {
  transform: rotate(-90deg);
  transform-origin: center center;
  max-width: 110px;
  max-height: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.bol-sig-pad {
  overflow: hidden;
}
.bol-sig-pad img.bol-sig-ink {
  max-width: 105px;
  max-height: 95%;
}
.bol-carrier-under-driver .bol-sig-pad img.bol-sig-ink {
  max-width: 36px;
  max-height: 100px;
}
.sig-preview {
  min-height: 96px;
}
.sig-preview img.bol-sig-ink {
  max-width: 72px;
  max-height: 160px;
}

/* Signature modal — full-screen, canvas fills remaining viewport */
.sig-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #111;
  display: flex;
  flex-direction: column;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
}

.sig-modal.hidden { display: none; }


.sig-modal-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  border: none;
  max-width: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
  box-sizing: border-box;
}
.sig-modal-header {
  flex: 0 0 auto;
  padding: 10px 14px;
  background: #111;
  color: #fff;
}
.sig-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.sig-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  background: #e8e8e8;
  padding: 6px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  position: relative;
  /* Fill available portrait viewport */
  width: 100%;
}
#sig-modal.sig-pad-wide .sig-canvas-wrap,
.sig-modal .sig-canvas-wrap {
  min-height: min(50dvh, 100%);
}
#sig-canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border: 2px solid #111;
  border-radius: 4px;
  touch-action: none;
  cursor: crosshair;
  display: block;
  box-sizing: border-box;
}
.sig-modal-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 12px;
  text-align: center;
  font-size: 0.8rem;
  color: #555;
  font-weight: 600;
  background: #fff;
}

/* Action bar: horizontal row rotated 90° and centered on the LEFT edge.
   Phone sideways → this bar sits along the physical bottom; pad is above.
   Portrait lock keeps coords; ink uses getBoundingClientRect (1:1). */
.sig-modal-actions {
  position: absolute;
  z-index: 3;
  left: 28px;
  top: 50%;
  bottom: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #bbb;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
  pointer-events: auto;
  touch-action: manipulation;
}
.sig-modal-actions .btn {
  transform: none;
  width: auto;
  min-width: 84px;
  max-width: none;
  min-height: 40px;
  height: 40px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: none;
  touch-action: manipulation;
  white-space: nowrap;
}
.sig-modal-actions .btn:active {
  transform: scale(0.96);
}

/* Room on the left for the action bar (becomes bottom when sideways) */
.sig-canvas-wrap {
  padding-bottom: 8px;
  padding-left: 56px;
}

/* When sig pad is open: no scroll; JS tries orientation.lock('portrait').
   If the device still goes landscape (common on Android Chrome PWA),
   counter-rotate the modal so the pad stays portrait-shaped (header top,
   X-line + rotated Clear/Cancel/Done as designed). Touch mapping uses
   getBoundingClientRect so ink stays 1:1 after the transform. */
html.sig-pad-open,
html.sig-pad-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

@media (orientation: landscape) {
  html.sig-pad-open.sig-css-portrait-cw #sig-modal:not(.hidden),
  html.sig-pad-open.sig-css-portrait-ccw #sig-modal:not(.hidden) {
    /* Portrait box inside landscape viewport: width=short, height=long */
    width: 100dvh;
    height: 100dvw;
    max-width: 100dvh;
    max-height: 100dvw;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    inset: auto;
    margin: 0;
  }
  /* Device rotated CW (angle 90) → counter-rotate CCW */
  html.sig-pad-open.sig-css-portrait-ccw #sig-modal:not(.hidden) {
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center center;
  }
  /* Device rotated CCW (angle 270) → counter-rotate CW */
  html.sig-pad-open.sig-css-portrait-cw #sig-modal:not(.hidden) {
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
  }
}

@media (max-width: 400px) {
  .bol-sig-row { flex-direction: column; }
}

@media print {
  .sig-modal { display: none !important; }
  .bol-sig-box { cursor: default; }
  .bol-sig-box .bol-sig-tap-hint { display: none !important; }
}


/* Three stop-type bubbles */
.type-bubbles-3 {
  flex-wrap: wrap;
}
.type-bubbles-3 .bubble {
  flex: 1 1 30%;
  min-width: 28%;
  font-size: 0.82rem;
  padding: 0 6px;
  text-align: center;
}

.equip-section-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 4px 0 8px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.trailer-dropped-section {
  margin-top: 8px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  margin-bottom: 10px;
}
.trailer-dropped-section.hidden { display: none; }

textarea.stop-address {
  min-height: 4.8em;
  line-height: 1.35;
  resize: vertical;
}

.bol-stop-checks {
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px solid #000;
}
.bol-stop-equip-pair {
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}
.bol-stop-cargo {
  font-size: 11px;
  margin: 4px 0 2px;
  padding: 3px 5px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 1px;
}



/* Pre-submit guidance: orange marks required/uncertain values that still need attention. */
.field-pending {
  border-color: var(--warn) !important;
  background: var(--warn-bg) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 42%, transparent);
  outline: none;
}
.type-bubbles.field-pending,
.load-bubbles.field-pending {
  border-radius: 12px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 42%, transparent);
}
.toggle-row.field-pending {
  border: 2px solid var(--warn);
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
}

/* Validation highlight */
.field-error {
  border-color: var(--danger) !important;
  background: var(--danger-bg) !important;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.35);
  outline: none;
}
.stop-card.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.25);
}
.type-bubbles.field-error,
.load-bubbles.field-error {
  border-radius: 12px;
  background: var(--danger-bg);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.4);
}
@keyframes bang-pulse {
  0%, 100% { transform: scale(1); background: var(--danger-bg); }
  50% { transform: scale(1.08); background: #ffcdd2; }
}

.container-row.bobtail-hidden,
.equip-fields.bobtail-hidden {
  display: none !important;
}
.bobtail-hint {
  margin: 0 0 8px;
}

/* Preview pinch-zoom / pan */
.zoom-hint {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}
.bol-zoom-viewport {
  width: 100%;
  max-height: min(70dvh, 900px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #e8e8e8;
  overscroll-behavior: contain;
}
.bol-zoom-canvas {
  /* Letter page sized; user can pinch via browser + scroll to pan */
  width: max(100%, 8.5in);
  min-height: 11in;
  display: flex;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
  transform-origin: top center;
}
.bol-zoom-canvas .bol-document {
  flex-shrink: 0;
}

/* Address autocomplete (custom — works on Android Chrome) */
.addr-suggest-wrap {
  position: relative;
}
.addr-suggest-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.addr-suggest-list.hidden { display: none; }
.addr-suggest-item {
  padding: 12px 14px;
  min-height: 48px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.95rem;
  line-height: 1.3;
  cursor: pointer;
  word-break: break-word;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  user-select: none;
}
.addr-suggest-item:last-child { border-bottom: none; }
.addr-suggest-item.addr-suggest-armed {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-2));
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.addr-suggest-item:active,
.addr-suggest-item:hover {
  background: var(--ink);
  color: var(--bg);
}

.stops-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-clear-stops {
  width: 100%;
  border-color: var(--danger);
  color: var(--danger);
  background: #fff;
  font-weight: 700;
}
.btn-clear-stops:active {
  background: var(--danger-bg);
}

/* US Letter receipt page */
@page {
  size: letter;
  margin: 0.4in;
}

.preview-main {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bol-document {
  width: 8.5in;
  max-width: 8.5in;
  min-height: 11in;
  padding: 0.45in;
  box-sizing: border-box;
  margin: 0 auto;
  background: #fff;
}

@media print {
  body { background: #fff; }
  .topbar, .bottom-bar, .preview-actions, .save-hint, .zoom-hint, .toast, .sig-modal { display: none !important; }
  .screen { display: none !important; }
  #screen-preview.screen.active { display: block !important; }
  .preview-main { overflow: visible; padding: 0; max-width: none; }
  .bol-document {
    border: none;
    width: 8.5in;
    max-width: 8.5in;
    min-height: 11in;
    padding: 0.4in;
    margin: 0;
    box-shadow: none;
  }
}

@media print {
  .bol-zoom-viewport {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    background: transparent !important;
  }
  .bol-zoom-canvas {
    width: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
}

/* OCR import */
.btn-ocr {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--ink);
  font-weight: 700;
  border-radius: var(--radius);
}
.ocr-progress {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}
.ocr-progress.hidden { display: none; }

@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] .btn-bright,
  html[data-theme="light"] .btn-bright,
  html[data-theme="dark"] .section-title,
  html[data-theme="light"] .section-title {
    box-shadow: none !important;
    text-shadow: none !important;
  }
}


/* Equipment camera OCR */
.equip-ocr-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-height: var(--tap);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface-2);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(0, 0, 0, 0.12) 100%
  );
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 1px 0 rgba(0, 0, 0, 0.35);
}
.equip-ocr-btn:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}
.equip-ocr-btn svg { display: block; }
.equip-ocr-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.equip-ocr-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px calc(12px + var(--safe-bottom));
}
.equip-ocr-sheet.hidden { display: none; }
.equip-ocr-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.equip-ocr-sheet-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 16px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 8px 8px;
  border-top: 3px solid var(--accent);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.equip-ocr-sheet-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}
.equip-ocr-sheet-hint {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.equip-ocr-choice { width: 100%; }


/* Settings company logo */
.logo-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.logo-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  max-width: 220px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.logo-preview-wrap.logo-preview-empty {
  border-style: dashed;
}
.logo-preview {
  max-width: 180px;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.logo-preview.hidden { display: none; }
.logo-preview-placeholder {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.logo-settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.logo-settings-actions .btn { width: 100%; }

/* BOL header logo + name */
.bol-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0 0 4px;
}
.bol-logo-img {
  display: block;
  max-height: 48px;
  max-width: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.bol-logo-img.hidden { display: none; }

@media print {
  .bol-document.bol-multipage {
    max-width: none;
    width: auto;
  }
  .bol-page {
    width: 8.5in;
    min-height: 11in;
    max-width: none;
    margin: 0;
    padding: 0.4in;
    border: none;
    page-break-after: always;
    break-after: page;
  }
  .bol-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .bol-page-continued {
    display: none;
  }
}


/* Preview save bar */
#screen-preview .bottom-bar-stack {
  flex-direction: column;
}
#screen-preview .bottom-bar-row .btn {
  font-size: 0.85rem;
}
#screen-preview .btn-save-tall {
  opacity: 0.85;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
}


/* ---------- First-run tutorial coach ---------- */
.tutorial-coach {
  position: fixed;
  z-index: 180;
  display: flex;
  justify-content: center;
}
.tutorial-coach.hidden,
.tutorial-coach[hidden] {
  display: none !important;
}
.tutorial-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tutorial-coach-welcome {
  inset: 0;
  align-items: center;
  padding: 24px 16px;
  pointer-events: auto;
}
.tutorial-coach-welcome .tutorial-backdrop {
  display: block;
  background: rgba(10, 12, 16, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}
.tutorial-coach-welcome .tutorial-coach-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 22px 18px 16px;
  text-align: center;
}
.tutorial-coach-welcome .tutorial-title { font-size: 1.35rem; }
.tutorial-coach-welcome .tutorial-body {
  font-size: 1rem;
  color: var(--ink);
}
.tutorial-coach-welcome .tutorial-coach-actions { justify-content: center; }

/* Install / A2HS tutorial step (same centered card as welcome) */
.tutorial-coach-install .tutorial-body {
  white-space: pre-line;
  text-align: left;
  max-width: 28em;
  margin-left: auto;
  margin-right: auto;
}
.tutorial-coach-install .tutorial-coach-actions {
  flex-wrap: wrap;
  justify-content: center;
}
.tutorial-coach-install #tutorial-a2hs {
  flex: 1 1 100%;
  order: -1;
  margin-bottom: 4px;
}
.tutorial-a2hs-btn.hidden,
.tutorial-a2hs-btn[hidden] {
  display: none !important;
}
.tutorial-a2hs-btn.is-installed {
  opacity: 0.85;
  filter: none;
}

/* Compact non-blocking coach (bottom or top) */
.tutorial-coach-bar,
.tutorial-coach-top {
  left: 0;
  right: 0;
  align-items: flex-end;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  pointer-events: none;
}
.tutorial-coach-bar { bottom: 0; top: auto; }
.tutorial-coach-top {
  top: calc(8px + var(--safe-top, 0px));
  bottom: auto;
  align-items: flex-start;
  padding-top: calc(8px + var(--safe-top, 0px));
}
.tutorial-coach-bar .tutorial-backdrop,
.tutorial-coach-top .tutorial-backdrop { display: none; }

.tutorial-coach-card {
  pointer-events: auto;
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  padding: 10px 12px 10px;
}
.tutorial-coach-bar .tutorial-coach-card,
.tutorial-coach-top .tutorial-coach-card {
  padding: 8px 10px 8px;
}
.tutorial-step-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.tutorial-title {
  margin: 2px 0 4px;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
}
.tutorial-coach-bar .tutorial-title,
.tutorial-coach-top .tutorial-title { font-size: 0.92rem; }
.tutorial-body {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}
.tutorial-coach-bar .tutorial-body,
.tutorial-coach-top .tutorial-body {
  font-size: 0.78rem;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 6.5em;
}
.tutorial-gate-hint {
  margin: -2px 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--danger);
}
.tutorial-gate-hint.hidden { display: none !important; }
.tutorial-coach-actions { display: flex; gap: 8px; }
.tutorial-coach-actions .btn {
  flex: 1;
  min-height: 40px;
  width: auto;
  font-size: 0.85rem;
}
#tutorial-next:disabled,
#tutorial-next.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
/* ---------- First-run player name gate ---------- */
.name-gate {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  pointer-events: auto;
}
.name-gate.hidden,
.name-gate[hidden] {
  display: none !important;
}
.name-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.name-gate-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  padding: 22px 18px 16px;
  text-align: center;
}
.name-gate-meta {
  margin-bottom: 2px;
}
.name-gate-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.name-gate-title {
  margin: 2px 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
}
.name-gate-body {
  margin: 0 0 14px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);
}
.name-gate-field {
  text-align: left;
  margin-bottom: 8px;
}
.name-gate-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.name-gate-field input {
  width: 100%;
  font-size: 1.05rem;
  min-height: 48px;
  text-align: center;
}
.name-gate-hint {
  margin: 0 0 12px;
  min-height: 1.1em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--danger);
}
.name-gate-hint.is-ok {
  color: var(--muted);
  font-weight: 600;
}
.name-gate-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.name-gate-actions .btn {
  flex: 1;
  min-height: 48px;
  font-size: 0.95rem;
}
#name-gate-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

/* Pulsing glow aura on current tutorial focus */
@keyframes tutorial-aura-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--accent) 75%, transparent),
      0 0 14px 2px color-mix(in srgb, var(--accent) 45%, transparent),
      0 0 28px 6px color-mix(in srgb, var(--accent) 22%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--accent) 95%, transparent),
      0 0 22px 6px color-mix(in srgb, var(--accent) 55%, transparent),
      0 0 40px 12px color-mix(in srgb, var(--accent) 30%, transparent);
  }
}
.tutorial-highlight {
  outline: 2px solid var(--accent) !important;
  outline-offset: 3px;
  border-radius: 8px;
  position: relative;
  z-index: 6;
  scroll-margin: 140px;
  animation: tutorial-aura-pulse 1.5s ease-in-out infinite;
  filter: none !important;
  opacity: 1 !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (prefers-reduced-motion: reduce) {
  .tutorial-highlight {
    animation: none;
    box-shadow:
      0 0 0 4px color-mix(in srgb, var(--accent) 80%, transparent),
      0 0 18px 4px color-mix(in srgb, var(--accent) 40%, transparent) !important;
  }
}

/* Dim / blur sections that are not the current tutorial focus */
.tutorial-dimmed {
  filter: blur(2.5px) saturate(0.75);
  opacity: 0.38;
  transition: filter 0.22s ease, opacity 0.22s ease;
  pointer-events: none;
  user-select: none;
}
body.tutorial-active .tutorial-dimmed .tutorial-highlight,
body.tutorial-active .tutorial-highlight {
  pointer-events: auto;
  user-select: auto;
}
/* Safety: never leave blur when tutorial ends (class cleared in JS) */
body:not(.tutorial-active) .tutorial-dimmed,
body:not(.tutorial-active) .tutorial-highlight {
  filter: none !important;
  opacity: unset;
  animation: none !important;
  outline: none !important;
  box-shadow: none !important;
  pointer-events: auto;
}
.addr-suggest-item.addr-suggest-sample {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  font-weight: 600;
}

/* Keep scroll targets above coach + bottom bar while tutorial runs */
body.tutorial-active #screen-home .main-content,
body.tutorial-active #screen-settings .main-content {
  padding-bottom: calc(190px + var(--safe-bottom)) !important;
}
body.tutorial-active #screen-generate .main-content.has-bottom-bar,
body.tutorial-active #screen-preview .main-content.has-bottom-bar {
  padding-bottom: calc(var(--bottom-bar-h, 96px) + 200px + var(--safe-bottom)) !important;
}
body.tutorial-active #screen-generate .stops-actions {
  scroll-margin-bottom: 220px;
}

/* Settings danger zone */
.card-danger-zone {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}
.section-title-danger {
  color: var(--danger);
}
.hint-danger {
  color: var(--muted);
}
#btn-clear-cache-data {
  width: 100%;
  margin-top: 4px;
}

/* ---------- Misty Maxwell-style easter egg (Home only) ---------- */
#screen-home {
  position: relative;
  /* Keep Home chrome + Misty pin on-screen; ticket list scrolls in .main-content */
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
/* Playfield shell over Home while Pong runs (frost + space BGs); below Misty game layers. */
.misty-game-backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: none;
  background: transparent; /* never solid black — Home must remain visible under frost */
  pointer-events: auto;
  touch-action: none;
  /* no overflow:hidden — it can isolate/break backdrop-filter on some engines */
}
.misty-game-backdrop.is-active {
  display: block;
}
/* Dark tinted frosted glass — Home UI faintly shows through (alpha, not blackout).
   Alpha 0.323 = prior 0.38 × 0.85 (−15% relative). Soft fade-in via .is-frost-in. */
.misty-game-frost {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(6, 8, 14, 0.323);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  opacity: 0;
  /* Soft phase: blur reaches full opacity at bass drop (MISTY_DROP_MS / MISTY_FROST_FADE_MS). */
  transition: opacity 6.5s ease-in;
}
.misty-game-frost.is-frost-in {
  opacity: 1;
}
/* Pixel-art space plates (L1–4 / pre-L5) — over the frost; sky keyed to alpha. */
.misty-space-static {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  display: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: transparent; /* keyed PNG sky must not sit on an opaque fill */
}
.misty-space-static.is-active {
  display: block;
  opacity: 1;
}
/* Nyan-era Star-Wars-style hyperspace streaks (canvas, loops while Nyan Cat song plays). */
.misty-space-hyper {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
  background: transparent;
}
.misty-space-hyper.is-active {
  display: block;
}
/* The shared topbar normally sits at z-index 50; lower it behind the playfield. */
#screen-home.misty-game-active .topbar {
  z-index: 33;
}
.misty-easter {
  /* Idle starts tiny; grow classes raise --misty-frame-h toward peek (~48px) */
  --misty-frame-h: 20px;
  /* fixed: stay above the fold on Home even when the ticket list is long */
  position: fixed;
  left: max(6px, env(safe-area-inset-left, 0px));
  bottom: max(4px, env(safe-area-inset-bottom, 0px));
  z-index: 12;
  width: var(--misty-frame-h);
  height: var(--misty-frame-h);
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.34;
  transition: opacity 0.28s ease, width 0.35s ease, height 0.35s ease, --misty-frame-h 0.35s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 0;
}
/* Pre-Pong growth: taps 1–4 step toward normal peek size */
.misty-easter.misty-grow-1 {
  --misty-frame-h: 27px;
  opacity: 0.42;
}
.misty-easter.misty-grow-2 {
  --misty-frame-h: 34px;
  opacity: 0.52;
}
.misty-easter.misty-grow-3 {
  --misty-frame-h: 41px;
  opacity: 0.62;
}
.misty-easter.misty-grow-4 {
  --misty-frame-h: 48px;
  opacity: 0.72;
}
.misty-easter:hover,
.misty-easter:focus-visible {
  opacity: 0.72;
  outline: none;
}
.misty-easter-sprite {
  display: block;
  width: 100%;
  height: 100%;
  /* 24-frame turntable sheet (2712×128 → fw 113) */
  background-image: url('./assets/misty-turntable.png');
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: auto 100%;
  pointer-events: none;
  user-select: none;
  image-rendering: auto;
}
/* Tap spins: cycle turntable sprites (not CSS rotateY) */
.misty-easter.is-spin-once .misty-easter-sprite {
  animation: misty-tt-once 0.95s steps(24) 1;
}
.misty-easter.is-wiggle .misty-easter-sprite {
  animation: misty-tt-wiggle 0.85s steps(24) 1;
}
.misty-easter.is-spinning .misty-easter-sprite {
  animation: misty-tt-spin 0.7s steps(24) infinite;
}
/* Soft phase (0–7s): turntable ~1.7s/rev */
.misty-easter.is-spinning-soft .misty-easter-sprite {
  animation: misty-tt-spin 1.7s steps(24) infinite;
}
/* Drop/blast phase: faster turntable ~0.85s/rev */
.misty-easter.is-spinning-fast .misty-easter-sprite {
  animation: misty-tt-spin 0.85s steps(24) infinite;
}
/* Bounce around viewport (JS sets left/top) */
.misty-easter.is-bouncing {
  --misty-frame-h: 48px;
  position: fixed;
  bottom: auto;
  right: auto;
  opacity: 1;
  z-index: 41;
  will-change: left, top;
  width: var(--misty-frame-h);
  height: var(--misty-frame-h);
}
/* Modest enlarge ~1.33× peek — not a center takeover */
.misty-easter.is-bouncing.is-enlarged {
  --misty-frame-h: min(13vw, 64px);
  width: var(--misty-frame-h);
  height: var(--misty-frame-h);
}
.misty-easter.is-bouncing.is-enlarged .misty-easter-sprite {
  width: 100%;
  height: 100%;
}
/* Sheet is 2712×128; with background-size:auto 100% the painted width is
   (2712/128)*frame-h. Keyframes must use that scaled width or Misty slides into empty space. */
@keyframes misty-tt-spin {
  from { background-position: 0 0; }
  to { background-position: calc(-2712 / 128 * var(--misty-frame-h)) 0; }
}
@keyframes misty-tt-once {
  from { background-position: 0 0; }
  to { background-position: calc(-2712 / 128 * var(--misty-frame-h)) 0; }
}
@keyframes misty-tt-wiggle {
  0% { background-position: 0 0; }
  35% { background-position: calc(-1130 / 128 * var(--misty-frame-h)) 0; } /* ~10 frames */
  70% { background-position: calc(-2034 / 128 * var(--misty-frame-h)) 0; } /* ~18 frames */
  100% { background-position: calc(-2712 / 128 * var(--misty-frame-h)) 0; }
}

/* Viewport trail layer — never blocks Home UI */
.misty-trail-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 40;
  pointer-events: none;
  display: none;
}
.misty-trail-canvas.is-active {
  display: block;
}
/* Flash overlay at drop */
.misty-rainbow {
  position: fixed;
  inset: 0;
  z-index: 38;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: soft-light;
}
.misty-rainbow.is-active {
  opacity: 0.62;
  animation: misty-strobe 0.38s steps(1) infinite;
}
@keyframes misty-strobe {
  0%   { background: #ff3b5c; }
  14%  { background: #ff9f1c; }
  28%  { background: #ffd60a; }
  42%  { background: #2ec4b6; }
  57%  { background: #3a86ff; }
  71%  { background: #8338ec; }
  85%  { background: #ff006e; }
  100% { background: #ff3b5c; }
}

/* Nyan Cat song bass-drop neon — thin glowing tubes on TOP + LEFT + RIGHT.
   Lives UNDER .misty-game-frost (z-index -1 in the backdrop) so backdrop-filter
   blur softens / diffuses the bloom through the frosted glass.
   Bottom / kill zone stays dark: side tubes are 86% tall and masked out at the end. */
.misty-neon-rim {
  position: absolute;
  inset: 0;
  z-index: -1; /* under frost (z:0) — glow diffuses through blur */
  pointer-events: none;
  opacity: 0;
  background: none;
}
.misty-neon-rim.is-neon-storm {
  opacity: 1;
  animation: misty-neon-top 0.36s steps(1) infinite;
}
.misty-neon-rim.is-neon-storm.is-neon-storm-peak {
  animation-duration: 0.16s;
}
.misty-neon-rim.is-neon-storm::before,
.misty-neon-rim.is-neon-storm::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3px; /* thin neon core ~2–4px */
  height: 86%;
  pointer-events: none;
  /* soft end so the tube does not cut through the kill zone */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 78%, transparent 100%);
}
.misty-neon-rim.is-neon-storm::before {
  left: 0;
  animation: misty-neon-left 0.36s steps(1) infinite;
}
.misty-neon-rim.is-neon-storm::after {
  right: 0;
  animation: misty-neon-right 0.36s steps(1) infinite;
}
.misty-neon-rim.is-neon-storm.is-neon-storm-peak::before,
.misty-neon-rim.is-neon-storm.is-neon-storm-peak::after {
  animation-duration: 0.16s;
}
/* Thin neon core + multi-layer bloom. Chroma: pink → cyan → lime → yellow → magenta. */
@keyframes misty-neon-top {
  0%, 100% {
    box-shadow:
      inset 0 2px 0 0 #ffb3f0,
      inset 0 3px 0 0 #ff4fd8,
      inset 0 6px 10px -1px rgba(255, 79, 216, 1),
      inset 0 12px 22px -2px rgba(255, 79, 216, 0.85),
      inset 0 22px 40px -4px rgba(255, 79, 216, 0.55),
      inset 0 36px 56px -8px rgba(255, 79, 216, 0.3);
  }
  20% {
    box-shadow:
      inset 0 2px 0 0 #b8ffff,
      inset 0 3px 0 0 #00f5ff,
      inset 0 6px 10px -1px rgba(0, 245, 255, 1),
      inset 0 12px 22px -2px rgba(0, 245, 255, 0.85),
      inset 0 22px 40px -4px rgba(0, 245, 255, 0.55),
      inset 0 36px 56px -8px rgba(0, 245, 255, 0.3);
  }
  40% {
    box-shadow:
      inset 0 2px 0 0 #c8ffb0,
      inset 0 3px 0 0 #39ff14,
      inset 0 6px 10px -1px rgba(57, 255, 20, 1),
      inset 0 12px 22px -2px rgba(57, 255, 20, 0.85),
      inset 0 22px 40px -4px rgba(57, 255, 20, 0.55),
      inset 0 36px 56px -8px rgba(57, 255, 20, 0.3);
  }
  60% {
    box-shadow:
      inset 0 2px 0 0 #fff5a0,
      inset 0 3px 0 0 #ffe600,
      inset 0 6px 10px -1px rgba(255, 230, 0, 1),
      inset 0 12px 22px -2px rgba(255, 230, 0, 0.85),
      inset 0 22px 40px -4px rgba(255, 230, 0, 0.55),
      inset 0 36px 56px -8px rgba(255, 230, 0, 0.3);
  }
  80% {
    box-shadow:
      inset 0 2px 0 0 #ffb0d4,
      inset 0 3px 0 0 #ff006e,
      inset 0 6px 10px -1px rgba(255, 0, 110, 1),
      inset 0 12px 22px -2px rgba(255, 0, 110, 0.85),
      inset 0 22px 40px -4px rgba(255, 0, 110, 0.55),
      inset 0 36px 56px -8px rgba(255, 0, 110, 0.3);
  }
}
@keyframes misty-neon-left {
  0%, 100% {
    background: linear-gradient(to right, #ff4fd8 0%, #ffb3f0 45%, #ff4fd8 100%);
    box-shadow:
      0 0 2px #ffb3f0,
      2px 0 0 0 #ff4fd8,
      4px 0 8px 0 rgba(255, 79, 216, 1),
      8px 0 18px 0 rgba(255, 79, 216, 0.9),
      14px 0 32px 0 rgba(255, 79, 216, 0.65),
      22px 0 48px 0 rgba(255, 79, 216, 0.35);
    filter:
      drop-shadow(0 0 3px #ff4fd8)
      drop-shadow(0 0 8px #ff4fd8)
      drop-shadow(2px 0 16px rgba(255, 79, 216, 0.95))
      drop-shadow(4px 0 28px rgba(255, 79, 216, 0.7));
  }
  20% {
    background: linear-gradient(to right, #00f5ff 0%, #b8ffff 45%, #00f5ff 100%);
    box-shadow:
      0 0 2px #b8ffff,
      2px 0 0 0 #00f5ff,
      4px 0 8px 0 rgba(0, 245, 255, 1),
      8px 0 18px 0 rgba(0, 245, 255, 0.9),
      14px 0 32px 0 rgba(0, 245, 255, 0.65),
      22px 0 48px 0 rgba(0, 245, 255, 0.35);
    filter:
      drop-shadow(0 0 3px #00f5ff)
      drop-shadow(0 0 8px #00f5ff)
      drop-shadow(2px 0 16px rgba(0, 245, 255, 0.95))
      drop-shadow(4px 0 28px rgba(0, 245, 255, 0.7));
  }
  40% {
    background: linear-gradient(to right, #39ff14 0%, #c8ffb0 45%, #39ff14 100%);
    box-shadow:
      0 0 2px #c8ffb0,
      2px 0 0 0 #39ff14,
      4px 0 8px 0 rgba(57, 255, 20, 1),
      8px 0 18px 0 rgba(57, 255, 20, 0.9),
      14px 0 32px 0 rgba(57, 255, 20, 0.65),
      22px 0 48px 0 rgba(57, 255, 20, 0.35);
    filter:
      drop-shadow(0 0 3px #39ff14)
      drop-shadow(0 0 8px #39ff14)
      drop-shadow(2px 0 16px rgba(57, 255, 20, 0.95))
      drop-shadow(4px 0 28px rgba(57, 255, 20, 0.7));
  }
  60% {
    background: linear-gradient(to right, #ffe600 0%, #fff5a0 45%, #ffe600 100%);
    box-shadow:
      0 0 2px #fff5a0,
      2px 0 0 0 #ffe600,
      4px 0 8px 0 rgba(255, 230, 0, 1),
      8px 0 18px 0 rgba(255, 230, 0, 0.9),
      14px 0 32px 0 rgba(255, 230, 0, 0.65),
      22px 0 48px 0 rgba(255, 230, 0, 0.35);
    filter:
      drop-shadow(0 0 3px #ffe600)
      drop-shadow(0 0 8px #ffe600)
      drop-shadow(2px 0 16px rgba(255, 230, 0, 0.95))
      drop-shadow(4px 0 28px rgba(255, 230, 0, 0.7));
  }
  80% {
    background: linear-gradient(to right, #ff006e 0%, #ffb0d4 45%, #ff006e 100%);
    box-shadow:
      0 0 2px #ffb0d4,
      2px 0 0 0 #ff006e,
      4px 0 8px 0 rgba(255, 0, 110, 1),
      8px 0 18px 0 rgba(255, 0, 110, 0.9),
      14px 0 32px 0 rgba(255, 0, 110, 0.65),
      22px 0 48px 0 rgba(255, 0, 110, 0.35);
    filter:
      drop-shadow(0 0 3px #ff006e)
      drop-shadow(0 0 8px #ff006e)
      drop-shadow(2px 0 16px rgba(255, 0, 110, 0.95))
      drop-shadow(4px 0 28px rgba(255, 0, 110, 0.7));
  }
}
@keyframes misty-neon-right {
  0%, 100% {
    background: linear-gradient(to left, #39ff14 0%, #c8ffb0 45%, #39ff14 100%);
    box-shadow:
      0 0 2px #c8ffb0,
      -2px 0 0 0 #39ff14,
      -4px 0 8px 0 rgba(57, 255, 20, 1),
      -8px 0 18px 0 rgba(57, 255, 20, 0.9),
      -14px 0 32px 0 rgba(57, 255, 20, 0.65),
      -22px 0 48px 0 rgba(57, 255, 20, 0.35);
    filter:
      drop-shadow(0 0 3px #39ff14)
      drop-shadow(0 0 8px #39ff14)
      drop-shadow(-2px 0 16px rgba(57, 255, 20, 0.95))
      drop-shadow(-4px 0 28px rgba(57, 255, 20, 0.7));
  }
  20% {
    background: linear-gradient(to left, #ffe600 0%, #fff5a0 45%, #ffe600 100%);
    box-shadow:
      0 0 2px #fff5a0,
      -2px 0 0 0 #ffe600,
      -4px 0 8px 0 rgba(255, 230, 0, 1),
      -8px 0 18px 0 rgba(255, 230, 0, 0.9),
      -14px 0 32px 0 rgba(255, 230, 0, 0.65),
      -22px 0 48px 0 rgba(255, 230, 0, 0.35);
    filter:
      drop-shadow(0 0 3px #ffe600)
      drop-shadow(0 0 8px #ffe600)
      drop-shadow(-2px 0 16px rgba(255, 230, 0, 0.95))
      drop-shadow(-4px 0 28px rgba(255, 230, 0, 0.7));
  }
  40% {
    background: linear-gradient(to left, #ff006e 0%, #ffb0d4 45%, #ff006e 100%);
    box-shadow:
      0 0 2px #ffb0d4,
      -2px 0 0 0 #ff006e,
      -4px 0 8px 0 rgba(255, 0, 110, 1),
      -8px 0 18px 0 rgba(255, 0, 110, 0.9),
      -14px 0 32px 0 rgba(255, 0, 110, 0.65),
      -22px 0 48px 0 rgba(255, 0, 110, 0.35);
    filter:
      drop-shadow(0 0 3px #ff006e)
      drop-shadow(0 0 8px #ff006e)
      drop-shadow(-2px 0 16px rgba(255, 0, 110, 0.95))
      drop-shadow(-4px 0 28px rgba(255, 0, 110, 0.7));
  }
  60% {
    background: linear-gradient(to left, #ff4fd8 0%, #ffb3f0 45%, #ff4fd8 100%);
    box-shadow:
      0 0 2px #ffb3f0,
      -2px 0 0 0 #ff4fd8,
      -4px 0 8px 0 rgba(255, 79, 216, 1),
      -8px 0 18px 0 rgba(255, 79, 216, 0.9),
      -14px 0 32px 0 rgba(255, 79, 216, 0.65),
      -22px 0 48px 0 rgba(255, 79, 216, 0.35);
    filter:
      drop-shadow(0 0 3px #ff4fd8)
      drop-shadow(0 0 8px #ff4fd8)
      drop-shadow(-2px 0 16px rgba(255, 79, 216, 0.95))
      drop-shadow(-4px 0 28px rgba(255, 79, 216, 0.7));
  }
  80% {
    background: linear-gradient(to left, #00f5ff 0%, #b8ffff 45%, #00f5ff 100%);
    box-shadow:
      0 0 2px #b8ffff,
      -2px 0 0 0 #00f5ff,
      -4px 0 8px 0 rgba(0, 245, 255, 1),
      -8px 0 18px 0 rgba(0, 245, 255, 0.9),
      -14px 0 32px 0 rgba(0, 245, 255, 0.65),
      -22px 0 48px 0 rgba(0, 245, 255, 0.35);
    filter:
      drop-shadow(0 0 3px #00f5ff)
      drop-shadow(0 0 8px #00f5ff)
      drop-shadow(-2px 0 16px rgba(0, 245, 255, 0.95))
      drop-shadow(-4px 0 28px rgba(0, 245, 255, 0.7));
  }
}
/* Brief UI neon pulse — thin rim tubes; leave bottom / kill zone dark */
body.misty-neon-flash #screen-home.active {
  box-shadow:
    inset 0 3px 10px 0 rgba(255, 0, 229, 0.85),
    inset 0 10px 22px -4px rgba(255, 0, 229, 0.35),
    inset 3px 0 10px 0 rgba(0, 245, 255, 0.8),
    inset 10px 0 22px -4px rgba(0, 245, 255, 0.3),
    inset -3px 0 10px 0 rgba(57, 255, 20, 0.8),
    inset -10px 0 22px -4px rgba(57, 255, 20, 0.3);
}
body.misty-neon-flash .misty-pong-hud:not([hidden]) {
  filter: drop-shadow(0 0 4px #00f5ff) drop-shadow(0 0 8px #ff00e5);
}
body.misty-neon-flash .misty-panic:not([hidden]) {
  filter: drop-shadow(0 0 6px #39ff14) drop-shadow(0 0 10px #ff00e5);
}

/* Misty 58s finale — freeze spin + stronger rainbow burst */
.misty-easter.is-finale .misty-easter-sprite {
  animation-duration: 0.35s !important;
  filter: drop-shadow(0 0 12px rgba(255, 214, 10, 0.85))
          drop-shadow(0 0 28px rgba(255, 0, 110, 0.65));
}
.misty-rainbow.is-finale-burst {
  opacity: 0.9 !important;
  mix-blend-mode: screen;
  animation: misty-strobe 0.18s steps(1) infinite, misty-finale-pulse 0.55s ease-out infinite;
}
@keyframes misty-finale-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Finale rainbow RING — expands outward from Misty after explosion */
.misty-finale-ring {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 39; /* above rainbow flash (38), under Misty (41) */
  opacity: 0;
  box-sizing: border-box;
  border: 3px solid transparent;
  background: transparent;
}
.misty-finale-ring.is-burst {
  opacity: 1;
  animation: misty-finale-ring-expand 1.15s cubic-bezier(0.15, 0.7, 0.25, 1) forwards;
}
@keyframes misty-finale-ring-expand {
  0% {
    width: 28px;
    height: 28px;
    margin-left: -14px;
    margin-top: -14px;
    opacity: 1;
    box-shadow:
      0 0 0 0 #ff3b5c,
      0 0 0 3px #ff9f1c,
      0 0 0 6px #ffd60a,
      0 0 0 9px #2ec4b6,
      0 0 0 12px #3a86ff,
      0 0 0 15px #8338ec,
      0 0 24px 4px rgba(255, 214, 10, 0.55);
  }
  70% {
    opacity: 0.85;
  }
  100% {
    width: min(160vw, 160vh);
    height: min(160vw, 160vh);
    margin-left: calc(min(160vw, 160vh) / -2);
    margin-top: calc(min(160vw, 160vh) / -2);
    opacity: 0;
    box-shadow:
      0 0 0 0 #ff3b5c,
      0 0 0 8px #ff9f1c,
      0 0 0 16px #ffd60a,
      0 0 0 24px #2ec4b6,
      0 0 0 32px #3a86ff,
      0 0 0 40px #8338ec,
      0 0 48px 12px rgba(255, 0, 110, 0.15);
  }
}

/* ---------- Misty Pong death nuke (pixel mushroom cloud) ---------- */
.misty-nuke {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 48; /* above paddle/panic/HUD (42–44); under game-over (50) */
  display: none;
  pointer-events: none;
  overflow: hidden;
  contain: layout style paint;
}
.misty-nuke.is-active {
  display: block;
}
.misty-nuke-flash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--nuke-x, 50%) var(--nuke-y, 78%),
      rgba(255, 255, 230, 0.95) 0%,
      rgba(255, 180, 40, 0.55) 18%,
      rgba(255, 60, 20, 0.25) 38%,
      transparent 62%),
    rgba(255, 250, 230, 0.55);
  opacity: 0;
  animation: misty-nuke-flash 1.2s steps(8) forwards;
}
.misty-nuke-art {
  position: absolute;
  left: var(--nuke-x, 50%);
  top: var(--nuke-y, 78%);
  width: min(72vw, 280px);
  height: auto;
  aspect-ratio: 256 / 320;
  transform: translate(-50%, -88%) scale(0.35);
  transform-origin: 50% 90%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 18px rgba(255, 140, 20, 0.85))
          drop-shadow(0 0 40px rgba(255, 60, 0, 0.45));
  opacity: 0;
  animation: misty-nuke-grow 1.2s steps(12) forwards;
  user-select: none;
  -webkit-user-drag: none;
}
@keyframes misty-nuke-flash {
  0% { opacity: 0; }
  6% { opacity: 1; }
  18% { opacity: 0.85; }
  40% { opacity: 0.35; }
  70% { opacity: 0.12; }
  100% { opacity: 0; }
}
@keyframes misty-nuke-grow {
  0% {
    opacity: 0;
    transform: translate(-50%, -88%) scale(0.2);
  }
  8% {
    opacity: 1;
    transform: translate(-50%, -88%) scale(0.45);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -88%) scale(0.95);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -92%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -96%) scale(1.35);
  }
}
/* Screen punch while nuking */
body.misty-nuking #screen-home.active {
  animation: misty-nuke-shake 0.45s steps(4) 2;
}
@keyframes misty-nuke-shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, -1px); }
}

/* Keep out of the way during tutorial coach */
body.tutorial-active .misty-easter,
body.tutorial-active .misty-rainbow,
body.tutorial-active .misty-finale-ring,
body.tutorial-active .misty-nuke,
body.tutorial-active .misty-trail-canvas,
body.tutorial-active .misty-paddle,
body.tutorial-active .misty-joystick,
body.tutorial-active .misty-pong-hud,
body.tutorial-active .misty-blackhole,
body.tutorial-active .misty-level-banner,
body.tutorial-active .misty-gameover,
body.tutorial-active .misty-panic,
body.tutorial-active .misty-fidgets,
body.tutorial-active .misty-fidget,
body.tutorial-active .misty-starman {
  display: none !important;
}

/* Belt-and-suspenders: never let Misty overlays steal taps off Home */
#screen-home:not(.active) .misty-game-backdrop,
#screen-home:not(.active) .misty-easter,
#screen-home:not(.active) .misty-trail-canvas,
#screen-home:not(.active) .misty-rainbow,
#screen-home:not(.active) .misty-finale-ring,
#screen-home:not(.active) .misty-nuke,
#screen-home:not(.active) .misty-paddle,
#screen-home:not(.active) .misty-joystick,
#screen-home:not(.active) .misty-pong-hud,
#screen-home:not(.active) .misty-panic,
#screen-home:not(.active) .misty-blackhole,
#screen-home:not(.active) .misty-level-banner,
#screen-home:not(.active) .misty-gameover,
#screen-home:not(.active) .misty-fidgets,
#screen-home:not(.active) .misty-fidget,
#screen-home:not(.active) .misty-starman {
  display: none !important;
  pointer-events: none !important;
}


/* Misty panic panel — 7-segment LCD digits (DSEG7 Classic) */
@font-face {
  font-family: 'DSEG7 Classic';
  src: url('./assets/fonts/DSEG7Classic-BoldItalic.woff2') format('woff2'),
       url('./assets/fonts/DSEG7Classic-BoldItalic.woff') format('woff');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- Misty industrial panic / eject control panel ----------
   Visuals come from cropped mock artwork (weathered metal, rivets, hazard,
   EJECT, meter plates, 13-seg volume rail, mute, top nixie tubes). DOM overlays:
   nixie level digits, EJECT / volume / mute hit targets, LED mask, live LCDs.
   Art 1056×1872 (aspect ~1:1.77). Width stays the prior narrow portrait cap;
   height follows the new aspect (slightly shorter than the 711×1466 plate).
*/
.misty-panic {
  position: fixed;
  top: 46%;
  left: 50%;
  /* Scale the complete panel art and hit targets by 26.5% (prior 15% × +10%), preserving proportions. */
  transform: translate(-50%, -50%) scale(1.265);
  /* Under trail (40) + Misty (41); above rainbow flash (38) / post-fx (36) */
  z-index: 37;
  display: none;
  align-items: flex-start;
  justify-content: center;
  /* ~25% smaller than prior min(48vw,190px); aspect-ratio keeps height in scale */
  width: min(36vw, 142px);
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1;
  pointer-events: none; /* EJECT, volume, mute, HIGH SCORE LCD opt in */
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.75));
}
.misty-panic.is-active {
  display: flex;
}
.misty-panic-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  /* Art aspect 1056:1872 */
  aspect-ratio: 1056 / 1872;
  pointer-events: none;
  /* LCD font-size uses cqw of THIS box (not the viewport). */
  container-type: inline-size;
  container-name: panic;
}
.misty-panic-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

/* Dynamic LEVEL digits over empty nixie tubes (baked into panel-art) */
.misty-panic-nixie {
  position: absolute;
  /* Full tube glass on 1056×1872 art (was only the top ~286px, so digits
     sat high with empty tube below). Box x 300–740, y 0–460. */
  left: 28.41%;
  top: 0%;
  width: 41.67%;
  height: 24.57%;
  pointer-events: none;
  z-index: 2;
  background: transparent;
  border: none;
  box-shadow: none;
}
.misty-panic-nixie-digit {
  position: absolute;
  /* Tube centers measured on 1056×1872 art, as % of the nixie overlay box:
     left glass mid ≈ 10.7%, right ≈ 83.3%. Digits sit lower in the glass
     (less empty gap under the glyph) and larger than Beta-v1.23 (60% height).
     translateX(-50%) centers each bitmap, including the narrower "1" and the
     right-heavy "0". Height % + width auto keeps intrinsic aspect. */
  /* Lower in the full tube: glyph bottom near the socket, still inside glass.
     ~255px tall on the art (larger than v1.23's ~172px). */
  top: 30%;
  height: 58%;
  width: auto;
  max-width: 46%;
  transform: translateX(-50%);
  object-fit: contain;
  object-position: center center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  /* Digits already carry orange bloom — keep shadow light so no hard plate */
  filter: drop-shadow(0 0 2px rgba(255, 110, 0, 0.45));
  background: transparent;
  border: none;
  box-shadow: none;
}
.misty-panic-nixie-digit--tens {
  left: 20.9%;
}
.misty-panic-nixie-digit--ones {
  left: 77.8%;
}
/* Transparent hit target over nixie tubes (7-tap unlock); does not cover EJECT */
.misty-panic-beacon-hit {
  position: absolute;
  left: 28.41%;
  top: 0%;
  width: 41.67%;
  height: 24.57%;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8% / 6%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: none;
}

/* Transparent hit target sized to art EJECT circle (not the volume rail) */
.misty-panic-eject {
  position: absolute;
  left: 26.5%;
  top: 27.1%;
  width: 43.6%;
  height: 30.0%;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: none;
}
.misty-panic-eject:active {
  filter: brightness(0.82) contrast(1.05);
  transform: scale(0.97);
  transform-origin: center center;
}
.misty-panic-eject:focus-visible {
  outline: 3px solid #ffd60a;
  outline-offset: 3px;
}

/* Lit LED column (13 segments). Mask covers unlit segments from the TOP down. */
.misty-panic-led-track {
  position: absolute;
  left: 78.98%;
  top: 58.39%;
  width: 4.36%;
  height: 27.62%;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.misty-panic-led-mask {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0%;
  background: #050607;
  pointer-events: none;
}
.misty-panic.is-muted .misty-panic-led-mask {
  height: 100% !important;
  background: rgba(4, 6, 8, 0.82);
}

/* Finger target over the LED bar (slightly wider than the lit pixels) */
.misty-panic-volume {
  position: absolute;
  left: 77.84%;
  top: 57.91%;
  width: 6.72%;
  height: 28.58%;
  z-index: 5;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: ns-resize;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.misty-panic-volume:focus-visible {
  outline: 2px solid #ffd60a;
  outline-offset: 1px;
}

/* Mute button under the LED rail */
.misty-panic-mute {
  position: absolute;
  left: 76.33%;
  top: 86.54%;
  width: 9.85%;
  height: 6.94%;
  z-index: 5;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.misty-panic-mute.is-muted {
  background: rgba(0, 0, 0, 0.48);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.misty-panic-mute.is-muted::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 46%;
  height: 2px;
  background: #ff2a2a;
  transform: rotate(-42deg);
  transform-origin: center center;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.misty-panic-mute:focus-visible {
  outline: 2px solid #ffd60a;
  outline-offset: 1px;
}

/* Live DSEG digits over empty black LCD windows in the artwork.
   Measured on 1056×1872 console-pack art (inner black only, not label plates).
   LEVEL digits live in the top nixie tubes; mult/score/best stay on plates.
   Tight negative letter-spacing + right-align — no justify/slot stretch.
   DSEG has no × glyph; panic mult uses ASCII x (see mistyFormatPanicMult). */
.misty-panic-lcd {
  position: absolute;
  z-index: 3;
  box-sizing: border-box;
  margin: 0;
  font-family: 'DSEG7 Classic', 'Courier New', monospace;
  font-style: italic;
  font-weight: 700;
  font-synthesis: none;
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: #fff;
  text-align: right;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.35);
  background: transparent;
  border: none;
  padding: 0 2%;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  /* Do NOT set container-type here. cqw/cqh on a container refer to an
     ancestor (or the viewport). That made font-size ~18vw (~90px) inside a
     ~16px window, so overflow clipped each digit to its right segments —
     the white chevron. Size comes from the panel container (see below). */
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 12px;
}
.misty-panic-lcd--mult {
  /* BONUS MULT black window ~407–722 × 1223–1341 */
  left: 40.72%;
  top: 65.33%;
  width: 31.44%;
  height: 6.30%;
  padding: 0 2%;
  letter-spacing: -0.04em;
  /* ~9% of panel width fills the ~6.3% tall window without clipping "x1.0" */
  font-size: 12px;
  font-size: 9.2cqw;
}
.misty-panic-lcd--score {
  /* SCORE black window ~352–747 × 1395–1517 */
  left: 33.33%;
  top: 74.52%;
  width: 37.41%;
  height: 6.52%;
  padding: 0 2%;
  letter-spacing: -0.05em;
  font-size: 12px;
  font-size: 8.8cqw;
}
.misty-panic-lcd--best {
  /* HIGH SCORE black window ~352–747 × 1576–1718 */
  left: 33.33%;
  top: 84.19%;
  width: 37.41%;
  height: 7.59%;
  padding: 0 2%;
  letter-spacing: -0.05em;
  font-size: 12px;
  font-size: 8.8cqw;
  /* Secret L5 skip hit target — only this LCD receives taps */
  pointer-events: auto;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Temp Misty dev spawn buttons — stacked to the right of the eject panel */
.misty-dev-spawns {
  position: absolute;
  left: calc(100% + 6px);
  top: 26%;
  z-index: 6;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  pointer-events: none;
}
.misty-dev-spawns.is-unlocked {
  display: flex;
}
.misty-dev-spawn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.misty-dev-spawn:active {
  transform: scale(0.92);
}
.misty-dev-spawn:focus-visible {
  outline: 2px solid #ffd60a;
  outline-offset: 2px;
}
.misty-dev-spawn--starman {
  background: #c62828;
}
.misty-dev-spawn--kart {
  background: #2e7d32;
}
.misty-dev-spawn--fidget {
  background: #f9a825;
}

@media (max-width: 360px) {
  .misty-panic {
    width: min(39vw, 132px);
  }
  .misty-dev-spawn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .misty-panic-nixie-digit {
    filter: drop-shadow(0 0 2px rgba(255, 90, 0, 0.7));
  }
  .misty-panic-eject:active {
    transform: none;
  }
}


/* ---------- Misty Pong kill-zone floor ---------- */
/* Transparent positioning shell — floor-plate PNG alpha lets misty space BG show through. */
.misty-blackhole {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Full-size floor art (matches paddle bottom clearance). Hit/death zone is joystick-mid via JS — art size is independent. */
  height: max(120px, calc(env(safe-area-inset-bottom, 0px) + 110px));
  z-index: 35;
  display: none;
  pointer-events: none;
  overflow: hidden;
  contain: layout style paint;
  background: transparent;
}
.misty-blackhole.is-active {
  display: block;
}

/* Kill-zone floor plate (early-level random stills / Nyan Cat song dog-ships boss). */
.misty-floor-plate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  /* cover + bottom: fill original full strip (1080×360 plates) */
  object-fit: cover;
  object-position: center bottom;
  display: none;
  pointer-events: none;
  z-index: 2;
  user-select: none;
  -webkit-user-drag: none;
}
.misty-floor-plate.is-active {
  display: block;
}

/* Nyan boss dogs: cover+bottom was cropping heads off the top of the strip.
   Give the kill-zone shell enough height for the 3:1 plate and contain the art
   so heads stay visible without changing early-level stills. */
.misty-blackhole.is-boss {
  height: max(140px, calc(100vw / 3), calc(env(safe-area-inset-bottom, 0px) + 130px));
  overflow: hidden;
}
.misty-floor-plate.is-boss {
  object-fit: contain;
  object-position: center bottom;
}

/* ---------- Misty Pong mini joystick (center-bottom thumb stick) ---------- */
.misty-joystick {
  position: fixed;
  left: 50%;
  bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 6px));
  transform: translateX(-50%);
  z-index: 44;
  width: 96px;
  height: 96px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  cursor: grab;
  /* Generous thumb hit area (full 96×96) */
  pointer-events: auto;
}
.misty-joystick.is-active {
  display: block;
}
.misty-joystick.is-dragging {
  cursor: grabbing;
}
.misty-joystick-well {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 52px;
  height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(70, 74, 84, 0.55), rgba(18, 20, 28, 0.35) 70%, transparent 78%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
.misty-joystick-stick {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 64px;
  height: 64px;
  margin: 0;
  padding: 0;
  border: 0;
  transform: translate(calc(-50% + var(--joy-x, 0px)), -50%) rotate(var(--joy-rot, 0deg));
  transform-origin: 50% 78%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: transform 0.12s ease-out;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
.misty-joystick.is-dragging .misty-joystick-stick {
  transition: none;
}

/* ---------- Misty mini-Pong (5th-tap full effect) ---------- */
.misty-paddle {
  position: fixed;
  left: 0;
  bottom: max(120px, calc(env(safe-area-inset-bottom, 0px) + 110px));
  z-index: 42;
  width: min(24.565vw, 101px);
  /* Level-1 cap width 101px × opaque art 72/295 ≈ 25px. JS sets the live height. */
  height: 25px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  cursor: grab;
  display: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.misty-paddle-art {
  position: absolute;
  left: 50%;
  top: 50%;
  /* Canvas is 476×72; opaque paddle is 295px wide, centered. Scale so art fills the hitbox. */
  width: calc(100% * 476 / 295);
  height: auto;
  max-width: none;
  transform: translate(-50%, -50%) rotate(0deg);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.misty-paddle.is-active {
  display: block;
}
.misty-paddle.is-dragging {
  cursor: grabbing;
}
/* Tiny RCS thruster plumes — opposite edge of travel, subtle neon/orange */
.misty-paddle-rcs {
  position: absolute;
  top: 50%;
  width: 6px;
  height: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 40% 40% 55% 55%;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  --rcs: 0;
  /* Local exhaust points "down"; L/R rotate to shoot outward */
  background: linear-gradient(
    180deg,
    rgba(255, 245, 200, 0.95) 0%,
    rgba(255, 160, 40, 0.85) 40%,
    rgba(255, 60, 30, 0.45) 75%,
    rgba(255, 40, 120, 0) 100%
  );
  box-shadow:
    0 0 3px 1px rgba(255, 170, 50, 0.5),
    0 2px 8px 1px rgba(255, 70, 40, 0.35);
  filter: blur(0.15px);
  transition: opacity 50ms linear;
}
.misty-paddle-rcs::before,
.misty-paddle-rcs::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 40%;
  width: 3px;
  height: 7px;
  border-radius: 50%;
  transform: translate(-50%, 0);
  background: radial-gradient(
    circle,
    rgba(255, 240, 160, 0.95) 0%,
    rgba(255, 110, 40, 0.5) 55%,
    transparent 78%
  );
  opacity: 0.85;
  animation: misty-rcs-flicker 88ms steps(2, end) infinite;
}
.misty-paddle-rcs::after {
  width: 2px;
  height: 5px;
  top: 62%;
  left: 62%;
  animation-delay: 44ms;
  opacity: 0.6;
}
.misty-paddle-rcs-l {
  left: 1%;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.55);
}
.misty-paddle-rcs-r {
  right: 1%;
  left: auto;
  transform: translate(50%, -50%) rotate(-90deg) scale(0.55);
}
.misty-paddle-rcs-l.is-firing {
  opacity: calc(0.3 + var(--rcs) * 0.7);
  transform: translate(-50%, -50%) rotate(90deg) scale(calc(0.55 + var(--rcs) * 0.75));
}
.misty-paddle-rcs-r.is-firing {
  opacity: calc(0.3 + var(--rcs) * 0.7);
  transform: translate(50%, -50%) rotate(-90deg) scale(calc(0.55 + var(--rcs) * 0.75));
}
@keyframes misty-rcs-flicker {
  0% { opacity: 0.95; transform: translate(-50%, 0) scaleY(1); }
  50% { opacity: 0.5; transform: translate(-50%, 1px) scaleY(0.82); }
  100% { opacity: 0.9; transform: translate(-50%, 0) scaleY(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .misty-paddle-rcs::before,
  .misty-paddle-rcs::after {
    animation: none;
  }
}
/* Retired during pong — score/level/mult/high only on panic panel LCDs */
.misty-pong-hud {
  position: fixed;
  top: calc(50% + min(22vw, 90px));
  left: 50%;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 43;
  display: none !important; /* permanently hidden; panel LCDs own the meters */
  gap: 10px;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}
.misty-pong-hud.is-active {
  display: none !important;
}
.misty-pong-hud b {
  font-variant-numeric: tabular-nums;
  color: #ffd60a;
}
.misty-pong-best b {
  color: #2ec4b6;
}
.misty-pong-level b {
  color: #a78bfa;
}
.misty-level-banner {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: transparent;
}
.misty-level-banner.is-active {
  display: flex;
}
.misty-level-banner-text {
  position: relative;
  font-size: clamp(42px, 14vw, 72px);
  font-weight: 800;
  letter-spacing: 0.06em;
  /* Keep white glyphs readable over the shifting neon card */
  color: #fff;
  -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.55);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.9),
    0 0 4px rgba(0, 0, 0, 0.85),
    0 0 18px rgba(255, 255, 255, 0.35),
    0 0 28px rgba(255, 0, 200, 0.45);
  animation:
    misty-level-pop 0.45s ease-out,
    misty-level-neon-cycle 2.8s linear infinite;
  padding: 12px 28px;
  border-radius: 16px;
  /* Dark base so Level N stays readable outdoors; rainbow rides border + wash */
  background:
    linear-gradient(135deg,
      rgba(255, 0, 110, 0.28),
      rgba(123, 97, 255, 0.28),
      rgba(0, 245, 255, 0.28),
      rgba(57, 255, 20, 0.28),
      rgba(255, 214, 10, 0.28),
      rgba(255, 0, 110, 0.28)) border-box,
    rgba(6, 8, 18, 0.78) padding-box;
  background-size: 300% 300%, auto;
  border: 2px solid #ff2bd6;
  box-shadow:
    0 0 16px rgba(255, 43, 214, 0.7),
    0 0 32px rgba(0, 245, 255, 0.35),
    inset 0 0 18px rgba(123, 97, 255, 0.22);
  image-rendering: pixelated;
}
@keyframes misty-level-pop {
  0% { transform: scale(0.55); opacity: 0; }
  55% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* Neon rainbow: hue-shift border/glow + gradient wash (text stays white) */
@keyframes misty-level-neon-cycle {
  0% {
    border-color: #ff2bd6;
    background-position: 0% 50%, 0 0;
    box-shadow:
      0 0 16px rgba(255, 43, 214, 0.75),
      0 0 32px rgba(255, 0, 110, 0.35),
      inset 0 0 18px rgba(255, 43, 214, 0.22);
  }
  20% {
    border-color: #ff7a00;
    background-position: 20% 50%, 0 0;
    box-shadow:
      0 0 16px rgba(255, 122, 0, 0.75),
      0 0 32px rgba(255, 214, 10, 0.3),
      inset 0 0 18px rgba(255, 122, 0, 0.2);
  }
  40% {
    border-color: #39ff14;
    background-position: 40% 50%, 0 0;
    box-shadow:
      0 0 16px rgba(57, 255, 20, 0.75),
      0 0 32px rgba(0, 245, 255, 0.3),
      inset 0 0 18px rgba(57, 255, 20, 0.2);
  }
  60% {
    border-color: #00f5ff;
    background-position: 60% 50%, 0 0;
    box-shadow:
      0 0 16px rgba(0, 245, 255, 0.75),
      0 0 32px rgba(123, 97, 255, 0.35),
      inset 0 0 18px rgba(0, 245, 255, 0.22);
  }
  80% {
    border-color: #7b61ff;
    background-position: 80% 50%, 0 0;
    box-shadow:
      0 0 16px rgba(123, 97, 255, 0.75),
      0 0 32px rgba(255, 43, 214, 0.3),
      inset 0 0 18px rgba(123, 97, 255, 0.22);
  }
  100% {
    border-color: #ff2bd6;
    background-position: 100% 50%, 0 0;
    box-shadow:
      0 0 16px rgba(255, 43, 214, 0.75),
      0 0 32px rgba(255, 0, 110, 0.35),
      inset 0 0 18px rgba(255, 43, 214, 0.22);
  }
}
@media (prefers-reduced-motion: reduce) {
  .misty-level-banner-text {
    animation: none;
    border-color: #c44dff;
    background-position: 40% 50%, 0 0;
    box-shadow:
      0 0 14px rgba(196, 77, 255, 0.55),
      0 0 24px rgba(0, 245, 255, 0.25),
      inset 0 0 14px rgba(123, 97, 255, 0.18);
  }
}
.misty-gameover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.misty-gameover.is-active {
  display: flex;
}
.misty-gameover-card {
  text-align: center;
  padding: 22px 22px 18px;
  border-radius: 18px;
  background: linear-gradient(160deg, #1a1030 0%, #0d1528 100%);
  border: 2px solid rgba(255, 214, 10, 0.55);
  box-shadow: 0 0 40px rgba(255, 0, 110, 0.35), 0 12px 32px rgba(0, 0, 0, 0.45);
  color: #fff;
  min-width: min(78vw, 280px);
  max-width: min(92vw, 320px);
  animation: misty-gameover-pop 0.35s ease-out;
}
.misty-gameover-title {
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ff3b5c;
  text-shadow: 0 0 18px rgba(255, 59, 92, 0.65);
  margin-bottom: 12px;
}
.misty-gameover-score,
.misty-gameover-best {
  font-size: 16px;
  margin: 4px 0;
  opacity: 0.95;
}
.misty-gameover-score b {
  color: #ffd60a;
  font-variant-numeric: tabular-nums;
}
.misty-gameover-best b {
  color: #2ec4b6;
  font-variant-numeric: tabular-nums;
}
.misty-gameover-level {
  font-size: 14px;
  margin: 4px 0 8px;
  opacity: 0.95;
}
.misty-gameover-level b {
  color: #a78bfa;
  font-variant-numeric: tabular-nums;
}
.misty-leaderboard {
  margin: 10px 0 4px;
  text-align: left;
  max-width: min(72vw, 260px);
  margin-left: auto;
  margin-right: auto;
}
.misty-leaderboard-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #ffd60a;
  text-align: center;
  margin-bottom: 6px;
}
.misty-leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 148px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 11px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.misty-leaderboard-list li {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  gap: 6px;
  align-items: baseline;
  padding: 3px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}
.misty-leaderboard-list li:last-child {
  border-bottom: none;
}
.misty-leaderboard-rank {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
}
.misty-leaderboard-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.misty-leaderboard-score {
  color: #ffd60a;
  font-weight: 700;
}
.misty-leaderboard-lv {
  color: #a78bfa;
  font-weight: 600;
  min-width: 2.6em;
  text-align: right;
}
.misty-leaderboard-status {
  margin-top: 4px;
  font-size: 10px;
  text-align: center;
  opacity: 0.55;
  min-height: 1.2em;
}
.misty-gameover-try-again {
  display: block;
  width: 100%;
  max-width: min(72vw, 260px);
  margin: 14px auto 0;
  padding: 14px 18px;
  min-height: 48px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0d1528;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, #ffe566 0%, #ffd60a 42%, #f0a800 100%);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 0 18px rgba(255, 214, 10, 0.55),
    0 4px 0 #c48400,
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.misty-gameover-try-again:active {
  transform: translateY(2px);
  box-shadow:
    0 0 12px rgba(255, 214, 10, 0.4),
    0 2px 0 #c48400,
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.misty-gameover-try-again:focus-visible {
  outline: 2px solid #2ec4b6;
  outline-offset: 3px;
}
.misty-gameover-hint {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.55;
}
@keyframes misty-gameover-pop {
  from { transform: scale(0.82); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .misty-gameover-card {
    animation: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .misty-easter.is-spinning-soft .misty-easter-sprite {
    animation: misty-spin-soft 2.4s linear infinite;
  }
  .misty-easter.is-spinning-fast .misty-easter-sprite {
    animation: misty-spin-fast 1.2s linear infinite;
  }
  .misty-easter.is-spin-once .misty-easter-sprite {
    animation-duration: 1.1s;
  }
  .misty-easter.is-wiggle .misty-easter-sprite {
    animation-duration: 1.0s;
  }
  .misty-rainbow.is-active {
    animation-duration: 0.9s;
    opacity: 0.35;
  }
}


/* App header logo (not BOL document brand) */
.topbar-with-logo {
  /* Let the logo reach the bottom edge of the chrome, above its border. */
  padding-bottom: 0;
}
.app-title.app-title-logo {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  overflow: visible;
}
.app-title-logo-img {
  display: block;
  height: 50px;
  width: auto;
  max-width: 156px;
  object-fit: contain;
  border-radius: 0;
}

/* Off-screen file inputs — display:none/hidden can block camera/gallery on some mobile PWAs */
.visually-hidden-file {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

/* Stop document attachments */
.stop-docs-count {
  font-weight: 600;
  color: var(--accent, #f5a623);
  font-size: 0.9em;
}
.stop-docs-row {
  margin-top: 8px;
}
.stop-docs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.stop-docs-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stop-doc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.85rem;
}
.stop-doc-thumb {
  width: 36px;
  height: 46px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.stop-doc-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stop-doc-remove {
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  margin: 0 6px 0 0;
  padding: 0;
  box-sizing: border-box;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  text-indent: 0;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
}
.stop-doc-remove-icon {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.stop-doc-remove:hover,
.stop-doc-remove:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  outline: none;
  box-shadow: none;
}
.stop-doc-remove:active {
  transform: scale(0.94);
  color: var(--ink);
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Doc scan modal — industrial ticket chrome (matches equip-ocr / stop cards) */
.docscan-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(90, 40, 140, 0.28) 0%, transparent 55%),
    rgba(8, 6, 14, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.docscan-overlay[hidden] { display: none !important; }
.docscan-panel {
  margin: 0 auto;
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  background:
    linear-gradient(165deg, #221833 0%, var(--surface, #2a2d31) 42%, #1c1f24 100%);
  color: var(--ink, #f4f5f6);
  border: 1px solid var(--border, #3d4248);
  border-top: 3px solid var(--accent, #f5c518);
  border-radius: 14px;
  padding: 14px 12px 12px;
  box-shadow:
    0 0 0 1px rgba(245, 197, 24, 0.12),
    0 16px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.docscan-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.docscan-title,
.docscan-panel h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #f5c518);
}
.docscan-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted, #9aa0a6);
  line-height: 1.35;
}
.docscan-crop-wrap {
  position: relative;
  width: 100%;
  max-height: 55vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, #0e0c14 0%, #16141c 100%);
  border: 1px solid var(--border, #3d4248);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(245, 197, 24, 0.08),
    inset 0 2px 10px rgba(0, 0, 0, 0.45);
  touch-action: none;
}
.docscan-crop-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 55vh;
  object-fit: contain;
}
.docscan-crop-wrap svg {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.docscan-crop-wrap .docscan-handle {
  pointer-events: auto;
  cursor: grab;
  fill: var(--accent, #f5c518);
  stroke: #1a1c1e;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 4px rgba(245, 197, 24, 0.65))
          drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}
.docscan-crop-wrap .docscan-handle:active {
  cursor: grabbing;
  fill: var(--accent-hover, #ffd54f);
}
.docscan-crop-wrap .docscan-poly {
  fill: rgba(245, 197, 24, 0.14);
  stroke: var(--accent, #f5c518);
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(245, 197, 24, 0.35));
}
.docscan-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
.docscan-actions .btn {
  width: 100%;
}
.docscan-preview {
  width: 100%;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border, #3d4248);
  max-height: 55vh;
  object-fit: contain;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .docscan-panel {
  background:
    linear-gradient(165deg, #e8eef6 0%, var(--surface, #e8eef6) 50%, #d4e0f0 100%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent),
    0 16px 40px rgba(15, 39, 77, 0.28);
}
html[data-theme="light"] .docscan-crop-wrap {
  background: #1a2333;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 11000;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.sheet-backdrop[hidden] { display: none !important; }
.action-sheet {
  width: min(420px, 100%);
  background: var(--surface, #1e1e1e);
  color: var(--text, #eee);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.4);
}
.action-sheet button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
}
.action-sheet button:active { background: color-mix(in srgb, var(--accent, #f5a623) 18%, transparent); }
.action-sheet .sheet-cancel { opacity: 0.75; font-weight: 600; margin-top: 4px; }

/* Extra attachment pages on ticket */
.bol-page.bol-attach-page {
  display: flex;
  flex-direction: column;
}
.bol-attach-page .bol-attach-frame {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  padding: 8px 10px 12px;
}
.bol-attach-page .bol-attach-frame img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
}



/* Nyan Cat song celebration FX layer (confetti + shooting stars + nyan cats) */
.misty-post-fx {
  position: fixed;
  inset: 0;
  z-index: 36; /* under Misty (41) / panic (37) / rainbow flash (38); above blackhole (35) */
  pointer-events: none;
  display: none;
}
.misty-post-fx.is-active {
  display: block;
}
body.tutorial-active .misty-post-fx,
#screen-home:not(.active) .misty-post-fx {
  display: none !important;
}

.misty-pong-mult {
  font-weight: 800;
  color: #ffd60a;
  letter-spacing: 0.02em;
}

/* ---------- Fidget spinner (Misty Pong) — multi entity container ---------- */
.misty-fidgets {
  position: fixed;
  inset: 0;
  z-index: 42; /* above paddle (~40); under panic */
  pointer-events: none;
  display: none;
}
.misty-fidgets.is-active {
  display: block;
}
.misty-fidget {
  position: fixed;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  will-change: left, top;
}
.misty-fidget-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 0 6px rgba(255, 210, 40, 0.55));
  user-select: none;
  -webkit-user-drag: none;
}

/* Kart-kid transform: swap Misty turntable for spinning gokart webp */
.misty-easter.is-kart-kid .misty-easter-sprite {
  background-image: url('./assets/misty-paddle/gokart.webp');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  animation: none !important;
  filter: drop-shadow(0 0 8px rgba(255, 180, 60, 0.55));
}
.misty-easter.is-kart-shake {
  animation: misty-kart-shake 0.28s ease-in-out;
}
@keyframes misty-kart-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-3px, 1px) rotate(-4deg); }
  40% { transform: translate(3px, -1px) rotate(4deg); }
  60% { transform: translate(-2px, 2px) rotate(-3deg); }
  80% { transform: translate(2px, -2px) rotate(2deg); }
}

/* Calm Nyan-era neon while kart-kid song plays — soft hue shifts, not storm strobe */
.misty-neon-rim.is-kart-calm {
  opacity: 1;
  animation: misty-neon-kart-calm-top 10s ease-in-out infinite;
}
.misty-neon-rim.is-kart-calm::before,
.misty-neon-rim.is-kart-calm::after {
  content: '';
  position: absolute;
  top: 0;
  width: 3px;
  height: 86%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 78%, transparent 100%);
}
.misty-neon-rim.is-kart-calm::before {
  left: 0;
  animation: misty-neon-kart-calm-left 12s ease-in-out infinite;
}
.misty-neon-rim.is-kart-calm::after {
  right: 0;
  animation: misty-neon-kart-calm-right 11s ease-in-out infinite;
}
@keyframes misty-neon-kart-calm-top {
  0%, 100% {
    box-shadow:
      inset 0 3px 14px 0 rgba(120, 200, 255, 0.35),
      inset 0 10px 28px -4px rgba(120, 200, 255, 0.15);
  }
  50% {
    box-shadow:
      inset 0 3px 14px 0 rgba(180, 140, 255, 0.4),
      inset 0 10px 28px -4px rgba(180, 140, 255, 0.18);
  }
}
@keyframes misty-neon-kart-calm-left {
  0%, 100% {
    background: linear-gradient(to bottom, rgba(100, 220, 180, 0.55), rgba(100, 220, 180, 0.05));
    box-shadow: 0 0 10px 2px rgba(100, 220, 180, 0.35);
  }
  50% {
    background: linear-gradient(to bottom, rgba(255, 200, 120, 0.55), rgba(255, 200, 120, 0.05));
    box-shadow: 0 0 10px 2px rgba(255, 200, 120, 0.35);
  }
}
@keyframes misty-neon-kart-calm-right {
  0%, 100% {
    background: linear-gradient(to bottom, rgba(255, 160, 200, 0.5), rgba(255, 160, 200, 0.05));
    box-shadow: 0 0 10px 2px rgba(255, 160, 200, 0.32);
  }
  50% {
    background: linear-gradient(to bottom, rgba(120, 200, 255, 0.55), rgba(120, 200, 255, 0.05));
    box-shadow: 0 0 10px 2px rgba(120, 200, 255, 0.35);
  }
}
body.misty-kart-calm #screen-home.active {
  box-shadow:
    inset 0 2px 12px 0 rgba(140, 190, 255, 0.28),
    inset 2px 0 12px 0 rgba(160, 220, 180, 0.22),
    inset -2px 0 12px 0 rgba(220, 170, 255, 0.22);
}

/* ---------- Starman Roadster tumble (Misty Pong) ---------- */
.misty-starman {
  position: fixed;
  z-index: 41; /* under fidget (42); above paddle (~40); separate entity */
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  display: none;
  will-change: left, top;
}
.misty-starman.is-active {
  display: block;
}
.misty-starman-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 0 5px rgba(255, 200, 80, 0.45));
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- Fleeting +points flare (Misty Pong) ---------- */
.misty-score-flare {
  position: fixed;
  z-index: 45; /* above paddle/fidgets/starman; under level banner (~49) & gameover */
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
  user-select: none;
  font-family: ui-rounded, "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 5.2vw, 26px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: #ffe566;
  text-shadow:
    0 0 6px rgba(255, 220, 80, 0.95),
    0 0 14px rgba(120, 220, 255, 0.75),
    0 0 22px rgba(255, 120, 220, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  will-change: transform, opacity;
  animation: misty-score-flare-pop 0.9s ease-out forwards;
}
@keyframes misty-score-flare-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -62%) scale(1.18);
  }
  32% {
    opacity: 1;
    transform: translate(-50%, -78%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -130%) scale(0.88);
  }
}
@media (prefers-reduced-motion: reduce) {
  .misty-score-flare {
    animation-duration: 0.55s;
  }
}


/* ---- Misty lives stub + death lesson ("What did we learn?") ---- */
.misty-lives-hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 46;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 18, 0.72);
  border: 1px solid rgba(255, 210, 80, 0.45);
  color: #ffe8a0;
  font: 700 13px/1.2 system-ui, sans-serif;
  letter-spacing: 0.04em;
  pointer-events: none;
  display: none;
}
.misty-lives-hud.is-active { display: block; }
.misty-lives-hud b { color: #fff6c8; }

.misty-death-lesson {
  position: fixed;
  inset: 0;
  z-index: 52;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.62);
  -webkit-tap-highlight-color: transparent;
}
.misty-death-lesson.is-active { display: flex; }
.misty-death-lesson-card {
  width: min(92vw, 360px);
  max-height: 92vh;
  overflow: auto;
  padding: 18px 16px 14px;
  border-radius: 16px;
  background: linear-gradient(165deg, #1a1428 0%, #0c0e18 70%);
  border: 1px solid rgba(255, 200, 80, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
  color: #f5f0ff;
  animation: misty-gameover-pop 0.35s ease-out;
}
.misty-death-lesson-title {
  font: 800 1.25rem/1.25 system-ui, sans-serif;
  color: #ffe28a;
  margin: 0 0 12px;
  text-shadow: 0 0 12px rgba(255, 180, 40, 0.35);
}
.misty-death-lesson-gif-wrap {
  margin: 0 auto 12px;
  width: min(100%, 280px);
  min-height: 120px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 210, 120, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.misty-death-lesson-gif {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.misty-death-lesson-lives {
  font: 600 0.95rem/1.3 system-ui, sans-serif;
  color: #d8d0f0;
  margin: 0 0 14px;
}
.misty-death-lesson-lives b { color: #fff2a8; }
.misty-death-lesson-revert,
.misty-death-lesson-quit {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 0;
  font: 700 0.95rem/1.25 system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.misty-death-lesson-revert {
  background: linear-gradient(180deg, #ffe08a, #f0b020);
  color: #1a1200;
}
.misty-death-lesson-revert:active { filter: brightness(0.92); }
.misty-death-lesson-quit {
  background: rgba(255, 255, 255, 0.08);
  color: #f0eaf8;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.misty-death-lesson-quit:active { background: rgba(255, 255, 255, 0.14); }
.misty-death-lesson-hint {
  margin-top: 4px;
  font: 500 0.72rem/1.35 system-ui, sans-serif;
  color: rgba(220, 210, 255, 0.55);
}
body.tutorial-active .misty-death-lesson,
body.tutorial-active .misty-lives-hud,
#screen-home:not(.active) .misty-death-lesson,
#screen-home:not(.active) .misty-lives-hud {
  display: none !important;
}
