:root {
  --reference-ink: #1d1e26;
  --reference-mid: #858689;
  --reference-concrete: #d1d2d0;
  --reference-purple: #ba7bff;
  --reference-white: #ffffff;
  --reference-shadow: 0 14px 34px rgba(29, 30, 38, .18);
  --font-sans: "Space Grotesk", "Urbanist", Arial, sans-serif;
}

html { scroll-padding-top: 105px; }

body.app-shell {
  min-height: 100vh;
  padding: 95px 0 78px;
  color: var(--reference-ink);
  background-color: var(--reference-concrete);
  background-image: linear-gradient(rgba(255,255,255,.08), rgba(255,255,255,.08)), url("../images/concrete-wall.png");
  background-repeat: repeat;
  background-size: auto, 768px 512px;
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: .055em;
  text-transform: uppercase;
}

body.app-shell::before { display: none; }

body.app-shell p,
body.app-shell li,
body.app-shell td,
body.app-shell .form-text {
  letter-spacing: .045em;
}

body.app-shell input,
body.app-shell textarea,
body.app-shell select,
body.app-shell code,
body.app-shell pre { text-transform: none; }

.dot-field-background {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  pointer-events: none !important;
  mix-blend-mode: screen;
}

#dotFieldCanvas { display: block !important; width: 100% !important; height: 100% !important; }

.main-content-shell { position: relative; z-index: 2; min-height: calc(100vh - 173px); }

.top-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1200;
  display: flex;
  width: 100%;
  height: 60px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: var(--reference-ink);
  border: 0;
}

.header-container {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1200px;
  height: 100%;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
}

.reference-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--reference-white);
  text-decoration: none;
}

.reference-brand:hover { color: var(--reference-white); }
.header-logo { width: auto; height: 31px; margin-right: 15px; object-fit: contain; }
.header-title { color: var(--reference-white); font-size: 18px; font-weight: 500; letter-spacing: .4em; text-align: center; }

.secondary-menu {
  position: fixed;
  top: 60px;
  left: 0;
  z-index: 1190;
  display: flex;
  width: 100%;
  height: 35px;
  align-items: center;
  justify-content: center;
  background: var(--reference-mid);
}

.secondary-menu-links { display: flex; height: 100%; margin: 0; padding: 0; align-items: center; list-style: none; }
.secondary-menu-links li { display: flex; height: 100%; margin: 0 20px; align-items: center; }
.admin-shell .secondary-menu-links li { margin-inline: 12px; }
.admin-shell .secondary-menu-links a { letter-spacing: .24em; }
.secondary-menu-links a {
  color: #08090b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .36em;
  line-height: 1;
  text-decoration: none;
  transition: color .25s ease;
}
.secondary-menu-links a:hover { color: #fff; }

.hamburger-menu {
  position: absolute;
  top: 50%;
  right: 20px;
  z-index: 1220;
  display: none;
  padding: 8px;
  cursor: pointer;
  background: transparent;
  border: 0;
  transform: translateY(-50%);
}
.hamburger-menu .bar { display: block; width: 25px; height: 3px; margin: 5px 0; background: #fff; transition: .35s ease; }
.hamburger-menu.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger-menu.active .bar:nth-child(2) { opacity: 0; }
.hamburger-menu.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: 60px;
  left: -320px;
  z-index: 1210;
  width: 300px;
  max-width: 82vw;
  height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--reference-ink);
  box-shadow: 8px 0 30px rgba(0,0,0,.35);
  transition: left .35s ease;
}
.mobile-menu.active { left: 0; }
.mobile-menu ul { margin: 0; padding: 26px 24px; list-style: none; }
.mobile-menu li { margin-bottom: 18px; }
.mobile-menu a { display: block; padding: 12px 0; color: #fff; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 15px; letter-spacing: .3em; text-decoration: none; }
.mobile-menu a:hover { color: var(--reference-mid); }
.menu-scrim { position: fixed; inset: 60px 0 0; z-index: 1200; opacity: 0; pointer-events: none; background: rgba(0,0,0,.38); transition: opacity .25s ease; }
.menu-scrim.active { opacity: 1; pointer-events: auto; }

.connection-banner { top: 95px; z-index: 1180; color: #fff; background: #5e1b1b; letter-spacing: .08em; }
.flash-wrap { position: relative; z-index: 3; margin-top: 18px; }

body.app-shell h1,
body.app-shell h2,
body.app-shell h3,
body.app-shell h4,
body.app-shell h5,
body.app-shell h6 {
  color: var(--reference-ink);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: .105em;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-transform: uppercase;
}

body.app-shell .hero h1,
body.app-shell .hunt-hero h1,
body.app-shell .completion-hero h1 {
  font-size: clamp(2.4rem, 6.6vw, 5.3rem);
  line-height: 1;
  letter-spacing: clamp(.035em, .55vw, .095em);
}

body.app-shell .admin-hero h1 { font-size: clamp(2.2rem, 4.6vw, 4rem); line-height: 1.04; }
body.app-shell .form-panel > h1,
body.app-shell .form-panel > h2 { font-size: clamp(1.7rem, 3.7vw, 3rem); line-height: 1.08; }
.row > *, .container-xl, .form-panel, .admin-card { min-width: 0; }
.text-normal-case { text-transform: none; }

body.app-shell p { color: #525356; font-size: .78rem; line-height: 1.8; }
body.app-shell .lead { font-size: .92rem; line-height: 1.8; letter-spacing: .075em; }
.eyebrow { color: #5c5d61; font-size: .62rem; font-weight: 600; letter-spacing: .28em; }
.eyebrow::before { height: 1px; background: var(--reference-ink); }
.eyebrow-light { color: #d9d9da; }
.eyebrow-light::before { background: #d9d9da; }

.hero,
.hunt-hero,
.completion-hero,
.player-topbar {
  color: #fff;
  background: rgba(29,30,38,.97);
  border-radius: 0;
}

.hero { padding: clamp(4rem, 9vw, 7rem) 0; }
.hero::before { opacity: .12; background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px); background-size: 20px 20px; }
.hero::after { border-color: rgba(186,123,255,.45); box-shadow: 0 0 0 4rem rgba(186,123,255,.025), 0 0 0 8rem rgba(255,255,255,.015); }
body.app-shell .hero h1,
body.app-shell .hunt-hero h1,
body.app-shell .completion-hero h1,
body.app-shell .player-topbar h1 { color: #fff; }
.hero h1 em { color: #c8c8ca; font-style: normal; }
.hero-copy,
.hunt-hero .lead,
.completion-hero p { color: rgba(255,255,255,.68) !important; }
.hero-stats { border-color: rgba(255,255,255,.2); }
.hero-stat strong { font-weight: 500; letter-spacing: .12em; }

.section-space { padding-block: clamp(3.5rem, 8vw, 6rem); }
.bg-white { background: rgba(235,235,232,.88) !important; }
.safety-band { color: #fff; background: rgba(91,92,96,.96); }
body.app-shell .safety-band h2,
body.app-shell .safety-band p { color: #fff; }

.btn {
  border-width: 1px;
  border-radius: 0;
  box-shadow: none;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  color: #fff !important;
  background: var(--reference-ink) !important;
  border-color: var(--reference-ink) !important;
}
.btn-primary:hover { color: var(--reference-ink) !important; background: #fff !important; }
.btn-dark { color: #fff; background: #46474c; border-color: #46474c; }
.btn-outline-dark { color: var(--reference-ink); border-color: var(--reference-ink); }
.btn-outline-dark:hover { color: #fff; background: var(--reference-ink); }

.hunt-grid { gap: 18px; }
.hunt-card {
  min-height: 23rem;
  background: rgba(29,30,38,.96);
  border: 1px solid #67686c;
  border-radius: 0;
  box-shadow: var(--reference-shadow);
}
.hunt-card::before { background: var(--reference-purple); opacity: .13; }
.hunt-card .hunt-number { color: #d6d6d7; letter-spacing: .28em; }
body.app-shell .hunt-card h3 { color: #fff; font-size: 1.55rem; letter-spacing: .1em; }
body.app-shell .hunt-card p { color: rgba(255,255,255,.6); }
.meta-chip { border-radius: 0; font-size: .58rem; letter-spacing: .14em; }

.how-grid { background: #77787b; border-color: #77787b; }
.how-step { background: rgba(219,220,217,.94); }
.step-index { color: #55565a; letter-spacing: .24em; }
.safety-list li { border-color: rgba(255,255,255,.65); }

.content-panel,
.side-panel,
.form-panel,
.game-panel,
.admin-card,
.empty-state,
.error-panel,
.qr-card {
  background: rgba(235,235,232,.94);
  border: 1px solid #8b8c8f;
  border-radius: 0;
  box-shadow: var(--reference-shadow);
}

.safety-note { background: rgba(205,206,203,.9); border-left-color: #5a5b60; }
.permission-card { background: rgba(207,208,205,.76); border-color: #8b8c8f; }
.permission-icon { color: #fff; background: #4b4c51; border-radius: 0; font-size: .58rem; letter-spacing: .1em; }
.form-control,
.form-select,
.input-group-text { color: #18191d; background: rgba(248,248,246,.92); border-color: #858689; border-radius: 0; }
.form-control:focus,
.form-select:focus { border-color: #3c3d42; box-shadow: 0 0 0 .18rem rgba(186,123,255,.25); }
.form-label { font-size: .68rem; font-weight: 600; letter-spacing: .14em; }

.signal-status { background: rgba(209,210,208,.85); border-color: #858689; }
.signal-status.nearby { background: rgba(224,224,221,.94); border-color: #515258; }
.signal-dot,
.signal-status.nearby .signal-dot { background: var(--reference-purple); box-shadow: 0 0 0 2px #5e5f64; }
.progress-fill { background: #b8b9bc; }
.progress-list .done .progress-marker { color: #fff; background: #505156; border-color: #505156; }
.progress-list .current .progress-marker { border-color: var(--reference-purple); box-shadow: 0 0 0 4px rgba(186,123,255,.18); }

.scanner-viewport { border: 1px solid #858689; border-radius: 0; }
.scanner-frame { border-color: #fff; border-radius: 0; }
.scanner-line { background: var(--reference-purple); box-shadow: 0 0 14px var(--reference-purple); }
.scanner-status { background: rgba(235,235,232,.94); border-color: #858689; }
.ar-fallback { background: #2d2e34; }
body.app-shell .ar-fallback h3,
body.app-shell .ar-fallback p { color: #fff; }
.completion-mark { color: #fff; background: #626369; border-radius: 0; box-shadow: 14px 14px 0 rgba(186,123,255,.22); }

.admin-shell { background-color: var(--reference-concrete); }
.admin-hero { padding: 3.25rem 0 2rem; }
.stat-card { background: rgba(235,235,232,.94); border-top: 2px solid #4c4d52; box-shadow: var(--reference-shadow); }
.stat-card:nth-child(2),
.stat-card:nth-child(3) { border-color: #858689; }
.status-pill { border-radius: 0; background: #c9cac8; font-size: .58rem; letter-spacing: .1em; }
.status-pill.live,
.status-pill.completed,
.status-pill.active { background: #aeb0ad; }
.status-pill.draft { background: #d5d1c4; }
.status-pill.paused { background: #c9bebb; }
.coordinate-readout { background: var(--reference-ink); font-size: .7rem; letter-spacing: .08em; }

.site-footer.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1200;
  display: flex;
  width: 100%;
  height: 60px;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  color: #050607;
  background: var(--reference-mid);
}
.site-footer .footer-links { display: flex; gap: 20px; }
.site-footer .footer-links a,
.site-footer .link-button { padding: 0; color: #050607; font-size: .62rem; font-weight: 600; letter-spacing: .25em; text-transform: uppercase; }
.site-footer .footer-links a:hover,
.site-footer .link-button:hover { color: #fff; }
.copyright { color: #050607; font-size: .58rem; font-weight: 500; letter-spacing: .28em; text-align: right; }

@media (max-width: 768px) {
  body.app-shell { padding-top: 60px; padding-bottom: 105px; background-size: auto, 640px auto; }
  html { scroll-padding-top: 70px; }
  .secondary-menu { display: none; }
  .hamburger-menu { display: block; }
  .header-title { max-width: calc(100vw - 125px); font-size: 11px; letter-spacing: .2em; line-height: 1.3; }
  .header-logo { height: 25px; margin-right: 10px; }
  .connection-banner { top: 60px; }
  .site-footer.footer { height: auto; min-height: 82px; padding: 12px 18px; flex-direction: column; justify-content: center; gap: 9px; }
  .site-footer .footer-links { gap: 14px; }
  .copyright { font-size: .5rem; letter-spacing: .18em; text-align: center; }
  body.app-shell h1 { font-size: clamp(2.1rem, 11vw, 3.4rem); line-height: 1.02; letter-spacing: .05em; }
  body.app-shell .hero h1,
  body.app-shell .hunt-hero h1,
  body.app-shell .completion-hero h1 { font-size: clamp(2rem, 10.5vw, 3rem); line-height: 1.04; letter-spacing: .04em; }
  body.app-shell .admin-hero h1 { font-size: clamp(2rem, 10vw, 3rem); }
  body.app-shell .form-panel > h1,
  body.app-shell .form-panel > h2 { font-size: clamp(1.65rem, 8vw, 2.3rem); }
}

@media (max-width: 480px) {
  .header-title { font-size: 9px; letter-spacing: .14em; }
  .mobile-menu { left: -82vw; width: 78vw; }
  .mobile-menu.active { left: 0; }
  body.app-shell p { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .dot-field-background { opacity: .45; }
}

@media print {
  body.app-shell { padding: 0; background: #fff; }
  .dot-field-background, .top-header, .secondary-menu, .mobile-menu, .menu-scrim, .site-footer { display: none !important; }
}
