/* UP Board Class 10/12 PYQ — GKSchools */
:root {
  --upb-teal: #0f766e;
  --upb-navy: #0b1f3a;
  --upb-ink: #0f172a;
  --upb-muted: #475569;
  --upb-line: #e2e8f0;
  --upb-bg: #f4efe4;
  --upb-paper: #fffdf8;
  --upb-ok: #15803d;
  --upb-bad: #b91c1c;
}

.upb-page {
  background: var(--upb-bg);
  color: var(--upb-ink);
  min-height: 100vh;
  font-family: var(--gks-font, Inter, "Noto Sans Devanagari", "Nirmala UI", "Segoe UI", sans-serif);
  font-size: var(--gks-fs-body, 1.0625rem);
  line-height: 1.65;
  overflow-x: clip;
}

.upb-shell {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 56px;
  box-sizing: border-box;
}

.upb-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--gks-fs-small, 0.9rem);
  margin-bottom: 12px;
  color: var(--upb-muted);
}
.upb-crumb a {
  color: var(--upb-teal);
  font-weight: 700;
  text-decoration: none;
}

.upb-hero {
  background: linear-gradient(125deg, #0b1f3a 0%, #1e3a5f 46%, #0f766e 100%);
  color: #fff;
  border-radius: 18px;
  padding: clamp(16px, 4vw, 32px);
  margin-bottom: 18px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}
.upb-hero h1 {
  margin: 8px 0 10px;
  font-size: var(--gks-fs-h1, clamp(1.35rem, 4vw, 2rem));
  line-height: 1.28;
  color: #fff;
}
.upb-hero p { margin: 0; color: rgba(255,255,255,0.92); max-width: 62ch; }
.upb-kicker {
  display: inline-flex;
  font-weight: 800;
  font-size: var(--gks-fs-small, 0.8rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  padding: 4px 10px;
}
.upb-hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 10px 18px;
  background: #fff;
  color: #0f766e !important;
  font-weight: 800;
  border-radius: 999px;
  text-decoration: none;
}
.upb-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.upb-hero-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  font-size: var(--gks-fs-small, 0.85rem);
}
.upb-hero-actions a.upb-hero-cta {
  background: #fff;
  color: #0f766e !important;
  border-color: #fff;
  margin-top: 0;
}

.upb-tabs,
.upb-toolbar,
.upb-chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.upb-tabs a,
.upb-filter,
.upb-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--upb-line);
  background: #fff;
  color: var(--upb-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--gks-fs-small, 0.85rem);
  cursor: pointer;
  font-family: inherit;
}
.upb-tabs a.is-on,
.upb-filter.is-on,
.upb-chip.is-on {
  background: var(--upb-teal);
  border-color: var(--upb-teal);
  color: #fff;
}

.upb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.upb-card {
  display: block;
  background: var(--upb-paper);
  border: 1px solid #e8dcc8;
  border-radius: 16px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.06);
}
.upb-card:hover { border-color: #99f6e4; }
.upb-card .upb-ico { font-size: 1.6rem; margin-bottom: 6px; }
.upb-card strong {
  display: block;
  font-size: var(--gks-fs-sub, 1.05rem);
  color: #134e4a;
}
.upb-card p {
  margin: 6px 0 0;
  color: var(--upb-muted);
  font-size: var(--gks-fs-small, 0.9rem);
}
.upb-stat {
  margin-top: 10px;
  font-weight: 800;
  color: var(--upb-teal);
  font-size: var(--gks-fs-small, 0.85rem);
}

.upb-score {
  position: sticky;
  top: var(--gks-sticky-top, 64px);
  z-index: 900;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  color: #115e59;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.upb-q {
  background: #fff;
  border: 1px solid var(--upb-line);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 14px;
}
.upb-q[hidden] { display: none !important; }
.upb-q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  font-size: var(--gks-fs-small, 0.8rem);
  font-weight: 700;
}
.upb-badge {
  background: #ccfbf1;
  color: #115e59;
  padding: 3px 8px;
  border-radius: 999px;
}
.upb-badge-mcq { background: #dbeafe; color: #1e40af; }
.upb-badge-short { background: #fef3c7; color: #92400e; }
.upb-badge-long { background: #fce7f3; color: #9d174d; }
.upb-badge-marks { background: #f1f5f9; color: #334155; }
.upb-ch { color: var(--upb-muted); }

.upb-years {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
  font-size: var(--gks-fs-small, 0.75rem);
  font-weight: 700;
}
.upb-years-k { color: #9a3412; }
.upb-year {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 999px;
  padding: 2px 8px;
}

.upb-q h3 {
  margin: 0 0 6px;
  font-size: var(--gks-fs-sub, 1.05rem);
  line-height: 1.45;
}
.upb-q-en {
  margin: 0 0 10px;
  color: var(--upb-muted);
  font-size: var(--gks-fs-small, 0.92rem);
}

.upb-opts { list-style: none; margin: 0; padding: 0; }
.upb-opts li { margin: 0 0 8px; }
.upb-opt {
  display: flex;
  width: 100%;
  text-align: left;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
  align-items: flex-start;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.upb-opt strong { flex-shrink: 0; }
.upb-opt:hover { border-color: #99f6e4; background: #f0fdfa; }
.upb-opt.is-correct {
  background: #dcfce7 !important;
  border-color: #22c55e !important;
  color: #15803d;
  font-weight: 700;
}
.upb-opt.is-wrong {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c;
}

.upb-ans { margin-top: 10px; border-top: 1px dashed var(--upb-line); padding-top: 8px; }
.upb-ans summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--upb-teal);
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.upb-ans summary::-webkit-details-marker { display: none; }
.upb-key { color: var(--upb-ok); font-weight: 800; }
.upb-final { color: #134e4a; font-weight: 600; }

.upb-steps {
  margin: 10px 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.upb-steps li {
  position: relative;
  margin: 0 0 8px;
  padding: 10px 12px 10px 14px;
  background: #f0fdfa;
  border-left: 4px solid var(--upb-teal);
  border-radius: 0 10px 10px 0;
  line-height: 1.5;
}
.upb-step-n {
  display: inline-block;
  font-weight: 800;
  color: #0f766e;
  margin-right: 6px;
}

.upb-note,
.upb-links,
.upb-paper-head {
  background: #fff;
  border: 1px solid #e8dcc8;
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
}
.upb-note h2,
.upb-links h2 {
  margin: 0 0 8px;
  font-size: var(--gks-fs-h3, 1.25rem);
  color: #134e4a;
}
.upb-links ul { margin: 0; padding-left: 18px; }
.upb-links a { color: var(--upb-teal); font-weight: 700; }

.upb-paper-head {
  text-align: center;
  border: 2px solid #0b1f3a;
  background: #fff;
}
.upb-paper-head .upb-board {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0b1f3a;
  font-size: var(--gks-fs-small, 0.85rem);
}
.upb-paper-head h1 {
  margin: 6px 0;
  font-size: var(--gks-fs-h2, 1.35rem);
}
.upb-paper-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-weight: 700;
  font-size: var(--gks-fs-small, 0.9rem);
}
.upb-section {
  margin: 18px 0 8px;
  padding: 10px 12px;
  background: #0b1f3a;
  color: #fff;
  border-radius: 10px;
  font-weight: 800;
}
.upb-inst {
  font-size: var(--gks-fs-small, 0.9rem);
  color: var(--upb-muted);
}

.upb-submit {
  width: 100%;
  max-width: 420px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: #0b1f3a;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.upb-submit:hover { background: #0f766e; }

.upb-summary {
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 70%);
  border: 2px solid #0f766e;
  border-radius: 16px;
  padding: 16px;
  margin: 0 0 16px;
}
.upb-summary h2 {
  margin: 0 0 6px;
  font-size: var(--gks-fs-h3, 1.2rem);
  color: #134e4a;
}
.upb-summary-grade {
  margin: 0 0 12px;
  font-size: var(--gks-fs-h2, 1.4rem);
  font-weight: 800;
  color: #0f766e;
}
.upb-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.upb-summary-grid div {
  background: #fff;
  border: 1px solid #ccfbf1;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.upb-summary-grid b {
  display: block;
  font-size: 1.15rem;
  color: #0b1f3a;
}
.upb-summary-grid span {
  font-size: var(--gks-fs-small, 0.75rem);
  color: #64748b;
  font-weight: 700;
}
.upb-summary-msg,
.upb-summary-wrong { margin: 0 0 8px; }
.upb-summary-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.upb-seq {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 14px;
}
.upb-seq a {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e8dcc8;
  color: #0f766e;
  font-weight: 800;
  text-decoration: none;
  font-size: var(--gks-fs-small, 0.85rem);
}
.upb-seq-next { justify-content: flex-end; text-align: right; }

.upb-tabs,
.upb-toolbar,
.upb-chapters {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.upb-tabs a,
.upb-filter,
.upb-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-height: 40px;
}
.upb-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -2px;
}
.upb-note h2 a {
  font-size: 0.85rem;
  margin-left: 8px;
  white-space: nowrap;
}

.upb-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: #0b1f3a;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  min-width: 7.5rem;
  text-align: center;
}
.upb-timer.is-end { background: #b91c1c; }
.upb-timer-start,
.upb-print {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #0b1f3a;
  background: #fff;
  color: #0b1f3a;
  font: inherit;
  font-weight: 800;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.upb-testbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 0 0 14px;
}
.upb-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.upb-dot {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.8rem;
  border: 1px solid #e2e8f0;
}
.upb-dot.is-ok { background: #dcfce7; border-color: #22c55e; }
.upb-dot.is-wrong { background: #fee2e2; border-color: #ef4444; }
.upb-dot.is-done { background: #dbeafe; border-color: #3b82f6; }
.upb-self {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  font-size: var(--gks-fs-small, 0.85rem);
  font-weight: 700;
}
.upb-self-btn {
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.upb-self-btn.is-on { background: #0f766e; color: #fff; border-color: #0f766e; }
.upb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--gks-fs-small, 0.92rem);
}
.upb-table th,
.upb-table td {
  border: 1px solid #e8dcc8;
  padding: 8px 10px;
  text-align: left;
}
.upb-table th { background: #ecfdf5; color: #134e4a; }

@media (max-width: 767px) {
  .upb-shell {
    padding: 10px 12px calc(36px + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
  }
  .upb-crumb {
    font-size: 0.78rem;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    max-width: 100%;
  }
  .upb-crumb a,
  .upb-crumb span { white-space: nowrap; }
  .upb-hero { padding: 14px 12px 16px; border-radius: 14px; }
  .upb-hero h1 {
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    overflow-wrap: anywhere;
  }
  .upb-hero p { font-size: var(--gks-fs-small, 0.88rem); }
  .upb-kicker {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
  }
  .upb-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .upb-hero-actions a {
    justify-content: center;
    text-align: center;
    width: 100%;
    min-height: 44px;
    padding: 8px 8px;
    font-size: 0.78rem;
    line-height: 1.25;
    box-sizing: border-box;
  }
  .upb-hero-actions a.upb-hero-cta,
  .upb-hero-cta {
    width: 100%;
    grid-column: 1 / -1;
  }
  .upb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .upb-card {
    padding: 12px 10px;
    border-radius: 12px;
    min-width: 0;
  }
  .upb-card p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.78rem;
  }
  .upb-card .upb-stat {
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .upb-q { padding: 12px; }
  .upb-q h3 { font-size: var(--gks-fs-body, 1rem); overflow-wrap: anywhere; }
  .upb-opt {
    font-size: var(--gks-fs-small, 0.88rem);
    align-items: flex-start;
    min-height: 44px;
  }
  .upb-tabs,
  .upb-toolbar,
  .upb-chapters {
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .upb-tabs::-webkit-scrollbar,
  .upb-toolbar::-webkit-scrollbar,
  .upb-chapters::-webkit-scrollbar { display: none; }
  .upb-tabs a,
  .upb-filter,
  .upb-chip { font-size: clamp(0.72rem, 3vw, 0.8125rem); padding: 8px 12px; }
  .upb-score {
    font-size: 0.82rem;
    top: var(--gks-sticky-top, 58px);
    z-index: 900;
    padding: 8px 10px;
  }
  .upb-testbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .upb-timer,
  .upb-timer-start,
  .upb-print,
  .upb-submit {
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
    justify-content: center;
  }
  .upb-submit { grid-column: 1 / -1; }
  .upb-palette {
    max-height: 132px;
    overflow: auto;
    padding-bottom: 4px;
  }
  .upb-dot { width: 34px; height: 34px; }
  .upb-self { gap: 8px; }
  .upb-self-btn { min-height: 40px; flex: 1 1 auto; }
  .upb-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upb-summary-actions .upb-hero-cta { width: 100%; }
  .upb-paper-head { padding: 12px 10px; }
  .upb-paper-head h1 { font-size: 1.05rem; }
  .upb-paper-head .upb-board { font-size: 0.72rem; letter-spacing: 0.02em; }
  .upb-paper-meta { flex-direction: column; align-items: flex-start; }
  .upb-seq { flex-direction: column; }
  .upb-seq a { width: 100%; box-sizing: border-box; }
  .upb-section { font-size: 0.85rem; line-height: 1.4; }
  .upb-note,
  .upb-links { padding: 12px; }
  .upb-note h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
  }
  .upb-note h2 a { margin-left: 0; }
  .upb-table { font-size: 0.8rem; }
  .upb-table th,
  .upb-table td { padding: 7px 8px; }
}

@media (max-width: 420px) {
  .upb-grid { gap: 8px; }
  .upb-card strong { font-size: 0.92rem; }
}

@media print {
  header, footer, .upb-crumb, .upb-testbar, .upb-palette, .upb-seq, .upb-links, .upb-score, .gks-premium-header {
    display: none !important;
  }
  .upb-ans { display: none !important; }
  .upb-q { break-inside: avoid; box-shadow: none; }
}

@media (max-width: 380px) {
  .upb-shell { padding: 8px 10px calc(28px + env(safe-area-inset-bottom, 0px)); }
  .upb-hero-actions { gap: 6px; }
  .upb-hero-actions a { font-size: 0.72rem; padding: 7px 6px; }
  .upb-card { padding: 10px 8px; }
  .upb-card p { -webkit-line-clamp: 2; }
}
