/*
 * Dancing Clock: the tool's own components, styled in the site's design language (10 Nov 2026, automatic mode, on the
 * UltraCompress Pro template, after the Clock, whose shared block the first part of this file copies). Base:
 * /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus rings) and /libs/shared-nav.css (the
 * site's header and footer). The second part is the stage: the sky, the floor and Tico, the original's drawing in its
 * own colours (a picture that follows the clock's hours, the same in the site's light and dark theme), copied from
 * Pending_Migration/dancing-clock/style.css by adapt_talking_clock.py; the speech bubble is drawn at full size whatever
 * Tico's size. The third part is the toolbar and the cards under the stage on the site's tokens. Light is the default;
 * dark applies when <html> has no data-theme. Source: docs/check-scripts/examples/adapt_talking_clock_styles.css.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden], .session [hidden] { display: none !important; } /* the script hides parts that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }


/* ===== Dancing Clock components ===== */

/* ----- The site's text rules (p, ul, li, headings) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) li, :where(.dialog) p { margin: 0; line-height: 1.5; }
:where(.app-shell) ul { padding: 0; list-style: none; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.dialog) h3 { margin: 0; line-height: 1.25; }

/* ----- Toolbar ----- */
.app-toolbar .toolbar-right { margin-left: auto; }
.clock-pill .status-main { font-size: 1.05rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.clock-pill .status-sub { font-size: 0.78rem; }
.toggle-btn[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.toggle-btn[aria-pressed="true"]:hover:not(:disabled) { color: #fff; }
.voice-select { min-height: 38px; padding: 7px 34px 7px 14px; border-radius: 9999px; font-size: 0.85rem; font-weight: 600; max-width: 220px; }
.banner { display: flex; align-items: center; gap: 10px 14px; padding: 12px 16px; margin: 0 0 1.25rem; border-radius: 14px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); font-size: 0.925rem; color: var(--text-strong); }
.banner .ico { color: var(--link); }
.banner-text { flex: 1 1 220px; font-weight: 600; }

/* ----- The stage: Tico's own colours, whatever the site's theme ----- */
.stage {
  /* materials */
  --brass-0: #fff6d2;
  --brass-1: #f3d989;
  --brass-2: #cf9d33;
  --brass-3: #8f6416;
  --brass-4: #5a3d08;
  --steel-0: #f5f7fa;
  --steel-1: #c9ced6;
  --steel-2: #8b929d;
  --steel-3: #4d545e;
  --ink: #1b1b1f;
  --cream: #f6efe0;
  --cream-deep: #e4d8bf;
  --red: #d8262c;
  --glove: #fbfbf9;
  --boot: #23232a;

  /* sky (day defaults, overridden by .stage[data-sky]) */
  --sky-top: #5aa9e6;
  --sky-mid: #a7d3f3;
  --sky-bot: #e9f4fb;
  --hill-far: #8fc38a;
  --hill-near: #5f9e5a;
  --floor-top: #7fb26e;
  --floor-bot: #4f7f42;
  --floor-line: rgba(0, 0, 0, 0.18);
  --star-alpha: 0;
}

.stage[data-sky="dawn"] {
  --sky-top: #5d6fb3;
  --sky-mid: #f0a07a;
  --sky-bot: #ffe2b8;
  --hill-far: #9a8fb0;
  --hill-near: #6c7a62;
  --floor-top: #8aa36a;
  --floor-bot: #4f6a3e;
  --star-alpha: 0.35;
}

.stage[data-sky="dusk"] {
  --sky-top: #3b3f78;
  --sky-mid: #d86f6a;
  --sky-bot: #f7c07a;
  --hill-far: #7b6d93;
  --hill-near: #4f5f50;
  --floor-top: #6b8d58;
  --floor-bot: #3c5a33;
  --star-alpha: 0.4;
}

.stage[data-sky="night"] {
  --sky-top: #070b1f;
  --sky-mid: #142046;
  --sky-bot: #2a3a6a;
  --hill-far: #1c2a45;
  --hill-near: #152136;
  --floor-top: #2a4a3a;
  --floor-bot: #142a20;
  --floor-line: rgba(0, 0, 0, 0.45);
  --star-alpha: 1;
}

.stage {
  position: relative;
  height: clamp(440px, 64vh, 600px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-border);
  box-shadow: var(--surface-shadow);
  background: var(--sky-bot);
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-bot) 100%);
  transition: background 2.5s ease;
}

.stars {
  position: absolute;
  inset: 0;
  opacity: var(--star-alpha);
  transition: opacity 2.5s ease;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 28% 9%, #fff 60%, transparent 61%),
    radial-gradient(1.6px 1.6px at 41% 24%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 55% 13%, #fff 60%, transparent 61%),
    radial-gradient(1.3px 1.3px at 66% 31%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 78% 7%, #fff 60%, transparent 61%),
    radial-gradient(1.8px 1.8px at 88% 21%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 7% 43%, #fff 60%, transparent 61%),
    radial-gradient(1.2px 1.2px at 21% 36%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 35% 46%, #fff 60%, transparent 61%),
    radial-gradient(1.5px 1.5px at 49% 38%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 61% 49%, #fff 60%, transparent 61%),
    radial-gradient(1.2px 1.2px at 73% 42%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 93% 39%, #fff 60%, transparent 61%),
    radial-gradient(1.1px 1.1px at 17% 58%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 83% 56%, #fff 60%, transparent 61%);
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { filter: brightness(0.75); }
  to { filter: brightness(1.15); }
}

.celestial {
  position: absolute;
  width: 84px;
  height: 84px;
  left: 70%;
  top: 14%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 20s linear, top 20s linear, background 2.5s ease, box-shadow 2.5s ease;
  background: radial-gradient(circle at 40% 35%, #fffdf0, #ffe36b 55%, #ffb627 100%);
  box-shadow: 0 0 60px 18px rgba(255, 221, 120, 0.55);
}

.celestial.moon {
  background: radial-gradient(circle at 40% 35%, #ffffff, #d9deea 60%, #aeb6ca 100%);
  box-shadow:
    inset -14px -8px 0 0 rgba(120, 130, 160, 0.25),
    inset 18px 14px 0 -10px rgba(140, 150, 180, 0.18),
    0 0 50px 12px rgba(200, 215, 255, 0.28);
}

.cloud {
  position: absolute;
  width: 160px;
  height: 46px;
  border-radius: 46px;
  background: rgba(255, 255, 255, 0.85);
  filter: blur(0.3px);
  opacity: 0.9;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cloud::before { width: 70px; height: 70px; left: 26px; top: -36px; }
.cloud::after { width: 50px; height: 50px; left: 84px; top: -22px; }
.cloud-1 { top: 16%; animation-duration: 95s; animation-delay: -20s; }
.cloud-2 { top: 29%; transform: scale(0.7); animation-duration: 130s; animation-delay: -70s; }
.cloud-3 { top: 9%; transform: scale(0.55); animation-duration: 160s; animation-delay: -110s; }
.stage[data-sky="night"] .cloud { opacity: 0.18; }
.stage[data-sky="dusk"] .cloud, .stage[data-sky="dawn"] .cloud { opacity: 0.6; background: rgba(255, 236, 225, 0.85); }

@keyframes drift {
  from { left: -220px; }
  to { left: 110%; }
}

.hills {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 46%;
  bottom: 14%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transition: background 2.5s ease;
}
.hills-far { background: var(--hill-far); bottom: 16%; transform: scaleX(1.4) translateX(8%); opacity: 0.85; }
.hills-near { background: var(--hill-near); height: 32%; transform: scaleX(1.2) translateX(-12%); }


.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  min-height: 70px;
  background: linear-gradient(180deg, var(--floor-top), var(--floor-bot));
  box-shadow: inset 0 2px 0 var(--floor-line), inset 0 14px 24px rgba(0, 0, 0, 0.12);
  transition: background 2.5s ease;
}
.floor::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 46px);
  opacity: 0.5;
}

/* The actor is the positioned, scaled unit: bubble + character + shadow */
.actor {
  --x: 0px;
  --scale: 1;
  --lean: 0deg;
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 300px;
  height: 404px;
  margin-left: -150px;
  transform-origin: 50% 100%;
  transform: translateX(var(--x)) rotate(var(--lean)) scale(var(--scale));
  transition: transform 0.12s linear;
  will-change: transform;
}

.shadow {
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 210px;
  height: 28px;
  margin-left: -105px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.18) 45%, rgba(0, 0, 0, 0) 72%);
  transform-origin: 50% 50%;
  animation: shadow-breathe 3.2s ease-in-out infinite;
}

@keyframes shadow-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.94); opacity: 0.85; }
}


.character {
  position: absolute;
  inset: 0;
  cursor: pointer;
  transform-origin: 50% 100%;
  animation: idle 3.2s ease-in-out infinite;
  user-select: none;
  -webkit-user-select: none;
}

@keyframes idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Bells ------------------------------------------------------------------ */

.bells {
  position: absolute;
  top: 0;
  left: 50%;
  width: 210px;
  height: 74px;
  margin-left: -105px;
  z-index: 1;
}

.bell {
  position: absolute;
  top: 4px;
  width: 66px;
  height: 64px;
  transform-origin: 50% 100%;
}
.bell-left { left: 6px; }
.bell-right { right: 6px; }

.bell::after {
  /* stalk connecting the bell to the casing */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 10px;
  height: 16px;
  margin-left: -5px;
  background: linear-gradient(90deg, var(--steel-3), var(--steel-0) 50%, var(--steel-2));
  border-radius: 2px;
}

.bell-cap {
  position: absolute;
  top: 0;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-0), var(--brass-2) 60%, var(--brass-3));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.bell-dome {
  position: absolute;
  top: 9px;
  left: 4px;
  width: 58px;
  height: 46px;
  border-radius: 50% 50% 12% 12% / 70% 70% 14% 14%;
  background:
    radial-gradient(ellipse at 30% 22%, rgba(255, 255, 255, 0.85) 0, rgba(255, 255, 255, 0) 32%),
    linear-gradient(90deg, var(--brass-3) 0%, var(--brass-2) 18%, var(--brass-1) 42%, var(--brass-2) 68%, var(--brass-3) 100%);
  box-shadow: inset -5px -6px 10px rgba(60, 35, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.35);
}

.bell-rim {
  position: absolute;
  left: 0;
  bottom: 8px;
  width: 66px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brass-1), var(--brass-3));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45), inset 0 -2px 2px rgba(0, 0, 0, 0.3);
}

.hammer {
  position: absolute;
  left: 50%;
  top: 14px;
  width: 5px;
  height: 52px;
  margin-left: -2.5px;
  background: linear-gradient(90deg, var(--steel-3), var(--steel-0) 55%, var(--steel-2));
  border-radius: 2px;
  transform-origin: 50% 100%;
  z-index: 0;
}
.hammer-head {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--steel-0), var(--steel-2) 55%, var(--steel-3));
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

/* Casing, bezel, dial ------------------------------------------------------ */

.clock-body {
  position: absolute;
  top: 54px;
  left: 50%;
  width: 244px;
  height: 244px;
  margin-left: -122px;
  border-radius: 50%;
  z-index: 3;
  background: conic-gradient(from 210deg,
    #dde1e7, #8c939d 14%, #f4f6f8 28%, #7b828c 44%, #e3e7ec 58%, #959ca6 72%, #f2f4f7 86%, #dde1e7);
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.38),
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 -8px 14px rgba(0, 0, 0, 0.28),
    inset 0 6px 10px rgba(255, 255, 255, 0.55);
}

.knob {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 34px;
  margin-top: -17px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--steel-0), var(--steel-2) 60%, var(--steel-3));
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
  z-index: -1;
}
.knob-left { left: -12px; }
.knob-right { right: -12px; }
.knob::after {
  content: "";
  position: absolute;
  inset: 4px 7px;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 4px);
}

.bezel {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    var(--brass-2), var(--brass-1) 12%, var(--brass-3) 26%, var(--brass-1) 40%,
    var(--brass-2) 52%, var(--brass-0) 64%, var(--brass-2) 76%, var(--brass-3) 88%, var(--brass-2));
  box-shadow:
    inset 0 0 0 2px rgba(60, 35, 0, 0.45),
    inset 0 0 0 4px rgba(255, 240, 190, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.4);
}

.dial {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #fcf8ee 0%, var(--cream) 50%, var(--cream-deep) 100%);
  box-shadow:
    inset 0 8px 16px rgba(60, 40, 10, 0.32),
    inset 0 -3px 8px rgba(255, 255, 255, 0.7),
    inset 0 0 0 1px rgba(60, 40, 10, 0.25);
}

.dial-svg, .hands-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hands-svg { pointer-events: none; z-index: 4; }

.hand-shadow path { fill: rgba(0, 0, 0, 0.22); transform: translate(2px, 4px); }
.hand-hour, .hand-minute { fill: var(--ink); }
.hand-minute { fill: #26262c; }
.hand-second line { stroke: var(--red); stroke-width: 1.5; stroke-linecap: round; }
.hand-second circle { fill: var(--red); }
.hand-second { filter: drop-shadow(1px 3px 1.5px rgba(0, 0, 0, 0.3)); }
.cap-outer { fill: #2b2b31; stroke: #0d0d10; stroke-width: 0.6; }
.cap-inner { fill: var(--red); }

.glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.18) 24%, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0) 68%, rgba(255, 255, 255, 0.1) 100%);
}
.glass::before {
  content: "";
  position: absolute;
  left: 14%;
  top: 7%;
  width: 46%;
  height: 20%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
  transform: rotate(-24deg);
}

/* Face --------------------------------------------------------------------- */

.face {
  --ex: 0px;
  --ey: 0px;
  position: absolute;
  inset: 0;
  z-index: 3;
}

.eyes {
  position: absolute;
  top: 31%;
  left: 50%;
  display: flex;
  gap: 20px;
  transform: translateX(-50%);
}

.eye {
  position: relative;
  width: 40px;
  height: 40px;
  transition: transform 0.3s ease;
}

.eyeball {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #f1efe9 70%, #ddd9cf 100%);
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.28), inset 0 -1px 2px rgba(255, 255, 255, 0.8), 0 1px 0 rgba(255, 255, 255, 0.7);
}

.iris {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #2d84cf 0%, #1f5fa6 50%, #113465 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 -3px 4px rgba(0, 0, 0, 0.3);
  transform: translate(var(--ex), var(--ey));
  transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease;
}
.iris::before {
  /* radial fibre texture */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.14) 0 4deg, rgba(0, 0, 0, 0) 4deg 9deg);
  opacity: 0.8;
}

.pupil {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #050609;
  transition: inset 0.25s ease;
}

.glint {
  position: absolute;
  width: 7px;
  height: 7px;
  top: 3px;
  left: 4px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.95;
}
.glint::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.8;
}

.lid {
  position: absolute;
  left: -3px;
  right: -3px;
  height: 0;
  background: linear-gradient(180deg, #ebe2cf, var(--cream));
  transition: height 0.14s ease;
  z-index: 2;
}
.lid-top {
  top: -2px;
  border-radius: 0 0 48% 48%;
  box-shadow: 0 1px 0 rgba(60, 40, 10, 0.45), 0 2px 3px rgba(0, 0, 0, 0.2);
}
.lid-bottom {
  bottom: -2px;
  border-radius: 48% 48% 0 0;
  box-shadow: 0 -1px 0 rgba(60, 40, 10, 0.3);
}

.brow {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 36px;
  height: 7px;
  margin-left: -18px;
  border-radius: 4px 4px 3px 3px;
  background: linear-gradient(180deg, #2a2a30, #0f0f12);
  transform: translateY(var(--by, 0px)) rotate(var(--br, 0deg));
  transition: transform 0.3s ease;
}
.eye-left .brow { --br: -5deg; }
.eye-right .brow { --br: 5deg; }

.cheek {
  position: absolute;
  top: 54%;
  width: 26px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(236, 110, 120, 0.55), rgba(236, 110, 120, 0) 72%);
  opacity: 0.8;
  transition: opacity 0.4s ease;
}
.cheek-left { left: 16%; }
.cheek-right { right: 16%; }

.mouth {
  position: absolute;
  top: 63%;
  left: 50%;
  width: 56px;
  height: 24px;
  margin-left: -28px;
  overflow: hidden;
  background: #35151a;
  border-radius: 0 0 30px 30px / 0 0 24px 24px;
  box-shadow: inset 0 4px 5px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.5);
  transform-origin: 50% 20%;
  transition: width 0.3s ease, height 0.3s ease, margin 0.3s ease, border-radius 0.3s ease, transform 0.3s ease, top 0.3s ease;
}

.teeth {
  position: absolute;
  top: 0;
  left: 3px;
  right: 3px;
  height: 7px;
  background: #fff;
  border-radius: 0 0 4px 4px;
  transition: opacity 0.25s ease, height 0.25s ease;
}

.tongue {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 32px;
  height: 20px;
  margin-left: -16px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #f06a7c, #c93a52);
  transition: opacity 0.25s ease, transform 0.3s ease;
}

/* Zzz for sleepy mood */
.zzz {
  position: absolute;
  top: 12%;
  right: 8%;
  opacity: 0;
  pointer-events: none;
  font: italic 700 14px Georgia, serif;
  color: #4a5a7a;
  transition: opacity 0.4s ease;
}
.zzz span { position: absolute; left: 0; top: 0; animation: zfloat 2.4s ease-in infinite; animation-play-state: paused; }
.zzz span:nth-child(2) { animation-delay: 0.8s; }
.zzz span:nth-child(3) { animation-delay: 1.6s; }
.mood-sleepy .zzz { opacity: 1; }
.mood-sleepy .zzz span { animation-play-state: running; }

@keyframes zfloat {
  0% { transform: translate(0, 0) scale(0.7); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(16px, -34px) scale(1.3); opacity: 0; }
}

/* Mood: happy (default) */
.mood-happy .cheek { opacity: 1; }

/* Mood: surprised */
.mood-surprised .eye { transform: scale(1.14); }
.mood-surprised .iris { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.mood-surprised .pupil { inset: 5px; }
.mood-surprised .brow { --by: -9px; }
.mood-surprised .eye-left .brow { --br: -2deg; }
.mood-surprised .eye-right .brow { --br: 2deg; }
.mood-surprised .mouth { width: 32px; height: 36px; margin-left: -16px; border-radius: 50%; top: 61%; }
.mood-surprised .teeth { opacity: 0; }
.mood-surprised .tongue { transform: translateY(6px); }

/* Mood: sad */
.mood-sad .eye-left .brow { --br: -14deg; --by: -3px; }
.mood-sad .eye-right .brow { --br: 14deg; --by: -3px; }
.mood-sad .lid-top { height: 28%; }
.mood-sad .lid-bottom { height: 12%; }
.mood-sad .mouth { width: 42px; height: 14px; margin-left: -21px; border-radius: 30px 30px 0 0 / 14px 14px 0 0; top: 68%; }
.mood-sad .teeth, .mood-sad .tongue { opacity: 0; }
.mood-sad .cheek { opacity: 0.2; }
.mood-sad .eyeball::after {
  /* a welling tear */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 7px;
  height: 9px;
  margin-left: -3px;
  border-radius: 50% 50% 55% 55%;
  background: rgba(120, 180, 255, 0.85);
  animation: tear 2.4s ease-in infinite;
}
@keyframes tear {
  0%, 30% { transform: translateY(0); opacity: 0; }
  45% { opacity: 1; }
  100% { transform: translateY(26px); opacity: 0; }
}

/* Mood: angry */
.mood-angry .eye-left .brow { --br: 18deg; --by: 5px; }
.mood-angry .eye-right .brow { --br: -18deg; --by: 5px; }
.mood-angry .lid-top { height: 34%; }
.mood-angry .iris { background: radial-gradient(circle at 50% 50%, #c6391f 0%, #8f2412 50%, #4a1008 100%); }
.mood-angry .mouth { width: 50px; height: 12px; margin-left: -25px; border-radius: 4px; top: 66%; }
.mood-angry .teeth {
  height: 100%;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #fff 0 7px, #b8b1a5 7px 8px);
}
.mood-angry .tongue { opacity: 0; }
.mood-angry .cheek { opacity: 1; background: radial-gradient(ellipse, rgba(220, 60, 60, 0.6), rgba(220, 60, 60, 0) 72%); }

/* Mood: sleepy */
.mood-sleepy .lid-top { height: 58%; }
.mood-sleepy .lid-bottom { height: 10%; }
.mood-sleepy .brow { --by: 3px; }
.mood-sleepy .eye-left .brow { --br: -2deg; }
.mood-sleepy .eye-right .brow { --br: 2deg; }
.mood-sleepy .mouth { width: 26px; height: 9px; margin-left: -13px; border-radius: 0 0 14px 14px; top: 66%; }
.mood-sleepy .teeth, .mood-sleepy .tongue { opacity: 0; }
.mood-sleepy .cheek { opacity: 0.4; }
.mood-sleepy.character { animation-duration: 4.6s; }

/* Blink and talk ----------------------------------------------------------- */

.blink .lid-top { height: 100% !important; transition-duration: 0.07s; }

.talking .mouth { animation: talk 0.19s ease-in-out infinite alternate; }
.word .mouth { animation: word 0.22s ease-out 1; }
@keyframes word {
  0% { transform: scaleY(1.35) scaleX(0.94); }
  100% { transform: scaleY(0.7) scaleX(1.04); }
}
@keyframes talk {
  from { transform: scaleY(0.55) scaleX(1.05); }
  to { transform: scaleY(1.2) scaleX(0.96); }
}

.yawn .mouth { width: 34px; height: 40px; margin-left: -17px; border-radius: 50% 50% 45% 45%; }
.yawn .lid-top { height: 85%; }
.yawn .teeth { opacity: 0; }

/* Arms --------------------------------------------------------------------- */

.arm {
  position: absolute;
  top: 150px;
  width: 24px;
  height: 66px;
  transform-origin: 50% 10px;
  z-index: 2;
  animation: arm-sway 3.2s ease-in-out infinite;
}
.arm-left { left: 24px; }
.arm-right { right: 24px; animation-delay: -1.6s; }

@keyframes arm-sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

.arm::before {
  /* shoulder ball */
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--steel-0), var(--steel-2) 60%, var(--steel-3));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.upper, .fore, .thigh, .shin {
  background:
    linear-gradient(90deg, var(--steel-3) 0%, var(--steel-1) 30%, var(--steel-0) 48%, var(--steel-1) 66%, var(--steel-3) 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.upper { position: absolute; inset: 0; border-radius: 12px; }

.fore {
  position: absolute;
  top: 56px;
  left: 1px;
  width: 22px;
  height: 58px;
  border-radius: 11px;
  transform-origin: 50% 6px;
  transform: rotate(var(--elbow, 0deg));
  transition: transform 0.4s ease;
}
.fore::before {
  /* elbow ball */
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--steel-0), var(--steel-2) 60%, var(--steel-3));
}

.glove {
  position: absolute;
  top: 48px;
  left: 50%;
  width: 40px;
  height: 42px;
  margin-left: -20px;
  border-radius: 46% 46% 50% 50% / 40% 40% 60% 60%;
  background: radial-gradient(circle at 40% 30%, #ffffff, var(--glove) 50%, #dcdcd6 100%);
  box-shadow: inset -3px -5px 7px rgba(0, 0, 0, 0.18), 0 5px 8px rgba(0, 0, 0, 0.35);
}
.glove::before {
  /* thumb */
  content: "";
  position: absolute;
  top: 8px;
  width: 15px;
  height: 20px;
  border-radius: 50%;
  background: inherit;
  box-shadow: inset -2px -3px 4px rgba(0, 0, 0, 0.15);
}
.arm-left .glove::before { right: -8px; transform: rotate(-30deg); }
.arm-right .glove::before { left: -8px; transform: rotate(30deg); }
.glove::after {
  /* finger seams */
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 1px;
  height: 18px;
  margin-left: -0.5px;
  background: rgba(0, 0, 0, 0.14);
  box-shadow: -9px 1px 0 rgba(0, 0, 0, 0.12), 9px 1px 0 rgba(0, 0, 0, 0.12);
}
.glove { box-shadow: inset 0 5px 0 #d9ae46, inset -3px -5px 7px rgba(0, 0, 0, 0.18), 0 5px 8px rgba(0, 0, 0, 0.35); }

/* Legs --------------------------------------------------------------------- */

.legs {
  position: absolute;
  top: 282px;
  left: 50%;
  width: 130px;
  height: 122px;
  margin-left: -65px;
  z-index: 1;
}

.leg {
  position: absolute;
  top: 0;
  width: 26px;
  height: 62px;
  transform-origin: 50% 8px;
}
.leg-left { left: 24px; }
.leg-right { right: 24px; }

.thigh { position: absolute; inset: 0; border-radius: 13px; }

.shin {
  position: absolute;
  top: 54px;
  left: 1px;
  width: 24px;
  height: 52px;
  border-radius: 12px;
  transform-origin: 50% 6px;
}
.shin::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--steel-0), var(--steel-2) 60%, var(--steel-3));
}

.boot {
  position: absolute;
  top: 42px;
  width: 50px;
  height: 28px;
  background: linear-gradient(180deg, #3b3b46 0%, var(--boot) 60%, #0e0e12 100%);
  border-radius: 60% 55% 30% 30% / 70% 65% 40% 40%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.45), inset 0 2px 2px rgba(255, 255, 255, 0.15);
}
.leg-left .boot { left: -22px; transform: scaleX(-1); }
.leg-right .boot { left: -4px; }
.boot::before {
  /* toe cap shine */
  content: "";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 16px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.boot::after {
  /* sole */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  border-radius: 0 0 6px 6px;
  background: #5a4634;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   Behaviours
   -------------------------------------------------------------------------- */

/* Walking */
.walking.character { animation: walk-bob 0.56s ease-in-out infinite; }
@keyframes walk-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-7px) rotate(1.2deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-7px) rotate(-1.2deg); }
}
.walking .leg-left { animation: step 0.56s ease-in-out infinite; }
.walking .leg-right { animation: step 0.56s ease-in-out infinite; animation-delay: -0.28s; }
@keyframes step {
  0% { transform: rotate(30deg); }
  50% { transform: rotate(-30deg); }
  100% { transform: rotate(30deg); }
}
.walking .leg-left .shin { animation: knee 0.56s ease-in-out infinite; }
.walking .leg-right .shin { animation: knee 0.56s ease-in-out infinite; animation-delay: -0.28s; }
@keyframes knee {
  0% { transform: rotate(0deg); }
  40% { transform: rotate(-12deg); }
  65% { transform: rotate(-52deg); }
  100% { transform: rotate(0deg); }
}
.walking .arm-left { animation: arm-swing 0.56s ease-in-out infinite; animation-delay: -0.28s; }
.walking .arm-right { animation: arm-swing 0.56s ease-in-out infinite; }
@keyframes arm-swing {
  0% { transform: rotate(-32deg); }
  50% { transform: rotate(28deg); }
  100% { transform: rotate(-32deg); }
}
.walking .fore { --elbow: -22deg; }
.walking .arm { z-index: 4; }
.walking .bell { animation: bell-jiggle 0.56s ease-in-out infinite; }
@keyframes bell-jiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* Dance move 1: the twist */
.dance-1.character { animation: twist 1s ease-in-out infinite; }
@keyframes twist {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  25% { transform: translateY(-10px) rotate(0deg); }
  50% { transform: translateY(0) rotate(6deg); }
  75% { transform: translateY(-10px) rotate(0deg); }
}
.dance-1 .arm-left { animation: twist-arm-l 1s ease-in-out infinite; }
.dance-1 .arm-right { animation: twist-arm-r 1s ease-in-out infinite; }
@keyframes twist-arm-l {
  0%, 100% { transform: rotate(140deg); }
  50% { transform: rotate(175deg); }
}
@keyframes twist-arm-r {
  0%, 100% { transform: rotate(-175deg); }
  50% { transform: rotate(-140deg); }
}
.dance-1 .fore { --elbow: 0deg; }
.dance-1 .leg-left { animation: twist-leg 1s ease-in-out infinite; }
.dance-1 .leg-right { animation: twist-leg 1s ease-in-out infinite; animation-delay: -0.5s; }
@keyframes twist-leg {
  0%, 100% { transform: rotate(-14deg); }
  50% { transform: rotate(14deg); }
}
.dance-1 .shin { animation: twist-knee 0.5s ease-in-out infinite; }
@keyframes twist-knee {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-22deg); }
}

/* Dance move 2: disco point */
.dance-2.character { animation: disco 1s ease-in-out infinite; }
@keyframes disco {
  0%, 100% { transform: translate(-10px, 0) rotate(-4deg); }
  50% { transform: translate(10px, -6px) rotate(4deg); }
}
.dance-2 .arm-right { animation: disco-point 1s ease-in-out infinite; }
@keyframes disco-point {
  0%, 100% { transform: rotate(-168deg); }
  50% { transform: rotate(-20deg); }
}
.dance-2 .arm-right .fore { --elbow: 0deg; }
.dance-2 .arm-left { animation: none; transform: rotate(40deg); }
.dance-2 .arm-left .fore { --elbow: -110deg; }
.dance-2 .leg-left { animation: disco-leg 1s ease-in-out infinite; }
.dance-2 .leg-right { animation: disco-leg 1s ease-in-out infinite; animation-delay: -0.5s; }
@keyframes disco-leg {
  0%, 100% { transform: rotate(10deg); }
  50% { transform: rotate(-16deg); }
}
.dance-2 .leg-right .shin { animation: twist-knee 1s ease-in-out infinite; }
.dance-2 .leg-left .shin { animation: twist-knee 1s ease-in-out infinite; animation-delay: -0.5s; }

/* Dance move 3: jump and tuck */
.dance-3.character { animation: jump 1s cubic-bezier(0.3, 0, 0.2, 1) infinite; }
@keyframes jump {
  0%, 100% { transform: translateY(0) scale(1.03, 0.95); }
  20% { transform: translateY(-4px) scale(0.98, 1.04); }
  50% { transform: translateY(-48px) scale(1, 1); }
  85% { transform: translateY(0) scale(1.04, 0.94); }
}
.dance-3 .arm-left { animation: jump-arm-l 1s ease-in-out infinite; }
.dance-3 .arm-right { animation: jump-arm-r 1s ease-in-out infinite; }
@keyframes jump-arm-l {
  0%, 100% { transform: rotate(20deg); }
  50% { transform: rotate(160deg); }
}
@keyframes jump-arm-r {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(-160deg); }
}
.dance-3 .leg-left { animation: tuck-l 1s ease-in-out infinite; }
.dance-3 .leg-right { animation: tuck-r 1s ease-in-out infinite; }
@keyframes tuck-l { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-24deg); } }
@keyframes tuck-r { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(24deg); } }
.dance-3 .shin { animation: tuck-knee 1s ease-in-out infinite; }
@keyframes tuck-knee { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-70deg); } }

.dancing ~ .shadow, .actor.is-dancing .shadow { animation: shadow-dance 1s ease-in-out infinite; }
@keyframes shadow-dance {
  0%, 100% { transform: scale(1.05); opacity: 1; }
  50% { transform: scale(0.8); opacity: 0.6; }
}

.dancing .bell, .jingle .bell { animation: bell-rock 0.5s ease-in-out infinite; }
.dancing .bell-right, .jingle .bell-right { animation-delay: -0.25s; }
@keyframes bell-rock {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
}
.dancing .hammer, .jingle .hammer { animation: hammer-rock 0.25s ease-in-out infinite alternate; }
@keyframes hammer-rock {
  from { transform: rotate(-14deg); }
  to { transform: rotate(14deg); }
}

/* Ringing alarm */
.ringing.character { animation: ring-shake 0.09s linear infinite; }
@keyframes ring-shake {
  0% { transform: translate(-3px, 0) rotate(-1.5deg); }
  50% { transform: translate(3px, -2px) rotate(1.5deg); }
  100% { transform: translate(-3px, 0) rotate(-1.5deg); }
}
.ringing .bell-left { animation: ring-bell-l 0.1s linear infinite alternate; }
.ringing .bell-right { animation: ring-bell-r 0.1s linear infinite alternate; }
@keyframes ring-bell-l { from { transform: rotate(-11deg); } to { transform: rotate(9deg); } }
@keyframes ring-bell-r { from { transform: rotate(11deg); } to { transform: rotate(-9deg); } }
.ringing .hammer { animation: ring-hammer 0.1s linear infinite alternate; }
@keyframes ring-hammer { from { transform: rotate(-34deg); } to { transform: rotate(34deg); } }
.ringing .arm-left { animation: ring-arm-l 0.2s ease-in-out infinite alternate; }
.ringing .arm-right { animation: ring-arm-r 0.2s ease-in-out infinite alternate; }
@keyframes ring-arm-l { from { transform: rotate(150deg); } to { transform: rotate(170deg); } }
@keyframes ring-arm-r { from { transform: rotate(-150deg); } to { transform: rotate(-170deg); } }
.ringing .glass { background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 220, 120, 0.25) 40%, rgba(255, 255, 255, 0.08)); }

/* Poke reaction, stretch, wave */
.poked.character { animation: squash 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) 1; }
@keyframes squash {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.08, 0.9) translateY(4px); }
  60% { transform: scale(0.96, 1.06) translateY(-6px); }
  100% { transform: scale(1, 1); }
}
.stretch .arm-left { animation: stretch-l 2.4s ease-in-out 1; }
.stretch .arm-right { animation: stretch-r 2.4s ease-in-out 1; }
@keyframes stretch-l { 0%, 100% { transform: rotate(-4deg); } 30%, 70% { transform: rotate(165deg); } }
@keyframes stretch-r { 0%, 100% { transform: rotate(4deg); } 30%, 70% { transform: rotate(-165deg); } }
.wave .arm-right { animation: wave 1.6s ease-in-out 1; }
.wave .arm-right .fore { --elbow: -30deg; }
@keyframes wave {
  0%, 100% { transform: rotate(4deg); }
  20% { transform: rotate(-160deg); }
  40% { transform: rotate(-135deg); }
  60% { transform: rotate(-165deg); }
  80% { transform: rotate(-135deg); }
}

/* --------------------------------------------------------------------------
   Speech bubble
   -------------------------------------------------------------------------- */

.bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 18px);
  max-width: 260px;
  padding: 12px 16px;
  border-radius: 18px;
  background: #fff;
  color: #1d2330;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05);
  transform-origin: 50% 100%;
  transform: translate(calc(-50% + var(--bx, 0px)), 10px) scale(calc(0.85 / var(--scale, 1)));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 0.2s ease;
  z-index: 6;
  white-space: normal;
  width: max-content;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 3px;
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.08);
}
.bubble.show { opacity: 1; transform: translate(calc(-50% + var(--bx, 0px)), 0) scale(calc(1 / var(--scale, 1))); }

/* Tico is a button: poke it with a click, a tap, Enter or Space. */
.character:focus { outline: none; }
.character:focus-visible { outline: 3px solid #ffffff; outline-offset: 4px; box-shadow: 0 0 0 7px #1e1b4b; border-radius: 28px; }

/* ----- Under the stage ----- */
.stage-status { margin: 14px 0 18px; text-align: center; font-weight: 600; color: var(--text-2); min-height: 1.5em; }
.dock { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .dock { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 20px; min-width: 0; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--surface-hover-shadow); }
.dock-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 12px; }
.dock-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dock-buttons .btn { gap: 8px; }
.btn.is-on, .btn-secondary[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.btn.is-on:hover:not(:disabled), .btn-secondary[aria-pressed="true"]:hover:not(:disabled) { color: #fff; }
.btn kbd { font-size: 0.7rem; padding: 0 5px; }
.btn.is-on kbd, .btn[aria-pressed="true"] kbd { background: rgba(255, 255, 255, 0.22); border-color: transparent; color: #fff; }
.seg .mood-btn[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg .mood-btn[aria-pressed="true"] kbd { background: rgba(255, 255, 255, 0.22); border-color: transparent; color: #fff; }
.seg .mood-btn kbd { font-size: 0.68rem; padding: 0 5px; }
.alarm-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.alarm-row .field { flex: 0 1 auto; }
.alarm-input.input { width: 10em; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.alarm-input.input:disabled { opacity: 0.7; cursor: not-allowed; }
.alarm-chip { display: inline-flex; align-items: center; padding: 7px 13px; border-radius: 9999px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); color: var(--text-strong); font-size: 0.85rem; font-weight: 600; }
.alarm-ringing { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.alarm-ringing:not(:has(:not([hidden]))) { display: none; }
.btn-stop { background: var(--danger-strong); color: #fff; box-shadow: 0 4px 15px rgba(185, 28, 28, 0.3); }
.btn-stop:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(185, 28, 28, 0.4); color: #fff; }
.care-line { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--text); margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); }
.care-line .ico { color: var(--warn); margin-top: 2px; }

/* ----- Windows ----- */
.dialog .set-group { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--surface-border); }
.dialog .set-group:first-child { border-top: 0; padding-top: 0; }
.shortcuts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.shortcuts li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcuts li span:last-child { color: var(--text-2); text-align: right; }
.help-body .examples { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; font-size: 0.925rem; color: var(--text); }
.help-body .examples li { list-style: disc; }
.help-body:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .status-pill { min-width: 0; flex: 1 1 auto; }
    .toolbar-right .btn, .toolbar-right .voice-select { flex: 1 1 auto; }
    .voice-select { max-width: none; }
    .stage { height: clamp(420px, 62vh, 520px); }
    .card { padding: 16px; }
    .btn kbd, .seg .mood-btn kbd { display: none; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
    .bubble { max-width: 220px; }
}

/* ----- Reduced motion: Tico keeps still (no bob, steps, dance moves, shaking or drifting clouds); a walk still moves it
   across the stage, the hands jump, and the faces and moods still show ----- */
@media (prefers-reduced-motion: reduce) {
    .character, .character *, .character *::before, .character *::after, .shadow, .stars, .cloud, .zzz span { animation: none !important; }
    .actor, .celestial, .sky, .floor, .bubble, .iris, .pupil, .mouth, .brow, .eye, .lid, .fore { transition: none !important; }
    .cloud-1 { left: 8%; }
    .cloud-2 { left: 46%; }
    .cloud-3 { left: 72%; }
    .btn, .info-card, .card, .dialog, .dialog[open], .toast, .seg button, .chip { transition: none; animation: none; }
}
@media (forced-colors: active) {
    .stage { border: 1px solid CanvasText; }
    .bubble { border: 1px solid CanvasText; }
}
/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). Tico and the sky are a drawing. */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"]:not(.character),
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .seg button, main .chip, main .voice-select { min-height: 44px; }
    main :is(p, li, .hint, .label, .status-main, .status-sub, .form-hint, .input, .select, .seg button, .chip, .muted,
        .stage-status, .alarm-chip, .care-line, .banner, .btn, .dock-title, .bubble) { font-size: 1rem; }
    .clock-pill .status-main { font-size: 1.1rem; }
    .dialog button, .dialog .btn, .dialog select, .dialog input:not([type="checkbox"]):not([type="range"]) { min-height: 44px; }
    .dialog .dialog-close { width: 44px; height: 44px; }
    .dialog :is(p, .hint, .label, .input, li, kbd) { font-size: 1rem; }
}
