/* The countdown widget. Everything inside .w-body scales with its font-size (set by widget.js). */
.stage {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--sat) + 76px) calc(var(--sar) + 18px) calc(var(--sab) + 92px) calc(var(--sal) + 18px);
  transition: bottom 0.36s var(--ease), right 0.36s var(--ease);
  container-type: size;
}
.stage[data-pos="top"] { justify-content: flex-start; }
.stage[data-pos="bottom"] { justify-content: flex-end; }
.view.editing .stage { padding-top: calc(var(--sat) + 22px); padding-bottom: 22px; }
@media (max-height: 520px) and (orientation: landscape) {
  .stage { padding-top: calc(var(--sat) + 62px); padding-bottom: calc(var(--sab) + 70px); }
}
.stage[data-swipe="left"] .w { animation: swipe-l 0.45s var(--ease); }
.stage[data-swipe="right"] .w { animation: swipe-r 0.45s var(--ease); }
@keyframes swipe-l { from { opacity: 0; transform: translateX(40px); } }
@keyframes swipe-r { from { opacity: 0; transform: translateX(-40px); } }

.w {
  position: relative; width: 100%; max-width: 1100px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  color: var(--w-color); transition: opacity 0.4s;
}
.w[data-align="left"] { align-items: flex-start; text-align: left; }
.w-body, .w-progress, .w-totals { transition: opacity 0.4s; }
.view.final-on .w-body, .view.final-on .w-progress, .view.final-on .w-totals { opacity: 0.06; }

/* ---------------------------------------------------------------- head */
.w-head { display: flex; flex-direction: column; align-items: inherit; max-width: 100%; margin-bottom: 18px; margin-bottom: clamp(10px, 3.2cqb, 30px); }
.w-emoji { font-size: clamp(30px, 10vw, 72px); font-size: clamp(30px, min(10cqi, 9cqb), 72px); line-height: 1; margin-bottom: 0.14em; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.3)); }
.w-title {
  margin: 0; max-width: 22em;
  font-family: var(--w-title-font); font-weight: var(--w-title-weight); color: var(--w-title-color);
  font-size: calc(clamp(22px, 7.4vw, 76px) * (0.55 + 0.5 * var(--w-scale, 0.9)));
  font-size: calc(clamp(22px, min(7.4cqi, 7cqb), 76px) * (0.55 + 0.5 * var(--w-scale, 0.9)));
  line-height: 1.12; letter-spacing: -0.01em; overflow-wrap: anywhere; text-wrap: balance;
}
.w-sub {
  margin-top: 0.55em; color: var(--w-title-color); opacity: 0.84;
  font: 550 clamp(13px, 3.7vw, 19px)/1.3 var(--ui);
  font-size: clamp(13px, min(3.7cqi, 3.4cqb), 19px);
}
.w[data-effect="shadow"] { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.3); }
.w[data-effect="glow"] .w-num,
.w[data-effect="glow"] .w-sep,
.w[data-effect="glow"] .dg-colon,
.w[data-effect="glow"] .dg-dot,
.w[data-effect="glow"] .w-words b {
  text-shadow: 0 0 0.05em rgba(var(--w-accent-rgb), 0.95), 0 0 0.2em rgba(var(--w-accent-rgb), 0.6), 0 0 0.55em rgba(var(--w-accent-rgb), 0.35);
}
.w[data-effect="glow"] .w-title { text-shadow: 0 0 0.15em rgba(var(--w-accent-rgb), 0.7), 0 0 0.5em rgba(var(--w-accent-rgb), 0.35); }
.w[data-effect="glow"] .w-sub, .w[data-effect="glow"] .w-label { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4); }

/* ---------------------------------------------------------------- numbers */
.w-body {
  max-width: 100%; display: flex; justify-content: center;
  font-family: var(--w-font); font-weight: var(--w-weight); line-height: 1; font-size: 64px;
}
.w[data-align="left"] .w-body { justify-content: flex-start; }
.w-body.tappable { cursor: pointer; }
.w-units, .w-digital, .w-words { flex: none; }
.w-units { display: flex; flex-direction: column; align-items: center; gap: 0.14em; width: max-content; }
.w-units.one-line { flex-direction: row; align-items: flex-start; }
.w[data-align="left"] .w-units { align-items: flex-start; }
.w-row { display: flex; align-items: flex-start; gap: 0.14em; }
.w-units:not(.one-line) .w-sep-join { display: none; }
.w-unit { display: flex; flex-direction: column; align-items: center; }
.w-num { display: flex; font-size: 1em; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.dg { display: inline-block; width: var(--dw, 0.62em); font-style: normal; text-align: center; }
.dg.sep { width: auto; padding: 0 0.02em; }
.w-label {
  margin-top: 0.5em; white-space: nowrap; color: var(--w-label-color);
  font: 650 max(10px, 0.17em)/1.1 var(--ui); letter-spacing: 0.02em;
}
.w[data-upper="1"] .w-label { text-transform: uppercase; letter-spacing: 0.13em; }
.w[data-labels="none"] .w-label { display: none; }
.w-sep { font-size: 1em; line-height: 1; opacity: 0.55; padding: 0 0.01em; }

/* card styles (applied to .wc: units, rings, flip digits or a single panel) */
.w[data-card="glass"] .wc {
  background: rgba(var(--w-card-rgb), var(--w-card-a));
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 0.08em 0.3em rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.w[data-card="solid"] .wc { background: rgba(var(--w-card-rgb), var(--w-card-a)); box-shadow: 0 0.06em 0.26em rgba(0, 0, 0, 0.25); }
.w[data-card="outline"] .wc { border: max(1.5px, 0.022em) solid rgba(var(--w-color-rgb), 0.5); }
.w:not([data-card="none"]) .w-units.wc,
.w:not([data-card="none"]) .w-digital.wc,
.w:not([data-card="none"]) .w-words.wc { padding: 0.26em 0.36em; border-radius: calc(var(--w-radius) * 1em + 0.1em); }
.w:not([data-card="none"]) .w-words.wc { padding: 0.45em 0.7em; }

/* cards */
.w[data-layout="cards"] .w-unit { min-width: 1.6em; padding: 0.16em 0.2em 0.15em; border-radius: calc(var(--w-radius) * 1em); }
.w[data-layout="cards"][data-card="none"] .w-unit { padding: 0 0.12em; }
.w[data-layout="cards"] .w-label { margin-top: 0.45em; }

/* minimal */
.w[data-layout="minimal"] .w-row,
.w[data-layout="minimal"] .w-units { gap: 0.2em; }
.w[data-layout="minimal"] .w-unit { padding: 0 0.04em; }

/* flip clock */
.w[data-layout="flip"] .w-row, .w[data-layout="flip"] .w-units { gap: 0.2em; }
.w[data-layout="flip"] .w-num { gap: 0.06em; }
.w[data-layout="flip"] .w-sep { align-self: center; margin-top: -0.35em; }
.w[data-layout="flip"] .w-label { margin-top: 0.55em; }
.fd { position: relative; width: calc(var(--dw, 0.62em) + 0.26em); height: 1.34em; border-radius: calc(var(--w-radius) * 0.7em); perspective: 3em; }
.fd.sep { width: auto; }
.fd-h {
  position: absolute; left: 0; right: 0; height: 50%; overflow: hidden;
  background: rgba(var(--w-card-rgb), max(var(--w-card-a), 0.86));
}
.w[data-card="none"] .fd-h, .w[data-card="outline"] .fd-h { background: rgba(17, 17, 20, 0.92); }
.fd-top, .fd-ft { top: 0; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fd-bot, .fd-fb { bottom: 0; border-radius: inherit; border-top-left-radius: 0; border-top-right-radius: 0; }
.fd-top::after, .fd-ft::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.1)); }
.fd-h span { position: absolute; left: 0; right: 0; height: 1.34em; line-height: 1.34em; text-align: center; }
.fd-top span, .fd-ft span { top: 0; }
.fd-bot span, .fd-fb span { bottom: 0; }
.fd-ft { z-index: 3; transform-origin: 50% 100%; visibility: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.fd-fb { z-index: 3; transform-origin: 50% 0; visibility: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; transform: rotateX(90deg); }
.fd.flipping .fd-ft { visibility: visible; animation: fd-top 0.3s ease-in forwards; }
.fd.flipping .fd-fb { visibility: visible; animation: fd-bot 0.3s 0.3s ease-out forwards; }
.fd::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 0.012em); height: 0.024em; z-index: 4; background: rgba(0, 0, 0, 0.45); }
.w[data-card="glass"] .fd, .w[data-card="solid"] .fd { box-shadow: 0 0.06em 0.22em rgba(0, 0, 0, 0.3); }
@keyframes fd-top { from { transform: rotateX(0); } to { transform: rotateX(-90deg); } }
@keyframes fd-bot { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }

/* rings */
.w[data-layout="rings"] .w-row, .w[data-layout="rings"] .w-units { gap: 0.2em; }
.w-ring { position: relative; width: 2.1em; height: 2.1em; display: grid; place-items: center; border-radius: 50%; }
.w-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.w-ring .rt { fill: none; stroke: rgba(var(--w-color-rgb), 0.16); stroke-width: 5.5; }
.w-ring .rb {
  fill: none; stroke: var(--w-accent); stroke-width: 5.5; stroke-linecap: round;
  stroke-dasharray: 276.46; stroke-dashoffset: 276.46; transition: stroke-dashoffset 0.95s linear;
}
.w[data-layout="rings"] .w-num { font-size: 0.64em; }
.w[data-layout="rings"] .w-label { margin-top: 0.6em; }

/* poster stack */
.w[data-layout="stack"] .w-units, .w[data-layout="stack"] .w-row { gap: 0.02em; }
.w[data-layout="stack"] .w-row { flex-direction: column; }
.w[data-layout="stack"] .w-unit { flex-direction: row; align-items: baseline; gap: 0.16em; }
.w[data-layout="stack"] .w-num { justify-content: flex-end; min-width: calc(var(--maxd, 2) * var(--dw, 0.62em)); }
.w[data-layout="stack"] .w-label {
  margin: 0; min-width: 4.4em; text-align: left;
  font: var(--w-weight) 0.42em/1 var(--w-font); letter-spacing: 0.04em;
}
.w[data-layout="stack"][data-upper="1"] .w-label { letter-spacing: 0.06em; }

/* digital */
.w-digital { display: flex; flex-direction: column; align-items: center; gap: 0.06em; width: max-content; line-height: 1.02; }
.w-digital.one-line { flex-direction: row; align-items: baseline; gap: 0.32em; }
.w[data-align="left"] .w-digital { align-items: flex-start; }
.dg-group { display: inline-flex; align-items: baseline; gap: 0.24em; white-space: nowrap; }
.dg-clock { gap: 0; }
.dg-seg { display: inline-flex; align-items: baseline; }
.dg-suf { margin-left: 0.06em; font-size: 0.42em; color: var(--w-label-color); }
.w[data-labels="none"] .dg-suf { display: none; }
.dg-colon, .dg-dot { padding: 0 0.03em; opacity: 0.72; }
.w[data-layout="digital"] .dg-colon { animation: colon 2s steps(1) infinite; }
@keyframes colon { 50% { opacity: 0.32; } }

/* words */
.w-words { margin: 0; width: max-content; max-width: 14em; font-size: 0.5em; line-height: 1.24; font-weight: var(--w-weight); text-wrap: balance; }
.w-words b { font-weight: inherit; color: var(--w-accent); font-variant-numeric: tabular-nums; }

.w-final .w-num { animation: beat 1s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.04); } }

/* ---------------------------------------------------------------- extras */
.w-progress { width: min(100%, 460px); margin-top: clamp(14px, 3.5cqb, 30px); color: var(--w-title-color); font: 550 clamp(12px, 3.3vw, 15px)/1.2 var(--ui); }
.w-track { height: 7px; border-radius: 99px; overflow: hidden; background: rgba(var(--w-color-rgb), 0.2); }
.w-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--w-accent); box-shadow: 0 0 12px rgba(var(--w-accent-rgb), 0.6); transition: width 1s linear; }
.w-plabel { margin-top: 8px; opacity: 0.82; }
.w-totals {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  max-width: min(100%, 640px); margin-top: clamp(12px, 3cqb, 26px);
  font: 550 clamp(11.5px, 3.1vw, 14px)/1 var(--ui); color: #fff;
}
.w[data-align="left"] .w-totals { justify-content: flex-start; }
.w-total {
  padding: 0.55em 0.8em; border-radius: 99px; white-space: nowrap; text-shadow: none;
  background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.w-total b { font-weight: 750; font-variant-numeric: tabular-nums; }
.w-cycle-hint {
  position: absolute; left: 50%; bottom: -2.6em; transform: translateX(-50%);
  padding: 6px 12px; border-radius: 99px; background: rgba(0, 0, 0, 0.5); color: #fff;
  font: 650 13px var(--ui); white-space: nowrap; text-shadow: none; opacity: 0; pointer-events: none;
}
.w-cycle-hint.show { animation: hint 1.8s var(--ease) both; }
@keyframes hint {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  15%, 75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; }
}
