/* PreSeeny styles. Brand colours come from the Rizwan, M. logo. Deck colours come from each deck's theme. */
:root {
  --red: #E3342F;
  --red-dark: #B9221E;
  --yellow: #F6C232;
  --ink: #2B2522;
  --cream: #FBF3E8;
  --paper: #FFFDF9;
  --muted: #7A6D63;
  --line: #EADCCB;
  --green: #2E8B57;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(60, 35, 20, .10), 0 2px 6px rgba(60, 35, 20, .06);
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--cream);
  background-image: radial-gradient(1200px 500px at 110% -10%, rgba(246, 194, 50, .18), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(227, 52, 47, .10), transparent 60%);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; }
img { max-width: 100%; }
button { font-family: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px clamp(16px, 4vw, 40px); background: rgba(255, 253, 249, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.brand-word { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -.5px; }
.brand-word span, .brand-title span { color: var(--red); }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { text-decoration: none; font-weight: 500; font-size: 14px; padding: 6px 10px; border-radius: 10px; }
.nav-link:hover { background: #F3E6D6; }
.nav-admin { background: var(--ink); color: #fff; }
.nav-admin:hover { background: #000; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.view { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 48px; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 16px clamp(16px, 4vw, 40px); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.loading { padding: 80px 0; text-align: center; color: var(--muted); font-weight: 500; }

/* ---------- buttons ---------- */
.btn { border: 0; cursor: pointer; border-radius: 12px; padding: 12px 18px; font-weight: 600; font-size: 15px; transition: transform .08s ease, box-shadow .2s ease, background .2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(227, 52, 47, .28); }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: #F3E6D6; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-google { width: 100%; background: #fff; border: 1.5px solid #DADCE0; color: #3C4043; }
.btn-google:hover { background: #F8F9FA; }
.linkbtn { background: none; border: 0; color: var(--red); font-weight: 600; cursor: pointer; padding: 8px 0; font-size: 14px; }

/* ---------- auth ---------- */
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(20px, 5vw, 64px); align-items: center; min-height: calc(100vh - 220px); }
.auth-logo { width: 150px; height: 150px; border-radius: 50%; box-shadow: var(--shadow); }
.auth-logo.small { width: 90px; height: 90px; }
.brand-title { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 7vw, 72px); letter-spacing: -1.5px; margin: 14px 0 6px; line-height: 1; }
.lead { font-size: 18px; color: #4B403A; max-width: 520px; line-height: 1.55; }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.ticks li { padding-left: 30px; position: relative; font-weight: 500; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.auth-card { background: var(--paper); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #F3E6D6; padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; color: #4B403A; }
form input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 15px; font-family: inherit; }
form input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(227, 52, 47, .12); }
.msg { display: none; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #FDECEC; color: #8A1C1C; font-size: 14px; }
.msg.show { display: block; }
.msg.ok { background: #E8F5EC; color: #1F6B3F; }
.demo-banner { background: #FFF6D6; border: 1px solid #F1D98A; color: #6B5200; padding: 10px 12px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; }
.center-card { max-width: 520px; margin: 60px auto; text-align: center; background: var(--paper); padding: 32px; border-radius: 24px; box-shadow: var(--shadow); }

/* ---------- home ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 12px; font-weight: 700; color: var(--red); margin: 0; }
.home h1 { font-family: var(--display); font-size: clamp(30px, 4.5vw, 44px); margin: 6px 0; letter-spacing: -.5px; }
.sub { color: var(--muted); max-width: 640px; margin: 0 0 24px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.deck-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; min-height: 250px; padding: 22px 24px;
  border-radius: 24px; text-decoration: none; color: var(--on); box-shadow: var(--shadow);
  background: linear-gradient(145deg, var(--p) 0%, var(--s) 100%); transition: transform .18s ease, box-shadow .18s ease;
}
.deck-tile::after { content: ""; position: absolute; right: -60px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; background: var(--a); opacity: .18; }
.deck-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0,0,0,.18); }
.deck-top { display: flex; justify-content: space-between; align-items: flex-start; }
.session-pill { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.deck-ring { color: var(--on); }
.org-name { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 4vw, 44px); line-height: 1.02; margin: 18px 0 0; letter-spacing: -1px; }
.deck-industry { margin: 0; opacity: .85; font-size: 14px; }
.deck-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .95; position: relative; z-index: 1; }
.deck-go { background: var(--a); color: var(--p); padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 28px; }
.how div { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.how b { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; }

/* ---------- study (themed by deck) ---------- */
.study { --p: #333; --s: #555; --a: #F6C232; --surf: #F6F1EA; --ink2: #222; --on: #fff; }
.deck-banner {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; padding: 24px 28px; border-radius: 24px;
  color: var(--on); background: linear-gradient(135deg, var(--p), var(--s)); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.deck-banner::after { content: ""; position: absolute; right: -40px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: var(--a); opacity: .15; }
.back { color: var(--on); opacity: .85; text-decoration: none; font-size: 13px; font-weight: 600; }
.org-name.big { font-size: clamp(36px, 6vw, 60px); margin: 8px 0 4px; }
.session-small { margin: 0; font-size: 13px; opacity: .85; letter-spacing: .3px; }
.banner-stats { display: flex; gap: 18px; align-items: center; position: relative; z-index: 1; }
.banner-stats div { text-align: center; }
.banner-stats b { display: block; font-size: 24px; }
.banner-stats span { font-size: 12px; opacity: .85; }
.banner-ring { color: var(--on); }
.progressbar { position: relative; height: 10px; background: #E9DED2; border-radius: 999px; margin: 16px 4px; overflow: hidden; }
.progressbar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); border-radius: 999px; transition: width .4s ease; }
.progressbar i { position: absolute; top: 0; bottom: 0; background: var(--a); transition: all .4s ease; }

.controls { display: grid; gap: 12px; margin-bottom: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chip.on { background: var(--p); border-color: var(--p); color: var(--on); }
.chip.on small { color: var(--on); opacity: .8; }
.ctrl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: #F0E5D8; border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.08); }

.card-stage { display: grid; justify-items: center; gap: 14px; }
.counter { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; gap: 10px; align-items: center; }
.status { padding: 3px 10px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }
.status.new { background: #ECE4DA; color: #6E5F53; }
.status.review { background: #FFF1D6; color: #8A5B00; }
.status.known { background: #DDF1E4; color: #1F6B3F; }

.flashcard { width: min(760px, 100%); perspective: 1600px; cursor: pointer; outline: none; }
.flashcard:focus-visible .face { box-shadow: 0 0 0 4px var(--a), var(--shadow); }
.fc-inner { display: grid; transition: transform .55s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; min-height: 340px; border-radius: 26px; padding: 28px 32px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.front { background: linear-gradient(160deg, var(--p), var(--s)); color: var(--on); justify-content: center; align-items: center; text-align: center; position: relative; overflow: hidden; }
.front::before { content: ""; position: absolute; left: -50px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%; background: var(--a); opacity: .18; }
.back { background: var(--paper); color: var(--ink2); transform: rotateY(180deg); border: 2px solid var(--a); }
.fc-section { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.16); }
.fc-tags { align-self: flex-start; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.front .fc-tags { position: absolute; top: 22px; left: 24px; }
.fc-type { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: var(--a); color: var(--p); }
.back .fc-section { background: var(--surf); color: var(--s); }
.type-split { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; position: relative; z-index: 1; }
.type-split span { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* Implication cards: light "think" front so students instantly see the card type */
.flashcard.impl .front { background: var(--surf); color: var(--ink2); border: 2px dashed var(--s); text-align: left; align-items: stretch; justify-content: center; padding-top: 70px; }
.flashcard.impl .front::before { background: var(--a); opacity: .25; }
.flashcard.impl .front .fc-section { background: #fff; color: var(--s); }
.flashcard.impl .front .fc-hint { left: 0; right: 0; text-align: center; }
.fc-factlabel { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--s); position: relative; z-index: 1; }
.fc-fact { margin: 0; padding: 14px 18px; border-left: 4px solid var(--a); background: #fff; border-radius: 12px; font-family: var(--display); font-size: clamp(17px, 2.2vw, 21px); line-height: 1.4; position: relative; z-index: 1; }
.fc-think { margin: 16px 0 24px; font-weight: 700; color: var(--p); font-size: 16px; position: relative; z-index: 1; }
.fc-think::before { content: "💭 "; }
.fc-impl-label { margin: 4px 0 10px; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--p); }
.flashcard.impl .back { border-style: dashed; }
.fc-q { font-family: var(--display); font-weight: 600; font-size: clamp(22px, 3.2vw, 32px); line-height: 1.25; margin: 20px 10px; position: relative; z-index: 1; }
.fc-hint { font-size: 12px; opacity: .75; position: absolute; bottom: 18px; }
.fc-qsmall { margin: 14px 0 8px; font-weight: 600; color: var(--s); font-size: 15px; }
.fc-a { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.fc-a li { position: relative; padding-left: 26px; font-size: 16.5px; line-height: 1.45; }
.fc-a li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 10px; height: 10px; border-radius: 50%; background: var(--a); box-shadow: 0 0 0 3px var(--surf); }
.fc-src { margin-top: auto; padding-top: 16px; font-size: 12px; color: var(--muted); font-style: italic; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-nav { background: var(--paper); border: 1.5px solid var(--line); width: 52px; font-size: 18px; color: var(--ink); }
.btn-review { background: #FFF1D6; color: #7A4F00; border: 1.5px solid #F2C877; min-width: 150px; }
.btn-review:hover { background: #FFE7B8; }
.btn-known { background: var(--green); color: #fff; min-width: 150px; box-shadow: 0 6px 16px rgba(46, 139, 87, .28); }
.btn-known:hover { background: #237347; }
.keys { font-size: 12px; color: var(--muted); margin: 0; }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-family: inherit; font-size: 11px; margin: 0 2px; }
.empty { text-align: center; background: var(--paper); border-radius: 24px; padding: 40px 24px; box-shadow: var(--shadow); }
.trophy { font-size: 56px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(30px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- admin ---------- */
.admin h1 { font-family: var(--display); margin: 6px 0 4px; font-size: clamp(28px, 4vw, 40px); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 20px 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.stat b { display: block; font-size: 30px; font-family: var(--display); }
.stat span { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); font-family: inherit; font-size: 14px; background: #fff; }
.toolbar input { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #F7EEE3; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #F1E6D9; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.who { display: flex; gap: 10px; align-items: center; }
.who .avatar { flex: none; }
.who small { display: block; color: var(--muted); }
.pbar { width: 140px; height: 8px; border-radius: 999px; background: #EEE3D6; overflow: hidden; }
.pbar span { display: block; height: 100%; background: var(--green); }
.ptext { font-size: 12px; color: var(--muted); margin-top: 4px; }
.badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.active { background: #DDF1E4; color: #1F6B3F; }
.badge.removed { background: #FDE2E1; color: #9B1C1C; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-danger { background: #FDE2E1; color: #9B1C1C; border: 1.5px solid #F5B5B2; }
.btn-danger:hover { background: #FBCFCD; }
.btn-ok { background: #DDF1E4; color: #1F6B3F; border: 1.5px solid #A9D9BB; }
.note { font-size: 13px; color: var(--muted); }
.uid-box { font-family: Consolas, monospace; background: #fff; border: 1px dashed var(--line); padding: 10px; border-radius: 10px; word-break: break-all; user-select: all; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; text-align: center; }
  .auth-hero { display: grid; justify-items: center; }
  .ticks { justify-items: start; }
  .how { grid-template-columns: 1fr; }
  .deck-banner { align-items: flex-start; }
}
@media (max-width: 520px) {
  .brand-word { font-size: 20px; }
  .brand img { width: 38px; height: 38px; }
  .nav-link { padding: 6px 6px; }
  .face { padding: 22px 20px; min-height: 300px; }
  .fc-a li { font-size: 15.5px; }
  .actions .btn-review, .actions .btn-known { min-width: 0; flex: 1; }
  .banner-stats { gap: 12px; }
  .deck-grid { grid-template-columns: 1fr; }
  .keys { display: none; }
  .topbar .nav-link:not(.nav-admin) { display: none; }
}
