/* Sikku — one-line kolam. Palette: night indigo, marigold, kumkum rose, peacock teal, rice white. */
:root,
[data-theme="dark"] {
  --bg: #170d2c;
  --bg2: #22133f;
  --card: #2a1a4b;
  --card2: #33205a;
  --line: #4a3477;
  --ink: #fbf3e4;
  --muted: #cdbde3;
  --accent: #ffb627;
  --accent-ink: #2a1300;
  --accent2: #ff5d7a;
  --teal: #2fd3bf;
  --rice: #fffaf0;
  --floor1: #7a2c1d;
  --floor2: #5a1d13;
  --dot: #f5d9a8;
  --mark: rgba(255, 250, 240, .55);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #fdf3e1;
  --bg2: #f6e2c2;
  --card: #fffaf1;
  --card2: #fbeedb;
  --line: #e2c9a3;
  --ink: #2c143f;
  --muted: #634a69;
  --accent: #b85400;
  --accent-ink: #fffaf0;
  --accent2: #b8164b;
  --teal: #0b7d74;
  --rice: #fffaf0;
  --floor1: #8a3220;
  --floor2: #6b2416;
  --dot: #f5d9a8;
  --mark: rgba(255, 250, 240, .6);
  --shadow: 0 10px 24px rgba(90, 40, 10, .15);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.06rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(255, 182, 39, .14), transparent 70%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, .display { font-family: "Yatra One", Georgia, serif; font-weight: 400; line-height: 1.15; letter-spacing: .01em; }
h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); margin: .2em 0 .25em; }
h2 { font-size: clamp(1.55rem, 4.6vw, 2.2rem); margin: 1.6em 0 .5em; }
h3 { font-size: 1.25rem; margin: .8em 0 .3em; }
p { margin: .5em 0 .9em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .5em 1em; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* toran garland */
.toran {
  height: 22px;
  background:
    radial-gradient(circle at 12px 6px, #ffb627 0 6px, transparent 7px) 0 0 / 24px 22px repeat-x,
    radial-gradient(circle at 12px 6px, #ff7b00 0 3px, transparent 4px) 0 0 / 24px 22px repeat-x,
    radial-gradient(ellipse 5px 9px at 0 12px, #3c9a4a 0 99%, transparent) 0 0 / 24px 22px repeat-x;
  opacity: .95;
}

/* header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: .5rem; padding: .45rem 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); font-family: "Yatra One", serif; font-size: 1.35rem; margin-right: auto; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; gap: .15rem; }
.nav a { color: var(--ink); text-decoration: none; padding: .35rem .6rem; border-radius: 99px; font-weight: 600; font-size: .98rem; }
.nav a:hover { background: var(--card); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.icon-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.05rem;
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { border-color: var(--accent); }
#navToggle { display: none; }
@media (max-width: 760px) {
  #navToggle { display: inline-grid; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; padding: .5rem 1rem 1rem; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav.open { display: flex; }
  .nav a { padding: .65rem .8rem; }
}

main { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  font: inherit; font-weight: 700; font-size: 1rem;
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: .6em 1.15em; border-radius: 999px; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
  min-height: 44px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 182, 39, .3); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn.rose { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn.small { font-size: .9rem; padding: .35em .85em; min-height: 38px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row.center { justify-content: center; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.chip { display: inline-block; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15em .7em; border-radius: 99px; background: var(--card2); color: var(--accent); border: 1px solid var(--line); }
.kicker { color: var(--accent); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; }

/* hero */
.hero { display: grid; gap: 1.5rem; align-items: center; grid-template-columns: 1fr; padding-top: .5rem; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.05fr 1fr; } }
.hero p.lead { font-size: 1.18rem; color: var(--muted); }
.name-form { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 .4rem; }
.name-form input {
  flex: 1 1 200px; min-width: 0; font: inherit; font-size: 1.15rem; padding: .55em .9em; border-radius: 999px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
.name-form input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(255, 182, 39, .3); }
.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: 1.2rem 0 0; }
.day { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .45rem .2rem; font-size: .8rem; line-height: 1.2; }
.day b { display: block; font-size: 1.15rem; font-family: "Yatra One", serif; font-weight: 400; color: var(--accent); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }

/* kolam frame */
.kolam-stage { position: relative; }
.kolam-card {
  position: relative; border-radius: 26px; padding: 14px;
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.kolam-card .caption { text-align: center; margin: .6rem 0 .1rem; font-family: "Yatra One", serif; font-size: 1.4rem; }
.kolam-card .sub { text-align: center; color: var(--muted); font-size: .92rem; margin: 0; }
svg.kb { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; border-radius: 18px; }
.kb-floor { fill: var(--floor1); }
.kb-dots circle { fill: var(--dot); opacity: .9; }
.kb-lines path { transition: stroke .35s ease; }
.kb-marks line { stroke: var(--mark); }
.kb-marks .kb-join { stroke-dasharray: 2 3; }
.kb-lock { fill: #ff3355; stroke: #fff2; }
.kb-hits circle { fill: transparent; cursor: pointer; }
.kb-hits circle.is-locked { cursor: not-allowed; }
.kb-hi circle { fill: rgba(255, 250, 240, .13); }
.kb-hi circle.is-locked { fill: rgba(255, 51, 85, .2); }
.kb-cursor circle { fill: none; stroke: var(--teal); stroke-width: 2.5; }
svg.kb:focus { outline: none; }
svg.kb:focus-visible { box-shadow: 0 0 0 3px var(--teal); }
svg.kb.is-solved .kb-lines path { stroke: var(--rice); filter: url(#glow-b); }
svg.kb.is-solved .kb-marks { opacity: 0; }
svg.kb.solved-multi .kb-lines path { filter: url(#glow-b); }
#nameBoard .kb-lines path, #gallery .kb-lines path, #studioBoard.glow .kb-lines path { filter: url(#glow-b); }
.kb-shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* play */
.play-layout { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .play-layout { grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); align-items: start; } }
.board-box { max-width: 620px; width: 100%; margin: 0 auto; }
.hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.lines-count { font-family: "Yatra One", serif; font-size: 1.5rem; }
.lines-count .n { color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .9rem; color: var(--muted); margin: .7rem 0 0; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend svg { width: 58px; height: auto; flex: none; border-radius: 8px; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 1rem; }
.tabs button { font: inherit; font-weight: 700; padding: .45em 1em; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; min-height: 42px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chapter { margin: 1rem 0 1.4rem; }
.chapter h3 { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.chapter h3 small { font-family: "Mukta", sans-serif; color: var(--muted); font-size: .9rem; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .55rem; }
.lvl {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 16px;
  padding: .5rem .3rem .45rem; cursor: pointer; text-align: center; min-height: 80px;
  display: flex; flex-direction: column; align-items: center; gap: .15rem; transition: transform .12s, border-color .12s;
}
.lvl:hover { transform: translateY(-2px); border-color: var(--accent); }
.lvl .num { font-family: "Yatra One", serif; font-size: 1.35rem; line-height: 1; }
.lvl .meta { font-size: .72rem; color: var(--muted); }
.lvl.done { background: var(--card2); }
.diyas { display: inline-flex; gap: 2px; }
.diya { width: 16px; height: 14px; display: inline-block; }
.diya path.flame { fill: var(--line); }
.diya.lit path.flame { fill: #ffcc33; filter: drop-shadow(0 0 3px #ffb627); }
.diya path.bowl { fill: #c4602d; }
@media (min-width: 900px) { .panel { position: sticky; top: 80px; } }
.goal { font-size: 1.05rem; }
.goal b { color: var(--accent); }
.timer { font-family: "Yatra One", serif; font-size: 2rem; color: var(--accent); }
.bar-track { height: 10px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); width: 100%; transition: width .25s linear; }

/* dialog */
dialog.modal {
  border: 1px solid var(--line); border-radius: 24px; padding: 1.4rem 1.3rem; max-width: min(440px, 92vw);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); text-align: center;
}
dialog.modal::backdrop { background: rgba(10, 4, 20, .6); }
dialog.modal h2 { margin-top: .2rem; }
.big-diyas { display: flex; justify-content: center; gap: .8rem; margin: .4rem 0 .8rem; }
.big-diyas .diya { width: 52px; height: 46px; }
.big-diyas .diya.lit { animation: pop .5s backwards; }
.big-diyas .diya:nth-child(2) { animation-delay: .15s; }
.big-diyas .diya:nth-child(3) { animation-delay: .3s; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.15); } }

/* studio */
.studio { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .studio { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); align-items: start; } }
.field { margin: .7rem 0; }
.field label, .field .lab { display: block; font-weight: 700; margin-bottom: .3rem; }
.seg { display: flex; flex-wrap: wrap; gap: .35rem; }
.seg button {
  font: inherit; font-size: .92rem; font-weight: 600; padding: .35em .8em; border-radius: 99px; cursor: pointer;
  background: var(--card2); color: var(--ink); border: 1px solid var(--line); min-height: 38px;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15); }
.swatch[aria-pressed="true"] { border-color: var(--ink); transform: scale(1.08); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="text"].plain { font: inherit; width: 100%; padding: .5em .8em; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--ink); }
.canvas-wrap canvas { display: block; width: 100%; height: auto; border-radius: 18px; cursor: crosshair; touch-action: manipulation; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .7rem 0; }
.stat { background: var(--card2); border-radius: 12px; padding: .4rem; text-align: center; }
.stat b { display: block; font-family: "Yatra One", serif; font-size: 1.3rem; font-weight: 400; color: var(--accent); }
.stat span { font-size: .75rem; color: var(--muted); }

/* learn */
.explain-board { max-width: 340px; margin: 0 auto; }
.figure-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.figure-row figure { margin: 0; text-align: center; font-size: .9rem; color: var(--muted); }
.gcd-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.gcd-table th, .gcd-table td { border: 1px solid var(--line); text-align: center; padding: .25rem; }
.gcd-table td.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.gcd-table td.one { color: var(--teal); font-weight: 700; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 2.6rem; margin: .8rem 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; }

/* diwali + quiz */
.day-card { position: relative; overflow: hidden; }
.day-card .date { font-family: "Yatra One", serif; color: var(--accent); font-size: 1.1rem; }
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.region { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem; }
.region b { font-family: "Yatra One", serif; font-weight: 400; font-size: 1.2rem; color: var(--accent); display: block; }
.quiz-q { font-size: 1.2rem; font-weight: 700; margin: .4rem 0 .9rem; }
.answers { display: grid; gap: .5rem; }
.answers button {
  font: inherit; text-align: left; padding: .7rem 1rem; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card2); color: var(--ink); cursor: pointer; min-height: 48px;
}
.answers button:hover:not([disabled]) { border-color: var(--accent); }
.answers button.right { border-color: #2fbf71; background: rgba(47, 191, 113, .18); }
.answers button.wrong { border-color: #ff5d7a; background: rgba(255, 93, 122, .16); }
.answers button[disabled] { cursor: default; }
.explain { margin-top: .8rem; padding: .7rem .9rem; border-radius: 12px; background: var(--card2); border-left: 4px solid var(--accent); }
.progress-dots { display: flex; gap: 4px; margin-bottom: .6rem; flex-wrap: wrap; }
.progress-dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.progress-dots i.ok { background: #2fbf71; }
.progress-dots i.no { background: #ff5d7a; }
.progress-dots i.cur { background: var(--accent); }

.fact-list { padding-left: 1.2rem; }
.fact-list li { margin: .4rem 0; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 1.4rem 1rem 2rem; text-align: center; color: var(--muted); font-size: .92rem; }
.site-footer a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: .65rem 1.1rem; border-radius: 99px; font-weight: 700; z-index: 100;
  transition: transform .25s, opacity .25s; max-width: 92vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* sparkles on win */
.spark { position: fixed; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; z-index: 90; animation: spark 1.1s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spark { display: none; }
}
