/* =====================================================================
   Escape the 9 to 5 — playful, warm, hand-drawn
   ===================================================================== */

:root {
  --ink:        #1a1410;          /* near-black brown */
  --paper:      #fff5e6;          /* warm cream */
  --paper-2:    #ffe8c2;          /* deeper cream */
  --mango:      #ff7a1a;          /* primary orange */
  --lime:       #c8ff3a;          /* electric lime */
  --pink:       #ff5c8a;          /* hot pink */
  --sky:        #6cd0ff;          /* friendly blue */
  --violet:     #8b5cf6;          /* coin-mascot purple */
  --muted:      #7a6a55;
  --line:       #1a1410;
  --shadow:     6px 6px 0 var(--ink);
  --shadow-sm:  3px 3px 0 var(--ink);
  --radius:     18px;
  --radius-lg:  28px;
  --font-disp:  "Fraunces", "Georgia", serif;
  --font-body:  "Bricolage Grotesque", system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%,  rgba(255,122,26,.12), transparent 32%),
    radial-gradient(circle at 88% 18%, rgba(108,208,255,.18), transparent 40%),
    radial-gradient(circle at 78% 92%, rgba(200,255,58,.20), transparent 40%),
    var(--paper);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.grain {
  pointer-events: none; position: fixed; inset: 0; z-index: 1;
  opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.06 0 0 0 0.12 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { font-family: var(--font-disp); font-weight: 900; letter-spacing: -0.02em; margin: 0 0 .4em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 4.4rem); line-height: 1.02; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); line-height: 1.08; }
h3 { font-size: 1.35rem; }
p  { margin: 0 0 1em; }

/* ---- Topbar --------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.brand {
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--font-disp); font-weight: 900; font-size: 1.25rem;
  letter-spacing: -.02em;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; background: var(--mango); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-6deg);
}
.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topnav a { font-weight: 600; }
.topnav a:hover { color: var(--mango); }
.hello { font-size: .92rem; color: var(--muted); }

.pill {
  display: inline-block; margin-left: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  border: 2px solid var(--ink);
}
.pill-free { background: var(--paper-2); color: var(--ink); }
.pill-paid { background: var(--lime); color: var(--ink); }
.badge-admin {
  background: var(--ink); color: var(--paper);
  padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800;
}

/* ---- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-body); font-weight: 700;
  padding: 12px 18px; border-radius: 14px;
  border: 2px solid var(--ink); cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
  text-decoration: none;
}
.btn-primary { background: var(--mango); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.btn-primary:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }
.btn-lime { background: var(--lime); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-pink { background: var(--pink); color: var(--paper); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(0,0,0,.06); }
.btn-google {
  background: #fff; color: var(--ink); box-shadow: var(--shadow-sm);
}
.btn-google svg { width: 18px; height: 18px; }

.btn-microsoft {
  background: #fff; color: #1a1410; border-color: #8a8a8a;
}
.btn-microsoft:hover { background: #f3f3f3; border-color: #1a1410; }
.btn-microsoft svg { width: 20px; height: 20px; flex-shrink: 0; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0; color: var(--muted); font-size: .85rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(0,0,0,.15);
}

/* ---- Page wrapper --------------------------------------------------- */
.page { position: relative; z-index: 2; padding: 56px 28px 96px; max-width: 1200px; margin: 0 auto; }

/* ---- HERO ----------------------------------------------------------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px;
  align-items: center; padding: 24px 0 64px;
}
.hero-eyebrow {
  display: inline-block; padding: 6px 14px;
  background: var(--lime); border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 800; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  transform: rotate(-2deg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.hero h1 .word-stack {
  display: inline-block; padding: 0 8px;
  background: var(--mango); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: var(--shadow);
  transform: rotate(-1.5deg);
}
.hero h1 .word-cash {
  display: inline-block; padding: 0 8px;
  background: var(--pink); color: var(--paper);
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}
.hero p.lead { font-size: 1.2rem; color: #3a2c1e; max-width: 38ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero-meta { margin-top: 22px; display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.hero-meta span::before { content: "● "; color: var(--mango); }

/* Hero illustration */
.hero-art {
  position: relative; aspect-ratio: 1 / 1;
}
.hero-art svg { width: 100%; height: 100%; }

/* ---- Sticker / floating bits --------------------------------------- */
.sticker {
  position: absolute;
  background: var(--lime); border: 2px solid var(--ink); border-radius: 14px;
  padding: 8px 12px; font-weight: 800; box-shadow: var(--shadow-sm);
  transform: rotate(-6deg);
}
.sticker-pink { background: var(--pink); color: var(--paper); }
.sticker-sky  { background: var(--sky); }

/* ---- Section heads -------------------------------------------------- */
.section { padding: 56px 0; }
.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  margin-bottom: 32px; flex-wrap: wrap;
}
.section-head h2 { max-width: 22ch; }
.section-head p { color: var(--muted); max-width: 42ch; }

/* ---- Module grid --------------------------------------------------- */
.module-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
@media (max-width: 900px) { .module-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .module-grid { grid-template-columns: 1fr; } }

.mcard {
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 240px;
}
.mcard:hover { transform: translate(-3px,-3px); box-shadow: 9px 9px 0 var(--ink); }
.mcard .emoji { font-size: 2.3rem; line-height: 1; }
.mcard h3 { margin: 0; }
.mcard p { color: var(--muted); margin: 0; }
.mcard .row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.mcard .num { font-family: var(--font-mono); font-size: .85rem; color: var(--muted); }
.mcard.locked { background: repeating-linear-gradient(135deg, var(--paper) 0 10px, var(--paper-2) 10px 20px); }
.mcard .lock { position: absolute; top: 14px; right: 14px;
  background: var(--ink); color: var(--paper);
  padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .08em;
}

/* nth-card color rotation */
.mcard:nth-child(6n+1) { background: #fff; }
.mcard:nth-child(6n+2) { background: var(--paper-2); }
.mcard:nth-child(6n+3) { background: #d9f7ff; }
.mcard:nth-child(6n+4) { background: #ffe1ec; }
.mcard:nth-child(6n+5) { background: #ecf9c5; }
.mcard:nth-child(6n+6) { background: #fff0d6; }

/* Status icon (top-left of card; replaces the old emoji slot) */
.mcard .status-ic {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  border: 2.5px solid var(--ink); border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.mcard .status-ic svg { width: 26px; height: 26px; }
.mcard.is-done   .status-ic { background: var(--lime); }
.mcard.is-todo   .status-ic { background: #fff; }
.mcard.is-locked .status-ic { background: var(--paper-2); }

/* When a module is completed, strike through the title (card + sidebar) */
.mcard.is-done h3,
.module-side a.is-done {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(26,20,16,.55);
}
.mcard.is-done h3 { opacity: .75; }

/* Inline status icon for sidebar links */
.module-side a {
  display: flex; align-items: center; gap: 8px;
}
.module-side .side-ic {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-grid; place-items: center;
}
.module-side .side-ic svg { width: 16px; height: 16px; }

/* ---- "Why" feature row ---------------------------------------------- */
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 820px) { .why-grid { grid-template-columns: 1fr; } }
.why-card {
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); padding: 22px;
  box-shadow: var(--shadow-sm);
}
.why-card .ic {
  width: 48px; height: 48px; border-radius: 12px;
  border: 2px solid var(--ink); display: grid; place-items: center;
  font-size: 1.4rem; margin-bottom: 12px;
}

/* ---- Forms (login/register/upgrade) -------------------------------- */
.auth-wrap {
  max-width: 460px; margin: 32px auto;
  background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--radius-lg);
  padding: 36px; box-shadow: var(--shadow);
}
.auth-wrap h1 { font-size: 2rem; margin-bottom: .1em; }
.auth-wrap .muted { color: var(--muted); margin-bottom: 22px; }
.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 700; font-size: .92rem; }
.form-row input {
  font: inherit; padding: 12px 14px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fff;
}
.form-row input:focus { outline: 3px solid var(--lime); outline-offset: 0; }
.errbox {
  background: var(--pink); color: var(--paper);
  padding: 10px 14px; border-radius: 12px; border: 2px solid var(--ink);
  margin-bottom: 14px; font-weight: 600;
}
.okbox {
  background: var(--lime); padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--ink); margin-bottom: 14px; font-weight: 600;
}
.divider {
  display: flex; align-items: center; gap: 10px; margin: 18px 0;
  color: var(--muted); font-size: .85rem;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 2px; background: var(--ink); opacity: .15;
}

/* ---- Dashboard ------------------------------------------------------ */
.dash-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--paper-2);
  border: 2.5px solid var(--ink); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2.5px solid var(--ink); background: var(--mango);
  display: grid; place-items: center; font-family: var(--font-disp);
  font-size: 1.6rem; font-weight: 900;
}
.progress-bar {
  height: 18px; background: #fff;
  border: 2px solid var(--ink); border-radius: 999px;
  overflow: hidden; min-width: 220px;
}
.progress-bar > span {
  display: block; height: 100%; background: var(--lime);
  border-right: 2px solid var(--ink);
}

/* ---- Module pages --------------------------------------------------- */
.module-page { display: grid; grid-template-columns: 240px 1fr; gap: 36px; align-items: start; }
@media (max-width: 880px) { .module-page { grid-template-columns: 1fr; } }
.module-side {
  position: sticky; top: 90px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.module-side a {
  display: block; padding: 8px 10px; border-radius: 10px; font-size: .92rem;
  color: var(--muted); border: 2px solid transparent;
}
.module-side a.active { background: var(--lime); color: var(--ink); border-color: var(--ink); font-weight: 700; }
.module-side a.locked { opacity: .55; }
.module-body { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow); }
.module-body h1 .emoji { display: inline-block; margin-right: .2em; transform: rotate(-8deg); }
.module-body h2 { margin-top: 1.8em; }
.module-body h3 { margin-top: 1.4em; color: var(--mango); }
.module-body p, .module-body li { font-size: 1.05rem; line-height: 1.65; color: #2d2218; }
.module-body ul { padding-left: 1.2em; }
.module-body li { margin-bottom: .5em; }
.module-body blockquote {
  margin: 1.4em 0; padding: 14px 18px;
  background: var(--paper-2); border-left: 6px solid var(--mango);
  border-radius: 10px;
}
.callout {
  margin: 1.6em 0; padding: 18px 20px;
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  background: #ecf9c5; box-shadow: var(--shadow-sm);
}
.callout.example  { background: #d9f7ff; }
.callout.warning  { background: #ffe1ec; }
.callout.tip      { background: #fff0d6; }
.callout .tag {
  display: inline-block; padding: 2px 10px; margin-bottom: 8px;
  background: var(--ink); color: var(--paper);
  font-size: .72rem; letter-spacing: .12em; font-weight: 800; border-radius: 999px;
}
.kbd-num {
  font-family: var(--font-mono); background: var(--ink); color: var(--lime);
  padding: 2px 8px; border-radius: 6px; font-size: .9em;
}

/* simple compound interest mini-calculator */
.mini-calc {
  margin: 20px 0; padding: 20px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius); border: 2.5px solid var(--ink);
}
.mini-calc h4 { font-family: var(--font-disp); margin: 0 0 10px; color: var(--lime); }
.mini-calc .calc-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.mini-calc label { display: block; font-size: .8rem; color: #c9b89d; }
.mini-calc input[type=range] { width: 100%; accent-color: var(--mango); }
.mini-calc .result {
  margin-top: 16px; font-family: var(--font-disp);
  font-size: 1.8rem; color: var(--lime);
}

/* ---- Locked / paywall ---------------------------------------------- */
.paywall {
  margin: 24px 0; padding: 40px 36px;
  background: linear-gradient(135deg, #ffe1ec, #ecf9c5);
  border: 2.5px solid var(--ink); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: grid; gap: 16px; text-align: center;
}
.paywall h2 { margin: 0; }
.paywall > p { margin: 0 auto; max-width: 54ch; color: var(--muted); line-height: 1.6; }

.paywall-pill {
  display: inline-block; justify-self: center;
  background: var(--lime); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 100px;
  padding: 5px 18px; font-size: .78rem; font-weight: 700; letter-spacing: .5px;
}
.paywall-price-card {
  display: inline-flex; flex-direction: column; align-items: center;
  justify-self: center;
  background: var(--ink); border-radius: 16px;
  padding: 24px 48px;
  box-shadow: 5px 5px 0 var(--mango);
  gap: 4px;
}
.paywall-price-label {
  font-size: .8rem; color: #9a8a7a; letter-spacing: .5px; text-transform: uppercase;
}
.paywall-price {
  font-size: 3.6rem; font-weight: 900; color: var(--lime);
  font-family: var(--font-disp); line-height: 1.05;
}
.paywall-price-sub { font-size: .8rem; color: #9a8a7a; }
.paywall-badges {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 18px;
}
.paywall-badges span {
  display: flex; align-items: center; gap: 6px;
  font-size: .85rem; color: var(--muted);
}
.paywall-badges svg { flex-shrink: 0; color: var(--ink); }

/* ---- Admin panel --------------------------------------------------- */
.admin-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 880px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-side {
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius); padding: 18px;
}
.admin-side h3 { color: var(--lime); margin: 0 0 12px; }
.admin-side a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--paper); }
.admin-side a:hover, .admin-side a.active { background: rgba(255,255,255,.08); color: var(--lime); }
.admin-card {
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  /* Keep the card itself inside its grid column even when a child table is wide */
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 880px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi {
  background: #fff; border: 2.5px solid var(--ink); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.kpi:nth-child(2) { background: var(--lime); }
.kpi:nth-child(3) { background: var(--paper-2); }
.kpi:nth-child(4) { background: #d9f7ff; }
.kpi .v { font-family: var(--font-disp); font-size: 2.2rem; font-weight: 900; line-height: 1; }
.kpi .l { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* Wrap any .admin-table in a horizontal scroller so wide tables scroll inside
   their card instead of stretching the whole page. */
.admin-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  padding: 10px 8px; text-align: left; border-bottom: 1px solid rgba(0,0,0,.08);
  vertical-align: top;
}
.admin-table th { font-family: var(--font-disp); white-space: nowrap; }
.admin-table tr:hover { background: rgba(0,0,0,.03); }
.tag-plan { padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; border: 2px solid var(--ink); }
.tag-plan.free { background: var(--paper-2); }
.tag-plan.paid { background: var(--lime); }

/* ---- Footer --------------------------------------------------------- */
.footsy { background: var(--ink); color: var(--paper); padding: 56px 28px 28px; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.6fr; gap: 32px; max-width: 1200px; margin: 0 auto; }
@media (max-width: 880px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-brand { font-family: var(--font-disp); font-weight: 900; font-size: 1.3rem; color: var(--lime); margin-bottom: 8px; }
.footsy h4 { color: var(--lime); }
.footsy a { display: block; color: var(--paper); opacity: .85; margin-bottom: 4px; }
.footsy a:hover { opacity: 1; color: var(--lime); }
.muted { color: var(--muted); }
.footsy .muted { color: #c9b89d; }
.foot-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); text-align: center; }

/* ---- Animations ----------------------------------------------------- */
@keyframes wobble {
  0%,100% { transform: rotate(-2deg); }
  50%     { transform: rotate(2deg);  }
}
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(-6deg); }
  50%     { transform: translateY(-8px) rotate(-3deg); }
}
.wobble { animation: wobble 3s ease-in-out infinite; transform-origin: center; }
.sticker { animation: floaty 5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .wobble, .sticker { animation: none; }
}

/* ---- Responsive hero ----------------------------------------------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-bottom: 36px; }
  .hero-art { order: -1; max-width: 360px; }
}
