:root {
  /* fourtillfour brand tokens from fourtillfour.com theme */
  --bg: #111111;
  --bg-lift: #1b1e24;
  --ink: #eee3cf;
  --ink-soft: #c8c1ad;
  --line: rgba(238, 227, 207, 0.16);
  --accent: #7b775a;
  --accent-bright: #a39e7a;
  --accent-deep: #6c694f;
  --ok: #028e48;
  --ok-wash: rgba(2, 142, 72, 0.14);
  --bad: #d12328;
  --bad-wash: rgba(209, 35, 40, 0.12);
  --display: "Francois One", "Arial Narrow", sans-serif;
  --serif: "PT Serif", Georgia, serif;
  --sans: "Montserrat", "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(90% 55% at 0% 0%, rgba(163, 158, 122, 0.22), transparent 55%),
    radial-gradient(70% 50% at 100% 0%, rgba(27, 30, 36, 0.95), transparent 52%),
    radial-gradient(80% 60% at 50% 110%, rgba(108, 105, 79, 0.2), transparent 55%),
    linear-gradient(180deg, #191919 0%, #111111 48%, #0d0d0d 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.masthead {
  animation: rise 0.7s var(--ease) both;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 8.5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  line-height: 1;
  color: var(--ink);
}

.brand-sub {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen h1,
.panel-head h1,
.verdict-title,
.report-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.05;
}

.screen h1,
.panel-head h1 {
  font-size: clamp(1.55rem, 6vw, 1.9rem);
}

.lede {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.5;
  max-width: 34ch;
}

.hint {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.92rem;
}

.hint.center {
  text-align: center;
}

.wedge-dock {
  width: min(100%, 420px);
  margin: 0 auto 0.85rem;
  padding: 0.85rem 0.9rem 0.95rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.wedge-input {
  width: 100%;
  margin-top: 0.45rem;
  box-sizing: border-box;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #161616;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.wedge-input:focus {
  outline: 1px solid var(--accent-bright);
  border-color: var(--accent-bright);
}

.wedge-help {
  margin-top: 0.45rem;
}

.eyebrow,
.field-label {
  display: block;
  margin: 0;
  color: var(--accent-bright);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.meta-line {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.error {
  margin: 0.75rem 0 0;
  color: #f0a0a0;
  font-size: 0.9rem;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(17, 17, 17, 0.78);
  color: var(--ink);
  border-radius: 2px;
  padding: 0.95rem 1rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

input:focus {
  border-color: rgba(163, 158, 122, 0.75);
  background: rgba(27, 30, 36, 0.95);
}

.btn-primary,
.btn-ghost {
  border: 0;
  border-radius: 2px;
  padding: 0.95rem 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

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

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

.btn-primary:active,
.btn-ghost:active {
  transform: scale(0.985);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: rgba(238, 227, 207, 0.32);
}

.screen-pin {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.75rem;
  animation: rise 0.75s var(--ease) 0.08s both;
}

.pin-form {
  display: grid;
  gap: 0.65rem;
}

#pinInput {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 1.45rem;
  font-weight: 600;
}

.staff-shell {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  flex: 1;
  animation: rise 0.55s var(--ease) both;
}

.rail {
  display: flex;
  gap: 1.15rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.15rem;
}

.rail-tab {
  position: relative;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  padding: 0.55rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.rail-tab.active {
  color: var(--ink);
}

.rail-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2rem;
  height: 2px;
  background: var(--accent-bright);
  transform-origin: left center;
  animation: underline 0.35s var(--ease) both;
}

.panel {
  animation: rise 0.45s var(--ease) both;
}

.panel-head {
  margin-bottom: 1.15rem;
}

.viewport-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 3 / 4;
  background: #050505;
  border: 1px solid var(--line);
}

video,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewfinder {
  position: absolute;
  inset: 16% 12%;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid rgba(238, 227, 207, 0.92);
}

.corner.tl {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}
.corner.tr {
  top: 0;
  right: 0;
  border-left: 0;
  border-bottom: 0;
}
.corner.bl {
  bottom: 0;
  left: 0;
  border-right: 0;
  border-top: 0;
}
.corner.br {
  bottom: 0;
  right: 0;
  border-left: 0;
  border-top: 0;
}

.scanline {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(163, 158, 122, 0.95),
    transparent
  );
  animation: sweep 2.4s var(--ease) infinite;
}

#scanHint {
  margin-top: 0.95rem;
}

#stopBtn,
#scanAgainBtn {
  margin-top: 0.85rem;
  width: 100%;
}

.verdict {
  margin: 1.5rem 0 0.25rem;
  padding: 1.5rem 1.15rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  animation: pop 0.45s var(--ease) both;
}

.verdict.ok {
  background: var(--ok-wash);
  border-color: rgba(2, 142, 72, 0.35);
}

.verdict.bad {
  background: var(--bad-wash);
  border-color: rgba(209, 35, 40, 0.35);
}

.verdict-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.verdict.ok .verdict-kicker {
  color: #4cbf7f;
}

.verdict.bad .verdict-kicker {
  color: #f08a8a;
}

.verdict-title {
  margin-top: 0.4rem;
  font-size: clamp(1.9rem, 7vw, 2.4rem);
}

.verdict .lede {
  max-width: none;
  font-size: 0.98rem;
}

.today-block,
.range-summary,
.stat-hit {
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.today-block {
  padding: 0.2rem 0 1.15rem;
  border-bottom: 1px solid var(--line);
}

.today-block:focus-visible,
.range-summary:focus-visible,
.stat-hit:focus-visible {
  outline: 1px solid var(--accent-bright);
  outline-offset: 4px;
}

.mega-number,
.number {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
}

.mega-number {
  font-size: clamp(3.6rem, 16vw, 5rem);
  animation: countIn 0.55s var(--ease) both;
}

.number {
  font-size: clamp(1.8rem, 7vw, 2.25rem);
}

.split-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.range-form {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.85rem;
}

.range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.range-fields label {
  display: grid;
  gap: 0.4rem;
}

.range-fields input[type="date"],
.search-input {
  letter-spacing: normal;
  text-align: left;
  font-size: 0.95rem;
}

.range-actions {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0.65rem;
}

.range-summary {
  margin-top: 1.1rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--line);
  width: 100%;
}

.daily-bars {
  margin-top: 1.15rem;
  display: grid;
  gap: 0.5rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 48px 1fr 28px;
  gap: 0.55rem;
  align-items: center;
}

.bar-label,
.bar-count {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 600;
}

.bar-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(238, 227, 207, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-bright));
  border-radius: inherit;
  animation: growBar 0.7s var(--ease) both;
}

.report {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.report-head h2 {
  font-size: 1.15rem;
}

.report-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.report-item {
  padding: 0.95rem 0;
  border-top: 1px solid var(--line);
  animation: rise 0.4s var(--ease) both;
}

.report-item:last-child {
  border-bottom: 1px solid var(--line);
}

.report-name {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.report-meta {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.report-points {
  margin: 0.4rem 0 0;
  color: var(--accent-bright);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-input {
  margin-top: 0.4rem;
}

.lookup-status {
  margin-top: 0.7rem;
}

.lookup-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.lookup-item {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  animation: rise 0.4s var(--ease) both;
}

.lookup-item:last-child {
  border-bottom: 1px solid var(--line);
}

.lookup-name {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.lookup-meta {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.lookup-points {
  margin: 0.35rem 0 0;
  color: var(--accent-bright);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

[hidden] {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes underline {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes sweep {
  0% {
    top: 8%;
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    top: 92%;
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes growBar {
  from {
    width: 0 !important;
  }
}

@keyframes countIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
