/* Countdown renderer styles. All sizes use container units so the editor
   preview and the dashboard cards look exactly like the full page. */
@font-face { font-family: 'DSEG7'; src: url('fonts/dseg7.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DSEG14'; src: url('fonts/dseg14.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Orbitron'; src: url('fonts/orbitron.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Share Tech Mono'; src: url('fonts/sharetechmono.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'VT323'; src: url('fonts/vt323.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Bebas Neue'; src: url('fonts/bebasneue.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Oswald'; src: url('fonts/oswald.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Black Ops One'; src: url('fonts/blackopsone.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Cinzel'; src: url('fonts/cinzel.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'UnifrakturCook'; src: url('fonts/unifraktur.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Special Elite'; src: url('fonts/specialelite.woff2') format('woff2'); font-display: swap; }

.cd-stage {
  --bg1: #2a0000; --bg2: #000; --digits: #ff2a1a; --glow: #f00; --title: #fff; --text: #c2a9a9;
  --accent: #ff3b1f; --final: #fff; --ga: .7; --dw: .6em; --ghost: ""; --spacing: .3em;
  --title-scale: 1; --text-scale: 1;
  --dc: var(--digits);
  position: relative; width: 100%; height: 100%; overflow: hidden; container-type: size;
  background: #000; color: var(--text); user-select: none; -webkit-user-select: none;
  font-family: var(--font-text);
}
.cd-stage [hidden] { display: none !important; }
.cd-bg, .cd-dim, .cd-grid, .cd-fx, .cd-noise, .cd-scan, .cd-vignette, .cd-strobe, .cd-flash, .cd-wave {
  position: absolute; inset: 0; pointer-events: none;
}
.cd-bg { background-position: center; background-repeat: no-repeat; }
.cd-dim { background: var(--bg2); opacity: 0; }
.cd-fx { width: 100%; height: 100%; }

.cd-noise { display: none; opacity: .07; background-size: 128px 128px; mix-blend-mode: screen; animation: cd-noise .5s steps(5) infinite; }
.cd-fx-noise .cd-noise { display: block; }
@keyframes cd-noise { 0% { background-position: 0 0; } 20% { background-position: 37px -53px; } 40% { background-position: -71px 19px; } 60% { background-position: 23px 88px; } 80% { background-position: -45px -31px; } 100% { background-position: 0 0; } }

.cd-scan { display: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.28) 3px, rgba(0,0,0,.28) 4px); }
.cd-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 18%; top: -20%;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--accent) 9%, transparent), transparent); animation: cd-sweep 7s linear infinite; }
.cd-fx-scan .cd-scan { display: block; }
@keyframes cd-sweep { to { top: 110%; } }

.cd-vignette { display: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.85) 100%); }
.cd-fx-vignette .cd-vignette { display: block; }

.cd-grid { display: none; top: 55%; perspective: 60cqh; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 70%); mask-image: linear-gradient(to bottom, transparent, #000 70%); }
.cd-grid::before { content: ""; position: absolute; left: -50%; right: -50%; top: 0; height: 200%; transform-origin: top center; transform: rotateX(72deg);
  background-image: linear-gradient(to right, color-mix(in srgb, var(--accent) 55%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--accent) 55%, transparent) 1px, transparent 1px);
  background-size: 6cqw 6cqw; animation: cd-grid 2.4s linear infinite; }
.cd-fx-grid .cd-grid { display: block; }
@keyframes cd-grid { to { background-position: 0 6cqw; } }

.cd-content {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.2cqmin; padding: 4cqmin; text-align: center;
}
.cd-title {
  font-family: var(--font-title); color: var(--title); font-weight: 700; line-height: 1.05;
  font-size: calc(clamp(12px, 5.2cqw, 11cqh) * var(--title-scale)); letter-spacing: var(--spacing); margin-right: calc(var(--spacing) * -1);
  text-transform: none; overflow-wrap: anywhere; max-width: 100%;
  text-shadow: 0 0 .25em color-mix(in srgb, var(--glow) calc(var(--ga) * 80%), transparent), 0 0 .9em color-mix(in srgb, var(--glow) calc(var(--ga) * 45%), transparent);
}
.cd-sub, .cd-footer, .cd-target, .cd-msgsub {
  font-family: var(--font-text); color: var(--text); line-height: 1.3; overflow-wrap: anywhere; max-width: 92%; white-space: pre-line;
  font-size: calc(clamp(10px, 2.1cqw, 4.6cqh) * var(--text-scale)); letter-spacing: .12em;
}
.cd-target { opacity: .75; font-size: calc(clamp(9px, 1.5cqw, 3.4cqh) * var(--text-scale)); }

.cd-clock {
  display: flex; align-items: flex-start; justify-content: center; gap: .12em; white-space: nowrap; line-height: 1;
  font-family: var(--font-digits); color: var(--dc); font-size: 100px; font-weight: 700;
  text-shadow: 0 0 .05em color-mix(in srgb, var(--glow) calc(var(--ga) * 100%), transparent),
    0 0 .22em color-mix(in srgb, var(--glow) calc(var(--ga) * 70%), transparent),
    0 0 .6em color-mix(in srgb, var(--glow) calc(var(--ga) * 40%), transparent);
}
.cd-unit { display: flex; flex-direction: column; align-items: center; gap: .1em; }
.cd-digits { display: flex; }
.cd-d { position: relative; display: inline-block; width: var(--dw); text-align: center; }
.cd-d::before { content: var(--ghost); position: absolute; left: 0; right: 0; top: 0; opacity: .11; text-shadow: none; }
.cd-sep { opacity: .85; padding: 0 .02em; }
.cd-blink-sep .cd-sep { animation: cd-blink 1s steps(1) infinite; }
@keyframes cd-blink { 50% { opacity: .15; } }
.cd-label { font-family: var(--font-text); font-size: calc(.15em * var(--text-scale)); letter-spacing: .25em; margin-right: -.25em; color: var(--text); text-shadow: none; font-weight: 400; }
.cd-no-labels .cd-label { display: none; }

.cd-boxed .cd-digits { padding: .12em .14em; border-radius: .08em; background: color-mix(in srgb, var(--accent) 9%, rgba(0,0,0,.55));
  box-shadow: inset 0 0 0 max(1px, .012em) color-mix(in srgb, var(--accent) 55%, transparent), 0 0 .3em color-mix(in srgb, var(--glow) calc(var(--ga) * 35%), transparent); }
.cd-boxed .cd-sep { padding-top: .12em; }
.cd-outline .cd-d, .cd-outline .cd-sep, .cd-outline .cd-big { color: transparent; -webkit-text-stroke: max(1px, .022em) var(--dc); }
.cd-outline .cd-d::before { -webkit-text-stroke: 0; color: var(--dc); }

.cd-column .cd-clock { flex-direction: column; align-items: center; gap: .16em; }
.cd-column .cd-sep { display: none; }

.cd-big { display: none; font-family: var(--font-digits); color: var(--final); line-height: 1; font-size: 100px; font-weight: 700; white-space: nowrap;
  text-shadow: 0 0 .08em color-mix(in srgb, var(--final) calc(var(--ga) * 100%), transparent), 0 0 .4em color-mix(in srgb, var(--glow) calc(var(--ga) * 80%), transparent); }
.cd-bigfinal .cd-clock { display: none; }
.cd-bigfinal .cd-big { display: block; }

.cd-msg { display: none; font-family: var(--font-title); color: var(--dc); font-weight: 700; line-height: 1.05; font-size: 100px; white-space: pre; max-width: none;
  letter-spacing: .06em;
  text-shadow: 0 0 .06em color-mix(in srgb, var(--glow) calc(var(--ga) * 100%), transparent), 0 0 .35em color-mix(in srgb, var(--glow) calc(var(--ga) * 70%), transparent); }
.cd-msgsub { display: none; }
.cd-expired .cd-msgsub:not(:empty) { display: block; }
.cd-exp-message .cd-msg { display: block; animation: cd-msg-in .9s cubic-bezier(.2, 1.4, .4, 1) both; }
.cd-exp-message .cd-clock { display: none; }
.cd-exp-zeros .cd-msg, .cd-exp-countup .cd-msg { display: block; order: -1; font-size: calc(clamp(14px, 6cqw, 12cqh)) !important; white-space: pre-line; }
.cd-exp-zeros .cd-digits { animation: cd-blink 1s steps(1) infinite; }
.cd-exp-countup .cd-clock::before { content: "+"; opacity: .8; }
.cd-exp-zeros .cd-title, .cd-exp-countup .cd-title { order: -2; }
@keyframes cd-msg-in { from { transform: scale(2.6); opacity: 0; filter: blur(12px); } to { transform: none; opacity: 1; filter: none; } }

.cd-progress { width: min(70cqw, 900px); height: max(3px, .7cqmin); background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 99px; overflow: hidden; }
.cd-progress-bar { width: 100%; height: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); box-shadow: 0 0 1cqmin var(--glow); }

/* effects on the clock */
.cd-fx-flicker .cd-clock, .cd-fx-flicker .cd-title { animation: cd-flicker 5s linear infinite; }
@keyframes cd-flicker { 0%, 100% { opacity: 1; } 3% { opacity: .82; } 6% { opacity: 1; } 42% { opacity: 1; } 43% { opacity: .6; } 44% { opacity: 1; } 45% { opacity: .85; } 46% { opacity: 1; } 78% { opacity: .93; } 80% { opacity: 1; } }

.cd-fx-glitch .cd-title { animation: cd-glitch 6.5s steps(1) infinite; }
.cd-fx-glitch.cd-fx-flicker .cd-title { animation: cd-glitch 6.5s steps(1) infinite, cd-flicker 5s linear infinite; }
@keyframes cd-glitch {
  0%, 100% { transform: none; clip-path: none; }
  61% { transform: translate(-.06em, 0) skewX(-12deg); text-shadow: .08em 0 #0ff, -.08em 0 #f0f; clip-path: inset(10% 0 55% 0); }
  62% { transform: translate(.05em, 0) skewX(8deg); text-shadow: -.08em 0 #0ff, .08em 0 #f0f; clip-path: inset(48% 0 12% 0); }
  63% { transform: none; clip-path: none; }
  88% { transform: translate(.04em, -.02em); text-shadow: .06em 0 #f00, -.06em 0 #0ff; clip-path: inset(30% 0 30% 0); }
  89% { transform: none; clip-path: none; }
}

.cd-fx-pulse.cd-beat-a .cd-u-seconds .cd-digits, .cd-fx-pulse.cd-beat-a .cd-big { animation: cd-beat-a .5s ease-out; }
.cd-fx-pulse.cd-beat-b .cd-u-seconds .cd-digits, .cd-fx-pulse.cd-beat-b .cd-big { animation: cd-beat-b .5s ease-out; }
@keyframes cd-beat-a { 0% { transform: scale(1.09); filter: brightness(1.6); } 100% { transform: none; filter: none; } }
@keyframes cd-beat-b { 0% { transform: scale(1.09); filter: brightness(1.6); } 100% { transform: none; filter: none; } }

/* the final seconds */
.cd-final { --dc: var(--final); }
.cd-final-shake .cd-content { animation: cd-shake .28s linear infinite; }
@keyframes cd-shake {
  0% { transform: translate(0, 0); } 20% { transform: translate(-.5cqmin, .3cqmin); } 40% { transform: translate(.4cqmin, -.4cqmin); }
  60% { transform: translate(-.3cqmin, -.2cqmin); } 80% { transform: translate(.5cqmin, .2cqmin); } 100% { transform: translate(0, 0); }
}
.cd-strobe { opacity: 0; box-shadow: inset 0 0 18cqmin color-mix(in srgb, var(--accent) 85%, transparent); }
.cd-final-strobe.cd-beat-a .cd-strobe { animation: cd-strobe-a .9s ease-out; }
.cd-final-strobe.cd-beat-b .cd-strobe { animation: cd-strobe-b .9s ease-out; }
@keyframes cd-strobe-a { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cd-strobe-b { 0% { opacity: 1; } 100% { opacity: 0; } }

/* zero */
.cd-flash { background: #fff; opacity: 0; }
.cd-boom-flash .cd-flash { animation: cd-flash 2.4s ease-out; }
@keyframes cd-flash { 0% { opacity: 1; } 12% { opacity: .95; } 100% { opacity: 0; } }
.cd-wave { display: none; inset: auto; left: 50%; top: 50%; width: 10cqmin; height: 10cqmin; margin: -5cqmin 0 0 -5cqmin; border-radius: 50%;
  border: 1.2cqmin solid var(--accent); box-shadow: 0 0 6cqmin var(--glow), inset 0 0 6cqmin var(--glow); }
.cd-boom-wave .cd-wave { display: block; animation: cd-wave 1.8s cubic-bezier(.1, .7, .3, 1) both; }
@keyframes cd-wave { from { transform: scale(.2); opacity: 1; } to { transform: scale(26); opacity: 0; } }

.cd-arm {
  position: absolute; left: 50%; bottom: 5cqh; transform: translateX(-50%); z-index: 5; cursor: pointer;
  font: 600 clamp(11px, 1.6cqw, 16px)/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.6); border: 1px solid var(--accent); border-radius: 99px; padding: .9em 1.5em;
  box-shadow: 0 0 1.5em color-mix(in srgb, var(--glow) 60%, transparent); animation: cd-arm 1.6s ease-in-out infinite; white-space: nowrap;
}
@keyframes cd-arm { 50% { box-shadow: 0 0 .4em color-mix(in srgb, var(--glow) 40%, transparent); } }
.cd-probe { position: absolute; visibility: hidden; font-size: 100px; font-weight: 700; white-space: nowrap; left: 0; top: 0; }

.cd-lite .cd-arm, .cd-lite .cd-noise, .cd-lite .cd-fx { display: none !important; }
.cd-lite .cd-scan::after { animation: none; }

.cd-calm .cd-content, .cd-calm .cd-title, .cd-calm .cd-clock, .cd-calm .cd-strobe, .cd-calm .cd-noise, .cd-calm .cd-scan::after, .cd-calm .cd-grid::before { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .cd-stage *, .cd-stage *::before, .cd-stage *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}
