.clock-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 160px;
  height: 160px;
  margin-bottom: 12px;
  background: radial-gradient(circle at 60% 40%, rgba(255,255,255,0.85) 0%, rgba(240,240,240,0.45) 70%, rgba(220,220,220,0.18) 100%);
  box-shadow: 0 12px 40px 0 rgba(60,60,60,0.18), 0 2px 12px 0 rgba(0,0,0,0.12);
  border-radius: 50%;
  transition: background 0.3s, box-shadow 0.3s;
}
.clock-face {
  position: relative;
  width: 160px;
  height: 160px;
  /* ...existing code... */
}
#slide-clock-container {
  position: fixed; top: 20px; right: 20px;
  width: 260px;
  height: auto; max-height: 80vh;
  z-index: 2147483647;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: rgba(30, 30, 30, 0.95); backdrop-filter: blur(8px);
  border-radius: 24px; padding: 15px; cursor: move;
  font-family: 'Roboto', Arial, sans-serif; color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  transform-origin: top left;
  overflow-y: auto; overflow-x: hidden;
  touch-action: none;
}

#slide-clock-container::-webkit-scrollbar { width: 0; }

/* --- RESIZE HANDLES --- */
.resize-handle {
  position: absolute;
  z-index: 101;
}
.resize-handle.corner { width: 20px; height: 20px; }
.resize-handle.edge { background: transparent; }
.resize-handle.top { top: 0; left: 20px; right: 20px; height: 5px; cursor: ns-resize; }
.resize-handle.bottom { bottom: 0; left: 20px; right: 20px; height: 5px; cursor: ns-resize; }
.resize-handle.left { left: 0; top: 20px; bottom: 20px; width: 5px; cursor: ew-resize; }
.resize-handle.right { right: 0; top: 20px; bottom: 20px; width: 5px; cursor: ew-resize; }
.resize-handle.top-left { top: 0; left: 0; cursor: nwse-resize; }
.resize-handle.top-right { top: 0; right: 0; cursor: nesw-resize; }
.resize-handle.bottom-left { bottom: 0; left: 0; cursor: nesw-resize; }
.resize-handle.bottom-right { bottom: 0; right: 0; cursor: nwse-resize; }
#slide-clock-container.maximized-mode .resize-handle { display: none; }

/* --- MODES --- */
#slide-clock-container.minimal-mode { width: 190px; overflow: hidden; }
#slide-clock-container.minimal-mode .controls { display: none !important; }

/* Visual indicator for settings panel */
#slide-clock-container .controls {
  background: rgba(255, 255, 255, 0.92);
  border: 4px solid #fff;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  margin-top: 10px;
  padding: 12px 8px 8px 8px;
  transition: background 0.2s, border 0.2s;
  outline: none;
}


#slide-clock-container.maximized-mode {
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  background: #000000 !important;
  border-radius: 0 !important;
  justify-content: center !important;
  align-items: center !important;
  cursor: default;
  padding: 0;
  overflow: hidden;
}
#slide-clock-container.maximized-mode .clock-face {
  width: 90vw;
  height: 90vw;
  max-width: 90vh;
  max-height: 90vh;
  margin: 0;
  transform: none;
}
#slide-clock-container.maximized-mode .controls { display: none !important; }
#slide-clock-container.maximized-mode #donation-link { display: none; }
#slide-clock-container.maximized-mode #btn-maximize { top: 40px; right: 40px; transform: scale(1.5); }
#slide-clock-container.maximized-mode #case-sound-toggle { bottom: 40px; right: 40px; transform: scale(1.5); }

/* --- ALARM ANIMATION --- */
@keyframes flashRed {
  0% { background-color: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
  50% { background-color: rgba(255, 200, 200, 1); box-shadow: 0 0 30px 10px rgba(255, 0, 0, 0.8); }
  100% { background-color: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}
.clock-face.alarm-active { animation: flashRed 1s infinite; border-color: red; }

/* --- CLOCK FACE --- */
.clock-face {
  width: 160px; height: 160px; 
  border: 4px solid white; border-radius: 50%; 
  position: relative;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
  margin-bottom: 12px; color: black; font-weight: bold;
  pointer-events: auto; flex-shrink: 0; transition: transform 0.3s;
}
#slide-clock-container.minimal-mode .clock-face { margin-bottom: 0; }

.timer-disk { position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 50%; background: transparent; z-index: 1; pointer-events: none; }

.hand { 
  position: absolute; 
  bottom: 50%; 
  left: 50%; 
  transform-origin: bottom center; 
  background: black; 
  border-radius: 4px; 
  z-index: 100; 
  pointer-events: none; 
}
.hour-hand { 
  width: 6px; 
  height: 45px; 
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.min-hand { 
  width: 4px; 
  height: 65px; 
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.second-hand { 
  width: 2px; 
  height: 70px; 
  background: red; 
  transition: transform 0.05s linear;
}
.center-dot { width: 12px; height: 12px; background: black; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 101; pointer-events: none; }

/* --- BLOCK LABELS --- */
.block-label {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 9px; font-weight: 700; color: #000;
  text-align: center; line-height: 1; 
  z-index: 10; pointer-events: auto;
  max-width: 50px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-color: rgba(255,255,255,0.9); 
  padding: 2px 4px; border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border: 1px solid rgba(0,0,0,0.1);
  cursor: move;
  transition: box-shadow 0.2s;
}
.block-label:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  border-color: #42A5F5;
}

/* --- ICONS (AUTO-HIDE) --- */
#case-sound-toggle, #donation-link, #btn-maximize {
  position: absolute; z-index: 100; cursor: pointer;
  /* Expanded tap target via padding; visual size stays 28x28 via box-sizing */
  width: 44px; height: 44px; color: white;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s ease-in-out;
}
#case-sound-toggle svg, #donation-link svg, #btn-maximize svg {
  width: 28px; height: 28px; flex-shrink: 0; pointer-events: none;
}
#settings-gear {
  position: absolute;
  z-index: 120;
  cursor: pointer;
  /* Expanded tap target; visual SVG stays 28x28 */
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0.7;
  transition: opacity 0.3s ease-in-out;
  /* Shift anchor so the visual icon still sits at bottom-right of clock-wrapper */
  right: -26px;
  bottom: -26px;
}
#settings-gear svg {
  width: 28px; height: 28px; flex-shrink: 0; pointer-events: none;
}

/* On hover (mouse) reveal auto-hide icons */
#slide-clock-container:hover #case-sound-toggle,
#slide-clock-container:hover #donation-link,
#slide-clock-container:hover #btn-maximize {
  opacity: 0.6;
}
#slide-clock-container:hover #settings-gear {
  opacity: 0.85;
}
#case-sound-toggle:hover, #donation-link:hover, #btn-maximize:hover, #settings-gear:hover { opacity: 1 !important; }

/* On touchscreen there is no hover: keep sound toggle always faintly visible */
@media (hover: none) {
  #case-sound-toggle {
    opacity: 0.6;
  }
}

/* Focus states also reveal the icon (keyboard navigation) */
#case-sound-toggle:focus-within,
#donation-link:focus-within,
#btn-maximize:focus-within,
#settings-gear:focus-within {
  opacity: 1;
}

#donation-link { top: 12px; left: 12px; }
#btn-maximize  { top: 12px; right: 12px; }
#case-sound-toggle { top: 12px; right: 12px; }
#settings-gear { /* now handled above, remove duplicate */ }

/* --- TICKS & NUMBERS --- */
.tick { position: absolute; left: 50%; top: 0; width: 2px; height: 100%; pointer-events: none; background: linear-gradient(to bottom, black 4%, transparent 4%); }
.tick.minor { width: 1px; background: linear-gradient(to bottom, #555 3%, transparent 3%); }
.tick.major { width: 3px; background: linear-gradient(to bottom, black 6%, transparent 6%); }

.number {
  position: absolute; width: 20px; height: 20px;
  display: flex; justify-content: center; align-items: center;
  font-size: 14px; font-weight: 700; pointer-events: none;
  transform: translate(-50%, -50%); z-index: 5;
}

/* --- INPUTS --- */
.controls { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.row { display: flex; justify-content: space-between; gap: 5px; }
#rows-container { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.block-row { display: flex; gap: 4px; align-items: center; }
.block-row input[type="number"] { width: 44px; min-height: 36px; padding: 4px; border-radius: 4px; border: none; text-align: center; font-size: 13px; }
.block-row input[type="text"] { flex: 1; min-height: 36px; padding: 4px; border-radius: 4px; border: none; font-size: 13px; }
.block-row input[type="color"] { width: 36px; height: 36px; border: none; background: none; cursor: pointer; padding: 0; border-radius: 4px; }

button { padding: 10px 10px; min-height: 44px; border: none; background: #444; color: white; border-radius: 4px; cursor: pointer; font-size: 13px; flex: 1; }
button:hover { background: #666; }
#slide-clock-container button:focus-visible { outline: 2px solid #42A5F5; outline-offset: 2px; }
/* #00C853 gives only 2.24:1 contrast with white text — use black text instead (9.39:1) */
#btn-set-block { background: #00C853; color: #000; font-weight: bold; }
#btn-set-block:hover { background: #00E676; color: #000; }
#btn-clear-block { background: #555; }
.btn-remove { flex: 0 0 36px; height: 36px; background: #ff4444; color: white; border-radius: 50%; font-weight: bold; padding: 0; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.btn-remove:hover { background: #ff0000; }
#btn-add-row { background: transparent; border: 1px dashed #666; color: #aaa; margin-bottom: 5px; font-size: 20px; line-height: 1; min-height: 44px; padding: 4px; }
#btn-add-row:hover { background: rgba(255,255,255,0.1); color: white; border-color: white; }
#case-sound-toggle:focus-visible, #donation-link:focus-visible, #btn-maximize:focus-visible,
#settings-gear:focus-visible {
  outline: 2px solid #42A5F5;
  outline-offset: 4px;
  opacity: 1;
}