/* RevApp — mobile-first, one stylesheet. Dark, punchy, built for an iPhone. */

:root {
  --bg: #14092b;
  --bg-2: #1b1035;
  --card: #241547;
  --card-2: #2d1b57;
  --line: #3b2a6b;
  --text: #f3effc;
  --muted: #a99cc9;
  --accent: #ff5c8a;
  --accent-2: #7c5cff;
  --good: #2fd07a;
  --warn: #ffb84f;
  --bad: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 60%, #251043 100%);
  min-height: 100vh;
  color: var(--text);
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(20, 9, 43, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 640px; margin: 0 auto; padding: 10px 16px;
}
.brand { font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 7px 11px; border-radius: 10px;
}
.topbar nav a.on { color: var(--text); background: var(--card); }
.topbar nav a.nav-out { opacity: .7; }

.page { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.page-title { font-size: 22px; margin: 4px 0 12px; }

/* ── Cards & sections ────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.micro { font-size: 12px; }
.hidden { display: none !important; }

/* ── Hero / stats ────────────────────────────────────────────────────────── */
.hero { margin: 6px 0 16px; }
.hero-hi { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 8px; text-align: center;
}
.stat-num { font-size: 22px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* ── Pips (today's blocks) ───────────────────────────────────────────────── */
.pips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.pip {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--card-2); border: 2px solid var(--line);
}
.pip-done { background: var(--good); border-color: var(--good); box-shadow: 0 0 10px rgba(47, 208, 122, .5); }
.pip-extra.pip-done { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 10px rgba(255, 184, 79, .5); }
.done-msg { color: var(--good); font-weight: 700; font-size: 15px; }

/* ── Buttons & forms ─────────────────────────────────────────────────────── */
.btn {
  display: inline-block; border: 0; border-radius: 14px; cursor: pointer;
  font-size: 16px; font-weight: 700; padding: 14px 20px; color: #fff;
  background: var(--card-2); text-align: center; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .5; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--text);
  font-size: 16px; font-family: inherit; margin: 4px 0 12px;
}
textarea { resize: vertical; }
label { font-size: 14px; font-weight: 600; color: var(--muted); }
.input-num { width: 76px !important; margin: 0 !important; }
.input-wide { margin: 0 !important; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-row .btn { padding: 12px 16px; }

/* ── Notices ─────────────────────────────────────────────────────────────── */
.notice { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.notice-success { background: rgba(47, 208, 122, .15); color: var(--good); }
.notice-error { background: rgba(255, 107, 107, .15); color: var(--bad); }
.notice-info { background: rgba(124, 92, 255, .18); color: #b9a8ff; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 30px 26px; text-align: center;
}
.login-logo { font-size: 40px; }
.login-card h1 { margin: 6px 0 2px; font-size: 26px; }
.login-card h1 span { color: var(--accent); }
.login-sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-card form { text-align: left; }

/* ── Block page ──────────────────────────────────────────────────────────── */
.block-head {
  background: linear-gradient(135deg, var(--subject, var(--accent-2)) 0%, rgba(0,0,0,.35) 160%);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.block-subject { font-size: 20px; font-weight: 800; }
.block-topic { font-size: 14px; opacity: .9; margin-top: 2px; }
.timer-wrap { margin-top: 14px; }
.timer { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-bar { height: 8px; border-radius: 4px; background: rgba(0,0,0,.3); margin-top: 6px; overflow: hidden; }
.timer-fill { height: 100%; width: 0; background: #fff; border-radius: 4px; transition: width 1s linear; }

.q-loading { text-align: center; padding: 26px 0; color: var(--muted); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.q-meta { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.q-text { font-size: 17px; line-height: 1.55; white-space: pre-wrap; margin-bottom: 14px; }
.q-text .q-part { margin: 0 0 10px; white-space: pre-wrap; }
.show-more {
  display: block; width: 100%; text-align: center; font-size: 14px; font-weight: 700;
  color: var(--accent-2); background: transparent; border: 1.5px dashed var(--line);
  border-radius: 10px; padding: 9px; cursor: pointer; font-family: inherit; margin-top: 4px;
}

.q-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mcq-option {
  text-align: left; font-size: 15px; font-weight: 600; color: var(--text);
  background: var(--card-2); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 13px 14px; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.mcq-option:active { transform: scale(.99); }
.mcq-option.picked { border-color: var(--accent); background: rgba(255, 92, 138, .12); }
.mcq-option:disabled { opacity: .7; }

.fb-score { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fb-marks { font-size: 30px; font-weight: 800; }
.fb-section h3 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fb-section p { margin: 0; font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
#q-next { margin-top: 16px; }

.block-actions { margin-top: 4px; }

.points-flash {
  display: inline-block; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; border-radius: 999px; padding: 6px 14px; font-size: 15px;
  animation: pop .35s ease;
}
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 4, 24, .8);
  backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.overlay-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 26px; text-align: center;
}
.overlay-card ul { text-align: left; color: var(--muted); font-size: 14px; padding-left: 20px; }
.overlay-card .btn { margin-top: 10px; }

/* ── Reflection ──────────────────────────────────────────────────────────── */
.card-reflect { border-color: var(--accent-2); }
.reflect-feedback { text-align: center; }
.reflect-feedback p { color: var(--muted); }
.reflection { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.reflection:first-of-type { border-top: 0; }
.reflection-head { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.reflection p { font-size: 14px; line-height: 1.5; margin: 6px 0; }
.stars { color: var(--warn); }
.points-inline { color: var(--good); font-weight: 800; margin-left: auto; }
.ai-comment { color: var(--muted); font-style: italic; }

/* ── Week / month strips ─────────────────────────────────────────────────── */
.week-strip { display: flex; gap: 8px; }
.week-day { flex: 1; text-align: center; }
.week-bar-wrap { height: 64px; background: var(--card-2); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.week-bar { width: 100%; background: var(--accent-2); border-radius: 8px 8px 0 0; min-height: 2px; }
.week-bar.hit { background: var(--good); }
.week-day.today .week-label { color: var(--accent); }
.week-label { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 5px; }
.week-count { font-size: 11px; color: var(--muted); }

.month-strip { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.month-day { aspect-ratio: 1; border-radius: 5px; background: var(--card-2); }
.month-day.some { background: var(--accent-2); opacity: .55; }
.month-day.hit { background: var(--good); opacity: 1; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 6px 0; }
.table td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

/* ── Prizes ──────────────────────────────────────────────────────────────── */
.prize-pts { float: right; font-size: 14px; color: var(--accent); }
.prize-progress { height: 10px; border-radius: 5px; background: var(--card-2); overflow: hidden; margin: 8px 0 4px; }
.prize-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 5px; transition: width .4s; }
.prize-ladder { list-style: none; margin: 10px 0 0; padding: 0; }
.prize-ladder li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.prize-ladder li:first-child { border-top: 0; }
.prize-ladder li.won .prize-title { color: var(--good); font-weight: 700; }
.prize-ladder li.passed .prize-title { color: var(--muted); }
.prize-tick { width: 24px; text-align: center; }
.prize-thresh { min-width: 60px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.prize-win { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.prize-win:first-of-type { border-top: 0; }
.prize-win-title { font-weight: 700; }
.prize-win form { margin-left: auto; }
.prize-status { margin-left: auto; font-size: 12px; font-weight: 800; }
.prize-win form + .prize-status, .prize-win .prize-status + form { margin-left: 0; }
.prize-status.given { color: var(--good); }
.prize-status.waiting { color: var(--warn); }
.prize-flash { margin-left: 8px; }
.btn-small { padding: 6px 10px; font-size: 13px; }

/* ── Admin: bank browser & preview ───────────────────────────────────────── */
.admin-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-links form { margin: 0; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input[type=search] { width: auto; flex: 1 1 130px; margin: 0; }
.filter-bar .btn { padding: 11px 16px; }
.bank-item { padding: 14px 16px; }
.bank-item.bank-off { opacity: .5; border-style: dashed; }
.bank-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.pill-mcq { background: rgba(79, 141, 255, .2); color: #8fb4ff; }
.pill-numeric { background: rgba(47, 208, 122, .2); color: var(--good); }
.pill-written { background: rgba(255, 92, 138, .2); color: var(--accent); }
.bank-q { margin: 0 0 8px; font-size: 15px; line-height: 1.5; }
.bank-opts { margin: 0 0 8px; padding-left: 20px; font-size: 14px; color: var(--muted); }
.bank-opts .right { color: var(--good); font-weight: 700; }
.bank-answer { font-size: 14px; margin: 0 0 8px; }
.bank-scheme summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 700; }
.bank-scheme p { font-size: 14px; color: var(--muted); }
.bank-actions { margin-top: 8px; }
.bank-actions .btn { padding: 8px 14px; font-size: 13px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.pager a { color: var(--muted); text-decoration: none; padding: 6px 11px; border-radius: 8px; font-weight: 700; }
.pager a.on { background: var(--card); color: var(--text); }
.pager-nav a { font-size: 15px; }
.pager-nav { justify-content: space-between; }

.viewas-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255, 184, 79, .15); color: var(--warn); border: 1px solid rgba(255, 184, 79, .4);
  border-radius: 12px; padding: 9px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 700;
}
.viewas-bar form { margin: 0; }
.viewas-bar button {
  background: var(--warn); color: #201500; border: 0; border-radius: 8px;
  padding: 5px 12px; font-weight: 800; font-size: 13px; cursor: pointer;
}

.attribution { color: var(--muted); opacity: .55; font-size: 11px; margin-top: 30px; text-align: center; }
.attribution a { color: inherit; }

/* ── Beta pill ───────────────────────────────────────────────────────────── */
.beta-pill {
  position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); right: 10px;
  background: var(--warn); color: #201500; font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; opacity: .85; z-index: 30;
}

@media (min-width: 700px) {
  .page-title { font-size: 26px; }
  .stat-num { font-size: 26px; }
}
