:root {
  --clock-gold: #AA771C;
  --clock-gold-light: #D4AF37;
  --clock-red: #ff3b30;
  --clock-green: #4cd964;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 0;
  background: transparent;
  color: #333;
  font-family: Arial, Helvetica, sans-serif;
}
body { overflow: hidden; }

#school-clock-container {
  position: relative;
  width: 100%;
  max-width: 270px;
  margin: 3px auto 0;
  padding: 0 3px 2px;
  text-align: center;
  transition: transform .25s ease;
  transform-origin: center top;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#school-clock-container:hover,
#school-clock-container.touch-active { transform: scale(1.025); }

#school-clock {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
}
.clock-bell, .clock-foot { fill: var(--clock-gold); }
.clock-label {
  width: 100%;
  margin: 5px auto;
  color: #333;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.28;
  overflow-wrap: anywhere;
  text-align: center;
}
#clock-top-text { min-height: 16px; }
#clock-bottom-text { min-height: 17px; }

.clock-number {
  fill: #333;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.clock-min-tick { stroke: #999; stroke-width: 1; }
.clock-hour-tick { stroke: #333; stroke-width: 2; stroke-linecap: round; }

.status-red { fill: var(--clock-red) !important; }
.status-green { fill: var(--clock-green) !important; }
.prepare-mode #clock-body {
  stroke: var(--clock-red);
  stroke-width: 3;
  animation: prepare-pulse .8s infinite;
}
@keyframes prepare-pulse {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: .25; }
}

@keyframes clock-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-2px) rotate(-2deg); }
  40% { transform: translateX(2px) rotate(2deg); }
  60% { transform: translateX(-2px) rotate(-2deg); }
  80% { transform: translateX(2px) rotate(2deg); }
}
.alarm-shaking { animation: clock-shake .12s infinite; }
@keyframes light-show-red {
  0%, 100% { fill: var(--clock-red); }
  50% { fill: #fff; }
}
@keyframes light-show-green {
  0%, 100% { fill: var(--clock-green); }
  50% { fill: #fff; }
}
.police-flash-red { animation: light-show-red .2s infinite; }
.police-flash-green { animation: light-show-green .2s infinite; }

#hour-tracker-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  margin: 7px 0 0;
}
#hour-tracker-container::before {
  content: "ЧАСОВЕ";
  flex: 0 0 auto;
  margin-right: 2px;
  color: #555;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .15px;
  white-space: nowrap;
}
.tracker-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--clock-gold-light);
  border-radius: 50%;
  background: #fff;
  color: #333;
  transition: background .2s ease, border-color .2s ease;
}
.tracker-number {
  display: block;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
#progress-ring {
  transition: stroke-dashoffset .25s linear;
}
@keyframes dot-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, .65); }
  70% { transform: scale(1.12); box-shadow: 0 0 0 5px rgba(255, 59, 48, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}
.tracker-dot.current {
  border-color: var(--clock-red);
  background: var(--clock-red);
  color: #fff;
  animation: dot-pulse 1.5s infinite;
}
.tracker-dot.passed { border-color: #b0b0b0; background: #e0e0e0; color: #666; }
.tracker-dot.passed::after {
  content: "×";
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  color: var(--clock-gold);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

/* Информационният прозорец стои вътре в iframe и не се отрязва от горния му ръб. */
.clock-tooltip-box {
  position: absolute;
  z-index: 50;
  top: 42px;
  left: 50%;
  width: 222px;
  max-width: calc(100% - 14px);
  max-height: 245px;
  overflow: auto;
  padding: 10px;
  transform: translateX(-50%);
  border: 2px solid var(--clock-gold-light);
  border-radius: 9px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s ease, visibility .2s ease;
  pointer-events: none;
  text-align: center;
}
#school-clock-container:hover .clock-tooltip-box,
#school-clock-container.touch-active .clock-tooltip-box {
  visibility: visible;
  opacity: 1;
}
.clock-tooltip-box h4 {
  margin: 0 0 6px;
  color: var(--clock-gold);
  font-size: 13px;
  line-height: 1.25;
}
.clock-tooltip-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  font-size: 11px;
}
.clock-tooltip-box li {
  padding: 4px 3px;
  border-bottom: 1px solid #eee;
  color: #333;
  line-height: 1.25;
}
.clock-tooltip-box li.highlighted-row {
  border-radius: 3px;
  background: #fff0f0;
  color: var(--clock-red);
  font-weight: 700;
}
.hidden-warning {
  display: none;
  padding: 7px 0;
  color: var(--clock-red);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.holiday-card-box {
  padding: 7px;
  border-right: 4px solid #D62612;
  border-left: 4px solid #00966E;
  border-radius: 6px;
  background: linear-gradient(135deg, #fff 0%, #f9f6f0 100%);
}
#holiday-title { margin: 3px 0 5px; color: #D62612; font-size: 14px; line-height: 1.25; }
#holiday-message { margin: 0; color: #444; font-size: 11px; line-height: 1.35; }
.style-hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

#mute-btn {
  position: absolute; top: 2px; right: 2px; z-index: 60;
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--clock-gold-light);
  border-radius: 50%; background: rgba(255,255,255,.9); font-size: 12px; line-height: 1; cursor: pointer;
}
#mute-btn:hover { background: #fff6dc; }

/* Анимации на надписа за междучасие */
#clock-top-text { transform-origin: center; }
.txt-blink { animation: txt-blink var(--txt-speed, 1.2s) steps(1, end) infinite; }
.txt-pulse { animation: txt-pulse var(--txt-speed, 1.2s) ease-in-out infinite; }
.txt-glow { animation: txt-glow var(--txt-speed, 1.2s) ease-in-out infinite; }
.txt-rainbow { animation: txt-rainbow calc(var(--txt-speed, 1.2s) * 3) linear infinite; }
@keyframes txt-blink { 50% { opacity: .15; } }
@keyframes txt-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes txt-glow { 0%, 100% { text-shadow: none; } 50% { text-shadow: 0 0 5px #4cd964, 0 0 11px #4cd964; } }
@keyframes txt-rainbow { 0%, 100% { color: #e53935; } 25% { color: #fb8c00; } 50% { color: #43a047; } 75% { color: #1e88e5; } }
@media (prefers-reduced-motion: reduce) { .txt-blink, .txt-pulse, .txt-glow, .txt-rainbow { animation: none; } }
