:root {
  --ink: #17233a; --paper: #fbf6ea; --card: #fffdf7; --muted: #66708a; --soft: #efe7d2;
  --y: #F2B705; --g: #2E9E5B; --r: #D7263D; --b: #1F6FEB;
  --radius: 14px; --shadow: 4px 4px 0 var(--ink);
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); background: var(--paper);
  background-image: radial-gradient(rgba(23,35,58,.07) 1px, transparent 1px); background-size: 18px 18px;
  min-height: 100vh; line-height: 1.5; padding-bottom: 76px;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 7vw, 4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 600; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* house colours */
.h-nalanda { --hc: var(--y); --hi: #3a2c00; }
.h-shantiniketan { --hc: var(--g); --hi: #fff; }
.h-ujjain { --hc: var(--r); --hi: #fff; }
.h-takshashila { --hc: var(--b); --hi: #fff; }

/* header */
.top {
  position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px clamp(12px, 3vw, 28px); background: var(--ink); color: #fff;
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--y) 0 25%, var(--g) 0 50%, var(--r) 0 75%, var(--b) 0) 1;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.brand b { font-weight: 800; }
.logo { display: grid; grid-template-columns: 1fr 1fr; width: 26px; height: 26px; border-radius: 6px; overflow: hidden; border: 2px solid #fff; }
.logo i.y { background: var(--y); } .logo i.g { background: var(--g); } .logo i.r { background: var(--r); } .logo i.b { background: var(--b); }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: 500; display: flex; gap: 6px; align-items: center; color: #d6dcec; }
.nav a:hover { background: rgba(255,255,255,.1); }
.nav a.on { background: #fff; color: var(--ink); }
.nav a.join-link { background: var(--y); color: #3a2c00; font-weight: 700; }
.nav a.join-link.on { background: #fff; }
@media (max-width: 720px) {
  .brand-text { font-size: .95rem; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around; border-top: 3px solid var(--y); }
  .nav a { flex-direction: column; gap: 0; font-size: .72rem; padding: 4px 10px; border-radius: 12px; }
  .nav a .ic { font-size: 1.25rem; line-height: 1.2; }
}
body.screen-mode .top, body.screen-mode .foot { display: none; }
body.screen-mode { padding-bottom: 0; }

/* layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 28px) 10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 30px 0 12px; }
.section-title a { font-weight: 700; font-size: .95rem; }
.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
  background: var(--card); border: 2px solid var(--ink); border-radius: 999px; padding: 10px 20px; font-weight: 700; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--y); color: #3a2c00; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.danger { background: var(--r); color: #fff; }
.btn.small { padding: 5px 12px; font-size: .85rem; box-shadow: 2px 2px 0 var(--ink); }
.btn[disabled] { opacity: .55; cursor: wait; }

/* hero */
.hero { padding: clamp(18px, 4vw, 40px) 0 6px; }
.hero .kicker { font-family: 'Noto Serif Devanagari', var(--display); font-weight: 600; color: var(--r); font-size: 1.15rem; letter-spacing: .02em; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--y) 62% 92%, transparent 92%); }
.hero p.lead { font-size: 1.15rem; max-width: 40ch; color: #36415c; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.stat { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 14px; min-width: 110px; }
.stat b { display: block; font-family: var(--display); font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--muted); }
.countdown { display: inline-flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; align-items: stretch; }
.countdown .cd { background: var(--ink); color: #fff; border-radius: 10px; padding: 6px 12px; text-align: center; min-width: 64px; }
.countdown .cd b { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.countdown .cd span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.countdown .lbl { align-self: center; font-weight: 700; margin-right: 4px; }

/* house cup */
.cup { display: grid; gap: 12px; }
.cup-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; }
.cup-row .nm { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cup-row .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--hc); border: 2px solid var(--ink); flex: none; }
.bar { height: 26px; background: var(--soft); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--hc); border-right: 2px solid var(--ink); transition: width .8s cubic-bezier(.2,.8,.2,1); min-width: 0; }
.cup-row .pts { font-family: var(--display); font-weight: 800; min-width: 74px; text-align: right; }
.cup-row .pts small { display: block; font-family: var(--body); font-weight: 400; color: var(--muted); font-size: .72rem; }
.crown { margin-left: 4px; }
@media (max-width: 520px) { .cup-row { grid-template-columns: 96px 1fr auto; gap: 8px; } }

/* chips + badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px;
  font-size: .85rem; font-weight: 700; background: var(--hc, var(--card)); color: var(--hi, var(--ink)); white-space: nowrap;
}
.chip.ghost { background: var(--card); color: var(--ink); cursor: pointer; }
.chip.ghost.on { background: var(--ink); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* avatar */
.av { width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; background: var(--hc); color: var(--hi); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.3rem; flex: none; overflow: hidden; }
.av.lg { width: 84px; height: 84px; font-size: 2rem; }
.av.sm { width: 36px; height: 36px; font-size: 1rem; }
.strip { display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 14px; scroll-snap-type: x proximity; }
.strip .mini { flex: none; text-align: center; width: 84px; scroll-snap-align: start; text-decoration: none; }
.strip .mini .av { margin: 0 auto 4px; }
.strip .mini span { font-size: .8rem; font-weight: 500; display: block; line-height: 1.2; }

/* forms */
form.f { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
form.f > *, .two > *, .photo-up > div, .grid > * { min-width: 0; }
input[type=file] { max-width: 100%; }
.field label, .lbl-t { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.field small { color: var(--muted); display: block; margin-top: 3px; }
input[type=text], input[type=search], textarea, select {
  width: 100%; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px rgba(31,111,235,.35); }
textarea { min-height: 96px; resize: vertical; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 600px) { .two { grid-template-columns: minmax(0, 1fr); } }
.house-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.house-pick label { position: relative; cursor: pointer; margin: 0; }
.house-pick input { position: absolute; opacity: 0; inset: 0; }
.house-pick span {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 8px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--card); font-weight: 700; transition: transform .1s;
}
.house-pick span::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--hc); border: 2px solid var(--ink); }
.house-pick input:checked + span { background: var(--hc); color: var(--hi); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px,-1px); }
.house-pick input:checked + span::before { background: #fff; }
.house-pick input:focus-visible + span { outline: 3px solid var(--b); outline-offset: 2px; }
.photo-up { display: flex; gap: 12px; align-items: center; }
.photo-up .prev { width: 72px; height: 72px; border-radius: 12px; border: 2px dashed var(--ink); background: var(--soft) center/cover; flex: none; display: grid; place-items: center; font-size: 1.6rem; }
.photo-up input { border: 0; padding: 0; background: none; }
.err { color: var(--r); font-weight: 700; min-height: 1.3em; }

/* directory */
.dir { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 14px; }
.person { background: var(--card); border: 2px solid var(--ink); border-top: 8px solid var(--hc); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; cursor: pointer; }
.person .head { display: flex; gap: 12px; align-items: center; }
.person h3 { margin: 0; font-size: 1.1rem; }
.person .sub { font-size: .88rem; color: var(--muted); }
.person .bio { font-size: .92rem; }
.person .tn { font-size: .78rem; font-weight: 700; color: var(--muted); }
.thennow { position: relative; width: 100%; aspect-ratio: 4/3; border-radius: 10px; border: 2px solid var(--ink); overflow: hidden; background: var(--soft); }
.thennow img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; transition: opacity .25s; }
.thennow img.then { opacity: 0; filter: sepia(.35) contrast(1.05); }
.thennow.flip img.then { opacity: 1; }
.thennow .tag { position: absolute; left: 8px; bottom: 8px; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 700; }
.mapbox { height: min(58vh, 520px); min-height: 320px; border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: #cfe0f0; }
.pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--hc); border: 3px solid var(--ink); display: grid; place-items: center; }
.pin b { transform: rotate(45deg); color: var(--hi); font: 800 .85rem var(--display); }
.pop { width: 200px; font-family: var(--body); }
.pop img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); margin-bottom: 6px; }
.pop b { font-family: var(--display); font-size: 1.05rem; display: block; }

/* wall */
.compose { margin-bottom: 20px; }
.kind { display: flex; gap: 8px; margin-bottom: 4px; }
.prompts { display: flex; flex-wrap: wrap; gap: 6px; }
.prompts button { cursor: pointer; border: 1.5px dashed var(--ink); background: transparent; border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.prompts button:hover { background: var(--soft); }
.wall { columns: 280px; column-gap: 18px; }
.post { break-inside: avoid; margin-bottom: 18px; background: var(--card); border: 2px solid var(--ink); border-left: 8px solid var(--hc, var(--ink)); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px 12px; }
.post:nth-child(3n+1) { transform: rotate(-.6deg); } .post:nth-child(3n+2) { transform: rotate(.5deg); }
.post img.ph { width: 100%; border-radius: 8px; border: 2px solid var(--ink); margin-bottom: 8px; background: var(--soft); }
.post .who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-weight: 700; }
.post .who small { font-weight: 400; color: var(--muted); margin-left: auto; }
.post p { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post.wish { background: #fff8d8; }
.reacts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.reacts button { cursor: pointer; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 1px 9px; font-size: .9rem; }
.reacts button:hover { background: var(--soft); }
.reacts button.mine { background: var(--y); }
.reacts .del { margin-left: auto; border-color: var(--r); color: var(--r); font-size: .78rem; }

/* quiz */
.qwrap { max-width: 720px; margin: 0 auto; }
.progress { height: 12px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; margin-bottom: 14px; }
.progress i { display: block; height: 100%; background: var(--hc, var(--b)); transition: width .3s; }
.qmeta { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.qtext { font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 4vw, 1.7rem); margin-bottom: 16px; line-height: 1.25; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; cursor: pointer; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 14px 16px; font-weight: 500; font-size: 1.02rem; display: flex; gap: 12px; align-items: center; box-shadow: 3px 3px 0 var(--ink); }
.opt:hover { background: var(--soft); }
.opt kbd { font: 800 .85rem var(--display); border: 2px solid var(--ink); border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--paper); flex: none; }
.opt.picked { background: var(--hc, var(--y)); color: var(--hi, var(--ink)); }
.opt.right { background: #cdeed8; } .opt.wrong { background: #fcd3d8; }
.score-big { text-align: center; }
.score-big .n { font-family: var(--display); font-weight: 800; font-size: clamp(3.4rem, 14vw, 6rem); line-height: 1; }
.lb { width: 100%; border-collapse: collapse; }
.lb td { padding: 8px 6px; border-bottom: 1.5px dashed rgba(23,35,58,.3); }
.lb tr.me td { background: #fff3bf; font-weight: 700; }
.lb td.rank { width: 38px; font-family: var(--display); font-weight: 800; }
.lb td.pts { text-align: right; font-weight: 800; font-family: var(--display); }
.review { display: grid; gap: 10px; margin-top: 10px; }
.review > div { border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; background: #fff; }
.review .ok { border-left: 8px solid var(--g); } .review .no { border-left: 8px solid var(--r); }

/* admin + footer + toasts */
.foot { text-align: center; color: var(--muted); font-size: .88rem; padding: 36px 16px 20px; }
.foot a { font-weight: 700; }
.foot .stripe { height: 6px; max-width: 220px; margin: 0 auto 12px; border-radius: 99px; background: linear-gradient(90deg, var(--y) 0 25%, var(--g) 0 50%, var(--r) 0 75%, var(--b) 0); }
#toasts { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 3000; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 16px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: pop .25s ease-out; }
.toast.bad { background: var(--r); }
@keyframes pop { from { transform: translateY(-10px) scale(.96); opacity: 0; } }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.adm-list { display: grid; gap: 6px; }
.adm-list > div { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border: 1.5px solid var(--ink); border-radius: 10px; background: #fff; }
.adm-list > div span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* projector screen */
.screen { min-height: 100vh; padding: 3vh 3vw; display: grid; grid-template-columns: 26vw 1fr 28vw; grid-template-rows: auto 1fr auto; gap: 2.4vh 2.4vw; background: var(--ink); color: #fff; font-size: clamp(14px, 1.45vw, 28px); }
.screen h1 { grid-column: 1 / -1; font-size: 4.2vw; margin: 0; display: flex; align-items: center; gap: 1.2vw; }
.screen h1 .logo { width: 3.6vw; height: 3.6vw; border-width: 3px; }
.screen h1 small { font: 600 1.6vw var(--body); opacity: .75; margin-left: auto; }
.screen .panel { background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.25); border-radius: 18px; padding: 1.6vw; }
.screen .panel h2 { font-size: 1.9vw; margin-bottom: .8em; }
.screen .qr { background: #fff; border-radius: 14px; padding: 1vw; display: block; margin: 0 auto 1vw; width: 100%; }
.screen .qr svg, .screen .qr img { width: 100%; height: auto; display: block; }
.screen .url { text-align: center; font-weight: 700; word-break: break-all; }
.screen .bar { height: 3.2vh; background: rgba(255,255,255,.12); border-color: #fff; }
.screen .bar > i { border-color: #fff; }
.screen .cup-row { grid-template-columns: 11vw 1fr 8vw; }
.screen .cup-row .dot { border-color: #fff; }
.screen .pts small { color: #b9c2d9; }
.screen .lb td { border-color: rgba(255,255,255,.25); padding: .55vh .4vw; }
.screen .lb td.pts { color: var(--y); }
.screen .ticker { grid-column: 1 / -1; min-height: 14vh; display: flex; align-items: center; gap: 2vw; }
.screen .ticker .tk { font-family: var(--display); font-size: 2.1vw; line-height: 1.25; animation: pop .5s ease-out; }
.screen .ticker .who { font-size: 1.3vw; opacity: .8; margin-top: .4vh; }
@media (max-width: 900px) { .screen { grid-template-columns: 1fr; font-size: 15px; } .screen h1 { font-size: 2rem; } .screen h1 .logo { width: 34px; height: 34px; } .screen h1 small { display: none; } .screen .panel h2 { font-size: 1.2rem; } .screen .cup-row { grid-template-columns: 110px 1fr 70px; } .screen .ticker .tk { font-size: 1.2rem; } .screen .ticker .who { font-size: .9rem; } .screen .qr { max-width: 220px; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
