/*
 * site_extras.css - Round 49's site-wide polish layer (see
 * static/js/site_extras.js): result-screen extras (success animation,
 * size counter, "What next?", WhatsApp share), Compress's before/after
 * preview, the "Your files" tray, upload/progress thumbnails, tool-card
 * tilt/glow and animated icons, page transitions, the Ctrl+K command
 * palette, hub category chips, festival themes, and the homepage's
 * animated hero / how-it-works / live counter.
 *
 * Every animation here is CSS/SVG only (no animation library - most of
 * this site's visitors are on mobile data) and is switched off wholesale
 * for visitors whose device asks for reduced motion (bottom of file).
 */

/* ---------- page transitions (cross-document View Transitions) ---------- */
@view-transition { navigation: auto; }
.topbar { view-transition-name: lbp-topbar; }
::view-transition-old(root) { animation: lbpVtOut 0.18s ease both; }
::view-transition-new(root) { animation: lbpVtIn 0.28s cubic-bezier(.2,.7,.2,1) both; }
@keyframes lbpVtOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes lbpVtIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- toast ---------- */
.lbp-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--primary); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .25s, transform .25s; z-index: 9000; pointer-events: none; max-width: calc(100vw - 32px);
}
.lbp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- success moment ---------- */
.rx-check { width: 64px; height: 64px; margin: 0 auto 4px; display: block; }
.rx-check circle { fill: none; stroke: var(--success); stroke-width: 3; stroke-dasharray: 170; stroke-dashoffset: 170; animation: rxDraw .6s ease-out forwards; }
.rx-check path { fill: none; stroke: var(--success); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: rxDraw .35s .5s ease-out forwards; }
.rx-check-wrap { animation: rxPop .5s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes rxDraw { to { stroke-dashoffset: 0; } }
@keyframes rxPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rx-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 8500; }

.rx-panel { margin: 18px auto 4px; max-width: 620px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.rx-size {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
}
.rx-size-col { text-align: center; }
.rx-size-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.rx-size-num { font-size: 22px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.rx-size-arrow { color: var(--accent); font-size: 20px; }
.rx-size-saved {
  grid-column: 1 / -1; text-align: center; font-weight: 700; color: var(--success);
  background: var(--success-bg); border-radius: 10px; padding: 6px 10px; font-size: 14px;
}
.rx-size-bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.rx-size-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--success), var(--accent)); border-radius: 99px; transition: width 1.2s cubic-bezier(.2,.7,.2,1); }

.rx-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.rx-title { width: 100%; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 2px; }
.rx-next-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; text-decoration: none;
}
.rx-next-chip:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.rx-next-chip .icon { color: var(--accent); }
.rx-next-chip[disabled] { opacity: .6; cursor: progress; }
.rx-wa {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: none;
  background: #25D366; color: #06331a; font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 14px rgba(37,211,102,.35); transition: transform .15s;
}
.rx-wa:hover { transform: translateY(-2px); }
.rx-wa svg { width: 18px; height: 18px; }

/* ---------- before / after (Compress) ---------- */
.ba-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px auto; max-width: 640px; }
.ba-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; }
.ba-card h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.ba-img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #fff; border-radius: 6px; border: 1px solid var(--border); display: block; }
.ba-size { margin-top: 6px; font-weight: 800; font-size: 16px; }
.ba-card.after .ba-size { color: var(--success); }
.ba-loupe { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
@media (max-width: 520px) { .ba-wrap { gap: 8px; } .ba-size { font-size: 14px; } }

/* ---------- "Your files" tray ---------- */
.ft-tray { position: fixed; left: 16px; bottom: 16px; z-index: 850; font-size: 13px; }
.ft-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card-solid, var(--card)); color: var(--text); font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); animation: ftIn .4s cubic-bezier(.3,1.4,.5,1) both;
}
.ft-count { background: var(--accent); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; padding: 0 6px; }
.ft-panel {
  position: absolute; left: 0; bottom: calc(100% + 10px); width: min(340px, calc(100vw - 32px));
  background: var(--card-solid, var(--card)); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.2); padding: 12px; animation: ftIn .25s ease both;
}
.ft-panel h4 { margin: 0 0 2px; font-size: 14px; }
.ft-sub { margin: 0 0 10px; color: var(--text-muted); font-size: 12px; }
.ft-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.ft-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-soft); }
.ft-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-meta { grid-column: 1 / 2; font-size: 11.5px; color: var(--text-muted); }
.ft-dl { grid-row: 1 / 3; grid-column: 2; }
.ft-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--warn); }
.ft-ring { width: 100%; height: 3px; grid-column: 1 / -1; background: var(--track); border-radius: 99px; overflow: hidden; }
.ft-ring span { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
@keyframes ftIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .ft-tray { left: 10px; bottom: 10px; } .ft-toggle { padding: 8px 12px; } }

/* ---------- upload: file cards + progress page thumbnails ---------- */
.file-list-row { animation: rxFlyIn .45s cubic-bezier(.2,.8,.2,1) both; }
.file-list-row:nth-child(2) { animation-delay: .05s; } .file-list-row:nth-child(3) { animation-delay: .1s; }
.file-list-row:nth-child(4) { animation-delay: .15s; } .file-list-row:nth-child(n+5) { animation-delay: .2s; }
@keyframes rxFlyIn { from { opacity: 0; transform: translateY(-18px) scale(.94) rotate(-1.5deg); } to { opacity: 1; transform: none; } }
.fx-thumb { width: 34px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: #fff; margin-right: 10px; vertical-align: middle; flex-shrink: 0; }
.file-list-row > span { display: inline-flex; align-items: center; }

.pt-strip { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0 6px; }
.pt-page {
  width: 46px; height: 60px; border-radius: 5px; background: #fff; border: 1px solid var(--border); position: relative;
  overflow: hidden; filter: grayscale(1) opacity(.45); transform: scale(.94); transition: filter .5s, transform .5s, box-shadow .5s;
}
.pt-page img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-page.done { filter: none; transform: scale(1); box-shadow: 0 0 0 2px var(--success); }
.pt-page.active { filter: none; transform: scale(1.06); box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(0,0,0,.12); }
.pt-page.active::after {
  content: ""; position: absolute; left: 0; right: 0; height: 30%; top: -30%;
  background: linear-gradient(180deg, transparent, rgba(226,150,60,.45), transparent); animation: ptScan 1.1s linear infinite;
}
@keyframes ptScan { to { top: 100%; } }
.pt-more { align-self: center; font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* ---------- tool cards: tilt + cursor glow + animated gradient border ---------- */
.tool-card { --mx: 50%; --my: 50%; transform-style: preserve-3d; will-change: transform; }
.tool-card.fx-tilt { transition: transform .12s ease-out, border-color .3s, box-shadow .3s; }
.tool-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgba(226,150,60,.16), transparent 60%);
}
.tool-card:hover::before { opacity: 1; }
.tool-card-flagship, .tool-card.tool-card-premium { position: relative; isolation: isolate; }
.tool-card-flagship > .fx-border, .tool-card.tool-card-premium > .fx-border {
  position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: -1;
  background: conic-gradient(from var(--fx-angle, 0deg), var(--accent), var(--violet), var(--cyan), var(--accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .55; animation: fxSpin 6s linear infinite;
}
@property --fx-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes fxSpin { to { --fx-angle: 360deg; } }
.tool-card:hover > .fx-border { opacity: 1; }

/* ---------- animated tool icons (hover acts out the tool's job) ---------- */
.tool-card .icon, .nav-dd-link .icon, .qt-card .icon { transform-origin: center; }
.tool-card:hover .ic-merge, .rx-next-chip:hover .ic-merge { animation: icMerge .7s ease-in-out; }
.tool-card:hover .ic-scissors { animation: icSnip .5s ease-in-out 2; }
.tool-card:hover .ic-compress, .rx-next-chip:hover .ic-compress { animation: icSqueeze .8s cubic-bezier(.3,1.5,.5,1); }
.tool-card:hover .ic-rotate { animation: icSpin .7s ease-in-out; }
.tool-card:hover .ic-shuffle, .tool-card:hover .ic-swap { animation: icShuffle .7s ease-in-out; }
.tool-card:hover .ic-lock, .tool-card:hover .ic-unlock, .rx-next-chip:hover .ic-lock { animation: icShake .5s ease-in-out; }
.tool-card:hover .ic-search { animation: icLoupe 1s ease-in-out; }
.tool-card:hover .ic-sparkles { animation: icTwinkle .9s ease-in-out; }
.tool-card:hover .ic-image, .tool-card:hover .ic-word, .tool-card:hover .ic-table, .tool-card:hover .ic-presentation { animation: icFlip .7s ease-in-out; }
.tool-card:hover .ic-hash, .rx-next-chip:hover .ic-hash { animation: icBounce .6s ease; }
.tool-card:hover .ic-translate, .tool-card:hover .ic-type { animation: icFlip .7s ease-in-out; }
.tool-card:hover .ic-signature path, .tool-card:hover .ic-signature polyline,
.rx-next-chip:hover .ic-signature path, .tool-card:hover .ic-input-field rect {
  stroke-dasharray: 60; animation: icDraw .9s ease-out;
}
.tool-card:hover .ic-shield-check, .tool-card:hover .ic-stamp { animation: icStamp .5s cubic-bezier(.3,1.6,.5,1); }
.tool-card:hover .ic-link, .tool-card:hover .ic-layers { animation: icBounce .6s ease; }
.tool-card:hover .ic-trash, .tool-card:hover .ic-alert-triangle { animation: icShake .5s ease-in-out; }
.tool-card:hover .ic-file-text, .tool-card:hover .ic-list { animation: icFlip .7s ease-in-out; }
@keyframes icMerge { 0%,100% { transform: scale(1); } 40% { transform: scaleX(.7); } 60% { transform: scaleX(1.12); } }
@keyframes icSnip { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
@keyframes icSqueeze { 0% { transform: scale(1); } 35% { transform: scale(1.15, .6); } 65% { transform: scale(.85, 1.1); } 100% { transform: scale(1); } }
@keyframes icSpin { to { transform: rotate(360deg); } }
@keyframes icShuffle { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes icShake { 20%,60% { transform: rotate(-10deg); } 40%,80% { transform: rotate(10deg); } }
@keyframes icLoupe { 30% { transform: translate(-3px,-2px) scale(1.15); } 60% { transform: translate(3px,1px) scale(1.15); } }
@keyframes icTwinkle { 30% { transform: scale(1.3) rotate(15deg); opacity: .6; } 60% { transform: scale(.9) rotate(-8deg); opacity: 1; } }
@keyframes icFlip { 50% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }
@keyframes icBounce { 30% { transform: translateY(-6px); } 55% { transform: translateY(0); } 75% { transform: translateY(-2px); } }
@keyframes icDraw { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }
@keyframes icStamp { 0% { transform: translateY(-8px) scale(1.2); } 60% { transform: translateY(1px) scale(.95); } 100% { transform: none; } }

/* ---------- Ctrl+K command palette ---------- */
.cp-trigger {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--card);
  color: var(--text-muted); border-radius: 999px; padding: 6px 10px 6px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.cp-trigger kbd, .cp-kbd { font-family: var(--font-mono, monospace); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--text-muted); background: var(--surface-soft); }
.cp-backdrop { position: fixed; inset: 0; background: rgba(20,16,30,.45); backdrop-filter: blur(4px); z-index: 9500; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; animation: cpFade .15s ease both; }
.cp-backdrop[hidden] { display: none; }
.cp-box { width: min(620px, 100%); background: var(--card-solid, var(--card)); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; animation: cpIn .2s cubic-bezier(.2,.9,.3,1.2) both; }
.cp-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cp-input-row .icon { color: var(--accent); flex-shrink: 0; }
.cp-input { flex: 1; border: none; outline: none; background: transparent; font-size: 16px; color: var(--text); font-family: inherit; }
.cp-list { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow: auto; }
.cp-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text); text-decoration: none; }
.cp-item .cp-ic { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--tint); color: var(--accent); flex-shrink: 0; }
.cp-item .cp-t { font-weight: 600; font-size: 14px; }
.cp-item .cp-d { font-size: 12px; color: var(--text-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 440px; }
.cp-item .cp-g { margin-left: auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.cp-item.active, .cp-item:hover { background: var(--tint); }
.cp-empty { padding: 22px; text-align: center; color: var(--text-muted); }
.cp-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.cp-item mark { background: transparent; color: var(--accent); font-weight: 800; }
@keyframes cpFade { from { opacity: 0; } }
@keyframes cpIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@media (max-width: 900px) { .cp-trigger .cp-label, .cp-trigger kbd { display: none; } }

/* ---------- hub category chips ---------- */
.hub-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.hub-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 7px 14px;
  font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; transition: all .2s;
}
.hub-chip:hover { border-color: var(--accent); }
.hub-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 16px rgba(0,0,0,.15); }
.hub-section-hidden { display: none !important; }

/* ---------- homepage: animated hero ---------- */
.hero-anim { width: 100%; max-width: 460px; margin: 0 auto; display: block; }
.hero-anim .ha-doc { animation: haFloat 5s ease-in-out infinite; transform-origin: center; }
.hero-anim .ha-line { stroke-dasharray: 120; stroke-dashoffset: 120; animation: haLine 6s ease-in-out infinite; }
.hero-anim .ha-line:nth-of-type(2) { animation-delay: .15s; } .hero-anim .ha-line:nth-of-type(3) { animation-delay: .3s; }
.hero-anim .ha-line:nth-of-type(4) { animation-delay: .45s; }
.hero-anim .ha-out { opacity: 0; animation: haOut 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.hero-anim .ha-out.o2 { animation-delay: 2s; } .hero-anim .ha-out.o3 { animation-delay: 4s; }
.hero-anim .ha-arrow { stroke-dasharray: 8 6; animation: haDash 1s linear infinite; }
.hero-anim .ha-spark { animation: haSpark 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.hero-anim .ha-spark.s2 { animation-delay: .8s; } .hero-anim .ha-spark.s3 { animation-delay: 1.6s; }
.hero-anim .ha-scan { animation: haScan 3s ease-in-out infinite; }
@keyframes haFloat { 50% { transform: translateY(-8px) rotate(-1deg); } }
@keyframes haLine { 0% { stroke-dashoffset: 120; } 25%,75% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -120; } }
@keyframes haOut { 0% { opacity: 0; transform: translateX(-24px) scale(.8); } 8%,30% { opacity: 1; transform: none; } 38%,100% { opacity: 0; transform: translateX(16px) scale(.9); } }
@keyframes haDash { to { stroke-dashoffset: -28; } }
@keyframes haSpark { 0%,100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1); } }
@keyframes haScan { 0%,100% { transform: translateY(0); opacity: .0; } 10% { opacity: .9; } 50% { transform: translateY(150px); opacity: .9; } 60% { opacity: 0; } }

/* ---------- homepage: how it works + live counter ---------- */
.hiw { margin: 48px 0; }
.hiw h2 { text-align: center; margin-bottom: 6px; }
.hiw-sub { text-align: center; color: var(--text-muted); margin: 0 auto 26px; max-width: 560px; }
.hiw-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; position: relative; }
.hiw-line { position: absolute; top: 44px; left: 16%; right: 16%; height: 3px; background: var(--track); border-radius: 99px; overflow: hidden; z-index: 0; }
.hiw-line span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 1.6s cubic-bezier(.2,.7,.2,1); }
.hiw.in .hiw-line span { width: 100%; }
.hiw-step { position: relative; z-index: 1; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px 16px 18px;
  opacity: 0; transform: translateY(26px); transition: opacity .6s, transform .6s cubic-bezier(.2,.8,.2,1); }
.hiw.in .hiw-step { opacity: 1; transform: none; }
.hiw.in .hiw-step:nth-child(3) { transition-delay: .25s; } .hiw.in .hiw-step:nth-child(4) { transition-delay: .5s; }
.hiw-num { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 18px; box-shadow: 0 0 0 6px var(--bg); }
.hiw-step h3 { margin: 0 0 6px; font-size: 16px; }
.hiw-step p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.hiw-step .icon { color: var(--accent); }
.hiw-stats { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 26px; }
.hiw-stat { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 20px; text-align: center; min-width: 170px; }
.hiw-stat b { display: block; font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.hiw-stat span { font-size: 12.5px; color: var(--text-muted); }
.hiw-stat .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 6px; animation: liveDot 1.6s ease-in-out infinite; }
@keyframes liveDot { 50% { box-shadow: 0 0 0 6px rgba(63,122,79,.0); opacity: .5; } 0% { box-shadow: 0 0 0 0 rgba(63,122,79,.45); } }
@media (max-width: 760px) { .hiw-steps { grid-template-columns: 1fr; } .hiw-line { display: none; } }

/* ---------- festival themes (admin: Site tools -> Festival theme) ---------- */
.fest-banner {
  position: relative; overflow: hidden; text-align: center; font-weight: 700; font-size: 13.5px; padding: 8px 40px;
  color: #fff; letter-spacing: .01em;
}
.fest-banner .fest-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: inherit; font-size: 18px; cursor: pointer; opacity: .8; }
.fest-strip { height: 34px; display: flex; justify-content: space-around; align-items: flex-start; pointer-events: none; overflow: hidden; }
.fest-particles { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.fest-p { position: absolute; top: -20px; font-size: 16px; animation: festFall linear infinite; opacity: .5; }
@keyframes festFall { to { transform: translateY(110vh) rotate(360deg); } }

html[data-festival="diwali"] .fest-banner { background: linear-gradient(90deg, #7a1f00, #c2410c, #eab308, #c2410c, #7a1f00); background-size: 200% 100%; animation: festShimmer 6s linear infinite; }
html[data-festival="holi"] .fest-banner { background: linear-gradient(90deg, #db2777, #f59e0b, #22c55e, #3b82f6, #a855f7, #db2777); background-size: 300% 100%; animation: festShimmer 8s linear infinite; }
html[data-festival="independence"] .fest-banner, html[data-festival="republic"] .fest-banner { background: linear-gradient(180deg, #FF9933 0 33%, #ffffff 33% 66%, #138808 66%); color: #0b2a6b; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
html[data-festival="navratri"] .fest-banner { background: linear-gradient(90deg, #b91c1c, #f97316, #b91c1c); }
html[data-festival="christmas"] .fest-banner { background: linear-gradient(90deg, #14532d, #b91c1c, #14532d); }
html[data-festival="newyear"] .fest-banner { background: linear-gradient(90deg, #1e1b4b, #7c3aed, #db2777, #1e1b4b); background-size: 200% 100%; animation: festShimmer 6s linear infinite; }
html[data-festival="eid"] .fest-banner { background: linear-gradient(90deg, #064e3b, #0f766e, #064e3b); }
@keyframes festShimmer { to { background-position: 200% 0; } }

/* Diwali: a row of flickering diyas under the header */
.fest-diya { width: 22px; height: 30px; position: relative; }
.fest-diya::before { content: ""; position: absolute; bottom: 2px; left: 1px; width: 20px; height: 9px; background: #b45309; border-radius: 0 0 12px 12px; }
.fest-diya::after { content: ""; position: absolute; bottom: 10px; left: 7px; width: 8px; height: 14px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff7c2, #facc15 45%, #f97316 80%); box-shadow: 0 0 12px 4px rgba(250,204,21,.55); animation: diyaFlicker 1.3s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.fest-diya:nth-child(2n)::after { animation-duration: 1.7s; } .fest-diya:nth-child(3n)::after { animation-duration: 1.1s; }
@keyframes diyaFlicker { 0% { transform: scale(1) rotate(-3deg); } 100% { transform: scale(1.12, .92) rotate(3deg); opacity: .85; } }
/* Tricolour ribbon wave for 15 Aug / 26 Jan */
.fest-flagwave { height: 6px; background: linear-gradient(90deg, #FF9933 0 33.3%, #fff 33.3% 66.6%, #138808 66.6%); background-size: 60px 100%; animation: festShimmer 10s linear infinite; }
/* Holi: colour puffs */
.fest-puff { width: 26px; height: 26px; border-radius: 50%; filter: blur(3px); opacity: .7; animation: puff 3s ease-in-out infinite; }
@keyframes puff { 50% { transform: scale(1.35); opacity: .35; } }
/* Festival accent tweak - a warmer accent for Diwali/Navratri */
html[data-festival="diwali"] { --accent: #E07A12; }

/* ---------- Round 50: custom event themes ---------- */
.fest-banner .fest-link { color: inherit; font-weight: 800; text-decoration: underline; margin-left: 8px; }
.fest-preview-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .08em; background: rgba(0,0,0,.35); color: #fff; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }
.fest-corner { position: fixed; z-index: 3; pointer-events: none; height: auto; max-width: 40vw; filter: drop-shadow(0 8px 18px rgba(0,0,0,.25)); animation: festFloat 6s ease-in-out infinite; }
.fest-corner-br { right: 12px; bottom: 70px; } .fest-corner-bl { left: 12px; bottom: 70px; }
.fest-corner-tr { right: 12px; top: 120px; } .fest-corner-tl { left: 12px; top: 120px; }
@keyframes festFloat { 50% { transform: translateY(-10px); } }
.fest-hero-host { position: relative; }
.fest-hero-img { position: absolute; right: -6px; top: -18px; width: min(170px, 18vw); height: auto; pointer-events: none; z-index: 0; opacity: .95; animation: festFloat 7s ease-in-out infinite; }
.fest-p-img { height: auto; }
.fest-strip-image { pointer-events: none; }

/* ---------- festival: hide decorative extras in print ---------- */
@media print { .fest-banner, .fest-strip, .fest-strip-image, .fest-flagwave, .fest-particles, .fest-corner, .fest-hero-img, .ft-tray, .cp-trigger { display: none !important; } }

/* ---------- reduced motion: everything above goes still ---------- */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
  .rx-check circle, .rx-check path { animation: none; stroke-dashoffset: 0; }
  .rx-check-wrap, .file-list-row, .ft-toggle, .ft-panel, .cp-box, .cp-backdrop { animation: none !important; }
  .pt-page.active::after, .fest-p, .fest-corner, .fest-hero-img, .fest-diya::after, .fest-puff, .fest-banner, .fest-flagwave,
  .tool-card-flagship > .fx-border, .tool-card.tool-card-premium > .fx-border,
  .hero-anim *, .hiw-stat .live-dot { animation: none !important; }
  .hero-anim .ha-out.o1 { opacity: 1; } .hero-anim .ha-line { stroke-dashoffset: 0; }
  .tool-card:hover .icon { animation: none !important; }
  .hiw-step { opacity: 1; transform: none; transition: none; } .hiw-line span { width: 100%; transition: none; }
  .fest-particles { display: none; }
}

/* ---------- pro tools: Hindi / English switch ---------- */
.fh-toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.fh-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.dash-header .fh-toggle { margin-left: auto; margin-right: 8px; }
main[lang="hi"] { font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", var(--font-body, Inter), sans-serif; }

/* ---------- phone signing page ---------- */
.phone-sign-panel { max-width: 560px; margin: 0 auto; text-align: center; }
.phone-sign-pad-wrap { position: relative; margin: 14px 0; }
#psPad { width: 100%; height: auto; aspect-ratio: 900 / 360; background: #fff; border: 2px dashed var(--border-strong); border-radius: 14px; touch-action: none; display: block; }
.phone-sign-line { position: absolute; left: 8%; right: 8%; bottom: 22%; border-bottom: 1.5px solid #c9c2b2; pointer-events: none; }
.phone-sign-colors { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.phone-sign-actions { display: flex; gap: 10px; justify-content: center; }
.phone-sign-status { margin-top: 12px; font-weight: 700; }
.phone-sign-done #psPad { border-color: var(--success); }
.phone-sign-colors .pe-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; padding: 0; }
.phone-sign-colors .pe-swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* ---------- exam photo: name/date strip + photo check ---------- */
.ep-strip { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--card); }
.ep-strip-toggle { display: flex !important; align-items: center; gap: 8px; font-weight: 600 !important; margin: 0 !important; }
.ep-strip-toggle input { width: auto !important; margin: 0; }
.ep-strip-fields { display: flex; gap: 8px; flex-wrap: wrap; }
.ep-strip-fields input { flex: 1 1 140px; }
.ep-check { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--card); }
.ep-check-title { display: flex; align-items: center; gap: 6px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.ep-check-flex { display: flex; gap: 12px; align-items: flex-start; }
.ep-final { width: 96px; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; flex-shrink: 0; }
.ep-check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ep-check-list li { padding-left: 24px; position: relative; line-height: 1.35; }
.ep-check-list li::before { position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }
.ep-check-list li.ok::before { content: "✓"; background: var(--success); }
.ep-check-list li.warn::before { content: "!"; background: var(--warn); }
.ep-check-list li.wait::before { content: "…"; background: var(--text-muted); }

/* ---------- PDF to Excel: preview & edit ---------- */
.xp-open { margin: 6px; }
.xp-panel { margin: 16px auto 0; text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; max-width: 100%; }
.xp-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.xp-sub { font-size: 12.5px; color: var(--text-muted); }
.xp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.xp-tab { border: 1px solid var(--border); background: var(--surface-soft); border-radius: 8px 8px 0 0; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit; color: var(--text); }
.xp-tab.active { background: #1F7A45; color: #fff; border-color: #1F7A45; }
.xp-grid-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.xp-grid { border-collapse: collapse; font-size: 12.5px; color: #111; min-width: 100%; }
.xp-grid th, .xp-grid td { border: 1px solid #d9dde3; padding: 4px 8px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.xp-grid thead th { position: sticky; top: 0; background: #eef1f4; z-index: 1; cursor: pointer; font-weight: 700; color: #475569; }
.xp-rowhead { background: #eef1f4; position: sticky; left: 0; cursor: pointer; color: #475569; font-weight: 600; text-align: right; }
.xp-grid td:focus { outline: 2px solid #1F7A45; background: #f0fdf4; white-space: normal; }
.xp-grid td.xp-edited { background: #fef9c3; }
.xp-grid .xp-del, .xp-grid tr.xp-del td { background: #fee2e2 !important; color: #991b1b; text-decoration: line-through; }
.xp-grid th.xp-del { background: #fecaca !important; }
.xp-foot { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.xp-count { margin-right: auto; font-size: 12.5px; color: var(--text-muted); }
.xp-msg { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 0; }

/* ---------- Merge: arrange pages ---------- */
.mp-wrap { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--card); }
.mp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mp-head strong { display: inline-flex; align-items: center; gap: 6px; }
.mp-head .btn { margin-left: auto; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; max-height: 520px; overflow: auto; padding: 4px; }
.mp-page { position: relative; background: #fff; border-radius: 8px; border: 2px solid var(--mp-c, var(--border)); padding: 4px; cursor: grab; box-shadow: 0 2px 6px rgba(0,0,0,.06); transition: opacity .2s, transform .15s; }
.mp-page:hover { transform: translateY(-2px); }
.mp-page canvas { width: 100%; height: auto; display: block; border-radius: 4px; }
.mp-page.mp-dragging { opacity: .4; }
.mp-page.mp-removed { opacity: .35; filter: grayscale(1); }
.mp-num { position: absolute; top: 6px; left: 6px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; border-radius: 99px; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.mp-src { display: block; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--mp-c, var(--text-muted)); margin-top: 3px; }
.mp-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }

/* Round 50: share card for in-browser tools */
.rx-sheet { position: fixed; right: 16px; bottom: 16px; z-index: 1200; width: min(380px, calc(100vw - 32px)); background: var(--card-solid, var(--card)); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px 10px; box-shadow: 0 18px 48px -12px rgba(0,0,0,.35); animation: rxSheetIn .35s cubic-bezier(.2,.8,.2,1) both; }
.rx-sheet-title { font-weight: 700; margin: 0 22px 6px 0; font-size: 14px; word-break: break-word; }
.rx-sheet-close { position: absolute; top: 6px; right: 8px; border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); }
.rx-sheet .rx-panel { margin: 0; }
@keyframes rxSheetIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rx-sheet { animation: none; } }
@media print { .rx-sheet { display: none !important; } }
