/* ============================================================
   BrackBarn LLC — Modern Marketplace UI (Classic Burnt Orange Skin)
   ============================================================ */

/* Trajan-style classical Roman for obelisk engraving (self-hosted; CSP font-src 'self').
   Prefer local Trajan Pro when present; Cinzel is the redistributable fallback. */
@font-face {
  font-family: "Cinzel";
  src: url("/vendor/fonts/cinzel/Cinzel-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cinzel";
  src: url("/vendor/fonts/cinzel/Cinzel-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bb-cream: #f8eee2;
  --bb-cream-light: #fff8ee;
  --bb-cream-hover: #ffe9cf;
  --bb-orange: #cc5500;
  --bb-orange-dark: #8b4513;
  --bb-orange-darker: #7a3300;
  --bb-orange-bright: #ff7722;
  --bb-brown-bg: #2f1703;
  --bb-text: #2a1500;
  --bb-text-muted: #5c3d1e;
  --bb-white: #ffffff;
  --bb-error: #800000;
  --bb-error-bg: #ffcccc;
  --bb-success: #004400;
  --bb-success-bg: #ccffcc;
  --bb-shadow: 0 12px 32px rgba(33, 16, 0, 0.2);
  --bb-shadow-sm: 0 4px 16px rgba(33, 16, 0, 0.12);
  --bb-line-height: 1.6;
  --bb-radius: 14px;
  --bb-radius-sm: 10px;
  --bb-touch-min: 44px;
  --bb-content-max: 72ch;
  --bb-space-xs: 6px;
  --bb-space-sm: 10px;
  --bb-space-md: 16px;
  --bb-space-lg: 24px;
  --bb-space-xl: 32px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Window Chrome ──────────────────────────────────────── */

.win98-window {
  background: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: 18px;
  max-width: 1240px;
  margin: 18px auto;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--bb-shadow);
}

.win98-titlebar {
  background: linear-gradient(110deg, var(--bb-orange-dark) 0%, var(--bb-orange) 48%, #d86a1f 100%);
  color: var(--bb-white);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.015em;
  user-select: none;
  flex-shrink: 0;
}

.win98-titlebar-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bb-brand-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: block;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
}

/* ── Tab Bar ────────────────────────────────────────────── */

.win98-tabs-bar {
  background: linear-gradient(180deg, #fff7eb 0%, #f7e7d4 100%);
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(139, 69, 19, 0.22);
  flex-shrink: 0;
}

.win98-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--bb-touch-min);
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(139, 69, 19, 0.2);
  text-decoration: none;
  color: var(--bb-text);
  font-family: "Segoe UI", "Tahoma", Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 999px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.win98-tab:hover {
  background: var(--bb-cream-hover);
  border-color: rgba(139, 69, 19, 0.34);
}

.win98-tab:focus-visible {
  outline: 3px solid var(--bb-orange);
  outline-offset: 2px;
  z-index: 3;
}

.win98-tab.active {
  background: var(--bb-orange);
  color: var(--bb-white);
  border-color: var(--bb-orange-darker);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.win98-tab[hidden] {
  display: none !important;
}

.win98-session-user {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: min(240px, 42vw);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: var(--bb-white);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Admin / Account Sub-Tabs ───────────────────────────── */

.admin-subnav-root,
.account-subnav-root {
  padding: 8px 12px;
  background: linear-gradient(180deg, #fff7eb 0%, #f3e2cd 100%);
  border-bottom: 1px solid rgba(139, 69, 19, 0.22);
}

.admin-nav-groups {
  display: grid;
  gap: 6px;
}

.admin-nav-group {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 6px 10px;
  align-items: baseline;
  min-width: 0;
}

.admin-nav-group-label {
  color: var(--bb-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  padding-top: 2px;
}

.admin-nav-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  min-width: 0;
}

.admin-nav-items > li {
  display: inline-flex;
  align-items: baseline;
  margin: 0;
  padding: 0;
}

.admin-nav-items > li:not(:last-child)::after {
  content: "·";
  margin: 0 0.4em;
  color: rgba(92, 61, 30, 0.45);
  pointer-events: none;
}

.admin-nav-link {
  color: var(--bb-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  border-radius: 2px;
}

.admin-nav-link:hover {
  color: var(--bb-orange-darker);
  text-decoration: underline;
}

.admin-nav-link:focus-visible {
  outline: 2px solid var(--bb-orange);
  outline-offset: 2px;
}

.admin-nav-link.active {
  color: var(--bb-orange-darker);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-role-card {
  margin-top: var(--bb-space-lg);
}

/* ── Admin page workspace ───────────────────────────────── */

.admin-page {
  display: grid;
  gap: 12px;
}

.admin-page-header {
  margin: 0;
  padding-bottom: 12px;
}

.admin-page-header h1 {
  margin-bottom: 6px;
}

.admin-page-header .inventory-hint {
  margin-bottom: 10px;
}

.admin-topic-tabs-root {
  margin-top: 4px;
}

.admin-topic-list {
  margin: 0;
}

.admin-topic-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
}

.admin-topic-items > li {
  display: inline-flex;
  align-items: baseline;
  margin: 0;
  padding: 0;
}

.admin-topic-items > li:not(:last-child)::after {
  content: "·";
  margin: 0 0.4em;
  color: rgba(92, 61, 30, 0.45);
  pointer-events: none;
}

.admin-topic-link {
  color: var(--bb-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.admin-topic-link:hover {
  color: var(--bb-orange-darker);
  text-decoration: underline;
}

.admin-topic-link:focus-visible {
  outline: 2px solid var(--bb-orange);
  outline-offset: 2px;
}

.admin-topic-link.active {
  color: var(--bb-orange-darker);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-topic-panel {
  margin: 0;
}

.admin-topic-panel > h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.admin-topic-panel > h3,
.admin-topic-panel .account-card > h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.admin-compact-form {
  margin-top: 12px;
  max-width: 42rem;
}

.obelisk-materials-form {
  max-width: none;
}

.obelisk-materials-run-fieldset {
  max-width: 28rem;
}

.obelisk-materials-run-grid {
  grid-template-columns: repeat(2, minmax(8rem, 1fr));
}

.obelisk-materials-sheet-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin-top: 8px;
  border: 1px solid #9aa0a6;
  background: #fff;
  max-width: 100%;
}

.obelisk-materials-sheet {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: #202124;
  background: #fff;
}

.obelisk-materials-sheet th,
.obelisk-materials-sheet td {
  border: 1px solid #c0c0c0;
  padding: 0;
  vertical-align: middle;
  line-height: 1.35;
  white-space: nowrap;
}

.obelisk-materials-sheet thead th {
  background: #f3f3f3;
  color: #202124;
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  border-bottom: 1px solid #9aa0a6;
}

.obelisk-materials-sheet thead tr:first-child th.obelisk-materials-sheet-group {
  background: #e8eaed;
  border-bottom: 1px solid #c0c0c0;
}

.obelisk-materials-sheet tbody td {
  padding: 3px 6px;
  background: #fff;
}

.obelisk-materials-sheet tbody tr:nth-child(even) td {
  background: #f8f9fa;
}

.obelisk-materials-sheet tbody tr:hover td {
  background: #eef4ff;
}

.obelisk-materials-sheet-label {
  text-align: left;
  font-weight: 500;
  min-width: 12rem;
}

.obelisk-materials-sheet-sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 1px 0 0 #c0c0c0;
}

.obelisk-materials-sheet thead .obelisk-materials-sheet-sticky {
  z-index: 2;
  background: #f3f3f3;
}

.obelisk-materials-sheet tbody td.obelisk-materials-sheet-sticky {
  background: #fff;
}

.obelisk-materials-sheet tbody tr:nth-child(even) td.obelisk-materials-sheet-sticky {
  background: #f8f9fa;
}

.obelisk-materials-sheet tbody tr:hover td.obelisk-materials-sheet-sticky {
  background: #eef4ff;
}

.obelisk-materials-sheet-center {
  text-align: center;
}

.obelisk-materials-sheet-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12.5px;
}

.obelisk-materials-sheet-muted {
  color: #5f6368;
  font-size: 12px;
  white-space: normal;
  min-width: 7rem;
}

.obelisk-materials-sheet-input {
  display: block;
  width: 100%;
  min-width: 4.5rem;
  box-sizing: border-box;
  border: 0;
  margin: 0;
  padding: 5px 8px;
  background: transparent;
  font: inherit;
  font-family: "Consolas", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: inherit;
}

.obelisk-materials-sheet-input:focus {
  outline: 2px solid #1a73e8;
  outline-offset: -2px;
  background: #fff;
}

.obelisk-materials-sheet-check {
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;
}

.obelisk-materials-bom-heading {
  margin: 18px 0 8px;
  font-size: 1.05rem;
}

.obelisk-materials-size-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin: 14px 0 4px;
}

.obelisk-materials-size-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #c0c0c0;
  background: #f8f9fa;
  font-size: 12.5px;
  line-height: 1.4;
}

.obelisk-materials-size-card strong {
  font-size: 13px;
}

.obelisk-materials-size-cost {
  font-family: "Consolas", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-top: 2px;
}

.obelisk-materials-total-row td {
  font-weight: 700;
  border-top: 2px solid #9aa0a6;
  background: #eef2f7 !important;
}

@media (max-width: 720px) {
  .obelisk-materials-run-grid {
    grid-template-columns: 1fr;
  }
}

.admin-shell .win98-content,
.account-shell .win98-content {
  padding: 0;
}

.admin-shell .standalone-main,
.account-shell .standalone-main {
  padding: 14px 16px 18px;
}

.admin-shell .standalone-main > .panel,
.account-shell .standalone-main > .panel {
  margin-top: 0;
}

.admin-shell .inventory-table-wrap {
  max-height: min(520px, 60vh);
}

.admin-shell .inventory-toolbar {
  margin-bottom: 10px;
}

.admin-shell .inventory-summary {
  margin: 8px 0 10px;
}

/* ── Content Area ───────────────────────────────────────── */

.win98-content {
  background: linear-gradient(180deg, #fffdfa 0%, #fff7ec 100%);
  padding: var(--bb-space-lg);
  flex: 1;
}

/* ── Status Bar ─────────────────────────────────────────── */

.win98-statusbar {
  background: #fff3e4;
  border-top: 1px solid rgba(139, 69, 19, 0.2);
  padding: 8px 12px;
  font-size: 14px;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.win98-statusbar-field {
  border: 1px solid rgba(139, 69, 19, 0.2);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  padding: 5px 10px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bb-text-muted);
}

/* ── Cart Badge ─────────────────────────────────────────── */

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  background: linear-gradient(180deg, #f06a1a 0%, var(--bb-orange) 100%);
  color: var(--bb-white);
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(122, 51, 0, 0.28);
}

/* ── Toast Notifications ────────────────────────────────── */

.toast-root {
  position: fixed;
  right: 12px;
  top: 12px;
  z-index: 9999;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  background: var(--bb-cream);
  border: 2px solid;
  border-color: var(--bb-cream-light) var(--bb-orange-dark) var(--bb-orange-dark) var(--bb-cream-light);
  padding: 12px 16px;
  font-size: 15px;
  line-height: var(--bb-line-height);
  font-family: "Tahoma", "Segoe UI", "MS Sans Serif", Arial, sans-serif;
}

.toast.error {
  background: var(--bb-error-bg);
  border-color: var(--bb-white) var(--bb-error) var(--bb-error) var(--bb-white);
  color: var(--bb-error);
}

.toast.success {
  background: var(--bb-success-bg);
  border-color: var(--bb-white) #008000 #008000 var(--bb-white);
  color: var(--bb-success);
}

/* legacy grain overlay — hidden in Win98 mode */
.grain-overlay {
  display: none;
}

/* legacy site header — hidden, replaced by win98 titlebar + tabs */
.site-header { display: none; }
.brand { display: none; }

/* legacy main wrappers — content is now inside win98-content */
main, .standalone-main {
  width: 100%;
}

/* ── Body ───────────────────────────────────────────────── */

body {
  font-family: "Segoe UI", "Tahoma", Arial, sans-serif;
  font-size: 16px;
  background: radial-gradient(1200px 700px at 0% 0%, #5b3211 0%, var(--bb-brown-bg) 45%, #1d0e01 100%);
  color: var(--bb-text);
  min-height: 100vh;
  line-height: var(--bb-line-height);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p {
  max-width: var(--bb-content-max);
}

a {
  color: var(--bb-orange-darker);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--bb-orange);
}

a:focus-visible {
  outline: 3px solid var(--bb-orange);
  outline-offset: 2px;
}

::selection {
  background: var(--bb-orange);
  color: var(--bb-white);
}

/* ── Grids / Layout ─────────────────────────────────────── */

.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--bb-space-md);
}

.account-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--bb-space-md);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--bb-space-lg);
  margin-top: var(--bb-space-sm);
}

/* ── Product Cards ──────────────────────────────────────── */

.product-card {
  background: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius);
  padding: var(--bb-space-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--bb-shadow-sm);
}

.product-card-club {
  border-color: rgba(204, 85, 0, 0.45);
  background: linear-gradient(180deg, #fff8ee 0%, #f6e2c8 100%);
}

.product-card h2 {
  font-size: 17px;
  line-height: 1.35;
}

.product-card p {
  max-width: none;
  color: var(--bb-text-muted);
}

.product-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
}

.product-sale-badge {
  display: inline-block;
  background: var(--bb-orange);
  color: var(--bb-white);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
}

.product-price-list {
  color: var(--bb-text-muted);
  font-weight: 400;
}

.product-price-now {
  color: var(--bb-text);
}

.product-image-placeholder {
  background: linear-gradient(180deg, #f9dfc1 0%, #f5cd9d 100%);
  color: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.24);
  border-radius: var(--bb-radius-sm);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-bottom: var(--bb-space-xs);
  text-align: center;
  padding: var(--bb-space-sm);
  color: var(--bb-orange-darker);
  font-weight: 600;
}

.product-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: var(--bb-radius-sm);
  margin-bottom: var(--bb-space-xs);
  display: block;
  background: var(--bb-white);
}

/* ── Hero / Home ────────────────────────────────────────── */

.win98-content--flush-home {
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

.win98-content--flush-home > main > .home-section {
  margin-left: clamp(14px, 2.5vw, 28px);
  margin-right: clamp(14px, 2.5vw, 28px);
}

/* Homepage: stack main nav over the hero so the graphic starts under the title bar. */
.win98-window--home-overlap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "title"
    "main"
    "status";
}

.win98-window--home-overlap .win98-titlebar {
  grid-area: title;
}

.win98-window--home-overlap .win98-tabs-bar {
  grid-area: main;
  align-self: start;
  z-index: 4;
  /* Transparent bar so the hero photo reads between the pills. */
  background: transparent;
  border-bottom: none;
  padding-bottom: 18px;
}

.win98-window--home-overlap .win98-tab {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(33, 16, 0, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.win98-window--home-overlap .win98-tab:hover {
  background: rgba(255, 233, 207, 0.96);
}

.win98-window--home-overlap .win98-tab.active {
  background: var(--bb-orange);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.24),
    0 2px 10px rgba(33, 16, 0, 0.28);
}

.win98-window--home-overlap .win98-content--flush-home {
  grid-area: main;
  min-width: 0;
  min-height: 0;
}

.win98-window--home-overlap .win98-statusbar {
  grid-area: status;
}

@media (prefers-reduced-transparency: reduce) {
  .win98-window--home-overlap .win98-tabs-bar {
    background: linear-gradient(180deg, rgba(255, 247, 235, 0.92) 0%, rgba(247, 231, 212, 0.72) 70%, rgba(247, 231, 212, 0) 100%);
  }

  .win98-window--home-overlap .win98-tab {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.home-hero {
  position: relative;
  isolation: isolate;
  min-height: min(78vh, 720px);
  display: grid;
  align-items: end;
  overflow: hidden;
  margin-bottom: var(--bb-space-lg);
  color: var(--bb-white);
  background: #2a1500;
}

.home-hero-media,
.home-hero-scrim {
  position: absolute;
  inset: 0;
}

.home-hero-media {
  z-index: 0;
}

.home-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keep the dark barn and garden in frame; sky is blown out at the top. */
  object-position: center 58%;
  display: block;
  transform: scale(1.04);
  animation: home-hero-ken 18s ease-out forwards;
}

.home-hero-scrim {
  z-index: 1;
  /* Stronger left/bottom wash so brand copy stays readable over busy garden texture. */
  background:
    linear-gradient(90deg, rgba(29, 14, 1, 0.92) 0%, rgba(29, 14, 1, 0.62) 42%, rgba(29, 14, 1, 0.22) 72%, rgba(29, 14, 1, 0.08) 100%),
    linear-gradient(0deg, rgba(29, 14, 1, 0.78) 0%, rgba(29, 14, 1, 0.22) 42%, rgba(29, 14, 1, 0.05) 70%);
}

.home-hero-copy {
  position: relative;
  z-index: 2;
  padding: clamp(28px, 6vw, 64px) clamp(18px, 4vw, 48px);
  max-width: 34rem;
  animation: home-hero-rise 0.9s ease-out both;
}

.home-hero-brand {
  font-family: "Cinzel", "Times New Roman", Times, serif;
  font-size: clamp(2.4rem, 7vw, 4.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.05;
  margin: 0 0 var(--bb-space-sm);
  color: #fff8ee;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  max-width: none;
}

.home-hero h1 {
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 var(--bb-space-sm);
  max-width: 18em;
  color: #fff8ee;
}

.home-hero-lede {
  margin: 0 0 var(--bb-space-lg);
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: rgba(255, 248, 238, 0.9);
  max-width: 32ch;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bb-space-sm);
}

.home-hero-cta {
  animation: home-cta-glow 2.8s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 119, 34, 0.45);
}

.home-spotlight {
  background:
    linear-gradient(135deg, rgba(255, 248, 238, 0.95) 0%, rgba(255, 233, 207, 0.88) 55%, rgba(247, 216, 180, 0.75) 100%),
    radial-gradient(ellipse at 12% 20%, rgba(204, 85, 0, 0.08), transparent 55%);
  border-color: rgba(139, 69, 19, 0.28);
  animation: home-spotlight-in 0.85s ease-out both;
  animation-delay: 0.15s;
}

.home-spotlight .eyebrow {
  margin-bottom: var(--bb-space-xs);
}

.home-spotlight h2 {
  margin-bottom: var(--bb-space-sm);
  max-width: 18em;
}

.home-spotlight .section-lede {
  max-width: 46ch;
  margin-bottom: var(--bb-space-md);
}

.home-spotlight .btn {
  display: inline-flex;
}

.home-spotlight .hero-actions {
  margin-top: 0;
}

.section-lede {
  margin: calc(var(--bb-space-xs) * -1) 0 var(--bb-space-md);
  color: var(--bb-text-muted);
}

.trust-strip .trust-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--bb-space-md);
}

@media (max-width: 960px) {
  .trust-strip .trust-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.trust-item h3 {
  margin-bottom: var(--bb-space-xs);
  font-size: 1rem;
  color: var(--bb-orange-darker);
}

.trust-item p {
  margin: 0;
  max-width: none;
}

.contact-reveal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--bb-space-xs);
  position: relative;
}

.contact-reveal-btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.875rem;
}

.contact-reveal-result {
  display: block;
  line-height: 1.45;
}

.contact-reveal-result + .contact-reveal-result,
.contact-reveal-btn + .contact-reveal-result,
.contact-reveal-result + .contact-reveal-btn {
  margin-top: 0;
}

.contact-reveal-link {
  font-weight: 600;
}

.trust-note {
  margin-top: var(--bb-space-xs) !important;
  font-size: 0.8125rem;
  color: var(--bb-text-muted);
}

@keyframes home-hero-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes home-hero-ken {
  from {
    transform: scale(1.08);
  }
  to {
    transform: scale(1);
  }
}

@keyframes home-cta-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 119, 34, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 119, 34, 0);
  }
}

@keyframes home-spotlight-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-image,
  .home-hero-copy,
  .home-hero-cta,
  .home-spotlight {
    animation: none;
  }

  .home-hero-image {
    transform: none;
  }
}

.hero {
  padding: var(--bb-space-xs) 0 var(--bb-space-sm);
}

.market-hero {
  background: linear-gradient(145deg, #fff7ea 0%, #f9e3cb 55%, #f7d8b4 100%);
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius);
  padding: clamp(18px, 3vw, 30px);
  margin-bottom: var(--bb-space-lg);
  box-shadow: var(--bb-shadow-sm);
}

.eyebrow {
  text-transform: uppercase;
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--bb-orange);
}

h1 {
  font-size: clamp(1.5rem, 2.5vw, 1.875rem);
  font-weight: bold;
  line-height: 1.25;
  margin: var(--bb-space-xs) 0 var(--bb-space-sm);
  max-width: 22em;
}

.hero-copy {
  margin: var(--bb-space-xs) 0 var(--bb-space-md);
  font-size: 17px;
  color: var(--bb-text-muted);
}

.hero-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--bb-space-sm);
  margin-top: var(--bb-space-sm);
}

.hero-search input[type="search"] {
  margin: 0;
}

.hero-actions {
  display: flex;
  gap: var(--bb-space-sm);
  flex-wrap: wrap;
  margin-top: var(--bb-space-md);
}

.service-area-section p {
  margin-bottom: var(--bb-space-md);
}

.service-area-map {
  width: 100%;
  height: 380px;
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius-sm);
  overflow: hidden;
}

.service-area-map--unavailable {
  display: grid;
  place-items: center;
  padding: var(--bb-space-md);
  text-align: center;
  font-weight: 600;
  color: var(--bb-text);
  background: #fff3e8;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn,
button,
input[type="submit"],
input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--bb-touch-min);
  background: #fff8ef;
  border: 1px solid rgba(139, 69, 19, 0.35);
  padding: 10px 20px;
  font-family: "Segoe UI", "Tahoma", Arial, sans-serif;
  font-size: 15px;
  cursor: pointer;
  color: var(--bb-text);
  text-decoration: none;
  min-width: 96px;
  text-align: center;
  border-radius: 10px;
  line-height: 1.3;
  transition: transform 0.05s ease, background-color 0.2s ease;
}

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

.btn:focus-visible,
button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible {
  outline: 3px solid var(--bb-orange);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, #e86b1f 0%, var(--bb-orange) 100%);
  color: var(--bb-white);
  border-color: var(--bb-orange-darker);
  font-weight: bold;
  font-size: 16px;
  padding: 10px 22px;
}

.btn-secondary {
  font-weight: bold;
}

.btn-danger {
  background: linear-gradient(180deg, #fff0ec 0%, #ffd8cc 100%);
  color: var(--bb-error);
  border-color: rgba(128, 0, 0, 0.28);
  font-weight: 700;
}

button:disabled,
.btn:disabled {
  color: #8a7358;
  background: #e8d5bc;
  cursor: not-allowed;
  opacity: 0.85;
}

/* .btn/button set display:inline-flex, which otherwise overrides [hidden]. */
.btn[hidden],
button[hidden],
input[type="submit"][hidden],
input[type="button"][hidden] {
  display: none !important;
}

/* ── Panels / Group Boxes ───────────────────────────────── */

.panel {
  background: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: var(--bb-radius);
  padding: var(--bb-space-lg);
  margin-bottom: var(--bb-space-md);
  box-shadow: var(--bb-shadow-sm);
}

.panel h2 {
  margin-top: 0;
}

.panel > p {
  color: var(--bb-text-muted);
  margin-bottom: var(--bb-space-sm);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--bb-space-md);
}

.page-header .btn {
  flex-shrink: 0;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--bb-space-md);
  margin-top: var(--bb-space-sm);
}

.widget-card {
  display: grid;
  gap: var(--bb-space-sm);
  padding: var(--bb-space-md);
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: var(--bb-radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #fff8ee 100%);
}

.obelisk-builder-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(320px, 1fr);
  gap: var(--bb-space-md);
}

.obelisk-controls-pane,
.obelisk-preview-pane {
  background: #fffcf8;
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: var(--bb-radius-sm);
  padding: var(--bb-space-md);
}

.obelisk-controls-pane h2,
.obelisk-preview-pane h2 {
  margin-top: 0;
}

.obelisk-controls-pane .stack-form {
  margin-top: var(--bb-space-sm);
}

.obelisk-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--bb-space-xs);
  font-weight: 600;
}

.payment-option-disabled {
  color: #6b7280;
  cursor: not-allowed;
}

.payment-unavailable-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a2f2f;
  background: #f3d6d6;
  border: 1px solid #d9a9a9;
  border-radius: 3px;
}

.obelisk-preview-stage {
  margin-top: var(--bb-space-sm);
}

.obelisk-preview-canvas {
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius-sm);
  background: linear-gradient(180deg, #fffefc 0%, #f8ecde 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--bb-space-sm);
  padding: var(--bb-space-md);
  text-align: center;
}

.obelisk-viewer {
  position: relative;
  width: 100%;
}

.obelisk-3d-canvas {
  display: block;
  width: 100%;
  height: 360px;
  border-radius: var(--bb-radius-sm);
  background:
    radial-gradient(120% 90% at 50% 12%, #ffffff 0%, #f4e7d7 70%, #ecdcc7 100%);
  border: 1px solid rgba(139, 69, 19, 0.18);
  touch-action: none;
  cursor: grab;
}

.obelisk-3d-canvas:active {
  cursor: grabbing;
}

.obelisk-viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(43, 30, 18, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}

.obelisk-view-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.obelisk-view-btn {
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(139, 69, 19, 0.28);
  background: rgba(255, 255, 255, 0.85);
  color: var(--bb-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.obelisk-view-btn:hover {
  background: var(--bb-cream-hover);
  border-color: rgba(139, 69, 19, 0.4);
}

.obelisk-view-btn:focus-visible {
  outline: 3px solid var(--bb-orange);
  outline-offset: 2px;
}

.obelisk-view-btn.active {
  background: var(--bb-orange);
  border-color: var(--bb-orange-darker);
  color: var(--bb-white);
}

.obelisk-ar-btn {
  border-color: rgba(120, 72, 24, 0.45);
  background: linear-gradient(180deg, #fff8ef 0%, #f0e0cc 100%);
}

.obelisk-ar-btn:hover {
  background: linear-gradient(180deg, #fff3e4 0%, #edd4b4 100%);
}

.obelisk-preview-note {
  margin: 0;
  color: var(--bb-text-muted);
  font-size: 15px;
  max-width: 48ch;
}

body.obelisk-ar-open {
  overscroll-behavior: none;
  /* Lock the page under the AR shell so iOS doesn't keep the designer visible. */
  overflow: hidden;
  touch-action: none;
}

.obelisk-ar-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: -webkit-fill-available;
  z-index: 12000;
  background: #0d0b09;
  color: #fff;
  /* Own compositing context so the camera layer can't escape under the page. */
  isolation: isolate;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.obelisk-ar-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  isolation: isolate;
}

.obelisk-ar-video,
.obelisk-ar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.obelisk-ar-video {
  z-index: 0;
  object-fit: cover;
  object-position: center;
  background: #111;
  pointer-events: none;
  /* Keep the rear-camera feed as a normal replaced element, not a native strip. */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.obelisk-ar-canvas {
  z-index: 1;
  touch-action: none;
  cursor: grab;
  background: transparent;
  /* Promote above the iOS camera compositor layer so the obelisk stays visible. */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.obelisk-ar-canvas:active {
  cursor: grabbing;
}

.obelisk-ar-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.obelisk-ar-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
}

.obelisk-ar-title {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.62);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.obelisk-ar-close {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.72);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.obelisk-ar-close:hover {
  background: rgba(40, 30, 22, 0.85);
}

.obelisk-ar-close:focus-visible {
  outline: 3px solid var(--bb-orange);
  outline-offset: 2px;
}

.obelisk-ar-label,
.obelisk-ar-hint,
.obelisk-ar-status {
  margin: 0;
  align-self: center;
  max-width: 36ch;
  text-align: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(20, 16, 12, 0.58);
  font-size: 13px;
  line-height: 1.35;
}

.obelisk-ar-label {
  margin-top: auto;
  font-weight: 700;
}

.obelisk-ar-hint {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.obelisk-ar-status {
  margin-top: 8px;
  color: rgba(255, 244, 230, 0.95);
}

.obelisk-ar-status.error {
  color: #ffd0c4;
}

.obelisk-orientation-fieldset {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: var(--bb-radius-sm);
}

.obelisk-orientation-fieldset legend {
  padding: 0 4px;
  font-size: 0.92rem;
}

.obelisk-orientation-fieldset .obelisk-checkbox-label {
  margin-top: 4px;
}

.obelisk-offset-label {
  display: block;
  margin-top: 12px;
}

.obelisk-offset-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--bb-text-muted);
}

.obelisk-offset-label input[type="range"] {
  width: 100%;
  margin: 4px 0;
  accent-color: var(--bb-orange);
}

.obelisk-engraving-layout-label {
  display: block;
}

input[type="text"].obelisk-engraving-roman,
textarea.obelisk-engraving-roman,
.obelisk-engraving-roman {
  font-family: "Trajan Pro", "Cinzel", "Times New Roman", Times, serif;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

textarea.obelisk-engraving-layout {
  display: block;
  width: auto;
  max-width: 100%;
  min-height: 0;
  margin-top: 6px;
  padding: 10px 12px;
  resize: none;
  line-height: 1.45;
  white-space: pre;
  overflow-x: hidden;
  overflow-wrap: normal;
  word-break: keep-all;
  tab-size: 1;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96) 0%, rgba(247, 236, 220, 0.96) 100%);
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  field-sizing: content;
}

textarea.obelisk-engraving-layout:focus {
  outline: 3px solid var(--bb-orange);
  outline-offset: 2px;
}

textarea.obelisk-engraving-layout:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.obelisk-field-hint {
  display: block;
  margin-top: 6px;
  color: var(--bb-text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.obelisk-measure-block {
  width: 100%;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(139, 69, 19, 0.18);
  text-align: left;
}

.obelisk-measure-heading {
  margin: 0 0 8px;
  font-size: 1rem;
}

.obelisk-measure-drawing {
  width: 100%;
  min-height: 220px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: var(--bb-radius-sm);
  background: linear-gradient(180deg, #fffefb 0%, #f3ebe0 100%);
}

.obelisk-measure-drawing svg {
  display: block;
  width: 100%;
  height: auto;
}

.obelisk-dimensions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.obelisk-dimensions-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(139, 69, 19, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}

.obelisk-dimensions-list li span {
  color: var(--bb-text-muted);
}

.obelisk-dimensions-list li strong {
  font-family: "Courier New", "Lucida Console", Consolas, monospace;
  font-weight: 700;
  text-align: right;
}

.obelisk-estimate-layout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--bb-space-md);
  flex-wrap: wrap;
}

.obelisk-price {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 1.1;
  color: var(--bb-orange-darker);
  font-weight: 800;
}

.obelisk-estimate-breakdown {
  margin-top: 8px;
  color: var(--bb-text-muted);
}

.page-toolbar {
  padding-top: var(--bb-space-md);
  padding-bottom: var(--bb-space-md);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(139, 69, 19, 0.24);
  border-radius: 999px;
  background: #fff7ec;
  color: var(--bb-text-muted);
  font-size: 14px;
  font-weight: 600;
}

.service-grid,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--bb-space-lg);
  margin-top: var(--bb-space-sm);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--bb-space-md);
}

.account-card {
  background: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: var(--bb-radius-sm);
  padding: 12px;
}

.account-card-narrow {
  max-width: 560px;
}

.account-session {
  background: var(--bb-cream);
}

.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--bb-space-md);
  margin-bottom: var(--bb-space-md);
}

.account-section {
  margin-top: var(--bb-space-sm);
}

.account-section .section-lead {
  margin: 0 0 var(--bb-space-md);
  color: var(--bb-text-muted);
  line-height: var(--bb-line-height);
}

.account-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--bb-space-sm);
  margin-bottom: var(--bb-space-md);
}

.account-stat-card {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bb-cream);
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius-sm);
  text-decoration: none;
  color: var(--bb-text);
  transition: background 160ms ease, transform 160ms ease;
}

.account-stat-card:hover {
  background: var(--bb-white);
  transform: translateY(-1px);
}

.account-stat-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.account-stat-card span {
  color: var(--bb-text-muted);
  font-size: 14px;
}

.club-card {
  margin-top: var(--bb-space-md);
}

.club-card .btn {
  margin-top: var(--bb-space-sm);
  width: fit-content;
}

.account-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bb-space-sm);
}

.account-form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--bb-space-sm);
}

/* ── Auth / Account ─────────────────────────────────────── */

.auth-status {
  margin: var(--bb-space-xs) 0 var(--bb-space-sm);
  font-weight: normal;
  color: var(--bb-text-muted);
  line-height: var(--bb-line-height);
}

.auth-status:empty {
  display: none;
  margin: 0;
}

.auth-status.error {
  color: var(--bb-error);
  font-weight: bold;
}

.account-summary {
  margin-bottom: var(--bb-space-sm);
  font-weight: bold;
  line-height: var(--bb-line-height);
}

/* ── Forms ──────────────────────────────────────────────── */

.stack-form {
  display: grid;
  gap: var(--bb-space-md);
}

.stack-form + .stack-form {
  margin-top: var(--bb-space-md);
  padding-top: var(--bb-space-md);
  border-top: 1px solid var(--bb-orange-dark);
}

fieldset,
fieldset.stack-form {
  border: 1px solid rgba(139, 69, 19, 0.28);
  padding: var(--bb-space-md);
  border-radius: var(--bb-radius-sm);
  background: #fffcf8;
}

legend {
  font-weight: bold;
  font-size: 15px;
  padding: 0 6px;
}

fieldset label {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

fieldset input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--bb-orange);
  cursor: pointer;
}

/* ── Headings ───────────────────────────────────────────── */

h2 {
  font-size: 20px;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: var(--bb-space-sm);
}

h3 {
  font-size: 16px;
  font-weight: bold;
  line-height: 1.35;
  margin-bottom: var(--bb-space-xs);
}

/* ── Inputs / Selects / Textareas ───────────────────────── */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="url"],
textarea,
select {
  background: var(--bb-white);
  border: 2px solid;
  border-color: var(--bb-orange-dark) var(--bb-cream-light) var(--bb-cream-light) var(--bb-orange-dark);
  padding: 10px 12px;
  font-family: "Tahoma", "Segoe UI", "MS Sans Serif", Arial, sans-serif;
  font-size: 16px;
  color: var(--bb-text);
  width: 100%;
  border-radius: var(--bb-radius);
  min-height: var(--bb-touch-min);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--bb-orange);
  outline-offset: 1px;
  border-color: var(--bb-orange);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: var(--bb-line-height);
}

select {
  cursor: pointer;
  background-image: linear-gradient(180deg, #ffffff 0%, #fff7ec 100%);
}

input[readonly] {
  background: #f7efe5;
  color: var(--bb-text-muted);
}

label {
  display: grid;
  gap: 6px;
  font-weight: bold;
  font-size: 15px;
  color: var(--bb-text);
}

/* ── Admin Controls ─────────────────────────────────────── */

#logout-btn {
  margin-top: var(--bb-space-sm);
}

.admin-panel {
  margin-top: var(--bb-space-sm);
  border-top: 1px solid var(--bb-orange-dark);
  padding-top: var(--bb-space-sm);
}

.admin-panel h4 {
  margin: 0 0 var(--bb-space-xs);
}

.admin-panel p {
  margin: 0 0 var(--bb-space-sm);
}

.orders-list {
  display: grid;
  gap: 8px;
}

.order-card {
  border: 1px solid var(--bb-orange-dark);
  background: var(--bb-white);
  padding: 6px 8px;
}

.order-meta {
  margin: 0 0 4px;
  color: var(--bb-text-muted);
  font-size: 13px;
}

.order-items {
  margin: 0 0 8px;
  padding-left: 16px;
}

.order-items li {
  margin-bottom: 2px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-users {
  background: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.24);
  border-radius: var(--bb-radius-sm);
  padding: 6px;
  min-height: 120px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.4;
  max-width: 100%;
}

.admin-log-controls {
  margin-top: var(--bb-space-md);
  padding-top: var(--bb-space-sm);
  border-top: 1px solid var(--bb-orange-dark);
}

.admin-log-controls h3 {
  margin-bottom: var(--bb-space-xs);
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--bb-space-md);
}

.admin-form-full {
  grid-column: 1 / -1;
}

.admin-form-note {
  margin: 0 0 var(--bb-space-sm);
  color: var(--bb-text-muted);
  font-size: 14px;
}

/* ── Admin Table ────────────────────────────────────────── */

.admin-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--bb-orange-dark);
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
  line-height: 1.35;
}

.admin-table th {
  background: var(--bb-orange);
  color: var(--bb-white);
  font-weight: bold;
}

.admin-table tr:nth-child(even) td {
  background: #faf6f0;
}

.admin-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-multiline-cell {
  white-space: normal;
  min-width: 140px;
  overflow-wrap: anywhere;
}

/* ── Cart Rows ──────────────────────────────────────────── */

.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: var(--bb-radius-sm);
  gap: 8px;
  background: #fffdf9;
  margin-bottom: 4px;
}

.cart-row:last-child {
  margin-bottom: 0;
}

.cart-item-info {
  flex: 1;
  font-weight: bold;
  line-height: 1.4;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.discount-scope-panel {
  display: grid;
  gap: 0.35rem;
}

.discount-target-select {
  min-height: 8rem;
  width: 100%;
}

.cart-discount {
  margin-top: var(--bb-space-md);
  padding-top: var(--bb-space-sm);
  border-top: 1px dashed rgba(139, 69, 19, 0.3);
}

.cart-discount > label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
}

.cart-discount-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.cart-discount-row input {
  flex: 1;
  min-width: 140px;
  text-transform: uppercase;
}

.cart-summary {
  margin-top: var(--bb-space-sm);
}

.cart-summary #cart-total {
  font-weight: bold;
  font-size: 1.05em;
}

#cart-discount-line {
  color: #1f7a33;
}

.btn-qty {
  background: #fff8ef;
  border: 1px solid rgba(139, 69, 19, 0.3);
  cursor: pointer;
  padding: 8px 12px;
  font-weight: bold;
  font-size: 16px;
  font-family: inherit;
  min-width: var(--bb-touch-min);
  min-height: var(--bb-touch-min);
  text-align: center;
}

.cart-item-qty {
  min-width: 28px;
  text-align: center;
  font-weight: bold;
  font-size: 16px;
}

.btn-remove {
  background: #fff2ef;
  border: 1px solid rgba(139, 69, 19, 0.3);
  cursor: pointer;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--bb-error);
  min-height: var(--bb-touch-min);
}

/* ── Misc / Home Sections ───────────────────────────────── */

.service-grid article {
 background: var(--bb-white);
 border: 1px solid rgba(139, 69, 19, 0.2);
 border-radius: var(--bb-radius-sm);
 padding: var(--bb-space-md);
}

.service-grid article p {
  max-width: none;
  color: var(--bb-text-muted);
  font-size: 15px;
}

.photo-card {
  min-height: 120px;
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius-sm);
  background: linear-gradient(180deg, #efb785 0%, #df7d33 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bb-white);
  font-size: 14px;
}

.photo-card.one,
.photo-card.two,
.photo-card.three {
  background: var(--bb-orange);
}

figure {
  margin: 0;
}

figcaption {
  margin-top: var(--bb-space-xs);
  font-weight: bold;
  font-size: 15px;
  line-height: 1.4;
}

/* ── Trailer Rental Rows ────────────────────────────────── */

.renter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: var(--bb-space-md);
}

.trailer-rows {
  display: grid;
  gap: 8px;
}

.trailer-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(360px, 1fr) minmax(200px, 240px);
  gap: 8px;
  align-items: start;
  background: var(--bb-white);
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: var(--bb-radius-sm);
  padding: 8px;
}

.trailer-row-image {
  min-height: 150px;
}

.trailer-row-image img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--bb-radius-sm);
  border: 1px solid rgba(139, 69, 19, 0.22);
}

.trailer-image-placeholder {
  min-height: 140px;
  border-radius: var(--bb-radius-sm);
  border: 1px solid rgba(139, 69, 19, 0.22);
  background: linear-gradient(180deg, #f9dfc1 0%, #f5cd9d 100%);
  color: var(--bb-orange-darker);
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
}

.trailer-row-calendar h3 {
  margin: 0 0 6px;
}

.trailer-rate {
  margin: 0 0 8px;
  color: var(--bb-text-muted);
}

.trailer-calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}

.trailer-calendar-month-label {
  margin: 0;
  min-width: 10rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
}

.trailer-calendar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.trailer-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--bb-text-muted);
}

.legend-item::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.14);
}

.legend-item.available::before {
  background: #4caf50;
}

.legend-item.blocked::before,
.legend-item.booked::before {
  background: #e05a5a;
}

.legend-item.selected::before {
  background: var(--bb-orange);
}

.trailer-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.trailer-calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--bb-text-muted);
  padding: 2px 0;
}

.trailer-day {
  min-width: 0;
  min-height: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  display: grid;
  place-items: center;
}

.trailer-day.is-empty {
  border: none;
  background: transparent;
  pointer-events: none;
}

.trailer-day.available {
  background: #4caf50;
  color: #fff;
  cursor: pointer;
}

.trailer-day.available:hover {
  filter: brightness(0.95);
}

.trailer-day.blocked,
.trailer-day.booked {
  background: #e05a5a;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.82;
}

.trailer-day.blocked:disabled,
.trailer-day.booked:disabled {
  background: #e05a5a;
  color: #fff;
  opacity: 0.82;
}

.trailer-day.outside {
  background: #ece7e0;
  color: var(--bb-text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.trailer-day.selected {
  background: var(--bb-orange);
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(92, 49, 16, 0.35);
}

.trailer-range-summary {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--bb-text-muted);
}

.trailer-row-checkout {
  display: grid;
  justify-items: start;
  align-content: start;
}

/* ── HR / Separator ─────────────────────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--bb-orange-dark);
  border-bottom: 1px solid var(--bb-cream-light);
  margin: var(--bb-space-sm) 0;
}

/* ── Footer (hidden, replaced by statusbar) ─────────────── */

.site-footer {
  display: none;
}

.login-hint {
  margin: var(--bb-space-xs) 0 var(--bb-space-sm);
  color: var(--bb-text-muted);
  font-size: 15px;
  max-width: var(--bb-content-max);
}

.login-hint strong {
  color: var(--bb-text);
}

.login-panel {
  max-width: 640px;
}

.login-panels.account-card {
  padding-top: var(--bb-space-sm);
}

.login-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 var(--bb-space-md);
  padding: 4px;
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: 10px;
  background: var(--bb-cream);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.login-mode-tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--bb-text-muted);
  font: inherit;
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
  text-align: center;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.login-mode-tab:hover {
  color: var(--bb-text);
  background: rgba(255, 255, 255, 0.55);
}

.login-mode-tab.is-active {
  background: var(--bb-white);
  color: var(--bb-orange-dark);
  border-color: rgba(139, 69, 19, 0.16);
  box-shadow: 0 1px 2px rgba(92, 51, 23, 0.08);
}

.login-mode-tab:focus-visible {
  outline: 2px solid var(--bb-orange);
  outline-offset: 2px;
}

.login-panels h2 {
  margin-top: 0;
}

.login-recovery-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: var(--bb-space-md) 0 0;
  color: var(--bb-text-muted);
  font-size: 15px;
}

.login-recovery-links a {
  color: var(--bb-orange-dark);
  font-weight: bold;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.password-field .password-toggle {
  white-space: nowrap;
  min-width: 72px;
}

.password-strength {
  margin: -4px 0 0;
  color: var(--bb-text-muted);
  font-size: 14px;
}

@media (max-width: 560px) {
  .login-mode-tab {
    padding: 12px 10px;
    font-size: 14px;
  }

  .password-field {
    grid-template-columns: 1fr;
  }
}

/* ── Inventory Manager ──────────────────────────────────── */

.inventory-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}

.inventory-summary span {
  background: var(--bb-white);
  border: 2px solid;
  border-color: var(--bb-orange-dark) var(--bb-cream-light) var(--bb-cream-light) var(--bb-orange-dark);
  padding: 4px 8px;
  font-weight: bold;
  font-size: 13px;
}

.admin-version-list {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
  gap: 4px 10px;
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
}

.admin-version-list dt {
  margin: 0;
  font-weight: 700;
  color: var(--bb-text-muted, #5c4030);
}

.admin-version-list dd {
  margin: 0;
  word-break: break-word;
}

.admin-version-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

.inventory-hint {
  margin: 0 0 var(--bb-space-sm);
  color: var(--bb-text-muted);
  font-size: 14px;
}

.admin-inline-select {
  min-height: 36px;
  max-width: 100%;
  padding: 4px 6px;
  border: 2px solid;
  border-color: var(--bb-cream-light) var(--bb-orange-dark) var(--bb-orange-dark) var(--bb-cream-light);
  background: var(--bb-white);
  font: inherit;
}

.trailer-reservations-panel {
  margin-top: var(--bb-space-lg);
}

.inventory-stat-warn {
  background: #ffe8cc !important;
  color: var(--bb-error);
}

.inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.inventory-table-wrap {
  margin-bottom: 8px;
  max-height: 420px;
}

.inventory-forms {
  margin-top: var(--bb-space-md);
}

.inventory-table .inventory-row-low td {
  background: #fff3e0;
}

.inventory-table .inventory-row-inactive td {
  color: var(--bb-text-muted);
}

.btn-table {
  min-width: 64px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 13px;
}

.inventory-actions-cell {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.inventory-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(139, 69, 19, 0.22);
  display: block;
}

.inventory-thumb-empty {
  color: var(--bb-text-muted);
  text-align: center;
}

.inventory-image-preview {
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--bb-radius-sm);
  border: 1px solid rgba(139, 69, 19, 0.22);
  background: #fff;
  padding: 4px;
}

.inventory-shipping-fieldset,
.inventory-sale-fieldset {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(139, 69, 19, 0.22);
  border-radius: var(--bb-radius-sm);
}

.inventory-shipping-fieldset legend,
.inventory-sale-fieldset legend {
  padding: 0 4px;
  font-weight: 600;
}

.inventory-shipping-options {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

/* ── Accessibility helpers ──────────────────────────────── */

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .win98-window {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  .win98-content {
    padding: var(--bb-space-sm);
  }

  .win98-content--flush-home {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .admin-shell .win98-content,
  .account-shell .win98-content {
    padding: 0;
  }

  .admin-shell .standalone-main,
  .account-shell .standalone-main {
    padding: 12px;
  }

  .win98-tabs-bar {
    gap: 4px;
    padding: 6px 6px 0;
  }

  .win98-tab {
    flex: 1 1 calc(50% - 4px);
    padding: 9px 12px;
    font-size: 15px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .admin-subnav-root,
  .account-subnav-root {
    padding: 6px 10px;
  }

  .admin-nav-groups {
    gap: 4px;
  }

  .admin-nav-group {
    grid-template-columns: 3.75rem 1fr;
    gap: 2px 8px;
  }

  .admin-nav-group-label {
    font-size: 10px;
    padding-top: 3px;
  }

  .admin-nav-link,
  .admin-topic-link {
    font-size: 12px;
  }

  .win98-titlebar {
    padding: 12px 14px;
    font-size: 16px;
  }

  .win98-session-user {
    max-width: min(180px, 38vw);
    font-size: 12px;
    padding: 4px 10px;
  }

  h1 {
    max-width: none;
  }

  .service-grid,
  .gallery-grid,
  .account-grid,
  .account-grid-two,
  .admin-form-grid,
  .product-grid,
  .split-layout,
  .account-form-row,
  .trust-strip .trust-grid {
    grid-template-columns: 1fr;
  }

  .win98-content--flush-home > main > .home-section {
    margin-left: var(--bb-space-sm);
    margin-right: var(--bb-space-sm);
  }

  .home-hero {
    min-height: min(72vh, 640px);
  }

  .win98-window--home-overlap .win98-tabs-bar {
    padding-bottom: 14px;
  }

  .account-header {
    flex-direction: column;
  }

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

  .renter-fields {
    grid-template-columns: 1fr;
  }

  .trailer-row {
    grid-template-columns: 1fr;
  }

  .trailer-calendar-month-label {
    min-width: 8rem;
  }

  .trailer-day {
    font-size: 11px;
    padding: 2px;
  }

  .trailer-row-checkout {
    justify-items: start;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .service-area-map {
    height: 300px;
  }

  .hero-search {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
  }

  .page-header .btn {
    width: 100%;
  }

  .cart-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cart-item-controls {
    justify-content: flex-end;
  }

  .admin-version-list {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .admin-version-list dt {
    margin-top: 4px;
  }

  .admin-version-list dt:first-child {
    margin-top: 0;
  }

  /* Stack admin data tables as labeled cards on narrow screens. */
  .admin-table {
    width: 100%;
    min-width: 0;
    border: 0;
  }

  .admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .admin-table tbody {
    display: grid;
    gap: 8px;
  }

  .admin-table tbody tr {
    display: block;
    border: 1px solid rgba(139, 69, 19, 0.28);
    border-radius: 8px;
    background: #fffdf9;
    overflow: hidden;
  }

  .admin-table tbody tr:nth-child(even) td,
  .inventory-table .inventory-row-low td,
  .inventory-table .inventory-row-inactive td {
    background: transparent;
  }

  .inventory-table .inventory-row-low {
    background: #fff3e0;
  }

  .inventory-table .inventory-row-inactive {
    color: var(--bb-text-muted);
  }

  .admin-table th,
  .admin-table td {
    display: grid;
    grid-template-columns: minmax(5.25rem, 34%) minmax(0, 1fr);
    gap: 6px;
    align-items: start;
    border: 0;
    border-bottom: 1px solid rgba(139, 69, 19, 0.12);
    padding: 5px 8px;
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
  }

  .admin-table td:last-child {
    border-bottom: 0;
  }

  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--bb-text-muted);
    line-height: 1.3;
  }

  .admin-table td:not([data-label])::before,
  .admin-table td[data-label=""]::before {
    content: none;
  }

  .admin-table td:not([data-label]),
  .admin-table td[data-label=""] {
    display: block;
  }

  .admin-table td[data-label="Actions"] {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .admin-table td[data-label="Actions"]::before {
    flex: 1 0 100%;
    margin-bottom: 0;
  }

  .admin-table .admin-multiline-cell {
    min-width: 0;
  }

  .admin-table .admin-inline-select {
    width: 100%;
    max-width: 100%;
  }

  .admin-table .btn-table,
  .admin-table .inventory-actions-cell,
  .admin-table .admin-table-actions {
    width: auto;
  }

  .admin-users.inventory-table-wrap,
  .admin-shell .inventory-table-wrap,
  .inventory-table-wrap {
    max-height: none;
    overflow: visible;
  }

  .obelisk-materials-sheet-wrap {
    max-height: min(70vh, 520px);
  }

  .obelisk-materials-sheet-label {
    min-width: 8rem;
  }

  .obelisk-builder-grid {
    grid-template-columns: 1fr;
  }

  .obelisk-3d-canvas {
    height: 300px;
  }

  .obelisk-estimate-layout {
    align-items: flex-start;
  }

  .signature-pad {
    width: 100%;
  }
}

/* ── Trailer rental agreements ──────────────────────────── */

.agreement-doc-panel {
  display: grid;
  gap: var(--bb-space-md);
}

.agreement-doc-body {
  margin: 0;
  padding: var(--bb-space-md);
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.45;
  background: #fffdf8;
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  color: #2b2118;
}

.signature-pad {
  width: 100%;
  max-width: 640px;
  height: 180px;
  touch-action: none;
  cursor: crosshair;
  background: #ffffff;
  border: 1px solid rgba(139, 69, 19, 0.4);
  border-radius: var(--bb-radius-sm);
}

.agreement-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bb-space-sm);
  align-items: center;
}

.acceptance-detail {
  display: grid;
  gap: var(--bb-space-sm);
  margin-top: var(--bb-space-md);
  padding: var(--bb-space-md);
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  background: #fffcf8;
}

.acceptance-signature-preview {
  max-width: 320px;
  width: 100%;
  height: auto;
  border: 1px solid rgba(139, 69, 19, 0.28);
  background: #fff;
}

.agreements-filters {
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
}

.agreements-filters label {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.rental-calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.rental-calendar-month-label {
  margin: 0;
  min-width: 10rem;
  text-align: center;
  font-size: 1.05rem;
}

.rental-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.rental-calendar-weekday {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--bb-text-muted);
  padding: 4px 0;
}

.rental-calendar-day {
  min-height: 110px;
  padding: 6px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 6px;
  background: #fffdf8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rental-calendar-day.is-empty {
  background: transparent;
  border-color: transparent;
  min-height: 0;
}

.rental-calendar-day.is-today {
  border-color: var(--bb-orange);
  box-shadow: inset 0 0 0 1px rgba(204, 85, 0, 0.35);
}

.rental-calendar-day-number {
  font-size: 12px;
  font-weight: 700;
}

.rental-calendar-empty {
  margin: 0;
  font-size: 12px;
  color: var(--bb-text-muted);
}

.rental-calendar-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rental-calendar-event {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
  background: #f3f3f3;
  color: #222;
}

.rental-calendar-event.status-tentative {
  background: #fff3cd;
  border-color: #e0c36a;
}

.rental-calendar-event.status-confirmed {
  background: #d7f0d9;
  border-color: #7cbc84;
}

.rental-calendar-event.status-active {
  background: #d7e8f8;
  border-color: #6f9fc4;
}

.rental-calendar-event.status-completed {
  background: #ececec;
  border-color: #bdbdbd;
}

.rental-calendar-event.status-cancelled {
  background: #f6d6d6;
  border-color: #d59a9a;
  text-decoration: line-through;
}

.rental-calendar-event.status-blocked {
  background: #e8e0f0;
  border-color: #9a86b5;
  font-style: italic;
}

.legend-item.rental-cal-tentative::before {
  background: #fff3cd;
}

.legend-item.rental-cal-confirmed::before {
  background: #d7f0d9;
}

.legend-item.rental-cal-active::before {
  background: #d7e8f8;
}

.legend-item.rental-cal-completed::before {
  background: #ececec;
}

.legend-item.rental-cal-cancelled::before {
  background: #f6d6d6;
}

.legend-item.rental-cal-blocked::before {
  background: #e8e0f0;
}

.rental-row-tentative {
  background: rgba(255, 243, 205, 0.45);
}

@media (max-width: 800px) {
  .rental-calendar-day {
    min-height: 84px;
  }

  .rental-calendar-event {
    font-size: 10px;
    padding: 3px 4px;
  }
}

/* Obelisk Challenge */
.challenge-header {
  align-items: flex-start;
}

.challenge-certificate-promo {
  margin: 0 0 var(--bb-space-xs);
  max-width: 42rem;
  padding: 8px 12px;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--bb-text);
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  background: linear-gradient(
    90deg,
    rgba(255, 244, 214, 0.95) 0%,
    rgba(255, 232, 190, 0.88) 100%
  );
}

.challenge-certificate-promo strong {
  color: var(--bb-orange, #c45c16);
  letter-spacing: 0.03em;
}

.challenge-intro--short {
  display: none;
}

.challenge-panel {
  display: grid;
  gap: var(--bb-space-md);
  min-width: 0;
  max-width: 100%;
}

/* Block accidental text selection / long-press callouts while playing on mobile. */
.challenge-panel,
.challenge-panel *,
.challenge-header,
.challenge-header *,
.challenge-ad,
.challenge-ad *,
.challenge-stage-wrap,
.challenge-canvas {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.challenge-hud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bb-space-sm) var(--bb-space-md);
}

.challenge-stat {
  min-width: 4.5rem;
  padding: 8px 12px;
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  background: linear-gradient(180deg, #fffaf2 0%, #f3e4cf 100%);
}

.challenge-stat-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bb-text-muted);
}

.challenge-stat strong {
  font-size: 1.15rem;
  color: var(--bb-text);
}

.challenge-stage-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(139, 69, 19, 0.35);
  border-radius: var(--bb-radius-sm);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.35), transparent 45%),
    linear-gradient(180deg, #8eb6cf 0%, #d9c7a4 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.challenge-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  touch-action: none;
  cursor: crosshair;
  vertical-align: top;
}

.challenge-canvas.challenge-canvas--tap-retry {
  cursor: pointer;
}

.challenge-banner {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  max-width: min(90%, 28rem);
  padding: 10px 16px;
  text-align: center;
  font-weight: 650;
  color: var(--bb-text);
  background: rgba(255, 248, 238, 0.92);
  border: 1px solid rgba(139, 69, 19, 0.35);
  border-radius: var(--bb-radius-sm);
  box-shadow: var(--bb-shadow-sm);
  pointer-events: none;
  animation: challenge-banner-in 280ms ease-out;
}

.challenge-banner[data-tone="good"] {
  border-color: rgba(0, 100, 40, 0.45);
  background: rgba(220, 255, 230, 0.94);
}

.challenge-banner[data-tone="bad"] {
  border-color: rgba(128, 0, 0, 0.4);
  background: rgba(255, 220, 220, 0.94);
}

.challenge-thrust-subtitle {
  position: absolute;
  left: 50%;
  top: calc(18% + 3.4rem);
  transform: translateX(-50%);
  max-width: min(92%, 32rem);
  margin: 0;
  padding: 8px 14px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--bb-text);
  background: transparent;
  border: none;
  box-shadow: none;
  text-shadow:
    0 1px 2px rgba(255, 248, 238, 0.95),
    0 0 8px rgba(255, 248, 238, 0.75);
  pointer-events: none;
  animation: challenge-banner-in 280ms ease-out;
}

.challenge-thrust-subtitle[data-active="true"] {
  color: #5a2d00;
  background: transparent;
  border: none;
}

/* Hold controls also suppress pan/zoom while the finger is down. */
#challenge-thrust-btn,
#challenge-spin-left-btn,
#challenge-spin-right-btn,
#challenge-fire-btn,
#challenge-fire-left-btn,
#challenge-parachute-btn {
  touch-action: none;
}

#challenge-thrust-btn.is-active,
#challenge-thrust-btn[aria-pressed="true"],
#challenge-spin-left-btn.is-active,
#challenge-spin-left-btn[aria-pressed="true"],
#challenge-spin-right-btn.is-active,
#challenge-spin-right-btn[aria-pressed="true"],
#challenge-fire-btn.is-active,
#challenge-fire-btn[aria-pressed="true"],
#challenge-fire-left-btn.is-active,
#challenge-fire-left-btn[aria-pressed="true"],
#challenge-parachute-btn.is-active,
#challenge-parachute-btn[aria-pressed="true"] {
  filter: brightness(1.08);
  box-shadow: inset 0 0 0 2px rgba(42, 21, 0, 0.35);
}

@keyframes challenge-banner-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.challenge-controls {
  --challenge-status-size: 1rem;
  --challenge-status-lh: 1.3;
  display: grid;
  gap: var(--bb-space-sm);
  min-width: 0;
}

.challenge-controls .auth-status {
  overflow-wrap: anywhere;
  /* Fixed two-row strip so status copy changes don't resize the stage.
     Height uses the control-level size token so shrink-to-fit font changes
     don't collapse the reserved strip. */
  box-sizing: border-box;
  font-size: var(--challenge-status-size);
  line-height: var(--challenge-status-lh);
  height: calc(var(--challenge-status-lh) * 2 * var(--challenge-status-size));
  min-height: calc(var(--challenge-status-lh) * 2 * var(--challenge-status-size));
  max-height: calc(var(--challenge-status-lh) * 2 * var(--challenge-status-size));
  margin: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

.challenge-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

/* Keep classic gameplay controls on one desktop row. */
body.challenge-page .challenge-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  font-size: 0.82rem;
  gap: 0.3em;
  white-space: nowrap;
}

/* Keyboard shortcut badges — shown only on non-mobile (fine pointer + hover). */
.challenge-key-hint {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 1.15em;
  margin-left: 0.28em;
  padding: 0.05em 0.28em;
  border: 1px solid currentColor;
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  opacity: 0.88;
}

@media (hover: hover) and (pointer: fine) {
  .challenge-key-hint {
    display: inline-flex;
  }
}

.challenge-btn-label {
  min-width: 0;
}

/* Desktop already has the header CTA; keep the actions copy for phones. */
.challenge-order-btn--actions {
  display: none;
}

.challenge-ad {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--bb-space-sm) var(--bb-space-md);
  margin-top: calc(-1 * var(--bb-space-sm));
  padding: 10px 14px;
  border: 1px solid rgba(139, 69, 19, 0.32);
  border-radius: var(--bb-radius-sm);
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.95) 0%, rgba(236, 214, 180, 0.9) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.challenge-ad-copy {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--bb-text);
  font-weight: 600;
}

/* Obelisk Master win certificate */
.challenge-certificate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: 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));
  background: rgba(24, 12, 2, 0.62);
  overflow: auto;
  -webkit-user-select: text;
  user-select: text;
}

.challenge-certificate[hidden] {
  display: none !important;
}

.challenge-certificate-card {
  width: min(920px, 100%);
  max-height: min(96vh, 1100px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(139, 69, 19, 0.4);
  border-radius: var(--bb-radius-sm);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(180deg, #fff8ee 0%, #f3e4cf 100%);
  box-shadow: var(--bb-shadow);
}

.challenge-certificate-header {
  display: grid;
  gap: 4px;
}

.challenge-certificate-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bb-text-muted);
  font-weight: 650;
}

.challenge-certificate-header h2 {
  margin: 0;
  font-family: "Trajan Pro", "Cinzel", "Times New Roman", Times, serif;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  color: var(--bb-text);
}

.challenge-certificate-lead {
  margin: 0;
  color: var(--bb-text-muted);
  line-height: 1.4;
  max-width: 46rem;
}

.challenge-certificate-name-label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--bb-text);
}

.challenge-certificate-name {
  width: min(100%, 22rem);
  padding: 8px 10px;
  border: 1px solid rgba(139, 69, 19, 0.35);
  border-radius: var(--bb-radius-sm);
  background: #fffaf2;
  color: var(--bb-text);
  font: inherit;
}

.challenge-certificate-name:focus-visible {
  outline: 2px solid var(--bb-orange);
  outline-offset: 1px;
}

.challenge-certificate-preview-wrap {
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  background: #efe0c8;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.challenge-certificate-canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  background: #f7ebda;
}

.challenge-certificate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bb-space-sm);
}

.challenge-certificate-actions .btn {
  text-decoration: none;
}

body.challenge-certificate-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .challenge-certificate-card {
    padding: 14px 12px 12px;
    gap: 12px;
  }

  .challenge-certificate-actions .btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
  }
}

.challenge-ad-link {
  flex: 0 0 auto;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--bb-accent, #8b4513);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.challenge-ad-link:hover,
.challenge-ad-link:focus-visible {
  color: var(--bb-text);
}

.challenge-hint {
  margin: 0;
  color: var(--bb-text-muted);
  font-size: 0.92rem;
}

/* Keep the 960×540 canvas from forcing the flex window wider than the phone. */
body.challenge-page .win98-window,
body.challenge-page .win98-content,
body.challenge-page .standalone-main {
  min-width: 0;
  max-width: 100%;
}

.challenge-stage-slot {
  min-width: 0;
  max-width: 100%;
}

/*
 * Phones (portrait or landscape): lock Obelisk Challenge to one browser view.
 * No document scroll — HUD, stage, and actions share the remaining viewport.
 * Landscape phones are often wider than 768px, so also match short+narrow viewports.
 */
@media (max-width: 768px), (max-width: 950px) and (max-height: 500px) {
  html:has(body.challenge-page) {
    height: 100%;
    overflow: hidden;
  }

  body.challenge-page {
    height: 100%;
    height: 100vh;
    height: 100svh;
    max-height: 100vh;
    max-height: 100svh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
  }

  body.challenge-page .win98-window {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  body.challenge-page .win98-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }

  body.challenge-page .standalone-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
  }

  /* Collapse intro to a one-line title; drop footer/tip so the game owns the screen. */
  body.challenge-page .challenge-header {
    flex: 0 0 auto;
    display: block;
    padding: 4px 2px;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  body.challenge-page .challenge-header > div > :not(h1):not(.challenge-certificate-promo),
  body.challenge-page .challenge-header .challenge-order-btn,
  body.challenge-page .challenge-intro,
  body.challenge-page .challenge-intro--short,
  body.challenge-page .challenge-ad,
  body.challenge-page .win98-statusbar,
  body.challenge-page .challenge-hint {
    display: none;
  }

  body.challenge-page .challenge-certificate-promo {
    display: block;
    margin: 0 0 4px;
    padding: 5px 8px;
    font-size: 0.78rem;
    line-height: 1.25;
  }

  /* Compact sacred-objects ad is hidden on phones; shatter shows the copy on-canvas + in status. */

  /* Always keep an Order CTA on phones (header CTA is collapsed). */
  body.challenge-page .challenge-order-btn--actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1 1 100%;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.84rem;
  }

  body.challenge-page .challenge-header h1 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
  }

  /* Compact nav chrome. */
  body.challenge-page .win98-tabs-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding: 4px 8px;
  }

  body.challenge-page .win98-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  body.challenge-page .win98-tab {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  body.challenge-page .win98-titlebar {
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    font-size: 14px;
  }

  body.challenge-page .challenge-panel {
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    overflow: hidden;
  }

  body.challenge-page .challenge-hud,
  body.challenge-page .challenge-controls {
    flex: 0 0 auto;
  }

  .challenge-hud {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .challenge-stat {
    min-width: 0;
    padding: 4px 2px;
    text-align: center;
  }

  .challenge-stat-label {
    font-size: 0.58rem;
    letter-spacing: 0.02em;
  }

  .challenge-stat strong {
    font-size: 0.9rem;
  }

  /* Remaining flex space becomes the stage; 16:9 fits inside that box. */
  body.challenge-page .challenge-stage-slot {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    container-type: size;
  }

  body.challenge-page .challenge-stage-wrap {
    /* Fallback when container queries are unavailable. */
    width: min(100%, calc((100svh - 14.5rem) * 16 / 9));
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    margin-inline: auto;
  }

  @supports (width: 1cqw) {
    body.challenge-page .challenge-stage-wrap {
      width: min(100cqw, calc(100cqh * 16 / 9));
      height: min(100cqh, calc(100cqw * 9 / 16));
    }
  }

  .challenge-banner {
    top: 12%;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .challenge-thrust-subtitle {
    top: calc(12% + 2.8rem);
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .challenge-controls {
    gap: 4px;
  }

  .challenge-controls {
    --challenge-status-size: 0.82rem;
  }

  .challenge-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .challenge-actions .btn {
    flex: 1 1 calc(33.33% - 6px);
    min-width: 0;
    min-height: 36px;
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  .challenge-hint-keyboard,
  .challenge-key-hint {
    display: none;
  }
}

/* Short landscape phones: denser chrome on top of the single-screen shell. */
@media (max-width: 950px) and (max-height: 500px) {
  body.challenge-page .challenge-header {
    display: none;
  }

  /* Header is gone in landscape — actions Order button must stay visible. */
  body.challenge-page .challenge-order-btn--actions {
    display: inline-flex;
    flex: 1 1 100%;
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.76rem;
  }

  body.challenge-page .win98-titlebar {
    padding: 4px 8px;
    font-size: 13px;
  }

  body.challenge-page .win98-tabs-bar {
    padding: 2px 6px;
    gap: 4px;
  }

  body.challenge-page .win98-tab {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }

  body.challenge-page .win98-content {
    padding: 4px 6px;
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  }

  body.challenge-page .challenge-panel {
    padding: 6px;
    gap: 4px;
  }

  body.challenge-page .challenge-controls {
    --challenge-status-size: 0.8rem;
  }

  body.challenge-page .challenge-actions .btn {
    flex: 1 1 calc(25% - 6px);
    min-height: 28px;
    padding: 4px 5px;
    font-size: 0.72rem;
  }

  body.challenge-page .challenge-order-btn--actions {
    flex: 1 1 calc(25% - 6px);
    min-height: 28px;
    padding: 4px 5px;
    font-size: 0.72rem;
  }

  body.challenge-page .challenge-stage-wrap {
    width: min(100%, calc((100svh - 9.5rem) * 16 / 9));
  }
}

/* ==========================================================================
   Obelisk Directory — Roman civic archive register
   ========================================================================== */

body.directory-page {
  --dir-ink: #1a1208;
  --dir-ink-soft: #3a2a18;
  --dir-parchment: #e7d7b8;
  --dir-parchment-deep: #d4c09a;
  --dir-stone: #6e6254;
  --dir-gold: #a67c2d;
  --dir-seal: #5c2e0a;
  --dir-line: rgba(26, 18, 8, 0.22);
  --dir-font-display: "Cinzel", "Times New Roman", Times, serif;
  --dir-font-body: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

body.directory-page .win98-content.directory-shell {
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, rgba(166, 124, 45, 0.14), transparent 55%),
    linear-gradient(180deg, #2a1c0c 0%, #1a1208 38%, #120c06 100%);
  color: var(--dir-parchment);
}

body.directory-page .directory-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0 48px;
  gap: 0;
}

body.directory-page .directory-hero {
  position: relative;
  min-height: min(78vh, 640px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 1px solid rgba(231, 215, 184, 0.18);
}

body.directory-page .directory-hero-atmosphere {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(18, 12, 6, 0.92) 0%, rgba(18, 12, 6, 0.55) 48%, rgba(18, 12, 6, 0.25) 100%),
    repeating-linear-gradient(
      -12deg,
      transparent 0 18px,
      rgba(231, 215, 184, 0.03) 18px 19px
    ),
    radial-gradient(circle at 78% 42%, rgba(166, 124, 45, 0.28), transparent 42%),
    linear-gradient(160deg, #3b2a16 0%, #1a1208 55%, #0d0905 100%);
  animation: directory-atmosphere-drift 18s ease-in-out infinite alternate;
}

@keyframes directory-atmosphere-drift {
  from {
    filter: saturate(1) brightness(1);
    transform: scale(1);
  }
  to {
    filter: saturate(1.08) brightness(1.06);
    transform: scale(1.03);
  }
}

body.directory-page .directory-hero-copy {
  position: relative;
  z-index: 1;
  padding: clamp(36px, 8vw, 80px) clamp(20px, 5vw, 56px);
  max-width: 38rem;
  animation: directory-hero-rise 1s ease-out both;
}

@keyframes directory-hero-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.directory-page .directory-kicker,
body.directory-page .directory-section-kicker {
  margin: 0 0 10px;
  font-family: var(--dir-font-display);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(231, 215, 184, 0.72);
}

body.directory-page .directory-brand {
  margin: 0 0 8px;
  font-family: var(--dir-font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0.06em;
  color: #f4e6c8;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.45);
}

body.directory-page .directory-title {
  margin: 0 0 14px;
  font-family: var(--dir-font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 230, 200, 0.92);
  max-width: none;
}

body.directory-page .directory-lede {
  margin: 0 0 28px;
  font-family: var(--dir-font-body);
  font-size: clamp(1.05rem, 2.1vw, 1.2rem);
  line-height: 1.55;
  color: rgba(231, 215, 184, 0.88);
  max-width: 34em;
}

body.directory-page .directory-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

body.directory-page .directory-cta {
  border-color: #c9a35a;
  background: linear-gradient(180deg, #b8893a 0%, #8a5f1e 100%);
  color: #1a1208;
  font-family: var(--dir-font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.directory-page .directory-hero-actions .btn-secondary {
  border-color: rgba(231, 215, 184, 0.45);
  background: transparent;
  color: var(--dir-parchment);
  font-family: var(--dir-font-display);
  letter-spacing: 0.04em;
}

body.directory-page .directory-hero-actions .btn-secondary:hover {
  background: rgba(231, 215, 184, 0.08);
}

body.directory-page .directory-register {
  margin: 0 clamp(16px, 4vw, 40px);
  padding: clamp(28px, 5vw, 48px) clamp(18px, 3vw, 36px) clamp(36px, 6vw, 56px);
  background:
    linear-gradient(180deg, rgba(231, 215, 184, 0.97) 0%, #dfcdaa 100%);
  color: var(--dir-ink);
  border: 1px solid rgba(92, 46, 10, 0.28);
  box-shadow:
    0 0 0 1px rgba(244, 230, 200, 0.35) inset,
    0 24px 48px rgba(0, 0, 0, 0.35);
  position: relative;
}

body.directory-page .directory-register::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(92, 46, 10, 0.16);
  pointer-events: none;
}

body.directory-page .directory-register-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--dir-line);
}

body.directory-page .directory-register-header h2 {
  margin: 0 0 8px;
  font-family: var(--dir-font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: 0.04em;
  color: var(--dir-ink);
  max-width: none;
}

body.directory-page .directory-register-header p {
  margin: 0;
  font-family: var(--dir-font-body);
  color: var(--dir-ink-soft);
  max-width: 40em;
}

body.directory-page .directory-register-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  min-width: min(100%, 260px);
}

body.directory-page #directory-count {
  font-family: var(--dir-font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dir-seal);
}

body.directory-page .directory-search-label {
  width: 100%;
}

body.directory-page #directory-search {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(92, 46, 10, 0.35);
  background: rgba(255, 248, 230, 0.65);
  color: var(--dir-ink);
  font-family: var(--dir-font-body);
  padding: 8px 12px;
  border-radius: 2px;
}

body.directory-page #directory-search:focus {
  outline: 2px solid var(--dir-gold);
  outline-offset: 1px;
}

body.directory-page .directory-status {
  position: relative;
  font-family: var(--dir-font-body);
  color: var(--dir-ink-soft);
  margin: 0 0 16px;
  min-height: 1.4em;
}

body.directory-page .directory-status.is-error {
  color: #6b1010;
}

body.directory-page .directory-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

body.directory-page .directory-entry {
  padding: 22px 0 4px;
  border-top: 1px solid var(--dir-line);
  animation: directory-entry-in 0.7s ease-out both;
  animation-delay: var(--directory-delay, 0ms);
}

@keyframes directory-entry-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.directory-page .directory-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

body.directory-page .directory-serial {
  margin: 0 0 4px;
  font-family: var(--dir-font-display);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dir-seal);
}

body.directory-page .directory-entry-name {
  margin: 0;
  font-family: var(--dir-font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  letter-spacing: 0.03em;
  color: var(--dir-ink);
  max-width: none;
  position: relative;
}

body.directory-page .directory-entry-name::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  margin-top: 6px;
  background: var(--dir-gold);
  transition: width 0.45s ease;
}

body.directory-page .directory-entry:hover .directory-entry-name::after,
body.directory-page .directory-entry:focus-within .directory-entry-name::after {
  width: min(12rem, 100%);
}

body.directory-page .directory-score-seal {
  flex: 0 0 auto;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  border: 2px solid var(--dir-seal);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 248, 230, 0.55), transparent 55%),
    linear-gradient(160deg, #c9a35a 0%, #8a5f1e 55%, #5c2e0a 100%);
  color: #fff8ee;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 6px 16px rgba(26, 18, 8, 0.22);
  animation: directory-seal-settle 0.9s ease-out both;
  animation-delay: calc(var(--directory-delay, 0ms) + 120ms);
}

@keyframes directory-seal-settle {
  from {
    opacity: 0;
    transform: scale(0.85) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

body.directory-page .directory-score-label {
  font-family: var(--dir-font-display);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.9;
}

body.directory-page .directory-score-value {
  font-family: var(--dir-font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.1;
}

body.directory-page .directory-entry-desc {
  margin: 0 0 16px;
  font-family: var(--dir-font-body);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--dir-ink-soft);
  max-width: 62ch;
}

body.directory-page .directory-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 20px;
  margin: 0 0 18px;
}

body.directory-page .directory-meta dt {
  font-family: var(--dir-font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dir-stone);
  margin: 0 0 2px;
}

body.directory-page .directory-meta dd {
  margin: 0;
  font-family: var(--dir-font-body);
  color: var(--dir-ink);
}

body.directory-page .directory-ratings {
  list-style: none;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px dashed var(--dir-line);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 24px;
}

body.directory-page .directory-rating-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  font-family: var(--dir-font-body);
  font-size: 0.95rem;
}

body.directory-page .directory-rating-label {
  color: var(--dir-ink-soft);
}

body.directory-page .directory-stars {
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

body.directory-page .directory-star {
  color: rgba(92, 46, 10, 0.28);
}

body.directory-page .directory-star.is-lit {
  color: var(--dir-gold);
}

body.directory-page .directory-rating-num {
  font-family: var(--dir-font-display);
  font-size: 0.78rem;
  color: var(--dir-seal);
  min-width: 2.2em;
  text-align: right;
}

.directory-admin-ratings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
}

@media (max-width: 720px) {
  body.directory-page .directory-hero {
    min-height: min(70vh, 560px);
  }

  body.directory-page .directory-register-meta {
    align-items: stretch;
    width: 100%;
  }

  body.directory-page .directory-entry-head {
    flex-direction: column;
  }

  body.directory-page .directory-score-seal {
    align-self: flex-start;
  }
}

/* ── Virtual farm ───────────────────────────────────────── */

.farm-charge-notice {
  margin-top: var(--bb-space-sm);
  padding: var(--bb-space-sm) var(--bb-space-md);
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius-sm);
  background: #fff8ee;
  color: var(--bb-text);
  font-weight: 600;
  max-width: 46em;
}

.farm-display-name-label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bb-text);
}

.farm-display-name-label input {
  font-weight: 400;
}

.farm-plot {
  position: relative;
  min-height: min(62vh, 520px);
  margin-top: var(--bb-space-md);
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: var(--bb-radius);
  overflow: hidden;
  background: linear-gradient(180deg, #9ec5d8 0 30%, #c5d97a 30%, #7fa33a 100%);
  box-shadow: var(--bb-shadow-sm);
}

.farm-plot-sky {
  position: absolute;
  inset: 0 0 70% 0;
  background: linear-gradient(180deg, #7eb3cc 0%, #b7d4e4 100%);
}

.farm-plot-barn {
  position: absolute;
  left: 8%;
  top: 14%;
  width: 86px;
  height: 64px;
  background: var(--bb-orange);
  border: 2px solid var(--bb-orange-darker);
  border-radius: 4px 4px 0 0;
  z-index: 1;
}

.farm-plot-barn::before {
  content: "";
  position: absolute;
  left: -10px;
  top: -28px;
  width: 0;
  height: 0;
  border-left: 53px solid transparent;
  border-right: 53px solid transparent;
  border-bottom: 32px solid var(--bb-orange-dark);
}

.farm-plot-fence {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  background: repeating-linear-gradient(
    90deg,
    #8b4513 0 10px,
    #f6e2c8 10px 14px
  );
  border-top: 3px solid #6b3410;
  z-index: 2;
}

.farm-animal {
  position: absolute;
  z-index: 3;
  width: 88px;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.farm-animal img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid rgba(139, 69, 19, 0.28);
  border-radius: 12px;
  background: var(--bb-cream-light);
  display: block;
  margin: 0 auto 4px;
}

.farm-animal-label {
  display: inline-block;
  max-width: 88px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.92);
  color: var(--bb-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .farm-plot {
    min-height: 380px;
  }

  .farm-animal {
    width: 72px;
  }

  .farm-animal img {
    width: 58px;
    height: 58px;
  }
}
