/* ============================================================
   components.css — All Reusable UI Components
   Premium AI Intelligence Platform
   ============================================================ */

/* ────────── SECTION HEADINGS ────────── */
h2 {
  font-family: var(--font-display);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: var(--s8) 0 var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

h2::before {
  content: "";
  width: 3px;
  height: 18px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: var(--r-full);
  box-shadow: 0 0 8px var(--gold-glow);
}

/* ────────── PREMIUM GLASS CARDS ────────── */
.card {
  background: var(--glass-medium);
  
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  
  padding: var(--s6);
  margin-bottom: var(--s4);
  
  box-shadow: var(--shadow-md),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  
  transition: all var(--t-base) var(--ease-out);
}

/* ────────── CARD DESCRIPTION ──────────
   Every analysis card reads: header -> what it is -> the controls.
   Sitting first inside the card, this is the line that tells a member
   what they are looking at before they meet a search box. Slightly
   dimmer than body text so it explains without competing with the
   numbers, and it carries a hairline so the eye registers it as
   commentary rather than data. */
.card-desc {
  margin: 0 0 var(--s4);
  padding-left: var(--s3);
  border-left: 2px solid var(--border-gold);

  color: var(--text-secondary);
  font-size: var(--fs-small);
  line-height: 1.55;
}

/* When a description is the only thing between the header and a row of
   controls, keep the gap even. */
.card-desc + .row,
.card-desc + .field { margin-top: 0; }

.card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-lg),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

/* ────────── COLLAPSIBLE FOLDS ────────── */
.fold {
  background: var(--glass-medium);
  
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  
  margin-bottom: var(--s4);
  overflow: hidden;
  
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base) var(--ease-out);
}

.fold[open] {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-md),
              0 0 0 1px var(--border-gold);
}

.fold > summary {
  position: sticky;
  top: 0;
  z-index: 20;
  list-style: none;
  cursor: pointer;
  padding: var(--s4) var(--s5);
  
  background: var(--glass-strong);
  
  user-select: none;
  transition: all var(--t-fast) var(--ease-out);
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary:hover {
  background: var(--bg-surface);
}

.fold > summary h2 {
  margin: 0;
  pointer-events: none;
  font-size: var(--fs-small);
}

.fold[open] > summary {
  border-bottom: 1px solid var(--border-subtle);
}

.fold[open] > summary h2 {
  color: var(--gold);
}

/* Chevron indicator */
.fold > summary::after {
  content: "";
  position: absolute;
  right: var(--s5);
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-right: 2px solid var(--text-tertiary);
  border-bottom: 2px solid var(--text-tertiary);
  transform: rotate(45deg);
  transition: all var(--t-base) var(--ease-out);
}

.fold[open] > summary::after {
  transform: rotate(-135deg);
  border-color: var(--gold);
}

.fold .card {
  margin: 0;
  padding: var(--s5);
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: slideDown var(--t-base) var(--ease-out) both;
}

.fold .card + .card {
  border-top: 1px solid var(--border-subtle);
}

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

/* Close bar at bottom of folds */
.closebar {
  display: flex;
  gap: var(--s3);
  margin: var(--s5) var(--s5) 0;
  padding: var(--s4) 0 var(--s5);
  border-top: 1px solid var(--border-subtle);
}

.closebar button {
  font-size: var(--fs-small);
  padding: var(--s3) var(--s4);
}

/* ────────── PREMIUM BUTTONS ────────── */
button {
  width: 100%;
  min-height: max(40px, calc(52px * var(--zoom-k)));
  padding: var(--s4) var(--s6);
  
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-base);
  
  border: 0;
  border-radius: var(--r-md);
  
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  
  cursor: pointer;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  
  box-shadow: var(--shadow-md),
              0 0 24px var(--gold-glow);
  
  transition: all var(--t-fast) var(--ease-out);
  
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on primary buttons */
button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform var(--t-slow) var(--ease-out);
}

button:hover::before {
  transform: translateX(100%);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg),
              0 0 32px var(--gold-glow);
}

button:active {
  transform: translateY(0) scale(0.98);
}

button:disabled {
  opacity: 0.4;
  pointer-events: none;
  box-shadow: none;
}

/* Ghost button variant */
button.ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  box-shadow: none;
}

button.ghost::before {
  display: none;
}

button.ghost:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* Sub button variant (toggle group) */
button.sub {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  font-weight: var(--fw-semibold);
  box-shadow: none;
  min-height: max(40px, calc(48px * var(--zoom-k)));
}

button.sub::before {
  display: none;
}

button.sub[aria-selected="true"] {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-base);
  border-color: transparent;
  box-shadow: var(--shadow-md), 0 0 20px var(--gold-glow);
}

button.sub:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

button.sub[aria-selected="true"]:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

/* Mini button */
button.mini {
  width: auto;
  min-height: max(36px, calc(40px * var(--zoom-k)));
  padding: var(--s2) var(--s4);
  font-size: var(--fs-small);
}

/* Danger button */
button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  box-shadow: none;
}

button.danger::before {
  display: none;
}

button.danger:hover {
  background: var(--danger-wash);
  box-shadow: 0 0 20px var(--danger-glow);
}

/* Button row layout */
.subrow {
  display: flex;
  gap: var(--s3);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}

.subrow button {
  flex: 1 1 120px;
}

/* ────────── FORM CONTROLS ────────── */
label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-tiny);
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: var(--s5) 0 var(--s2);
}

select,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="search"],
textarea {
  width: 100%;
  min-height: max(40px, calc(52px * var(--zoom-k)));
  
  background: var(--bg-surface);
  color: var(--text-primary);
  
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  
  padding: var(--s3) var(--s4);
  
  font-size: var(--fs-body);
  font-family: var(--font-body);
  font-weight: var(--fw-regular);
  font-variant-numeric: tabular-nums;
  
  transition: all var(--t-fast) var(--ease-out);
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--gold-wash),
              var(--shadow-md);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 1;
}

input[type="password"] {
  letter-spacing: 0.2em;
}

textarea {
  min-height: 120px;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  line-height: var(--lh-relaxed);
  resize: vertical;
}

/* Select dropdown */
select {
  appearance: none;
  cursor: pointer;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

/* Form row layout */
.row {
  display: flex;
  gap: var(--s3);
}

.row > * {
  flex: 1;
  min-width: 0;
}

/* ────────── STAT ROWS ────────── */
.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-body);
  color: var(--text-secondary);
}

.stat:last-child {
  border-bottom: 0;
}

.stat b {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-bold);
  text-align: right;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ────────── LIST ITEMS ────────── */
.list {
  margin-top: var(--s3);
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s4);
  padding: var(--s4) 0;
  border-top: 1px solid var(--border-subtle);
}

.item:first-child {
  border-top: 0;
}

.item .n {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--fs-large);
  color: var(--text-primary);
  border-left: 3px solid var(--border-default);
  padding-left: var(--s3);
}

.item .n.k5 {
  border-left-color: var(--gold);
  color: var(--gold);
}

.item .meta {
  font-size: var(--fs-small);
  color: var(--text-tertiary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ────────── NUMBER CHIPS (Premium 3D Tiles) ────────── */
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--s3);
  margin-top: var(--s4);
}

.chips.wide {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.chip {
  display: block;
  text-align: center;
  
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lead);
  line-height: 1.3;
  color: var(--text-primary);
  
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  
  padding: var(--s4) var(--s2);
  
  box-shadow: var(--shadow-sm),
              inset 0 1px 0 rgba(255, 255, 255, 0.03);
  
  transition: all var(--t-fast) var(--ease-out);
  cursor: pointer;
}

.chip:hover {
  background: var(--bg-overlay);
  border-color: var(--border-strong);
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.chip i {
  display: block;
  font-style: normal;
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
  margin-top: var(--s1);
}

/* Premium 5K chip */
.chip.k5 {
  background: linear-gradient(135deg, var(--gold-wash), var(--gold-wash));
  border-color: var(--border-gold);
  color: var(--gold);
  box-shadow: var(--shadow-md),
              0 0 20px var(--gold-glow);
}

.chip.k5:hover {
  background: linear-gradient(135deg, var(--gold-wash), var(--gold));
  color: var(--bg-base);
  box-shadow: var(--shadow-lg),
              0 0 32px var(--gold-glow);
}

.chip.k5 i {
  color: var(--gold-dark);
}

/* 5K badge */
.tag5 {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-base);
  font-family: var(--font-display);
  font-weight: var(--fw-heavy);
  font-size: var(--fs-micro);
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  margin-left: var(--s1);
  vertical-align: middle;
  box-shadow: 0 0 12px var(--gold-glow);
}

/* Chip entrance animation */
.chips > .chip {
  animation: chipPop var(--t-base) var(--ease-spring) both;
}

.chips > .chip:nth-child(1) { animation-delay: 0ms; }
.chips > .chip:nth-child(2) { animation-delay: 30ms; }
.chips > .chip:nth-child(3) { animation-delay: 60ms; }
.chips > .chip:nth-child(4) { animation-delay: 90ms; }
.chips > .chip:nth-child(5) { animation-delay: 120ms; }
.chips > .chip:nth-child(6) { animation-delay: 150ms; }
.chips > .chip:nth-child(7) { animation-delay: 180ms; }
.chips > .chip:nth-child(8) { animation-delay: 210ms; }
.chips > .chip:nth-child(n+9) { animation-delay: 240ms; }

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

/* ────────── BAR CHARTS ────────── */
.bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--fs-small);
  margin: var(--s2) 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.bar span {
  min-width: 100px;
  flex-shrink: 0;
}

.bar i {
  display: block;
  height: 10px;
  min-width: 4px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transform-origin: left center;
  animation: barGrow var(--t-slow) var(--ease-out) both;
  box-shadow: 0 0 12px var(--gold-glow);
}

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

/* Interactive bar */
.bar[onclick],
.bar.clickable {
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: var(--s1) var(--s2);
  margin-inline: calc(-1 * var(--s2));
  transition: background var(--t-fast) var(--ease-out);
}

.bar[onclick]:hover,
.bar.clickable:hover {
  background: var(--bg-surface);
}

.bar.active i {
  background: linear-gradient(90deg, var(--emerald), var(--emerald-light));
  box-shadow: 0 0 12px var(--emerald-glow);
}

.bar.active span {
  color: var(--emerald);
  font-weight: var(--fw-semibold);
}

/* ────────── NOTES & MESSAGES ────────── */
.note {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  border-left: 3px solid var(--border-default);
  padding: var(--s2) 0 var(--s2) var(--s4);
  margin-top: var(--s4);
  line-height: var(--lh-relaxed);
}

/* Honesty strip */
.honesty {
  display: flex;
  gap: var(--s3);
  align-items: flex-start;
  margin-top: var(--s5);
  padding: var(--s4);
  
  background: var(--gold-wash);
  border: 1px solid var(--border-gold);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

.honesty .ico {
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 2px;
}

.honesty b {
  color: var(--text-primary);
}

/* Verdict boxes */
.verd {
  padding: var(--s4);
  border-radius: var(--r-md);
  font-size: var(--fs-body);
  margin-top: var(--s3);
  border: 1px solid transparent;
}

.verd.ch {
  background: var(--emerald-wash);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--text-primary);
}

.verd.up {
  background: var(--gold-wash);
  border-color: var(--border-gold);
  color: var(--text-primary);
}

/* Win announcement */
.win {
  background: linear-gradient(135deg, var(--emerald-wash), transparent);
  border: 2px solid var(--emerald);
  border-radius: var(--r-lg);
  padding: var(--s6);
  margin-top: var(--s4);
  text-align: center;
  box-shadow: 0 0 0 4px var(--emerald-wash),
              var(--shadow-lg);
  animation: winPop var(--t-slow) var(--ease-spring) both;
}

.win .amt {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: var(--fw-heavy);
  color: var(--emerald);
  line-height: 1;
  text-shadow: 0 0 24px var(--emerald-glow);
}

@keyframes winPop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Lose result */
.lose {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--s5);
  margin-top: var(--s3);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-body);
}

/* Error box */
.errb {
  background: var(--danger-wash);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--text-primary);
  border-radius: var(--r-md);
  padding: var(--s4);
  margin-top: var(--s3);
  font-size: var(--fs-body);
}

/* Ad placeholder */
.ad {
  border: 2px dashed var(--border-default);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  border-radius: var(--r-md);
  padding: var(--s4);
  text-align: center;
  font-size: var(--fs-tiny);
  letter-spacing: 0.14em;
  margin-bottom: var(--s4);
}

/* ────────── TABLES ────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
  margin-top: var(--s4);
  font-variant-numeric: tabular-nums;
}

td, th {
  padding: var(--s3) var(--s2);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

th {
  color: var(--text-tertiary);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover {
  background: var(--bg-surface);
}

/* ────────── DETAILS / ACCORDION ────────── */
details:not(.fold) {
  margin-top: var(--s3);
}

details:not(.fold) > summary {
  cursor: pointer;
  font-size: var(--fs-body);
  color: var(--gold);
  padding: var(--s3) 0;
  font-weight: var(--fw-semibold);
  transition: color var(--t-fast) var(--ease-out);
}

details:not(.fold) > summary:hover {
  color: var(--gold-light);
}

/* ────────── DRAW PANEL ────────── */
.drawpanel {
  margin-top: var(--s5);
  padding: var(--s5);
  
  background: var(--glass-medium);
  
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  
  box-shadow: var(--shadow-md);
}

.dphead {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding-bottom: var(--s4);
  margin-bottom: var(--s4);
  border-bottom: 1px solid var(--border-subtle);
}

.dphead b {
  font-family: var(--font-mono);
  font-size: var(--fs-large);
  color: var(--text-primary);
}

.dphead span {
  flex: 1;
  font-size: var(--fs-small);
  color: var(--text-tertiary);
}

.dphead button {
  width: auto;
  min-height: max(36px, calc(40px * var(--zoom-k)));
  padding: var(--s2) var(--s4);
  font-size: var(--fs-small);
}

.drawpanel .stat {
  padding: var(--s3) 0;
}

.drawpanel .chips {
  margin-bottom: var(--s5);
}

/* ────────── OCR CAMERA ────────── */
#ocrwrap {
  position: relative;
  overflow: hidden;
  background: #000;
  border-radius: var(--r-lg);
  border: 2px solid var(--border-default);
  aspect-ratio: 4/3;
  max-height: 48vh;
  margin: var(--s4) 0;
  box-shadow: var(--shadow-lg);
}

#ocrwrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ────────── EMPTY STATES ────────── */
.empty {
  text-align: center;
  padding: var(--s8) var(--s5);
  color: var(--text-tertiary);
  font-size: var(--fs-body);
}

.empty .ico {
  display: block;
  margin: 0 auto var(--s4);
  width: 40px;
  height: 40px;
  opacity: 0.4;
}

/* Loading placeholder */
.loading-rows::before {
  content: "";
  display: block;
  height: 24px;
  width: 55%;
  margin-bottom: var(--s4);
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    var(--skeleton-from) 25%,
    var(--skeleton-to) 50%,
    var(--skeleton-from) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

.loading-rows::after {
  content: "";
  display: block;
  height: 120px;
  border-radius: var(--r-md);
  background: linear-gradient(
    90deg,
    var(--skeleton-from) 25%,
    var(--skeleton-to) 50%,
    var(--skeleton-from) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

/* ────────── ZONE PILL ────────── */
.zonepill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: var(--gold-wash);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  border-radius: var(--r-full);
  padding: var(--s2) var(--s4);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  margin: var(--s3) 0;
  box-shadow: 0 0 16px var(--gold-glow);
}

/* ============================================================
   FINALIZATION FIXES — styles for classes that previously had
   none and were inheriting the wrong look.
   ============================================================ */

/* 1. Inline "Guide" link-button. Without this it inherited the
   global full-width gold button and swallowed the login's
   LANGUAGE field. Now it is a small text link. */
button.linkbtn {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 0;
  margin-left: var(--s2);
  padding: 2px 6px;
  background: none;
  border: 0;
  border-radius: var(--r-xs);
  box-shadow: none;
  color: var(--gold);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.linkbtn::before { display: none; }
button.linkbtn:hover { color: var(--gold-light); background: var(--gold-wash); }

/* 2. Ticket-anatomy row: label and number were running together. */
.tm-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  padding: 4px 0;
}
.tm-row .tm-label { color: var(--text-tertiary); font-size: var(--fs-small); }
.tm-row .tm-num {
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-lead);
  letter-spacing: .12em;
  color: var(--text-primary);
}

/* 3. Upload-a-photo label: the italic hint was glued to the bold
   title. Stack them with breathing room. */
.pickfile > span { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; }
.pickfile b { font-size: var(--fs-body); }
.pickfile i {
  font-style: normal;
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

/* 4. DATA footer: sentence was wrapping around the Guide button
   and language dropdown mid-sentence. Sentence gets its own line;
   controls sit centred underneath. */
.footerline { display: block; margin-bottom: var(--s3); line-height: 1.55; }
.langrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  flex-wrap: wrap;
}
.langrow button.ghost.mini { width: auto; }
.langrow select { min-height: max(36px, calc(40px * var(--zoom-k))); }

/* Offline banner — sits under the header, only visible with no connection. */
#offlineBar{
  position: sticky; top: var(--header-h); z-index: 60;
  padding: 10px var(--s4);
  background: #4A2410; color: #FFD9A0;
  border-bottom: 1px solid var(--border-gold);
  font-size: var(--fs-caption); text-align: center; letter-spacing: .02em;
}

/* ============================================================
   CHECK / BATCH RESULTS — compact, clear rows with a win/no-win
   state, a highlight for the just-added row, and a firecracker
   burst on a win.
   ============================================================ */
#batchOut{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }

.checkrow{
  position:relative; overflow:hidden;
  padding:10px 12px;
  border:1px solid var(--border-default);
  border-radius:var(--r-md);
  background:var(--bg-surface);
}
.checkrow .cr-top{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.checkrow .cr-num{ font-family:var(--font-mono,monospace); font-size:var(--fs-lead); letter-spacing:.1em; color:var(--text-primary); }
.checkrow .cr-num.k5{ color:var(--gold-light); }
.checkrow .cr-key{ font-size:var(--fs-caption); color:var(--text-tertiary); }
.checkrow .cr-head{ margin-top:6px; font-size:var(--fs-small); font-weight:700; letter-spacing:.04em; }
.checkrow .cr-detail{ margin-top:3px; font-size:var(--fs-small); color:var(--text-secondary); }
.checkrow .cr-dim{ color:var(--text-tertiary); }

/* WIN state — warm gold, celebratory header */
.checkrow.win{ border-color:var(--border-gold); background:linear-gradient(180deg,var(--gold-wash),transparent); }
.checkrow .cr-win{ color:var(--gold-light); display:flex; align-items:center; gap:8px; font-size:var(--fs-body); }
.checkrow .cr-win .cr-fx{ font-size:var(--fs-lead); }

/* NO-WIN state — quiet, never harsh */
.checkrow.nowin{ opacity:.92; }
.checkrow .cr-none{ color:var(--text-tertiary); }

/* the row just added flashes gently so the eye follows it */
.checkrow.justadded{ animation:crFlash 1.1s ease-out 1; }
@keyframes crFlash{
  0%{ box-shadow:0 0 0 3px var(--gold-glow); transform:translateY(-4px); }
  100%{ box-shadow:0 0 0 0 transparent; transform:translateY(0); }
}

/* firecracker burst */
.fx-burst{ position:absolute; top:22px; left:50%; width:0; height:0; pointer-events:none; }
.fx-burst i{
  position:absolute; left:0; top:0; width:7px; height:7px; border-radius:50%;
  background:var(--gold-light);
  transform:translate(0,0) scale(1); opacity:1;
  animation:fxfly .9s ease-out forwards; animation-delay:var(--d,0s);
}
.fx-burst i:nth-child(3n){ background:#FF7A59; }
.fx-burst i:nth-child(3n+1){ background:#FFD34D; }
.fx-burst i:nth-child(3n+2){ background:#7ED0FF; }
@keyframes fxfly{
  0%{ transform:translate(0,0) scale(1); opacity:1; }
  100%{ transform:translate(var(--dx,0),var(--dy,0)) scale(.2); opacity:0; }
}
@media (prefers-reduced-motion: reduce){
  .checkrow.justadded{ animation:none; }
  .fx-burst{ display:none; }
}

/* Scan guide: example ticket diagram showing which barcode to scan */
.scan-guide{
  margin:10px 0; padding:12px;
  border:1px solid var(--border-default); border-radius:var(--r-md);
  background:var(--bg-elevated); text-align:center;
}
.scan-guide-title{ font-size:var(--fs-small); font-weight:700; color:var(--gold); margin-bottom:8px; letter-spacing:.03em; }
.scan-guide-img{ width:100%; max-width:320px; height:auto; }
.scan-guide-note{ margin-top:8px; font-size:var(--fs-caption); color:var(--text-tertiary); line-height:1.5; }

/* ============================================================
   DISPLAY PREFERENCES — user-controlled zoom + screen fit,
   shown in the DATA footer. Choices persist across sessions.
   ============================================================ */
#displayPrefs{
  max-width:340px; margin:14px auto 0; padding:10px 12px;
  border:1px solid var(--border-gold); border-radius:var(--r-md);
  background:var(--gold-wash); text-align:left;
}
#displayPrefs .dp-title{
  display:flex; align-items:center; gap:6px; justify-content:center;
  color:var(--gold-light); font-weight:700; font-size:var(--fs-caption);
  letter-spacing:.06em; text-transform:uppercase; margin-bottom:9px;
}
#displayPrefs .dp-title .ico{ width:14px; height:14px; }
#displayPrefs .dp-row{ display:flex; align-items:center; gap:9px; margin:7px 0; }
#displayPrefs label,#displayPrefs .dp-lbl{
  font-size:var(--fs-micro); color:var(--text-secondary); min-width:30px;
  text-transform:uppercase; letter-spacing:.05em;
}
#displayPrefs output{
  font-family:var(--font-mono,monospace); font-size:var(--fs-micro);
  color:var(--gold-light); min-width:38px; text-align:right;
}
#displayPrefs input[type="range"]{
  flex:1; min-height:0; -webkit-appearance:none; appearance:none;
  height:5px; border-radius:3px; background:var(--bg-surface);
  border:1px solid var(--border-default); padding:0;
}
#displayPrefs input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none; width:18px; height:18px;
  border-radius:50%; background:linear-gradient(135deg,var(--gold),var(--gold-dark));
  border:2px solid var(--bg-base); cursor:pointer;
}
#displayPrefs input[type="range"]::-moz-range-thumb{
  width:18px; height:18px; border-radius:50%; border:2px solid var(--bg-base);
  background:var(--gold); cursor:pointer;
}
#displayPrefs .dp-seg{ display:flex; gap:0; flex:1; border-radius:var(--r-sm); overflow:hidden; border:1px solid var(--border-default); }
#displayPrefs .dp-seg button{
  flex:1; width:auto; min-height:30px; padding:4px 3px; margin:0;
  background:var(--bg-surface); color:var(--text-secondary);
  border:0; border-radius:0; font-size:var(--fs-micro); font-weight:600;
  box-shadow:none;
}
#displayPrefs .dp-seg button::before{ display:none; }
#displayPrefs .dp-seg button.on{ background:linear-gradient(135deg,var(--gold),var(--gold-dark)); color:var(--bg-base); }
#displayPrefs .dp-note{ margin-top:7px; font-size:9px; color:var(--text-tertiary); text-align:center; opacity:.8; }

/* the zoom/fit wrapper applied to <main> */
main{ transform-origin: top center; }
body[data-fit="tall"] main{ max-width:520px; margin-inline:auto; }
body[data-fit="wide"] main{ max-width:100%; }

/* Playful exit dialog */
.exit-emoji{ font-size:34px; text-align:center; margin-bottom:6px; }
/* ============================================================
   SCAN REDESIGN (v51) — trimmed, polished, glassmorphic.
   Camera viewfinder overlay, clean barcode example, per-day
   scan toggle on recent draws, and the per-day scan popup.
   ============================================================ */

.scan-lead{ font-size:var(--fs-small); color:var(--text-secondary); line-height:1.55; margin:0 0 4px; }
.scan-cap{ font-size:11px; color:var(--text-tertiary); text-align:center; margin:8px 0 0; }
.scan-cap.ok{ color:var(--gold-light); }
.scan-stat{ margin-top:10px; }

/* One clean barcode example */
.barcode-eg{
  position:relative; display:flex; flex-direction:column; align-items:center; gap:10px;
  margin:14px 0; padding:18px 16px; border-radius:16px;
  background:linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--glass-border);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.be-tag{ position:absolute; top:10px; right:12px; font-size:9px; letter-spacing:.16em;
  text-transform:uppercase; color:var(--text-tertiary); }
.be-strip{
  width:min(260px,82%); height:58px; border-radius:8px; background:#f5f5f4;
  background-image:repeating-linear-gradient(90deg,
    #0b0b0d 0, #0b0b0d 2px, transparent 2px, transparent 5px,
    #0b0b0d 5px, #0b0b0d 8px, transparent 8px, transparent 10px,
    #0b0b0d 10px, #0b0b0d 13px, transparent 13px, transparent 16px);
  border:2px solid var(--gold);
  box-shadow:0 0 0 4px var(--gold-wash), 0 10px 26px rgba(0,0,0,.4);
}
.be-num{ font-family:var(--font-mono); letter-spacing:.2em; color:var(--text-secondary); font-size:14px; }

/* Camera viewfinder — shared by main scanner (#ocrwrap) and day popup (.dayscan-cam) */
#ocrwrap{
  border:1px solid var(--border-gold);
  box-shadow:0 12px 44px rgba(0,0,0,.5), inset 0 0 0 1px rgba(245,158,11,.14);
}
#ocrwrap.hit, .dayscan-cam.hit{ box-shadow:0 0 0 3px var(--gold), 0 12px 44px rgba(0,0,0,.5); }

.reticle{ position:absolute; inset:0; pointer-events:none; }
.reticle .rc{
  position:absolute; width:34px; height:34px; border:3px solid var(--gold);
  filter:drop-shadow(0 0 5px var(--gold-glow));
}
.reticle .rc.tl{ top:14px; left:14px; border-right:0; border-bottom:0; border-radius:9px 0 0 0; }
.reticle .rc.tr{ top:14px; right:14px; border-left:0; border-bottom:0; border-radius:0 9px 0 0; }
.reticle .rc.bl{ bottom:14px; left:14px; border-right:0; border-top:0; border-radius:0 0 0 9px; }
.reticle .rc.br{ bottom:14px; right:14px; border-left:0; border-top:0; border-radius:0 0 9px 0; }
.reticle .sweep{
  position:absolute; left:16px; right:16px; top:16px; height:2px;
  background:linear-gradient(90deg, transparent, var(--gold), transparent);
  box-shadow:0 0 12px 2px var(--gold-glow); border-radius:2px;
  animation:scanSweep 2.4s var(--ease-in-out) infinite;
}
@keyframes scanSweep{
  0%{ top:16px; opacity:0; } 12%{ opacity:1; } 88%{ opacity:1; }
  100%{ top:calc(100% - 18px); opacity:0; }
}
.reticle-hint{
  position:absolute; left:50%; bottom:12px; transform:translateX(-50%);
  background:rgba(0,0,0,.6); color:#fff; font-size:11px; font-weight:600;
  padding:5px 12px; border-radius:999px; white-space:nowrap;
  box-shadow:0 2px 10px rgba(0,0,0,.4);
}

/* Action rows + manual entry */
.scan-actions{ display:flex; gap:10px; margin-top:12px; flex-wrap:wrap; }
.scan-actions > button{ flex:1 1 auto; }
.scan-manual{ margin-top:14px; }
.scan-manual > label{
  display:block; font-size:11px; text-transform:uppercase; letter-spacing:.08em;
  color:var(--text-tertiary); margin:12px 0 5px;
}
.scan-manual input, .scan-manual select{
  width:100%; height:46px; background:var(--bg-surface); color:var(--text-primary);
  border:1px solid var(--border-default); border-radius:12px; padding:0 14px; font-size:15px;
  appearance:none; -webkit-appearance:none;
}
.scan-manual input:focus, .scan-manual select:focus{
  outline:none; border-color:var(--gold); box-shadow:0 0 0 3px var(--gold-wash); background:var(--bg-elevated);
}

/* Recent draws (last 6 days) — QR scan toggle on the left of each row */
.recent-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.recent-row{ display:flex; align-items:stretch; gap:8px; }
.recent-row .chip{ flex:1 1 auto; display:flex; flex-direction:column; justify-content:center; text-align:left; margin:0; }
.dayscan-toggle{
  flex:0 0 auto; width:48px; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border-gold); border-radius:12px; cursor:pointer;
  background:linear-gradient(160deg, var(--gold-wash), rgba(245,158,11,.04));
  transition:transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.dayscan-toggle:hover{ background:var(--gold-wash); transform:translateY(-1px); box-shadow:0 6px 16px rgba(245,158,11,.22); }
.dayscan-toggle:active{ transform:translateY(0) scale(.97); }
.qr-ic{ width:22px; height:22px; fill:none; stroke:var(--gold); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

/* Per-day scan popup — matches the app modal pattern (solid scrim, above modal layer) */
.dayscan{
  position:fixed; inset:0; z-index:var(--z-toast);
  display:flex; align-items:center; justify-content:center; padding:16px;
  background:rgba(6,6,8,0.92);
  opacity:0; animation:fadeIn var(--t-base) var(--ease-out) forwards;
}
.dayscan[hidden]{ display:none; animation:none; opacity:0; }
.dayscan-card{
  position:relative; width:100%; max-width:400px; max-height:92vh; overflow-y:auto;
  background:rgba(20,20,24,0.99); border:1px solid var(--glass-border);
  border-radius:20px; padding:18px 16px 16px;
  box-shadow:var(--shadow-2xl), inset 0 1px 0 rgba(255,255,255,.06);
  animation:scaleIn var(--t-base) var(--ease-spring) forwards;
}
.dayscan-card::before{
  content:""; position:absolute; top:0; left:0; right:0; height:2px;
  background:linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity:.7; border-radius:20px 20px 0 0;
}
.dayscan-close{
  position:absolute; top:8px; right:8px; width:34px; height:34px; padding:0;
  display:flex; align-items:center; justify-content:center;
  border:0; border-radius:50%; background:transparent; color:var(--text-tertiary);
  font-size:26px; line-height:1; cursor:pointer;
}
.dayscan-close:hover{ color:var(--text-primary); background:var(--bg-surface); }
.dayscan-head{ display:flex; gap:11px; align-items:flex-start; margin-bottom:12px; padding-right:30px; }
.dayscan-head .ico{ color:var(--gold); width:24px; height:24px; flex:0 0 auto; margin-top:2px; }
.dayscan-title{ font-family:var(--font-display); font-weight:var(--fw-heavy); font-size:16px; color:var(--text-primary); line-height:1.2; }
.dayscan-sub{ font-size:12px; color:var(--text-secondary); margin-top:3px; line-height:1.4; }
.dayscan-cam{
  position:relative; overflow:hidden; background:#000;
  border-radius:14px; border:1px solid var(--border-gold);
  aspect-ratio:4/3; max-height:40vh; margin:6px 0 10px;
  box-shadow:inset 0 0 0 1px rgba(245,158,11,.14);
}
.dayscan-cam[hidden]{ display:none; }
.dayscan-cam video{ width:100%; height:100%; object-fit:cover; }
.dayscan-manual{ margin-top:12px; display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end; }
.dayscan-manual label{ flex:1 0 100%; font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--text-tertiary); }
.dayscan-manual input{
  flex:1 1 auto; min-width:0; height:44px; background:var(--bg-surface); color:var(--text-primary);
  border:1px solid var(--border-default); border-radius:12px; padding:0 14px; font-size:15px;
}
.dayscan-manual input:focus{ outline:none; border-color:var(--gold); box-shadow:0 0 0 3px var(--gold-wash); }
.dayscan-manual #dayCheck{ flex:0 0 auto; width:auto; padding:0 20px; height:44px; }
#dayResult{ margin-top:10px; }

/* Kerala-only guard note (v52) */
.scan-guard-note{
  display:flex; align-items:flex-start; gap:8px;
  margin:8px 0 0; padding:8px 11px;
  border:1px solid rgba(224,108,108,.32); border-left:3px solid #e06c6c; border-radius:0 10px 10px 0;
  background:rgba(224,108,108,.06);
  font-size:11px; color:var(--text-secondary); line-height:1.45;
}
.scan-guard-note[hidden]{ display:none; }
.scan-guard-note .ico{ color:#e06c6c; width:14px; height:14px; flex:0 0 auto; margin-top:1px; }

/* ============================================================
   CELEBRATION OVERLAY (v53) — win crackers / lose gentle note
   ============================================================ */
.celebrate{
  position:fixed; inset:0; z-index:1600; overflow:hidden;
  opacity:0; transition:opacity .3s var(--ease-out); pointer-events:none;
}
.celebrate.show{ opacity:1; pointer-events:auto; }
.celebrate.win{ background:radial-gradient(circle at 50% 42%, rgba(26,19,4,.34), rgba(6,6,8,.58)); }
.celebrate.lose{ background:rgba(7,9,13,.64); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); }

.celebrate .cel-glow{
  position:absolute; inset:0;
  background:radial-gradient(circle at 50% 40%, rgba(245,158,11,.42), transparent 62%);
  animation:celGlow 1.4s var(--ease-out);
}
@keyframes celGlow{ 0%{opacity:0} 35%{opacity:1} 100%{opacity:.15} }

.cel-confetti{
  position:absolute; top:-12vh; width:9px; height:15px; opacity:.96;
  animation-name:celFall; animation-timing-function:cubic-bezier(.28,.6,.42,1); animation-fill-mode:both;
}
@keyframes celFall{
  0%{ transform:translateY(-12vh) translateX(0) rotate(0deg); opacity:0; }
  8%{ opacity:1; }
  100%{ transform:translateY(114vh) translateX(calc(var(--dx,0) * 24vw)) rotate(var(--rot,360deg)); opacity:.85; }
}

.cel-card{
  position:absolute; left:50%; top:44%; transform:translate(-50%,-50%) scale(.55);
  width:min(320px,84vw); text-align:center; padding:24px 26px; border-radius:22px;
  background:rgba(20,20,24,.9); border:1px solid var(--border-gold);
  box-shadow:0 22px 70px rgba(0,0,0,.62), 0 0 64px rgba(245,158,11,.42);
  animation:celPop .6s var(--ease-spring) forwards;
}
.celebrate.lose .cel-card{ border-color:var(--border-subtle); box-shadow:0 22px 60px rgba(0,0,0,.5); }
@keyframes celPop{ to{ transform:translate(-50%,-50%) scale(1); } }

.cel-emoji{ font-size:42px; line-height:1; margin-bottom:8px; animation:celFloat 1.7s var(--ease-in-out) infinite; }
.cel-emoji.soft{ opacity:.92; }
@keyframes celFloat{ 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-6px); } }

.cel-title{
  font-family:var(--font-display); font-weight:900; letter-spacing:.05em; font-size:30px; line-height:1.1;
  background:linear-gradient(135deg, var(--gold-light), var(--gold) 45%, var(--gold-dark));
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.cel-title.soft{ background:none; color:var(--text-primary); -webkit-text-fill-color:currentColor; font-size:22px; font-weight:800; letter-spacing:.02em; }
.cel-amt{ margin-top:6px; font-family:var(--font-display); font-weight:800; font-size:23px; color:var(--gold-light); }
.cel-sub{ margin-top:9px; font-size:13px; color:var(--text-secondary); line-height:1.5; }
.cel-tap{ margin-top:12px; font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:var(--text-tertiary); }

@media (prefers-reduced-motion: reduce){
  .cel-confetti{ display:none; }
  .cel-card{ animation:none; transform:translate(-50%,-50%) scale(1); }
  .cel-emoji{ animation:none; }
}

/* ============================================================
   FAIRNESS LAB / NUMBER LAB (v54)
   Same glass + gold language as the rest of the app.
   ============================================================ */
.lab-card .labitem{
  margin-top:14px; padding:14px 14px 10px;
  border:1px solid var(--glass-border); border-radius:14px;
  background:linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.lab-card .labitem:first-of-type{ margin-top:12px; }
.lab-h{
  display:flex; align-items:center; gap:8px;
  font-family:var(--font-display); font-weight:var(--fw-heavy);
  font-size:var(--fs-small); letter-spacing:.06em; text-transform:uppercase;
  color:var(--gold-light); margin-bottom:6px;
}
.lab-dot{ width:8px; height:8px; border-radius:50%; flex:0 0 auto; }
/* good = bright gold, the brand's positive state. 'warn'/'mid' is now a
   neutral grey rather than a second gold, so the two stay clearly
   distinguishable by more than a shade — grey reads as 'unremarkable',
   which is exactly what these honest statistics usually are. */
.lab-dot.ok{   background:var(--gold-light); box-shadow:0 0 8px var(--gold-glow); }
.lab-dot.warn{ background:var(--text-tertiary); box-shadow:0 0 8px rgba(142,142,153,.35); }
.lab-lead{
  font-size:var(--fs-small); color:var(--text-secondary);
  line-height:1.55; margin-bottom:8px;
}
.lab-card .labitem .stat{ padding:5px 0; border-bottom:1px dashed var(--border-subtle); }
.lab-card .labitem .stat:last-of-type{ border-bottom:0; }
.lab-foot{ margin-top:8px; font-size:11px; opacity:.85; }

/* ============================================================
   DRAWS + PER-DRAW SCAN (v55)
   One plain list of every draw, each with a clearly visible SCAN
   button. Sized with the zoom token so it stays legible at every
   zoom level (the old icon-only toggle vanished when zoomed out).
   ============================================================ */
.results-bar{ display:flex; gap:8px; flex-wrap:wrap; margin:10px 0 4px; }
.results-bar .ghost.mini{ width:auto; }

.draws-head{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-top:14px; }
.draws-count{ color:var(--text-tertiary); }
.draws-hint{ margin:2px 0 0; color:var(--text-tertiary); }

.draw-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }

.draw-row{
  display:flex; align-items:stretch; gap:8px;
  border:1px solid var(--glass-border); border-radius:14px;
  background:linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
  overflow:hidden;
}
.draw-info{
  flex:1 1 auto; min-width:0; cursor:pointer;
  padding:10px 12px;
  transition:background var(--t-fast) var(--ease-out);
}
.draw-info:hover{ background:rgba(255,255,255,.04); }
.draw-key{
  font-family:var(--font-mono); font-weight:var(--fw-bold);
  font-size:max(15px, calc(16px * var(--zoom-k)));
  color:var(--text-primary); letter-spacing:.04em; line-height:1.2;
}
.draw-meta{
  font-size:max(11px, calc(12px * var(--zoom-k)));
  color:var(--text-tertiary); margin-top:3px; line-height:1.35;
}

/* The SCAN button: gold, labelled, and never smaller than a thumb target */
.draw-row .scan-btn{
  flex:0 0 auto; width:auto;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  min-width:max(66px, calc(72px * var(--zoom-k)));
  padding:0 12px;
  border:0; border-left:1px solid var(--border-gold); border-radius:0;
  background:linear-gradient(160deg, rgba(245,158,11,.22), rgba(245,158,11,.08));
  color:var(--gold-light); cursor:pointer;
  font-family:var(--font-display); font-weight:var(--fw-heavy);
  font-size:max(10px, calc(11px * var(--zoom-k))); letter-spacing:.1em;
  transition:background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.draw-row .scan-btn:hover{ background:linear-gradient(160deg, rgba(245,158,11,.34), rgba(245,158,11,.14)); }
.draw-row .scan-btn:active{ transform:scale(.97); }
.scan-btn-ic{
  width:max(22px, calc(24px * var(--zoom-k)));
  height:max(22px, calc(24px * var(--zoom-k)));
  fill:none; stroke:var(--gold); stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
  filter:drop-shadow(0 0 4px var(--gold-glow));
}

/* Plain-language verdict pills + strength bars (v56) */
.lab-pill{
  margin-left:auto; flex:0 0 auto;
  font-family:var(--font-body); font-weight:700; font-size:10px;
  letter-spacing:.04em; text-transform:none;
  padding:3px 9px; border-radius:999px; white-space:nowrap;
}
.lab-pill.good{ background:var(--gold-wash); color:var(--gold-light); border:1px solid var(--border-gold); }
.lab-pill.mid { background:rgba(255,255,255,.05); color:var(--text-tertiary); border:1px solid var(--border-default); }
.lab-h{ flex-wrap:nowrap; }

.lab-bar{
  height:7px; border-radius:999px; overflow:hidden;
  background:rgba(255,255,255,.07); margin:2px 0 10px;
}
.lab-bar i{ display:block; height:100%; border-radius:999px; }
.lab-bar i.good{ background:linear-gradient(90deg,var(--gold-dark),var(--gold-light)); box-shadow:0 0 10px var(--gold-glow); }
.lab-bar i.mid { background:linear-gradient(90deg,#4A4A55,#7A7A85); box-shadow:none; }

/* Camera light toggle */
.torch-btn{ width:auto !important; display:inline-flex; align-items:center; gap:6px; }
.torch-btn.on{ border-color:var(--gold) !important; color:var(--gold-light) !important; background:var(--gold-wash) !important; }
.torch-btn.on .ico{ filter:drop-shadow(0 0 6px var(--gold-glow)); }

/* Winning numbers inside the scan popup + today marker (v57) */
.day-draw{
  margin:8px 0 10px; border:1px solid var(--border-gold); border-radius:12px;
  background:linear-gradient(160deg, var(--gold-wash), rgba(245,158,11,.03));
  overflow:hidden;
}
.day-draw > summary{
  list-style:none; cursor:pointer; padding:10px 12px;
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  font-family:var(--font-display); font-weight:var(--fw-bold);
  font-size:var(--fs-small); color:var(--gold-light);
}
.day-draw > summary::-webkit-details-marker{ display:none; }
.dd-caret{ width:8px; height:8px; border-right:2px solid var(--gold); border-bottom:2px solid var(--gold);
  transform:rotate(45deg); transition:transform var(--t-fast) var(--ease-out); flex:0 0 auto; }
.day-draw[open] .dd-caret{ transform:rotate(-135deg); }
.dd-body{ padding:0 12px 12px; }
.dd-date{ font-size:11px; color:var(--text-tertiary); margin-bottom:6px; }
.dd-tiers{ margin-top:8px; }
.dd-tier{ margin-top:10px; padding-top:8px; border-top:1px dashed var(--border-subtle); }
.dd-tier-h{ font-size:11px; letter-spacing:.05em; text-transform:uppercase; color:var(--text-secondary); margin-bottom:6px; }
.dd-tier.k5 .dd-tier-h{ color:var(--gold-light); font-weight:700; }
.dd-tier-n{ color:var(--text-tertiary); text-transform:none; letter-spacing:0; }
.dd-body .chips{ grid-template-columns:repeat(auto-fill, minmax(64px,1fr)); gap:6px; margin-top:4px; }
.dd-body .chip{ padding:6px 4px; font-size:13px; }

.draw-row.is-today{ border-color:var(--border-gold); box-shadow:0 0 0 1px rgba(245,158,11,.18) inset; }
.today-tag{
  display:inline-block; margin-left:6px; padding:1px 7px; border-radius:999px;
  background:var(--gold); color:#1a1200; font-family:var(--font-body);
  font-size:9px; font-weight:800; letter-spacing:.08em; vertical-align:middle;
}

/* Batch summary, row delete, share (v58) */
.batch-sum{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:10px 12px; margin-top:4px;
  border:1px solid var(--glass-border); border-radius:12px;
  background:linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
}
.bs-item{ display:flex; flex-direction:column; gap:2px; min-width:64px; }
.bs-item span{ font-size:10px; letter-spacing:.06em; text-transform:uppercase; color:var(--text-tertiary); }
.bs-item b{ font-family:var(--font-display); font-size:16px; color:var(--text-primary); }
.bs-item.win b{ color:var(--gold-light); }
.bs-share{ margin-left:auto; width:auto !important; }

.cr-top{ display:flex; align-items:center; gap:8px; }
.cr-del{
  margin-left:auto; flex:0 0 auto; width:26px; height:26px; padding:0;
  display:flex; align-items:center; justify-content:center;
  border:0; border-radius:50%; background:transparent;
  color:var(--text-tertiary); font-size:20px; line-height:1; cursor:pointer;
}
.cr-del:hover{ color:#e06c6c; background:rgba(224,108,108,.12); }

/* Result export bar (v58) */
.dp-export{ display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }
.dp-export .ghost.mini{ width:auto; }
.dp-credit{
  margin-top:10px; padding-top:8px; border-top:1px solid var(--border-subtle);
  font-size:10px; letter-spacing:.05em; color:var(--text-tertiary); text-align:center;
}

/* ────────── FIRST-RUN WALKTHROUGH (onboard.js) ──────────
   Uses the app's proven modal pattern: a solid scrim with no
   backdrop-filter, above the modal layer. The language dialog once
   rendered *behind* the sign-in view because it sat at a lower
   z-index — that bug is the reason this sits at 1400. */
.ob-wrap {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: var(--s5);
}

.ob-scrim {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.82);
}

.ob-card {
  position: relative;
  width: 100%;
  max-width: 380px;

  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--r-2xl);
  padding: var(--s7) var(--s6) var(--s6);

  box-shadow: var(--shadow-2xl), 0 0 40px var(--gold-glow);
  text-align: center;

  animation: obIn 0.35s var(--ease-out) both;
}

@keyframes obIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.ob-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--s4);
  display: grid;
  place-items: center;

  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-wash), transparent);
  border: 1px solid var(--border-gold);
  color: var(--gold);
}
.ob-icon .ico { width: 26px; height: 26px; }

/* .ob-title is an <h2>, so it inherits the global section-heading rules:
   uppercase, flex layout, and the gold bar ::before. All three are wrong
   for a centred dialog title, so they are undone explicitly here rather
   than by hoping specificity works out. */
.ob-title {
  display: block;
  margin: 0 0 var(--s3);
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  color: var(--gold-light);
  letter-spacing: 0.02em;
  text-transform: none;
}
.ob-title::before { content: none; }

.ob-body {
  margin: 0 0 var(--s4);
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: 1.6;
}

.ob-honest {
  margin: 0 0 var(--s5);
  padding-top: var(--s3);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: var(--fs-caption);
  line-height: 1.5;
}

.ob-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-bottom: var(--s5);
}
.ob-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border-default);
  transition: all var(--t-fast) var(--ease-out);
}
.ob-dot.is-on {
  width: 20px;
  border-radius: var(--r-full);
  background: var(--gold);
}

.ob-actions { display: grid; gap: var(--s3); }
.ob-actions button { width: 100%; min-height: 48px; }
.ob-next {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-base);
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-body);
  cursor: pointer;
}
.ob-skip {
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  font-size: var(--fs-small);
  cursor: pointer;
}

/* Someone who has asked for less motion gets none of the entrance. */
@media (prefers-reduced-motion: reduce) {
  .ob-card { animation: none; }
  .ob-dot  { transition: none; }
}

/* ────────── TOAST ──────────
   Used by the double-back exit hint. Deliberately not a modal: it never
   blocks the screen and can never itself become something the user has
   to dismiss. Sits above content but below dialogs, and clears the
   bottom navigation and the gesture bar. */
.tkl-toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1350;

  max-width: min(90vw, 340px);
  padding: var(--s3) var(--s5);

  background: rgba(18, 18, 22, 0.96);
  color: var(--text-primary);
  border: 1px solid var(--border-gold);
  border-radius: var(--r-full);

  font-size: var(--fs-small);
  text-align: center;
  white-space: nowrap;

  box-shadow: var(--shadow-lg), 0 0 20px var(--gold-glow);
  pointer-events: none;

  animation: toastIn 0.22s var(--ease-out) both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .tkl-toast { animation: none; }
}

/* ────────── KEYBOARD FOCUS ──────────
   The app had no visible focus ring anywhere, which makes it unusable
   by keyboard and fails an accessibility statement the app publishes.
   :focus-visible shows the ring for keyboard users only, so nothing
   changes for someone tapping. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
button:focus-visible,
.iconbtn:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* ════════════════════════════════════════════════════════════
   NATIVE CONTROLS — dropdowns, date pickers, checkboxes

   These are drawn by the operating system, not by us, which is why
   they arrived as stark white-and-black panels in the middle of a
   gold-on-black app. Two properties do most of the work:

     color-scheme  tells the OS to draw its widgets in DARK mode, so
                   the calendar and the dropdown list come back black
                   instead of white.
     accent-color  tints the parts the OS lets us tint — the selected
                   date, the checked box, the focus ring.

   Honest limit: the dropdown LIST itself is an OS surface. We can make
   it dark and gold-accented, but we cannot fully restyle it from a web
   page on Android. Anything that had to be exactly on-brand would need
   a custom picker, which is a much larger change and a new set of
   accessibility problems.
   ════════════════════════════════════════════════════════════ */
:root[data-theme="dark"],
:root[data-theme="dark"] select,
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea {
  color-scheme: dark;
}
:root[data-theme="light"],
:root[data-theme="light"] select,
:root[data-theme="light"] input,
:root[data-theme="light"] textarea {
  color-scheme: light;
}

select, input, textarea, progress { accent-color: var(--gold); }

/* The little calendar / clock glyph inside date and time fields is a
   browser-drawn icon. It cannot take a colour, but it can be filtered
   from grey to our gold. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  filter: invert(66%) sepia(78%) saturate(1352%) hue-rotate(1deg) brightness(101%) contrast(96%);
}

/* Dropdowns: our own chevron, gold, and a gold ring on focus so the
   control looks deliberate rather than borrowed from the OS. */
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% + 1px),
    calc(100% - 12px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: var(--s8);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  color: var(--text-primary);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
select:hover { border-color: var(--border-gold); }
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-wash);
}
/* The option rows themselves — honoured on desktop and on some Android
   builds; harmless where it is ignored. */
select option {
  background: var(--bg-overlay);
  color: var(--text-primary);
}
select option:checked { background: var(--gold-wash); color: var(--gold-light); }

/* Text and date fields get the same gold focus treatment, so every
   control in the app agrees with every other one. */
input:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-wash);
}

/* Checkboxes large enough to hit, tinted gold by accent-color above. */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}


/* ────────── PER-ROW TICKET QUANTITY (checked list) ──────────
   Prizes 4th-9th are won on the last four digits, so every ticket
   sharing an ending wins them. This records how many the member holds
   so the running total reflects what they actually collected. */
.cr-qty {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--border-subtle);
}
.cr-qty-lab {
  flex: 1 1 auto;
  color: var(--text-tertiary);
  font-size: var(--fs-caption);
}
.cr-qty-btn {
  width: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  padding: 0;
  background: var(--bg-surface);
  color: var(--gold);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  box-shadow: none;
  cursor: pointer;
}
.cr-qty-btn::before { display: none; }      /* no shimmer on a stepper */
.cr-qty-btn:hover { border-color: var(--border-gold); background: var(--bg-overlay); transform: none; }
.cr-qty-in {
  flex: 0 0 56px;
  width: 56px;
  min-height: 34px;
  padding: 0 var(--s2);
  text-align: center;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  color: var(--gold-light);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
}
/* Hide the browser's own spinner — we supply our own buttons. */
.cr-qty-in::-webkit-outer-spin-button,
.cr-qty-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cr-qty-in[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.cr-qtytot {
  margin-top: var(--s2);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.5;
}
.cr-qtytot b { color: var(--gold-light); margin-left: 4px; }
.cr-qtytot .cr-dim { color: var(--text-tertiary); }

.bs-sub {
  display: block;
  font-style: normal;
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
}
