/* ============================================================
   The Anti-App — MVP GUI styles
   Dark, minimal, rounded. Primary #89b4fa. Font: Segoe UI.
   ============================================================ */
:root {
  --bg: #0f111a;
  --bg-raise: #161a26;
  --bg-card: #1b2030;
  --bg-card-hover: #20263a;
  --line: #2a3147;
  --line-strong: #3a4360;
  --text: #e6e9f2;
  --text-dim: #98a2bd;
  --text-faint: #6b7490;
  --primary: #89b4fa;
  --primary-strong: #6f9ef0;
  --primary-soft: rgba(137, 180, 250, 0.14);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(137, 180, 250, 0.09), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(137, 180, 250, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Header ---------- */
.app-header {
  padding: 22px 18px 8px;
  max-width: 620px;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  box-shadow: 0 0 24px rgba(137, 180, 250, 0.18);
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-tag {
  color: var(--text-dim);
  font-size: 13px;
}

.mode-chip {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.mode-chip.live {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(74, 222, 128, 0.35);
}

.mode-chip.demo {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.35);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ---------- Main ---------- */
.app-main {
  max-width: 620px;
  margin: 0 auto;
  padding: 10px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Progress ---------- */
.progress-card {
  background: linear-gradient(160deg, rgba(137, 180, 250, 0.1), transparent 70%), var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.progress-top > span:first-child {
  font-weight: 700;
}

.progress-xp-left {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.progress-track {
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #b4ccfb);
  box-shadow: 0 0 12px rgba(137, 180, 250, 0.55);
  transition: width 0.45s ease;
}

.progress-sub {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- Mode banner ---------- */
.mode-banner {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  border: 1px solid;
  line-height: 1.5;
}

.mode-banner.demo {
  color: #fde68a;
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.35);
}

.mode-banner.err {
  color: #fecaca;
  background: var(--err-soft);
  border-color: rgba(248, 113, 113, 0.35);
}

/* ---------- Quest list ---------- */
.quest-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.quest-item:not(.quest-done):hover {
  background: var(--bg-card-hover);
}

.quest-item.quest-done {
  opacity: 0.82;
  border-color: rgba(74, 222, 128, 0.28);
}

.quest-emoji {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--bg-raise);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.quest-done .quest-emoji {
  background: var(--ok-soft);
  border-color: rgba(74, 222, 128, 0.35);
}

.quest-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.quest-name {
  font-weight: 700;
  font-size: 15px;
}

.quest-point {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.quest-act {
  flex: 0 0 auto;
}

.verify-btn {
  background: var(--primary);
  color: #0b1020;
  font-weight: 800;
  font-size: 13.5px;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  box-shadow: 0 4px 14px rgba(137, 180, 250, 0.3);
  transition: transform 0.12s ease, background 0.15s ease;
}

.verify-btn:hover {
  background: #a5c5fc;
  transform: translateY(-1px);
}

.verify-btn:active {
  transform: translateY(0);
}

.verify-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.quest-done-badge {
  color: var(--ok);
  font-weight: 800;
  font-size: 13px;
  background: var(--ok-soft);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.quest-demo-badge {
  color: var(--warn);
  font-weight: 700;
  font-size: 11px;
  background: var(--warn-soft);
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* ---------- History ---------- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.day-cell {
  text-align: center;
}

.day-cell .day-dot {
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  color: var(--text-faint);
}

.day-cell.today .day-dot {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(137, 180, 250, 0.3);
}

.day-cell.full .day-dot {
  background: var(--ok-soft);
  border-color: rgba(74, 222, 128, 0.4);
  color: var(--ok);
}

.day-cell.partial .day-dot {
  color: var(--primary);
}

.day-cell .day-label {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ---------- Footer note ---------- */
.footer-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ============================================================
   Camera overlay
   ============================================================ */
.camera-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 14, 0.92);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.camera-overlay[hidden] {
  display: none;
}

.cam-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cam-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.cam-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
}

.cam-close {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
}

.cam-close:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.cam-stage {
  position: relative;
  background: #000;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.cam-video,
.cam-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* viewfinder corners + scan line */
.scan-frame {
  position: absolute;
  inset: 8%;
  pointer-events: none;
}

.scan-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid var(--primary);
}

.scan-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.scan-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.scan-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 8px; }
.scan-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 8px; }

.scan-line {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  box-shadow: 0 0 12px rgba(137, 180, 250, 0.9);
  animation: scanMove 2.4s ease-in-out infinite;
}

@keyframes scanMove {
  0%   { top: 2%; }
  50%  { top: 94%; }
  100% { top: 2%; }
}

.cam-msg {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}

.cam-msg.busy {
  background: rgba(15, 17, 26, 0.9);
  border-color: var(--line-strong);
  color: var(--text);
}

.cam-msg.ok {
  background: var(--ok-soft);
  border-color: rgba(74, 222, 128, 0.4);
  color: #bbf7d0;
}

.cam-msg.err {
  background: var(--err-soft);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.cam-msg.bad {
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fde68a;
}

.cam-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
}

.cam-btn {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
}

.cam-btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text-dim);
}

.cam-btn.ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.cam-btn.go {
  background: var(--primary);
  color: #0b1020;
  font-weight: 800;
}

.cam-btn.go:hover {
  background: #a5c5fc;
}

.cam-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 620px) {
  .app-header { padding-top: 34px; }
  .brand-text h1 { font-size: 25px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 27px; }
}

@media (max-width: 360px) {
  .quest-item { padding: 11px; }
  .quest-point { font-size: 11.5px; }
  .verify-btn { padding: 8px 12px; font-size: 12.5px; }
}
