/* ==========================================================================
   DIGITAL CLOCK DISPLAY - ULTRA-FAST, ZERO-DEPENDENCY DESIGN SYSTEM
   Optimized for 100/100 Lighthouse Performance & Zero Layout Shift (CLS = 0)
   ========================================================================== */

/* --- CSS Reset & Base Variables --- */
:root {
  /* Default: Dark / OLED Black Theme */
  --bg-primary: #07090e;
  --bg-secondary: #0f141f;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-glass: rgba(15, 20, 31, 0.75);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(56, 189, 248, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-primary: #38bdf8;
  --accent-secondary: #818cf8;
  --clock-color: #38bdf8;
  --clock-shadow: 0 0 35px rgba(56, 189, 248, 0.3), 0 0 70px rgba(56, 189, 248, 0.12);
  --card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --badge-bg: rgba(56, 189, 248, 0.12);
  --badge-text: #7dd3fc;
  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-border: rgba(255, 255, 255, 0.12);
  --btn-hover: rgba(255, 255, 255, 0.12);
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "SF Pro Display", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", "Courier New", monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Theme 2: Pastel Pink / Cute Theme --- */
[data-theme="pink"] {
  --bg-primary: #fff0f3;
  --bg-secondary: #ffe3e8;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-glass: rgba(255, 240, 243, 0.9);
  --border-color: rgba(225, 29, 72, 0.18);
  --border-highlight: rgba(225, 29, 72, 0.4);
  --text-main: #4c0519;
  --text-muted: #9f1239;
  --text-dim: #be123c;
  --accent-primary: #e11d48;
  --accent-secondary: #f43f5e;
  --clock-color: #e11d48;
  --clock-shadow: 0 0 30px rgba(225, 29, 72, 0.18), 0 0 50px rgba(244, 63, 94, 0.12);
  --card-shadow: 0 20px 35px -10px rgba(225, 29, 72, 0.12);
  --badge-bg: rgba(225, 29, 72, 0.1);
  --badge-text: #e11d48;
  --btn-bg: rgba(225, 29, 72, 0.08);
  --btn-border: rgba(225, 29, 72, 0.22);
  --btn-hover: rgba(225, 29, 72, 0.16);
}

/* --- Theme 3: Emerald Aurora Glass (Deep Forest Green, Royal Indigo & Soft Emerald) --- */
[data-theme="glass-emerald"],
[data-theme="glass-ice"] {
  --bg-primary: #051923;
  --bg-secondary: #082631;
  --bg-card: rgba(5, 25, 35, 0.72);
  --bg-glass: rgba(5, 25, 35, 0.82);
  --border-color: rgba(52, 211, 153, 0.28);
  --border-highlight: rgba(52, 211, 153, 0.65);
  --text-main: #ecfdf5;
  --text-muted: #a7f3d0;
  --text-dim: #6ee7b7;
  --accent-primary: #34d399;
  --accent-secondary: #818cf8;
  --clock-color: #34d399;
  --clock-shadow: 0 0 35px rgba(52, 211, 153, 0.55), 0 0 70px rgba(58, 12, 163, 0.45);
  --card-shadow: 0 25px 50px -12px rgba(5, 25, 35, 0.85), inset 0 1px 2px rgba(255, 255, 255, 0.18);
  --badge-bg: rgba(52, 211, 153, 0.18);
  --badge-text: #6ee7b7;
  --btn-bg: rgba(5, 25, 35, 0.65);
  --btn-border: rgba(52, 211, 153, 0.35);
  --btn-hover: rgba(52, 211, 153, 0.22);
}

[data-theme="glass-emerald"] body,
[data-theme="glass-ice"] body {
  background: linear-gradient(135deg, #051923 0%, #006400 50%, #3a0ca3 100%) fixed !important;
  background-attachment: fixed !important;
}

[data-theme="glass-emerald"] .clock-display-card,
[data-theme="glass-ice"] .clock-display-card,
[data-theme="glass-emerald"] .customizer-panel,
[data-theme="glass-ice"] .customizer-panel {
  background: linear-gradient(135deg, rgba(5, 25, 35, 0.75) 0%, rgba(0, 100, 0, 0.32) 50%, rgba(58, 12, 163, 0.25) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(52, 211, 153, 0.35) !important;
  box-shadow: 0 25px 50px -12px rgba(5, 25, 35, 0.85), 0 0 30px rgba(52, 211, 153, 0.18), inset 0 1px 2px rgba(255, 255, 255, 0.2) !important;
}

[data-theme="glass-emerald"] .card-top,
[data-theme="glass-emerald"] .card-bottom,
[data-theme="glass-emerald"] .card-flip-top,
[data-theme="glass-emerald"] .card-flip-bottom,
[data-theme="glass-ice"] .card-top,
[data-theme="glass-ice"] .card-bottom,
[data-theme="glass-ice"] .card-flip-top,
[data-theme="glass-ice"] .card-flip-bottom {
  background: rgba(5, 25, 35, 0.88) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
}

/* --- Theme 4: Sunset Lavender Glass (Light Glass Theme 2) --- */
[data-theme="glass-lavender"] {
  --bg-primary: #f6f0fa;
  --bg-secondary: #ede3f5;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-glass: rgba(246, 240, 250, 0.88);
  --border-color: rgba(255, 255, 255, 0.85);
  --border-highlight: rgba(147, 51, 234, 0.45);
  --text-main: #361752;
  --text-muted: #6b3ba4;
  --text-dim: #9262c7;
  --accent-primary: #9333ea;
  --accent-secondary: #c084fc;
  --clock-color: #7e22ce;
  --clock-shadow: 0 10px 30px rgba(147, 51, 234, 0.2);
  --card-shadow: 0 20px 45px -10px rgba(147, 51, 234, 0.14), inset 0 1px 2px rgba(255, 255, 255, 0.95);
  --badge-bg: rgba(147, 51, 234, 0.1);
  --badge-text: #7e22ce;
  --btn-bg: rgba(255, 255, 255, 0.75);
  --btn-border: rgba(255, 255, 255, 0.9);
  --btn-hover: rgba(255, 255, 255, 0.95);
}

/* --- Theme 4: Zen / Cream Minimalist Theme --- */
[data-theme="zen"] {
  --bg-primary: #f8f5ee;
  --bg-secondary: #ede7db;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(248, 245, 238, 0.92);
  --border-color: rgba(68, 64, 60, 0.16);
  --border-highlight: rgba(68, 64, 60, 0.38);
  --text-main: #292524;
  --text-muted: #57534e;
  --text-dim: #78716c;
  --accent-primary: #57534e;
  --accent-secondary: #78716c;
  --clock-color: #292524;
  --clock-shadow: none;
  --card-shadow: 0 15px 30px -10px rgba(68, 64, 60, 0.08);
  --badge-bg: rgba(68, 64, 60, 0.09);
  --badge-text: #292524;
  --btn-bg: rgba(68, 64, 60, 0.08);
  --btn-border: rgba(68, 64, 60, 0.22);
  --btn-hover: rgba(68, 64, 60, 0.15);
}

/* --- Theme 5: High Contrast Neon (Classroom / Visibility) --- */
[data-theme="neon"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-card: #0f0f0f;
  --bg-glass: rgba(0, 0, 0, 0.95);
  --border-color: #facc15;
  --border-highlight: #fef08a;
  --text-main: #facc15;
  --text-muted: #fef08a;
  --text-dim: #ca8a04;
  --accent-primary: #facc15;
  --accent-secondary: #fde047;
  --clock-color: #facc15;
  --clock-shadow: 0 0 35px rgba(250, 204, 21, 0.45), 0 0 85px rgba(250, 204, 21, 0.2);
  --card-shadow: 0 0 30px rgba(250, 204, 21, 0.15);
  --badge-bg: #262626;
  --badge-text: #facc15;
  --btn-bg: #1a1a1a;
  --btn-border: #facc15;
  --btn-hover: #262626;
}

/* Customizer Dynamic Overrides */
[data-custom-clock] {
  --clock-color: var(--custom-clock-color, var(--clock-color)) !important;
}
[data-custom-bg] {
  --bg-primary: var(--custom-bg-color, var(--bg-primary)) !important;
}

/* --- Global Reset & Tabular Figures --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-display);
  background-color: var(--bg-primary);
  color: var(--text-main);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Strict Tabular Numbers for CLS = 0 and Jitter-free Time Display */
.tabular-nums, .clock-digits, .flip-card, .ms-digits, .date-display, .timestamp-code {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Accessibility: Focus States --- */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* --- Site Navigation Bar --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.nav-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.brand-icon svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-link {
  padding: 0.5rem 0.85rem;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent-primary);
  background: var(--badge-bg);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  border-color: var(--border-highlight);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
}

/* --- Hero Clock Stage --- */
.hero-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.5rem 3rem;
  position: relative;
  min-height: 65vh;
  text-align: center;
}

.clock-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Clock Header Info (Date, Timezone, Mode tags) */
.clock-meta-top {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.date-badge {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tz-pill {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tz-pill .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* --- Core Clock Display Container --- */
.clock-display-card {
  width: min(100%, calc(1150px * var(--clock-user-scale, 1)));
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: calc(var(--radius-lg) * clamp(0.75, var(--clock-user-scale, 1), 1.35));
  padding: calc(3rem * var(--clock-user-scale, 1)) calc(2rem * var(--clock-user-scale, 1));
  box-shadow: 0 calc(12px * var(--clock-user-scale, 1)) calc(35px * var(--clock-user-scale, 1)) rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  transition: width 0.25s ease, max-width 0.25s ease, padding 0.25s ease, border-radius 0.25s ease, box-shadow 0.25s ease;
}

/* Sub-card glow effect */
.clock-display-card::before {
  content: "";
  position: absolute;
  top: -20%;
  left: 20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  opacity: 0.07;
  pointer-events: none;
  filter: blur(40px);
}

/* --- Massive Clock Digits --- */
.clock-digits-container {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: nowrap;
  color: var(--clock-color);
  text-shadow: var(--clock-shadow);
  line-height: 1;
  font-weight: 800;
  user-select: none;
  transition: transform 0.25s ease;
}

.clock-digits {
  font-size: calc(clamp(3.8rem, 13vw, 11rem) * var(--clock-user-scale, 1));
  font-weight: 800;
  display: inline-block;
  line-height: 0.95;
  transition: font-size 0.25s ease;
}

.clock-colon {
  font-size: calc(clamp(3.2rem, 11vw, 9.5rem) * var(--clock-user-scale, 1));
  opacity: 0.85;
  display: inline-block;
  margin: 0 0.08em;
  font-weight: 700;
  animation: colonBlink 1s step-start infinite;
  transition: font-size 0.25s ease;
}

@keyframes colonBlink {
  50% { opacity: 0.25; }
}

.clock-colon.static {
  animation: none;
}

/* Seconds styling - matching exact size and alignment of clock digits */
.clock-seconds {
  font-size: calc(clamp(3.8rem, 13vw, 11rem) * var(--clock-user-scale, 1));
  opacity: 1;
  font-weight: 800;
  display: inline-block;
  line-height: 0.95;
  margin-left: 0;
  transition: font-size 0.25s ease;
}

/* Milliseconds styling */
.clock-ms-block {
  font-size: calc(clamp(1.8rem, 5.5vw, 4.8rem) * var(--clock-user-scale, 1));
  opacity: 0.85;
  font-weight: 600;
  margin-left: 0.15em;
  color: var(--accent-secondary);
  transition: font-size 0.25s ease;
}

/* AM/PM indicator */
.clock-ampm {
  font-size: calc(clamp(1.1rem, 3vw, 2.5rem) * var(--clock-user-scale, 1));
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-left: 0.6rem;
  align-self: flex-start;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: font-size 0.25s ease;
}

/* --- Flip Clock Styles (Aesthetic Page) --- */
.flip-clock-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(clamp(0.35rem, 1.8vw, 1.25rem) * var(--clock-user-scale, 1));
  margin: calc(1.5rem * var(--clock-user-scale, 1)) 0;
  perspective: 1200px;
  max-width: 100%;
  transition: gap 0.25s ease, margin 0.25s ease;
}

.flip-seconds-wrapper {
  display: flex;
  align-items: center;
  gap: calc(clamp(0.35rem, 1.8vw, 1.25rem) * var(--clock-user-scale, 1));
  transition: gap 0.25s ease;
}

.flip-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(clamp(0.35rem, 1.2vw, 0.75rem) * var(--clock-user-scale, 1));
  transition: gap 0.25s ease;
}

.flip-group-label {
  font-size: calc(clamp(0.6rem, 1.2vw, 0.85rem) * var(--clock-user-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  transition: font-size 0.25s ease;
}

.flip-card-wrapper {
  display: flex;
  gap: calc(clamp(0.18rem, 0.6vw, 0.45rem) * var(--clock-user-scale, 1));
  transition: gap 0.25s ease;
}

.flip-unit {
  position: relative;
  width: calc(clamp(24px, 7.5vw, 115px) * var(--clock-user-scale, 1));
  height: calc(clamp(38px, 11vw, 165px) * var(--clock-user-scale, 1));
  border-radius: calc(var(--radius-md) * clamp(0.75, var(--clock-user-scale, 1), 1.3));
  box-shadow: 0 calc(12px * var(--clock-user-scale, 1)) calc(25px * var(--clock-user-scale, 1)) rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-size: calc(clamp(1.4rem, 7vw, 7.2rem) * var(--clock-user-scale, 1));
  font-weight: 800;
  color: var(--clock-color);
  user-select: none;
  perspective: 600px;
  transition: width 0.25s ease, height 0.25s ease, font-size 0.25s ease, border-radius 0.25s ease;
}

/* Halves: static and animated flaps */
.card-top, .card-bottom, .card-flip-top, .card-flip-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  background: var(--bg-secondary);
  color: var(--clock-color);
  box-sizing: border-box;
}

.card-top, .card-flip-top {
  top: 0;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  transform-origin: bottom center;
}

.card-bottom, .card-flip-bottom {
  bottom: 0;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transform-origin: top center;
}

.card-top .card-num, .card-flip-top .card-num {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.card-bottom .card-num, .card-flip-bottom .card-num {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Center horizontal slot cut in flip card */
.flip-unit::after {
  content: "";
  position: absolute;
  top: calc(50% - 1px);
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 25;
  pointer-events: none;
}

.card-flip-top, .card-flip-bottom {
  display: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-unit.is-flipping .card-flip-top {
  display: block;
  z-index: 20;
  animation: flipTopAnim 0.22s ease-in forwards;
}

.flip-unit.is-flipping .card-flip-bottom {
  display: block;
  z-index: 20;
  transform: rotateX(90deg);
  animation: flipBottomAnim 0.22s ease-out 0.22s forwards;
}

@keyframes flipTopAnim {
  0% { transform: rotateX(0deg); filter: brightness(1); }
  100% { transform: rotateX(-90deg); filter: brightness(0.7); }
}

@keyframes flipBottomAnim {
  0% { transform: rotateX(90deg); filter: brightness(0.7); }
  100% { transform: rotateX(0deg); filter: brightness(1); }
}

.flip-separator {
  font-size: calc(clamp(2.5rem, 6vw, 5rem) * var(--clock-user-scale, 1));
  font-weight: 800;
  color: var(--text-dim);
  line-height: 1;
  transition: font-size 0.25s ease;
}

/* --- Classroom Giant Display Mode (classroom.html) --- */
.classroom-container .clock-display-card {
  padding: calc(4rem * var(--clock-user-scale, 1)) calc(1.5rem * var(--clock-user-scale, 1));
  border-width: 2px;
}

.classroom-container .clock-digits {
  font-size: calc(clamp(4.5rem, 18vw, 16rem) * var(--clock-user-scale, 1));
  font-weight: 900;
  transition: font-size 0.25s ease;
}

.classroom-container .clock-colon {
  font-size: calc(clamp(4rem, 16vw, 14rem) * var(--clock-user-scale, 1));
  transition: font-size 0.25s ease;
}

.classroom-container .clock-seconds {
  font-size: calc(clamp(4.5rem, 18vw, 16rem) * var(--clock-user-scale, 1));
  font-weight: 900;
  display: inline-block;
  line-height: 0.95;
  transition: font-size 0.25s ease;
}

.classroom-period-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* --- LCD 7-Segment Retro Look Mode (features.html & Theme) --- */
.font-lcd .clock-digits,
.font-lcd .clock-seconds,
.font-lcd .clock-colon,
.font-lcd .clock-ms-block {
  font-family: "Courier New", monospace, "SF Pro Display";
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 0 15px var(--accent-primary);
}

/* Typography Variants for Customizer */
.font-mono .clock-digits,
.font-mono .clock-seconds,
.font-mono .clock-colon,
.font-mono .clock-ms-block {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.font-system .clock-digits,
.font-system .clock-seconds,
.font-system .clock-colon,
.font-system .clock-ms-block {
  font-family: var(--font-display);
}

/* Glow intensity modifiers for Customizer */
.glow-none .clock-digits,
.glow-none .clock-seconds,
.glow-none .clock-colon,
.glow-none .clock-ms-block {
  text-shadow: none !important;
}

.glow-intense .clock-digits,
.glow-intense .clock-seconds,
.glow-intense .clock-colon,
.glow-intense .clock-ms-block {
  text-shadow: 0 0 20px var(--clock-color), 0 0 45px var(--clock-color), 0 0 70px var(--clock-color) !important;
}

/* Display scale modifiers for Customizer */
.scale-compact .clock-digits { font-size: clamp(2.5rem, 8vw, 6.5rem) !important; }
.scale-compact .clock-seconds { font-size: clamp(2.5rem, 8vw, 6.5rem) !important; }
.scale-large .clock-digits { font-size: clamp(4.5rem, 16vw, 13.5rem) !important; }
.scale-large .clock-seconds { font-size: clamp(4.5rem, 16vw, 13.5rem) !important; }

/* Always ensure seconds wrapper has robust baseline flex alignment */
.clock-seconds-wrapper {
  display: inline-flex;
  align-items: baseline;
}

/* --- Interactive Control Bar (Floating & Docked) --- */
.clock-controls {
  margin-top: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  z-index: 50;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  background: var(--btn-bg, rgba(255, 255, 255, 0.05));
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--btn-border, var(--border-color));
  transition: all var(--transition-fast);
  user-select: none;
}

.ctrl-btn:hover {
  background: var(--btn-hover, rgba(255, 255, 255, 0.12));
  border-color: var(--border-highlight);
  color: var(--text-main);
  transform: translateY(-1px);
}

.ctrl-btn.active {
  background: var(--badge-bg);
  border-color: var(--border-highlight);
  color: var(--accent-primary);
}

.ctrl-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* --- Milliseconds Timestamp Box & Epoch Counter --- */
.ms-tools-container {
  margin-top: 2rem;
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.25rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.tool-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.tool-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
}

.tool-code-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-primary);
  word-break: break-all;
}

.btn-copy {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-highlight);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-copy:hover {
  background: var(--accent-primary);
  color: #000000;
}

/* --- Features / Customizer Grid Layout --- */
.customizer-layout {
  width: 100%;
  max-width: 1260px;
  margin: 1.5rem auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 2rem;
  align-items: start;
}

.customizer-layout .clock-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.customizer-layout .clock-display-card {
  width: 100%;
  max-width: 100%;
  padding: calc(3rem * var(--clock-user-scale, 1)) calc(1.5rem * var(--clock-user-scale, 1));
  overflow: hidden;
  transition: padding 0.25s ease;
}

.customizer-layout .clock-digits-container {
  max-width: 100%;
  overflow: hidden;
  justify-content: center;
  flex-wrap: nowrap;
}

.customizer-layout .clock-digits,
.customizer-layout .clock-seconds {
  font-size: calc(clamp(2.4rem, 6.2vw, 6.2rem) * var(--clock-user-scale, 1));
  line-height: 0.95;
  transition: font-size 0.25s ease;
}

.customizer-layout .clock-colon {
  font-size: calc(clamp(2.1rem, 5.2vw, 5.5rem) * var(--clock-user-scale, 1));
  transition: font-size 0.25s ease;
}

.customizer-layout .clock-ampm {
  font-size: calc(clamp(0.95rem, 1.8vw, 1.6rem) * var(--clock-user-scale, 1));
  transition: font-size 0.25s ease;
}

.customizer-layout .scale-compact .clock-digits,
.customizer-layout .scale-compact .clock-seconds {
  font-size: clamp(1.8rem, 4.5vw, 4.2rem) !important;
}

.customizer-layout .scale-large .clock-digits,
.customizer-layout .scale-large .clock-seconds {
  font-size: clamp(2.9rem, 7.8vw, 7.8rem) !important;
}

.customizer-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: left;
}

.custom-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.custom-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.preset-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatch-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform var(--transition-fast);
}

.swatch-btn:hover, .swatch-btn.active {
  transform: scale(1.18);
  border-color: #ffffff;
}

.input-color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.input-color {
  -webkit-appearance: none;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
}

.input-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.input-color::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.select-custom {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
}

/* --- Universal Fullscreen Mode States --- */
:fullscreen body, :-webkit-full-screen body {
  background-color: var(--bg-primary);
}

body.is-fullscreen {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

body.is-fullscreen .site-header,
body.is-fullscreen .content-section,
body.is-fullscreen .site-footer,
body.is-fullscreen .breadcrumb-nav,
body.is-fullscreen .customizer-panel,
body.is-fullscreen .ms-tools-container,
body.is-fullscreen .clock-tagline,
body.is-fullscreen .classroom-period-bar,
body.is-fullscreen .square-popup-overlay {
  display: none !important;
}

body.is-fullscreen .hero-stage {
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  width: 100vw !important;
  box-sizing: border-box !important;
  padding: 4.5rem 1.5rem 5.5rem !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  overflow: hidden !important;
}

body.is-fullscreen .customizer-layout {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.is-fullscreen .clock-wrapper {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin: auto !important;
}

body.is-fullscreen .clock-display-card {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  height: auto !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Fullscreen control floating bar - high contrast in all themes */
body.is-fullscreen .clock-controls {
  position: fixed !important;
  bottom: 2.5rem !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  z-index: 10001 !important;
  transition: opacity var(--transition-normal), transform var(--transition-normal) !important;
}

body.is-fullscreen .clock-controls .ctrl-btn {
  background: var(--btn-bg) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--btn-border) !important;
}

body.is-fullscreen .clock-controls .ctrl-btn:hover {
  background: var(--btn-hover) !important;
  color: var(--text-main) !important;
}

/* Inactivity Auto-Fade (3 seconds idle in Fullscreen) */
body.is-fullscreen.idle-hidden {
  cursor: none;
}

body.is-fullscreen.idle-hidden .clock-controls {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(25px) !important;
}

body.is-fullscreen.idle-hidden .clock-meta-top {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(-25px) !important;
}

/* --- Rich SEO Content Sections --- */
.content-section {
  max-width: 1200px;
  margin: 3.5rem auto 2rem;
  padding: 0 1.5rem;
}

.section-head {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 3rem;
}

.section-tag {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* Feature Grid Cards */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.feature-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.85rem;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.feature-box:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
}

.feature-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  color: var(--accent-primary);
}

.feature-icon-wrapper svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.feature-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* SEO Article & Prose Block */
.prose-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 3.5rem;
}

.prose-block h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.prose-block h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  color: var(--accent-primary);
}

.prose-block p {
  font-size: 1.025rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.75;
}

.prose-block ul {
  margin: 0.75rem 0 1.25rem 1.5rem;
  color: var(--text-muted);
}

.prose-block li {
  margin-bottom: 0.45rem;
}

/* FAQ Accordion Section */
.faq-container {
  max-width: 860px;
  margin: 0 auto 4rem;
}

.faq-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text-main);
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-highlight);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-icon {
  width: 20px;
  height: 20px;
  fill: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  fill: var(--accent-primary);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), padding 0.3s ease;
  padding: 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

.faq-item.active .faq-answer {
  max-height: 500px;
  padding: 0 1.5rem 1.5rem;
}

/* Breadcrumbs Component */
.breadcrumb-nav {
  max-width: 1200px;
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.breadcrumb-item a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--accent-primary);
}

.breadcrumb-item.current {
  color: var(--text-main);
  font-weight: 600;
}

.breadcrumb-sep {
  opacity: 0.4;
}

/* --- Site Footer --- */
.site-footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3.5rem 1.5rem 2rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.8fr 1.1fr 1.1fr 1.1fr;
  gap: 2.25rem;
  margin-bottom: 2.5rem;
}

.footer-brand h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.925rem;
  max-width: 440px;
  line-height: 1.6;
}

.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a, .footer-theme-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.footer-links a:hover, .footer-theme-link:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* --- Notification Toast --- */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* --- Responsive Media Queries --- */
@media (min-width: 993px) and (max-width: 1150px) {
  .nav-container {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
  .nav-link {
    padding: 0.45rem 0.6rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 1024px) {
  .customizer-layout {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
  .customizer-layout .clock-digits,
  .customizer-layout .clock-seconds {
    font-size: clamp(2.6rem, 9.5vw, 6.5rem);
  }
  .customizer-layout .clock-colon {
    font-size: clamp(2.2rem, 8vw, 5.8rem);
  }
}

@media (max-width: 992px) {
  .nav-menu {
    display: none;
  }
  .nav-menu.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    gap: 0.35rem;
  }
  .nav-menu.is-open .nav-link {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
  }
  .mobile-nav-toggle {
    display: inline-flex;
  }
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .clock-display-card {
    padding: 1.75rem 0.6rem;
    overflow: visible;
  }
  .hero-stage {
    padding: 1.25rem 0.75rem 2rem;
  }
  .clock-controls {
    border-radius: var(--radius-md);
    gap: 0.45rem;
  }
  .footer-top {
    grid-template-columns: 1fr;
  }

  /* Flip clock tablet sizing */
  .flip-clock-grid {
    gap: clamp(0.22rem, 1.2vw, 0.6rem);
    margin: 1rem 0;
  }
  .flip-seconds-wrapper {
    gap: clamp(0.22rem, 1.2vw, 0.6rem) !important;
  }
  .flip-card-wrapper {
    gap: clamp(0.12rem, 0.4vw, 0.28rem);
  }
  .flip-unit {
    width: clamp(26px, 5.2vw, 56px);
    height: clamp(40px, 8vw, 84px);
    font-size: clamp(1.5rem, 5vw, 3.8rem);
    border-radius: 7px;
  }
  .flip-separator {
    font-size: clamp(1.4rem, 4vw, 2.6rem);
  }
  .flip-group-label {
    font-size: 0.65rem;
  }

  /* Classroom giant display tablet sizing */
  .classroom-container .clock-digits,
  .classroom-container .clock-seconds {
    font-size: clamp(2.4rem, 11vw, 6rem);
  }
  .classroom-container .clock-colon {
    font-size: clamp(2rem, 9.5vw, 5rem);
  }
}

@media (min-width: 1800px) {
  .clock-digits {
    font-size: clamp(8rem, 16vw, 18rem);
  }
  .clock-seconds {
    font-size: clamp(8rem, 16vw, 18rem);
  }
}

@media (max-width: 640px) {
  .clock-digits, .clock-seconds {
    font-size: clamp(2.2rem, 11vw, 4.2rem);
  }
  .clock-colon {
    font-size: clamp(1.9rem, 9.5vw, 3.8rem);
  }
  .clock-ms-block {
    font-size: clamp(1.1rem, 4.6vw, 2.2rem);
  }
  .content-section {
    padding: 0 1rem;
    margin: 2.5rem auto 1.5rem;
  }
  .prose-block {
    padding: 1.5rem 1rem;
    margin-bottom: 2.5rem;
  }
  .legal-card, .article-card {
    padding: 1.75rem 1.15rem;
  }
  .legal-page-container, .article-container {
    padding: 0 0.85rem;
    margin: 1.5rem auto 3.5rem;
  }
  .blog-tools-spotlight {
    padding: 1.25rem 1rem;
    margin-bottom: 2.5rem;
  }
  .blog-card {
    padding: 1.5rem 1.15rem;
  }
  .blog-grid {
    gap: 1.25rem;
  }
  .features-grid {
    gap: 1.15rem;
  }
  .feature-box {
    padding: 1.35rem 1.15rem;
  }
  .clock-controls {
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    max-width: 100%;
  }
  .ctrl-btn {
    padding: 0.42rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.35rem;
  }
  .ctrl-btn svg {
    width: 15px;
    height: 15px;
  }
  .faq-question {
    padding: 1rem 1.15rem;
    font-size: 1rem;
  }
  .faq-answer {
    padding: 0 1.15rem;
  }
  .faq-item.active .faq-answer {
    padding: 0 1.15rem 1.25rem;
  }
  .sound-settings-card {
    padding: 1.5rem 1.15rem;
  }
  .breadcrumb-nav {
    padding: 0.75rem 1rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.85rem;
  }
}

@media (max-width: 480px) {
  .clock-display-card {
    padding: 1.25rem 0.35rem;
  }
  .clock-digits, .clock-seconds {
    font-size: clamp(1.8rem, 9.2vw, 2.8rem);
  }
  .clock-colon {
    font-size: clamp(1.5rem, 8vw, 2.4rem);
  }
  .clock-ampm {
    font-size: 0.72rem;
    margin-left: 0.2rem;
  }
  .clock-ms-block {
    font-size: clamp(0.95rem, 4vw, 1.6rem);
  }
  .date-badge {
    font-size: clamp(0.82rem, 3.2vw, 1rem) !important;
  }
  .tz-pill, .atomic-sync-pill {
    font-size: 0.74rem !important;
    padding: 0.2rem 0.55rem !important;
  }
  .clock-controls {
    gap: 0.3rem;
    padding: 0.38rem 0.5rem;
  }
  .ctrl-btn {
    padding: 0.38rem 0.62rem;
    font-size: 0.76rem;
    gap: 0.25rem;
  }
  .ctrl-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Flip clock compact mobile sizing */
  .flip-clock-grid {
    gap: clamp(0.14rem, 0.9vw, 0.3rem);
    margin: 0.6rem 0;
  }
  .flip-seconds-wrapper {
    gap: clamp(0.14rem, 0.9vw, 0.3rem) !important;
  }
  .flip-card-wrapper {
    gap: 2px;
  }
  .flip-unit {
    width: clamp(19px, 4.4vw, 29px);
    height: clamp(30px, 7vw, 46px);
    font-size: clamp(1.15rem, 4vw, 1.85rem);
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  }
  .flip-separator {
    font-size: clamp(1rem, 2.8vw, 1.4rem);
  }
  .flip-group-label {
    font-size: 0.52rem;
    letter-spacing: 0.02em;
  }

  /* Classroom mobile sizing */
  .classroom-container .clock-digits,
  .classroom-container .clock-seconds {
    font-size: clamp(1.8rem, 9.2vw, 2.8rem);
  }
  .classroom-container .clock-colon {
    font-size: clamp(1.4rem, 7.8vw, 2.3rem);
  }
  .classroom-period-bar {
    gap: 0.75rem;
    font-size: 0.95rem;
    margin-top: 1rem;
  }
  .toast-notice {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .clock-digits, .clock-seconds {
    font-size: clamp(1.6rem, 8.8vw, 2.2rem);
  }
  .clock-colon {
    font-size: clamp(1.3rem, 7.2vw, 1.85rem);
  }
  .clock-controls {
    gap: 0.25rem;
    padding: 0.32rem 0.4rem;
  }
  .ctrl-btn {
    padding: 0.32rem 0.52rem;
    font-size: 0.72rem;
  }
  .brand-link {
    font-size: 1.05rem;
    gap: 0.5rem;
  }
  .brand-icon {
    width: 28px;
    height: 28px;
  }
  .btn-icon {
    width: 36px;
    height: 36px;
  }
}

/* --- AdSense Compliance & Legal Pages Layout --- */
.legal-page-container {
  width: 100%;
  max-width: 920px;
  margin: 2.5rem auto 5rem;
  padding: 0 1.5rem;
}

.legal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.legal-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}

.legal-tag {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.legal-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.legal-meta {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.legal-body {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.8;
}

.legal-body h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 2.25rem 0 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 1.5rem 0 0.5rem;
}

.legal-body p {
  margin-bottom: 1.25rem;
}

.legal-body ul, .legal-body ol {
  margin: 1rem 0 1.5rem 1.75rem;
}

.legal-body li {
  margin-bottom: 0.5rem;
}

.legal-body a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-body strong {
  color: var(--text-main);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.contact-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.contact-box p {
  font-size: 0.92rem;
  margin: 0;
  color: var(--text-muted);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.form-textarea {
  min-height: 130px;
  resize: vertical;
}

.btn-submit {
  align-self: flex-start;
  padding: 0.85rem 2rem;
  background: var(--accent-primary);
  color: #07090e;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.35);
}

/* --- Blog Hub & Article Architecture --- */
.blog-hub-container {
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto 5rem;
  padding: 0 1.5rem;
}

/* Blog Hub Hero Header */
.blog-hub-header {
  text-align: center;
  max-width: 840px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
}

.blog-hub-tag {
  display: inline-block;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--accent-primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-highlight);
}

.blog-hub-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0 0 1.15rem 0;
  letter-spacing: -0.025em;
}

.blog-hub-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0 auto;
}

/* Quick Tools Spotlight Banner */
.blog-tools-spotlight {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2.25rem;
  margin-bottom: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.spotlight-text h3 {
  margin: 0 0 0.35rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.spotlight-text p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.spotlight-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.spotlight-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.spotlight-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-highlight);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.spotlight-btn-primary {
  background: var(--accent-primary);
  color: #07090e;
  border-color: transparent;
  font-weight: 700;
}

.spotlight-btn-primary:hover {
  background: #7dd3fc;
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.35);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 2rem;
  margin-top: 2.5rem;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.blog-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
}

.blog-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.blog-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.blog-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.blog-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent-primary);
  transition: gap var(--transition-fast);
}

.blog-read-more:hover {
  gap: 0.7rem;
}

.blog-read-more svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Blog Article Layout */
.article-container {
  width: 100%;
  max-width: 880px;
  margin: 2.5rem auto 5rem;
  padding: 0 1.5rem;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2.5rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
}

.article-title {
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin: 0.85rem 0;
  letter-spacing: -0.02em;
}

.article-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.article-body {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.85;
}

.article-body h2 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 2.5rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.article-body h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 1.75rem 0 0.65rem;
}

.article-body p {
  margin-bottom: 1.4rem;
}

.article-body ul, .article-body ol {
  margin: 1rem 0 1.5rem 1.75rem;
}

.article-body li {
  margin-bottom: 0.6rem;
}

.article-body a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.article-body strong {
  color: var(--text-main);
}

.article-cta-box {
  margin: 3rem 0 2rem;
  padding: 2.25rem;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(129, 140, 248, 0.08) 100%);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  text-align: center;
}

.article-cta-box h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.65rem;
}

.article-cta-box p {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
  font-size: 0.98rem;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #07090e;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.4);
  color: #000000;
}

.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.related-card {
  padding: 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.related-card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

/* --- Atomic Clock Sync Status Pill (Competitor Feature 1) --- */
.atomic-sync-pill {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.atomic-sync-pill:hover {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.5);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseGreen 2s infinite;
}

.atomic-sync-pill strong {
  font-weight: 700;
  color: #4ade80;
}

/* Tagline directly under clock controls */
.clock-tagline {
  max-width: 780px;
  margin: 1.25rem auto 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

/* --- Sound Timing & Volume Settings Modal --- */
.sound-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 1.5rem;
}

.sound-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sound-settings-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform 0.25s ease;
  position: relative;
}

.sound-modal-backdrop.is-open .sound-settings-card {
  transform: scale(1);
}

.sound-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.sound-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sound-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.sound-modal-close:hover {
  color: var(--text-main);
}

.sound-control-group {
  margin-bottom: 1.35rem;
}

.sound-group-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.55rem;
}

.sound-btn-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 0.5rem;
}

.sound-opt-btn {
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.sound-opt-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.sound-opt-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #07090e;
}

/* --- High-Corner Non-Screen-Covering Experience Popups --- */
.square-popup-overlay {
  position: fixed;
  top: 4.8rem;
  right: 1.5rem;
  bottom: auto;
  left: auto;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: none !important;
  visibility: hidden !important;
  z-index: 900;
  opacity: 0;
  pointer-events: none !important;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(-12px) scale(0.96);
  padding: 0;
}

.square-popup-overlay.show {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

.square-popup-card {
  width: 290px;
  height: 290px;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: 22px;
  padding: 1.5rem 1.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 35px rgba(56, 189, 248, 0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
}

.popup-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  transform: rotate(90deg);
}

.popup-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--badge-bg);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
  font-size: 1.65rem;
  border: 1px solid var(--border-highlight);
}

.popup-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin: 0.35rem 0 0.15rem;
}

.popup-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
  padding: 0 0.25rem;
}

.popup-action-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #07090e;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.3);
}

.popup-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(56, 189, 248, 0.45);
}

/* --- Watch Size Scale Controls (Customization Page) --- */
.scale-percent-badge {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--accent-primary);
  border: 1px solid var(--border-highlight);
  font-family: var(--font-mono);
}

.scale-slider-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-scale-step {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-scale-step:hover {
  background: var(--badge-bg);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-scale-step svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.scale-range-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: var(--border-color);
  outline: none;
  cursor: pointer;
}

.scale-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.scale-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.scale-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.scale-chip {
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.scale-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.scale-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #07090e;
}

/* --- Mobile & Tablet Fullscreen Professional Optimizations --- */
@media (max-width: 768px) {
  body.is-fullscreen .hero-stage {
    padding-top: max(3.2rem, calc(env(safe-area-inset-top) + 2.2rem)) !important;
    padding-bottom: max(4.2rem, calc(env(safe-area-inset-bottom) + 3.2rem)) !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  body.is-fullscreen .clock-controls {
    bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
    padding: 0.3rem 0.55rem !important;
    gap: 0.3rem !important;
    width: max-content !important;
    max-width: calc(100vw - 1rem) !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-full) !important;
    scrollbar-width: none;
    z-index: 10001 !important;
  }
  body.is-fullscreen .clock-controls::-webkit-scrollbar {
    display: none;
  }
  body.is-fullscreen .clock-controls .ctrl-btn {
    padding: 0.36rem 0.58rem !important;
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    gap: 0.25rem !important;
    flex-shrink: 0 !important;
  }
  body.is-fullscreen .clock-controls .ctrl-btn svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
  }
  body.is-fullscreen .clock-meta-top {
    position: fixed !important;
    top: max(0.65rem, env(safe-area-inset-top)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 0.45rem !important;
    z-index: 10001 !important;
    width: max-content !important;
    max-width: calc(100vw - 1rem) !important;
  }
  body.is-fullscreen .date-badge {
    font-size: clamp(0.72rem, 2.7vw, 0.88rem) !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
    white-space: nowrap !important;
  }
  body.is-fullscreen .tz-pill {
    font-size: 0.7rem !important;
    padding: 0.2rem 0.5rem !important;
    white-space: nowrap !important;
  }
  body.is-fullscreen .atomic-sync-pill {
    display: none !important;
  }
  body.is-fullscreen .clock-digits,
  body.is-fullscreen .clock-seconds {
    font-size: clamp(2.1rem, 11vw, 4.2rem) !important;
  }
  body.is-fullscreen .clock-colon {
    font-size: clamp(1.8rem, 9.5vw, 3.8rem) !important;
  }
  body.is-fullscreen .clock-ampm {
    font-size: clamp(0.75rem, 3.2vw, 1.1rem) !important;
    margin-left: 0.25rem !important;
  }
  body.is-fullscreen .clock-ms-block {
    font-size: clamp(0.95rem, 4.2vw, 1.8rem) !important;
  }
  body.is-fullscreen .flip-clock-grid {
    gap: clamp(0.18rem, 1.2vw, 0.45rem) !important;
    margin: 0 !important;
  }
  body.is-fullscreen .flip-seconds-wrapper {
    gap: clamp(0.18rem, 1.2vw, 0.45rem) !important;
  }
  body.is-fullscreen .flip-card-wrapper {
    gap: 2px !important;
  }
  body.is-fullscreen .flip-unit {
    width: clamp(22px, 4.8vw, 38px) !important;
    height: clamp(34px, 7.5vw, 58px) !important;
    font-size: clamp(1.3rem, 4.8vw, 2.4rem) !important;
    border-radius: 5px !important;
  }
  body.is-fullscreen .flip-separator {
    font-size: clamp(1.1rem, 3.5vw, 1.8rem) !important;
  }
  body.is-fullscreen .flip-group-label {
    font-size: 0.55rem !important;
    margin-top: 0.2rem !important;
  }
  body.is-fullscreen .toast-notice {
    bottom: max(4.5rem, calc(env(safe-area-inset-bottom) + 3.5rem)) !important;
  }
}

@media (max-width: 480px) {
  body.is-fullscreen .clock-digits,
  body.is-fullscreen .clock-seconds {
    font-size: clamp(1.8rem, 10.2vw, 3.2rem) !important;
  }
  body.is-fullscreen .clock-colon {
    font-size: clamp(1.5rem, 8.8vw, 2.8rem) !important;
  }
  body.is-fullscreen .clock-ampm {
    font-size: 0.72rem !important;
  }
  body.is-fullscreen .clock-ms-block {
    font-size: clamp(0.85rem, 4vw, 1.4rem) !important;
  }
  body.is-fullscreen .flip-unit {
    width: clamp(19px, 4.4vw, 28px) !important;
    height: clamp(30px, 7vw, 44px) !important;
    font-size: clamp(1.15rem, 4.2vw, 1.75rem) !important;
    border-radius: 4px !important;
  }
  body.is-fullscreen .flip-separator {
    font-size: clamp(0.95rem, 2.8vw, 1.3rem) !important;
  }
  body.is-fullscreen .flip-group-label {
    font-size: 0.5rem !important;
  }
}

@media (max-width: 360px) {
  body.is-fullscreen .clock-digits,
  body.is-fullscreen .clock-seconds {
    font-size: clamp(1.55rem, 9.8vw, 2.4rem) !important;
  }
  body.is-fullscreen .clock-colon {
    font-size: clamp(1.3rem, 8.2vw, 2.1rem) !important;
  }
}

/* Landscape Mode on Mobile & Tablets (Bedside / Desk Stand Experience) */
@media (orientation: landscape) and (max-height: 550px) {
  body.is-fullscreen .hero-stage {
    padding-top: max(1.8rem, calc(env(safe-area-inset-top) + 1.2rem)) !important;
    padding-bottom: max(2.6rem, calc(env(safe-area-inset-bottom) + 1.8rem)) !important;
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
  }
  body.is-fullscreen .clock-digits,
  body.is-fullscreen .clock-seconds {
    font-size: clamp(2.8rem, 22vh, 6.5rem) !important;
  }
  body.is-fullscreen .clock-colon {
    font-size: clamp(2.4rem, 19vh, 5.5rem) !important;
  }
  body.is-fullscreen .clock-ampm {
    font-size: clamp(0.85rem, 6vh, 1.6rem) !important;
  }
  body.is-fullscreen .flip-unit {
    width: clamp(28px, 6.5vw, 56px) !important;
    height: clamp(40px, 15vh, 80px) !important;
    font-size: clamp(1.6rem, 11vh, 3.2rem) !important;
  }
  body.is-fullscreen .flip-separator {
    font-size: clamp(1.2rem, 9vh, 2.4rem) !important;
  }
  body.is-fullscreen .clock-meta-top {
    top: max(0.4rem, env(safe-area-inset-top)) !important;
  }
  body.is-fullscreen .date-badge {
    font-size: 0.74rem !important;
  }
  body.is-fullscreen .tz-pill {
    font-size: 0.68rem !important;
    padding: 0.18rem 0.45rem !important;
  }
  body.is-fullscreen .atomic-sync-pill {
    display: none !important;
  }
  body.is-fullscreen .clock-controls {
    bottom: max(0.4rem, env(safe-area-inset-bottom)) !important;
    padding: 0.25rem 0.5rem !important;
  }
  body.is-fullscreen .clock-controls .ctrl-btn {
    padding: 0.3rem 0.55rem !important;
    font-size: 0.72rem !important;
  }
}

/* Mobile high-corner popup sizing */
@media (max-width: 480px) {
  .square-popup-overlay {
    top: 4.25rem;
    right: 0.75rem;
    max-width: calc(100vw - 1.5rem);
  }
  .square-popup-card {
    width: min(270px, calc(100vw - 1.5rem));
    height: min(270px, calc(100vw - 1.5rem));
    padding: 1.25rem 1.1rem;
    border-radius: 18px;
  }
  .popup-icon-badge {
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
  }
  .popup-title {
    font-size: 1rem;
  }
  .popup-desc {
    font-size: 0.78rem;
  }
}

@media (max-width: 340px) {
  .square-popup-overlay {
    right: 50% !important;
    transform: translateX(50%) !important;
  }
}
