@import url("https://fonts.googleapis.com/css2?family=Geologica:wght@100..900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Tiny5&family=Unbounded:wght@300;400;500;600;700;800;900&display=swap");

@font-face {
  font-family: "Cakra";
  src:
    url("/fonts/Cakra-Normal.woff2") format("woff2"),
    url("/fonts/Cakra-Normal.woff") format("woff"),
    url("/fonts/Cakra-Normal.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 300 800;
}

@font-face {
  font-family: "ST Nizhegorodsky";
  src: url("/fonts/ST-Nizhegorodsky.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: dark;
  --void-black: #000;
  --deep-plum: #000;
  --royal-purple: #0a0a0a;
  --plum-glow: rgba(255, 255, 255, 0.08);
  --mustard-gold: rgba(255, 255, 255, 0.9);
  --mustard-soft: rgba(255, 255, 255, 0.62);
  --mustard-faint: rgba(255, 255, 255, 0.16);
  --warm-white: rgba(255, 255, 255, 0.96);
  --warm-soft: rgba(255, 255, 255, 0.72);
  --muted-lavender: rgba(255, 255, 255, 0.46);
  --lavender-faint: rgba(255, 255, 255, 0.26);
  --hairline: rgba(255, 255, 255, 0.28);
  --glass: rgba(0, 0, 0, 0.38);
  --status-ok: rgba(255, 255, 255, 0.72);
  --status-warn: rgba(255, 255, 255, 0.72);
  --font-ui: "Geologica", "ST Nizhegorodsky", "Cakra", "Segoe UI", system-ui, sans-serif;
  --font-display: "Geologica", "ST Nizhegorodsky", "Cakra", "Arial Narrow", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--warm-white);
  background: var(--void-black);
}

ol,
p,
h2 {
  margin: 0;
}

.mirror {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  --w-unit: 1vw;
  --h-unit: 1vh;
  overflow: hidden;
  isolation: isolate;
  font-family: var(--font-ui);
  background: #000;
}

.mirror::before {
  content: none;
  position: absolute;
  inset: 0;
  z-index: -2;
  background: none;
  opacity: 0;
  filter: none;
  pointer-events: none;
  transform: none;
  animation: none;
  will-change: auto;
}

.mirror::after {
  content: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  background: none;
  pointer-events: none;
}

.mirror-glass {
  display: none;
}


.mirror[data-design="signal"] .date-line,
.mirror[data-design="signal"] .module-markets h2,
.mirror[data-design="signal"] .module-calendar h2,
.mirror[data-design="signal"] .weather-place {
  letter-spacing: 0.22em;
}

.mirror[data-design="signal"] .time-main,
.mirror[data-design="signal"] .weather-temp,
.mirror[data-design="signal"] .market-row strong {
  font-weight: 800;
}

.photo-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.012);
  transition: opacity 420ms ease, transform 900ms ease;
  background: #000;
}

.photo-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.photo-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.5s ease;
  transform: scale(1);
  will-change: transform;
}

.photo-image.photo-img-active {
  opacity: 1;
  animation: kenburns-scale-photo 15s linear infinite;
}

@keyframes kenburns-scale-photo {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.photo-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.36)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 42%, rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.photo-caption {
  position: absolute;
  right: clamp(18px, 2.2vw, 36px);
  bottom: clamp(18px, 3vh, 36px);
  z-index: 1;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

.photo-caption p,
.photo-caption span {
  margin: 0;
  font-size: clamp(0.78rem, 0.9vw, 0.95rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-caption span {
  color: rgba(255, 255, 255, 0.64);
}

.photo-mode .photo-screen {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.photo-mode .module {
  opacity: 0;
  transform: translate3d(calc(var(--layout-x, 6) * var(--w-unit)), calc(var(--layout-y, 6) * var(--h-unit) - 10px), 0);
  pointer-events: none;
}
.photo-mode .gallery-screen,
.photo-mode .ar-screen {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.gallery-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.01);
  transition: opacity 520ms ease, transform 900ms ease;
}

.gallery-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gallery-stage img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  transform: scale(1);
  will-change: transform;
}

.gallery-stage img.gallery-img-active {
  opacity: 1;
  animation: kenburns-scale 45s linear infinite;
}

@keyframes kenburns-scale {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.gallery-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 1, 8, 0.2), transparent 34%, rgba(5, 1, 8, 0.82)),
    radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.48));
  pointer-events: none;
}

.gallery-caption {
  position: absolute;
  z-index: 1;
  left: clamp(24px, 4vw, 62px);
  bottom: clamp(42px, 7vh, 86px);
  max-width: min(52vw, 720px);
  padding: 16px 20px 16px 18px;
  border-left: 2px solid var(--mustard-gold);
  border-radius: 0 22px 22px 0;
  background: linear-gradient(90deg, rgba(8, 2, 12, 0.95), rgba(8, 2, 12, 0.5));
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.9vw, 1.95rem);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.gallery-artist {
  margin-top: 6px;
  color: var(--mustard-soft);
  font-size: clamp(0.78rem, 1vw, 1rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-mode .gallery-screen {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.gallery-mode .module {
  opacity: 0;
  transform: translate3d(calc(var(--layout-x, 6) * var(--w-unit)), calc(var(--layout-y, 6) * var(--h-unit) - 10px), 0);
  pointer-events: none;
}

.ar-screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}

.ar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.ar-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 44%, rgba(5, 1, 8, 0.54)),
    linear-gradient(180deg, rgba(5, 1, 8, 0.18), transparent 22%, rgba(5, 1, 8, 0.56));
  pointer-events: none;
}

.ar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ar-hud {
  position: absolute;
  top: clamp(24px, 4vw, 54px);
  left: clamp(22px, 4vw, 62px);
  max-width: min(46vw, 560px);
  padding: 14px 18px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.54);
}

.ar-kicker {
  color: var(--mustard-gold);
  font-size: clamp(0.74rem, 1vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ar-tracking {
  margin-top: 5px;
  color: var(--warm-soft);
  font-size: clamp(0.92rem, 1.3vw, 1.22rem);
}

.ar-message {
  position: absolute;
  left: 50%;
  top: 50%;
  color: var(--warm-soft);
  font-size: clamp(1.2rem, 2vw, 2rem);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.95);
  transform: translate(-50%, -50%);
}

.ar-message:empty {
  display: none;
}

.ar-controls {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 5vh, 54px);
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}

.ar-controls button {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--warm-soft);
  background: rgba(9, 2, 13, 0.46);
  font: inherit;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.05);
}

.ar-controls button.active {
  color: var(--void-black);
  border-color: var(--mustard-gold);
  background: var(--mustard-gold);
}

.ar-mode .ar-screen {
  opacity: 1;
  pointer-events: auto;
}

.ar-mode .module {
  opacity: 0;
  transform: translate3d(calc(var(--layout-x, 6) * var(--w-unit)), calc(var(--layout-y, 6) * var(--h-unit) - 10px), 0);
  pointer-events: none;
}

.module {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--layout-w, 42) * var(--w-unit));
  height: calc(var(--layout-h, 12) * var(--h-unit));
  min-height: 0;
  max-width: none;
  z-index: 1;
  contain: layout style;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.14), 0 2px 8px rgba(0, 0, 0, 0.82);
  transform: translate3d(calc(var(--layout-x, 6) * var(--w-unit)), calc(var(--layout-y, 6) * var(--h-unit)), 0);
  transition: opacity 260ms ease, transform 260ms ease;
  will-change: transform, opacity;
}

.module-clock {
  --layout-x: 6;
  --layout-y: 4;
  --layout-w: 52;
  --layout-h: 10;
}

.module-weather {
  --layout-x: 52;
  --layout-y: 6;
  --layout-w: 42;
  --layout-h: 14;
}

.module-calendar {
  --layout-x: 6;
  --layout-y: 18;
  --layout-w: 52;
  --layout-h: 26;
}

.module-markets {
  --layout-x: 0;
  --layout-y: 92;
  --layout-w: 100;
  --layout-h: 8;
}

.module-news {
  --layout-x: 8;
  --layout-y: 88;
  --layout-w: 84;
  --layout-h: 8;
}

.module-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-size: var(--module-fit-size, 16px);
  transform-origin: top left;
}

.module-clock .module-content,
.module-news .module-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.module-news .module-content {
  align-items: center;
}

.module.align-right .module-content {
  transform-origin: top right;
}

.module.align-center .module-content {
  transform-origin: top center;
}

.module.align-right {
  text-align: right;
}

.module.align-center {
  text-align: center;
}

.module-hidden {
  opacity: 0;
  transform: translate3d(calc(var(--layout-x, 6) * var(--w-unit)), calc(var(--layout-y, 6) * var(--h-unit) + 10px), 0);
  pointer-events: none;
}

.layout-edit-mode .module:not(.module-hidden) {
  outline: 1px solid rgba(255, 255, 255, 0.58);
  outline-offset: 10px;
  border-radius: 18px;
}

.layout-edit-mode .module:not(.module-hidden)::before {
  content: attr(data-layout-label);
  position: absolute;
  top: -34px;
  left: 0;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.layout-edit-mode .module.align-right::before {
  left: auto;
  right: 0;
}

.date-line {
  margin-bottom: 2px;
  color: var(--warm-soft);
  font-family: var(--font-display);
  font-size: 1.22em;
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.time-line {
  display: flex;
  align-items: flex-start;
  gap: 0.08em;
  font-family: var(--font-display);
  line-height: 0.86;
  white-space: nowrap;
}

.time-main {
  color: var(--warm-white);
  font-size: 5.4em;
  font-weight: 500;
  letter-spacing: -0.05em;
}

.time-seconds {
  padding-top: 0.18em;
  color: var(--mustard-soft);
  font-size: 1.25em;
  font-weight: 500;
}

.time-period {
  align-self: flex-end;
  padding-bottom: 0.16em;
  color: var(--muted-lavender);
  font-size: 2.1em;
  font-weight: 400;
}

.module-markets h2,
.module-calendar h2 {
  margin-bottom: 0.68em;
  padding-bottom: 0.46em;
  border-bottom: 1px solid var(--hairline);
  color: var(--mustard-gold);
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.module-markets h2 {
  text-align: inherit;
}

.event-list,
.forecast-list {
  list-style: none;
  padding: 0;
}

.event-list {
  display: grid;
  gap: 0.45em;
}

.event-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 1.4em;
  align-items: baseline;
  font-size: 0.95em;
}

.event-name {
  overflow: hidden;
  color: var(--warm-white);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-time {
  color: var(--muted-lavender);
  font-size: 0.88em;
}

.weather-now {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.74em;
  margin-bottom: 0.82em;
}

.module:not(.align-right) .weather-now {
  justify-content: flex-start;
}

.module.align-center .weather-now {
  justify-content: center;
}

.weather-icon {
  width: 3.4em;
  height: 3.4em;
  color: var(--mustard-gold);
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px var(--mustard-faint));
}

.weather-temp {
  font-family: var(--font-display);
  font-size: 4.2em;
  line-height: 0.92;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.weather-temp span {
  margin-left: 0.12em;
  color: var(--mustard-soft);
  font-size: 0.34em;
  vertical-align: super;
}

.weather-place {
  margin-top: 0.38em;
  color: var(--muted-lavender);
  font-size: 0.78em;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.forecast-list {
  display: grid;
  gap: 0.34em;
  width: 100%;
  min-width: 0;
  margin-left: auto;
  padding-top: 0.62em;
  border-top: 1px solid var(--hairline);
}

.forecast-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.72em;
  color: var(--muted-lavender);
  font-size: 0.78em;
}

.forecast-list strong,
.forecast-list em {
  color: var(--warm-soft);
  font-style: normal;
  font-weight: 500;
  text-align: right;
}

.forecast-list svg {
  width: 1.1em;
  height: 1.1em;
  color: var(--mustard-gold);
  flex-shrink: 0;
  align-self: center;
}

.market-group {
  display: grid;
  gap: 0.44em;
  width: 100%;
  min-width: 0;
}

.market-group + .market-group {
  margin-top: 1em;
  padding-top: 0.75em;
  border-top: 1px solid var(--hairline);
}

.market-row {
  display: grid;
  grid-template-columns: minmax(5.5em, 1fr) minmax(5.8em, max-content) minmax(4.2em, max-content);
  gap: 0.8em;
  align-items: baseline;
  font-size: 0.84em;
}

.market-row span {
  overflow: hidden;
  color: var(--warm-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-row strong {
  color: var(--warm-white);
  font-family: var(--font-display);
  font-size: 1.14em;
  font-weight: 600;
  text-align: right;
}

.market-row em {
  color: var(--muted-lavender);
  font-style: normal;
  text-align: right;
}

.market-row em.up {
  color: rgba(178, 247, 207, 0.8);
}

.market-row em.down {
  color: rgba(255, 182, 182, 0.78);
}

.news-headline {
  color: var(--warm-white);
  font-family: var(--font-display);
  font-size: 1.35em;
  font-weight: 700;
  line-height: 1.16;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.9);
  transition: opacity 300ms ease, transform 300ms ease;
  will-change: transform, opacity;
}
.news-hidden {
  opacity: 0;
  transform: translateY(4px);
}

.mirror-status,
.mirror-meta {
  position: absolute;
  z-index: 8;
  right: clamp(16px, 2vw, 28px);
  color: var(--status-warn);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.5;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.95);
}

.mirror-status {
  bottom: clamp(18px, 3vh, 34px);
}

.mirror-status.connected {
  color: var(--status-ok);
}

.mirror-meta {
  bottom: clamp(38px, 6vh, 64px);
  max-width: 42vw;
  text-align: right;
}

.pairing-panel {
  position: absolute;
  z-index: 9;
  left: clamp(18px, 3vw, 34px);
  bottom: clamp(18px, 3vh, 34px);
  width: clamp(250px, 18vw, 330px);
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  color: var(--warm-soft);
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.58);
  text-align: center;
}

.pairing-panel:not([hidden]) {
  animation: slide-up-fade 420ms ease forwards;
}

@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pairing-panel[hidden] {
  display: none;
}

.pairing-panel p {
  margin-bottom: 10px;
  color: var(--mustard-gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pairing-qr {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 4px solid #fff;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.pairing-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.pairing-qr.error {
  padding: 12px;
  color: var(--status-warn);
  font-size: 0.7rem;
  line-height: 1.25;
}

.pairing-panel span {
  display: block;
  margin-top: 9px;
  font-size: 0.72rem;
  line-height: 1.25;
}

.display-blackout {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: block;
  width: 100vw;
  height: 100vh;
  background: #000;
  pointer-events: auto;
}

.display-blackout[hidden] {
  display: none !important;
}

html.display-off,
body.display-off,
.mirror.display-off {
  background: #000 !important;
}

.mirror.display-off > :not(.mirror-glass) {
  visibility: hidden !important;
}

.mirror.display-off > .display-blackout {
  visibility: visible !important;
}

.mirror.display-off::before {
  content: none !important;
  display: none !important;
}

.mirror.display-off::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: block;
  background: #000 !important;
  pointer-events: auto;
}

@media (max-width: 520px) {
  body {
    overflow: auto;
  }

  .mirror {
    min-height: 100svh;
    padding: 26px 22px 30px;
    display: grid;
    gap: 28px;
    align-content: start;
  }

  .photo-screen,
  .gallery-screen {
    position: fixed;
    inset: 0;
    min-height: 100svh;
    padding: 0;
  }

  .ar-screen {
    position: fixed;
    inset: 0;
  }

  .ar-hud {
    right: 18px;
    max-width: none;
  }

  .ar-controls {
    width: calc(100vw - 32px);
    justify-content: center;
    flex-wrap: wrap;
  }

  .gallery-stage {
    width: 100%;
    height: 100%;
  }

  .gallery-caption {
    left: 18px;
    right: 18px;
    bottom: 24px;
    max-width: none;
    text-align: center;
  }

  .photo-caption {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-content: space-between;
  }

  .module {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: none;
    transform: none;
  }

  .module-markets h2 {
    text-align: left;
  }

  .weather-now {
    justify-content: flex-start;
  }

  .forecast-list {
    width: 100%;
    margin-left: 0;
  }

  .market-group {
    min-width: 0;
  }

  .mirror-status,
  .mirror-meta,
  .pairing-panel {
    position: fixed;
    right: 16px;
    max-width: calc(100vw - 32px);
  }

  .pairing-panel {
    left: 16px;
    right: auto;
    width: min(72vw, 310px);
  }
}

@media (max-width: 520px) {
  .event-list li,
  .forecast-list li {
    font-size: 0.88rem;
  }

  .event-list li {
    gap: 12px;
  }

  .mirror-meta {
    display: none;
  }
}

/* ── Clock colon blink ── */
@keyframes colon-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.time-colon {
  animation: colon-blink 1s steps(1) infinite;
}

.greeting-line {
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 500;
  margin-top: -0.2em;
  color: var(--muted-lavender);
}

/* ── Notification toast ── */
.toast-container {
  position: fixed;
  top: clamp(28px, 5vh, 60px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 12;
  max-width: min(80vw, 620px);
  padding: 16px 28px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 380ms ease, transform 380ms ease;
}

.toast-container.toast-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.toast-text {
  margin: 0;
  color: var(--warm-white);
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.12);
}

/* ── Gallery crossfade GPU hint ── */
.gallery-stage {
  will-change: auto;
}

.gallery-mode .gallery-stage img {
  will-change: opacity;
}

/* ── Connection status pulse ── */
@keyframes status-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

.mirror-status:not(.connected) {
  animation: status-pulse 2s ease-in-out infinite;
}

/* ── Signal breathing glow ── */
@keyframes signal-breathe {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.35; }
}

/* ── Smooth Clock Colon Blink ── */
.time-colon {
  animation: blink-opacity 2s infinite;
  will-change: opacity;
}

@keyframes blink-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* ── Weather SVG Animations ── */
.sun-beams {
  transform-origin: 32px 32px;
  animation: rotate-clockwise 25s linear infinite;
  will-change: transform;
}

.sun-beams-small {
  transform-origin: 26px 22px;
  animation: rotate-clockwise 20s linear infinite;
  will-change: transform;
}

@keyframes rotate-clockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.weather-cloud {
  animation: float-cloud 4s ease-in-out infinite;
  will-change: transform;
}

@keyframes float-cloud {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}

.weather-drops line {
  animation: rain-fall 1.5s linear infinite;
  will-change: transform;
}

.weather-drops line:nth-child(2) {
  animation-delay: 0.5s;
}

.weather-drops line:nth-child(3) {
  animation-delay: 1s;
}

@keyframes rain-fall {
  0% { transform: translateY(-4px); opacity: 0; }
  30% { opacity: 1; }
  80% { opacity: 0.8; }
  100% { transform: translateY(8px); opacity: 0; }
}

.weather-snowflakes circle {
  animation: snow-fall 2.5s linear infinite;
  will-change: transform;
}

.weather-snowflakes circle:nth-child(even) {
  animation-delay: 1.25s;
  animation-duration: 2s;
}

@keyframes snow-fall {
  0% { transform: translateY(-3px) translateX(0); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 0.8; }
  100% { transform: translateY(6px) translateX(1px); opacity: 0; }
}

/* Music Module */
.module-music {
  --layout-x: 30;
  --layout-y: 75;
  --layout-w: 40;
  --layout-h: 15;
}

.music-container {
  display: flex;
  align-items: center;
  gap: 0.8em;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.6em;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
}

.music-art {
  width: 4em;
  height: 4em;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.music-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.music-title {
  color: var(--warm-white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-artist {
  color: var(--mustard-soft);
  font-size: 0.85em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2em;
}

/* Marquee Markets */
.marquee-container {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.5);
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
}

.marquee-content {
  display: inline-block;
  padding-left: 100vw;
  animation: marquee 30s linear infinite;
  color: var(--warm-white);
  font-family: var(--font-display);
  font-size: 1.4em;
  font-weight: 500;
  letter-spacing: 0.05em;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

}

.toast-text {
  margin: 0;
  color: var(--warm-white);
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.12);
}

/* ── Gallery crossfade GPU hint ── */
.gallery-stage {
  will-change: auto;
}

.gallery-mode .gallery-stage img {
  will-change: opacity;
}

/* ── Connection status pulse ── */
@keyframes status-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

.mirror-status:not(.connected) {
  animation: status-pulse 2s ease-in-out infinite;
}

/* ── Signal breathing glow ── */
@keyframes signal-breathe {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.35; }
}

/* ── Smooth Clock Colon Blink ── */
.time-colon {
  animation: blink-opacity 2s infinite;
  will-change: opacity;
}

@keyframes blink-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* ── Weather SVG Animations ── */
.sun-beams {
  transform-origin: 32px 32px;
  animation: rotate-clockwise 25s linear infinite;
  will-change: transform;
}

.sun-beams-small {
  transform-origin: 26px 22px;
  animation: rotate-clockwise 20s linear infinite;
  will-change: transform;
}

@keyframes rotate-clockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.weather-cloud {
  animation: float-cloud 4s ease-in-out infinite;
  will-change: transform;
}

@keyframes float-cloud {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}

.weather-drops line {
  animation: rain-fall 1.5s linear infinite;
  will-change: transform;
}

.weather-drops line:nth-child(2) {
  animation-delay: 0.5s;
}

.weather-drops line:nth-child(3) {
  animation-delay: 1s;
}

@keyframes rain-fall {
  0% { transform: translateY(-4px); opacity: 0; }
  30% { opacity: 1; }
  80% { opacity: 0.8; }
  100% { transform: translateY(8px); opacity: 0; }
}

.weather-snowflakes circle {
  animation: snow-fall 2.5s linear infinite;
  will-change: transform;
}

.weather-snowflakes circle:nth-child(even) {
  animation-delay: 1.25s;
  animation-duration: 2s;
}

@keyframes snow-fall {
  0% { transform: translateY(-3px) translateX(0); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 0.8; }
  100% { transform: translateY(6px) translateX(1px); opacity: 0; }
}

/* Music Module */
.module-music {
  --layout-x: 30;
  --layout-y: 75;
  --layout-w: 40;
  --layout-h: 15;
}

.music-container {
  display: flex;
  align-items: center;
  gap: 0.8em;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.6em;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
}

.music-art {
  width: 4em;
  height: 4em;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.music-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.music-title {
  color: var(--warm-white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-artist {
  color: var(--mustard-soft);
  font-size: 0.85em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2em;
}

/* Marquee Markets */
.marquee-container {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.5);
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
}

.marquee-content {
  display: inline-block;
  padding-left: 100vw;
  animation: marquee 30s linear infinite;
  color: var(--warm-white);
  font-family: var(--font-display);
  font-size: 1.4em;
  font-weight: 500;
  letter-spacing: 0.05em;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.market-sep {
  color: var(--muted-lavender);
  margin: 0 1.2em;
}

.marquee-content .up { color: rgba(178, 247, 207, 0.9); font-size: 0.85em; }
.marquee-content .down { color: rgba(255, 182, 182, 0.9); font-size: 0.85em; }

@media (orientation: portrait) {
  .mirror.orientation-horizontal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vh;
    height: 100vw;
    --w-unit: 1vh;
    --h-unit: 1vw;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
  }
}

@media (orientation: landscape) {
  .mirror.orientation-vertical {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vh;
    height: 100vw;
    --w-unit: 1vh;
    --h-unit: 1vw;
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center;
  }
}

.markets-chart-container {
  margin-top: 15px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(8px);
  width: 100%;
}

.markets-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.markets-chart-title {
  color: var(--mustard-gold);
  font-family: var(--font-display);
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.markets-chart-buttons {
  display: flex;
  gap: 4px;
}

.markets-chart-buttons button {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--muted-lavender);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.7em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.markets-chart-buttons button.active {
  background: var(--mustard-gold);
  color: #000;
  border-color: var(--mustard-gold);
}

.markets-chart-svg-wrapper {
  width: 100%;
  height: auto;
}

#marketsChartSvg {
  width: 100%;
  display: block;
}

.chart-line {
  fill: none;
  stroke: var(--mustard-gold);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 6px rgba(255, 255, 255, 0.15));
}

.chart-area {
  fill: url(#chartGradient);
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  stroke-dasharray: 4, 4;
}

.chart-text {
  fill: var(--muted-lavender);
  font-family: var(--font-ui);
  font-size: 10px;
}