/* ===========================================================================
   admin.css — "Weekend Warriors KPIs" control panel.

   Designed for one thumb, at night, outdoors, on cell data, while holding a
   beer. Every primary control is at least 56px tall and nothing important
   requires precision.
   =========================================================================== */

.admin-shell {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 14px calc(40px + env(safe-area-inset-bottom));
}

/* =============================================================== login === */

.login-wrap {
  min-height: 78vh;
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  padding: 26px 24px 24px;
}

.login-badge {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 26px;
  margin: 0 auto 16px;
  background: linear-gradient(160deg, var(--board-bg-2), var(--board-bg));
  border: 1px solid rgba(255,176,32,.35);
  box-shadow: inset 0 0 22px rgba(0,0,0,.5);
}

.login-title {
  text-align: center;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: .05em;
}

.login-sub {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 5px 0 22px;
  letter-spacing: .04em;
}

.login-error {
  background: rgba(208,59,59,.14);
  border: 1px solid rgba(208,59,59,.45);
  color: #ff9d9d;
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.login-hint {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
}

/* ============================================================= live bar === */
/* Pinned so the inning is always on screen — it's the number that decides
   whether he's behind. */

/* The console masthead deliberately scrolls away. Two sticky bars both pinned
   at top:0 meant the livebar sat behind the 113px-tall masthead on a phone and
   was never seen — and while scrolling, the inning matters and the Exit button
   doesn't. */
#panel-view .masthead { position: static; }

.livebar {
  position: sticky;
  top: 0;
  z-index: 45;
  margin: 0 -14px 14px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(180deg, var(--board-bg-2), var(--board-bg));
  border-bottom: 1px solid rgba(255,176,32,.24);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
}

.livebar-inning {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.livebar-num {
  font-size: 26px;
  font-weight: 780;
  color: var(--board-amber);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(255,176,32,.5);
}

.livebar-lbl {
  font-size: 9.5px;
  letter-spacing: .15em;
  color: rgba(255,176,32,.62);
  font-weight: 700;
}

.livebar-counts {
  margin-left: auto;
  display: flex;
  gap: 14px;
  align-items: center;
}

.livebar-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.livebar-stat .n {
  font-size: 19px;
  font-weight: 750;
  line-height: 1;
}

.livebar-stat .d {
  font-size: 11px;
  color: var(--text-muted);
}

.livebar-pace {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* =========================================================== big counter = */

.counter {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 16px;
  box-shadow: var(--shadow-1);
  margin-bottom: 14px;
  border-left: 4px solid var(--counter-accent, var(--border-2));
}

.counter-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.counter-emoji { font-size: 26px; line-height: 1; }

.counter-name {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.counter-readout {
  margin-left: auto;
  font-size: 32px;
  font-weight: 780;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.counter-readout .of {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 600;
}

.counter-controls {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
}

.btn-huge {
  min-height: 64px;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: .04em;
  border-radius: var(--r-lg);
  color: #fff;
  border: 1px solid rgba(255,255,255,.16);
  background: var(--counter-accent, var(--seq-500));
  box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.18);
}

.btn-huge:hover { filter: brightness(1.1); background: var(--counter-accent, var(--seq-500)); }
.btn-huge:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.35); }

.btn-undo {
  min-height: 64px;
  font-size: 22px;
  border-radius: var(--r-lg);
  background: var(--surface-sunk);
  color: var(--text-secondary);
}

.counter-meter { margin-top: 12px; }

.counter-foot {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  min-height: 16px;
}

/* ========================================================== chip grids === */

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 9px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .12s ease, border-color .12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Removing a condiment is a long-press. Without these, iOS answers a long
     press with the text-selection callout instead, and the gesture never
     reaches us. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.chip:hover  { background: var(--surface-3); }
.chip:active { transform: translateY(1px); }

.chip:focus-visible { outline: 2px solid var(--seq-350); outline-offset: 2px; }

.chip.has-value { border-color: var(--seq-400); }

.chip-count {
  margin-left: auto;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-sunk);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.chip.has-value .chip-count {
  background: var(--seq-500);
  color: #fff;
}

/* ============================================================ game list == */

.game-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 4px;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  min-height: 56px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.game-row:hover { background: var(--surface-3); }

.game-row.active {
  border-color: var(--board-amber);
  background: rgba(255,176,32,.09);
}

.game-row-main { flex: 1; min-width: 0; }

.game-row-teams {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.game-row-check {
  font-size: 15px;
  color: var(--board-amber);
  flex: none;
}

/* ============================================================== misc ===== */

.admin-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 14px;
  overflow: hidden;
}

.admin-section > .card-body { padding: 15px 16px 16px; }

.row-2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: end;
}

.status-hint {
  margin: 9px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.status-hint .badge { flex: none; }

.danger-zone {
  border-color: rgba(208,59,59,.32);
}

.danger-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.saving {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--seq-400);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
  z-index: 200;
}

.saving.on { transform: scaleX(1); }

/* ======================================================= inning control == */

.inning-control {
  display: grid;
  grid-template-columns: 74px 1fr 74px;
  gap: 10px;
  align-items: stretch;
}

.btn-step {
  min-height: 64px;
  font-size: 26px;
  font-weight: 700;
  border-radius: var(--r-lg);
  background: var(--surface-sunk);
  color: var(--text-secondary);
}

.inning-readout {
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--board-bg-2), var(--board-bg));
  border: 1px solid rgba(255, 176, 32, .28);
}

.inning-num {
  font-size: 30px;
  font-weight: 780;
  line-height: 1.05;
  color: var(--board-amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(255, 176, 32, .45);
}

.inning-cap {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  color: rgba(255, 176, 32, .6);
}

.inning-cap.manual { color: var(--warning); }

/* ============================================== pending / outbox note ==== */

.pending-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  padding: 9px 13px;
  border-radius: var(--r-md);
  background: rgba(250, 178, 25, .1);
  border: 1px solid rgba(250, 178, 25, .36);
  color: #ffd479;
  font-size: 12.5px;
  font-weight: 600;
}

.pending-note span:first-child {
  display: inline-block;
  animation: spin 1.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .pending-note span:first-child { animation: none; }
}

.offline-note {
  margin: 0 0 14px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: rgba(250,178,25,.1);
  border: 1px solid rgba(250,178,25,.36);
  color: #ffd479;
  font-size: 12.5px;
}
