/* Akio Math — shared styles */

:root{
  --bg: #f2f7fd;
  --bg-2: #e8f1fc;
  --surface: #ffffff;
  --ink: #16213a;
  --muted: #5c6b85;
  --muted-2: #8593ac;
  --line: #dde7f5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #ea580c;
  --accent-light: #ffedd5;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --success: #15803d;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .06), 0 1px 1px rgba(20,30,60,.04);
  --shadow-md: 0 8px 24px rgba(20, 50, 90, .10);
  --shadow-lg: 0 18px 48px rgba(20, 50, 90, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img{ max-width: 100%; }
a{ color: inherit; }
button{ font-family: inherit; }
.container{
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}
.visually-hidden{
  position: absolute; width:1px; height:1px; overflow:hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border:0; padding:0; margin:-1px;
}

/* ---------- Interactive background ---------- */
.bg-scene{
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 12% -10%, #cfe0fb 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 10%, #fdddc2 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.bg-shape{
  position: absolute;
  will-change: transform;
  opacity: .5;
  color: var(--primary);
  transform: translate3d(calc(var(--mx, 0) * var(--px, 0)), calc(var(--my, 0) * var(--py, 0)), 0)
             translateY(0) rotate(0deg);
  animation: drift var(--dur, 22s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.bg-shape svg{ display:block; width: var(--size, 40px); height: var(--size, 40px); }
@keyframes drift{
  0%   { transform: translate3d(calc(var(--mx,0) * var(--px,0)), calc(var(--my,0) * var(--py,0)), 0) translateY(0) rotate(0deg); }
  50%  { transform: translate3d(calc(var(--mx,0) * var(--px,0)), calc(var(--my,0) * var(--py,0) - 26px), 0) translateY(-26px) rotate(180deg); }
  100% { transform: translate3d(calc(var(--mx,0) * var(--px,0)), calc(var(--my,0) * var(--py,0)), 0) translateY(0) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce){
  .bg-shape{ animation: none; }
}

/* ---------- Top bar ---------- */
.topbar{
  position: relative;
  z-index: 2;
  padding: 22px 0 8px;
}
.topbar-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark{
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-text{ line-height: 1.15; }
.brand-text strong{ font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.brand-text span{ display:block; font-size: 12px; color: var(--muted); font-weight: 600; }

.btn{
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
}
.btn:active{ transform: translateY(1px) scale(.98); }
.btn:disabled{ opacity: .45; cursor: not-allowed; }
.btn-primary{ background: var(--primary); color:#fff; box-shadow: 0 6px 16px rgba(109,40,217,.28); }
.btn-primary:hover:not(:disabled){ background: var(--primary-dark); }
.btn-accent{ background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(13,148,136,.25); }
.btn-accent:hover:not(:disabled){ background: #0b7c72; }
.btn-ghost{ background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled){ background: var(--bg-2); }
.btn-soft{ background: var(--primary-light); color: var(--primary-dark); }
.btn-soft:hover:not(:disabled){ background: #e2d8fc; }
.btn-danger{ background: var(--danger-light); color: var(--danger); }
.btn-danger:hover:not(:disabled){ background: #fecaca; }
.btn-sm{ padding: 7px 14px; font-size: 13px; }
.btn-lg{ padding: 14px 26px; font-size: 16px; border-radius: 999px; }
.btn-block{ width: 100%; justify-content: center; }

/* ---------- Hero ---------- */
.hero{
  position: relative; z-index: 2;
  text-align: center;
  padding: 46px 0 20px;
}
.hero h1{
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary) 45%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p{
  max-width: 620px; margin: 0 auto;
  color: var(--muted); font-size: 16px;
}
.hero-stats{
  display:flex; gap: 26px; justify-content:center; margin-top: 22px; flex-wrap: wrap;
}
.hero-stat b{ display:block; font-size: 22px; color: var(--primary-dark); }
.hero-stat span{ font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------- Chapter grid ---------- */
.chapters{
  position: relative; z-index: 2;
  padding: 18px 0 70px;
}
.chapter-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  margin-top: 10px;
}
.tile{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex; flex-direction: column; gap: 12px;
  text-decoration: none; color: inherit;
  overflow: hidden;
}
.tile::after{
  content:"";
  position:absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(109,40,217,.06));
  opacity: 0; transition: opacity .2s ease;
}
.tile:hover{
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #d9cffb;
}
.tile:hover::after{ opacity: 1; }
.tile.locked{ cursor: default; }
.tile.locked:hover{ transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }
.tile-icon{
  width: 54px; height: 54px;
  border-radius: 16px;
  display:flex; align-items:center; justify-content:center;
  background: var(--tile-bg, var(--primary-light));
  color: var(--tile-fg, var(--primary));
}
.tile-icon svg{ width: 30px; height: 30px; }
.tile-bab{ font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.tile-title{ font-size: 16.5px; font-weight: 800; line-height: 1.3; }
.tile-desc{ font-size: 13px; color: var(--muted); flex-grow: 1; }
.tile-badge{
  align-self: flex-start;
  font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px;
  letter-spacing: .02em;
}
.tile-badge.live{ background: var(--success-light); color: var(--success); }
.tile-badge.soon{ background: #f1eefc; color: var(--muted-2); }
.tile-progress{
  height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 2px;
}
.tile-progress > i{ display:block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }

/* ---------- Toast ---------- */
.toast{
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  z-index: 50; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.toast.show{ opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* ---------- Footer ---------- */
.site-footer{
  position: relative; z-index: 2;
  text-align: center; padding: 24px 0 40px;
  color: var(--muted-2); font-size: 12.5px;
}

/* ---------- Card / panel (shared) ---------- */
.panel{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- Confetti ---------- */
.confetti-piece{
  position: fixed; top: -20px; z-index: 60; border-radius: 2px; pointer-events:none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall{
  to{ transform: translateY(105vh) rotate(540deg); opacity: .9; }
}

@media (max-width: 640px){
  .hero-stats{ gap: 16px; }
  .topbar-inner{ flex-wrap: wrap; }
}
