* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Make the digital clock responsive and smaller on small screens */
@media (max-width: 480px) {
  #clock.clock--digital {
    max-width: 300px;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
  }
  /* Header and logo */
  header { padding: 12px 16px; }
  h1 .logo { width: 80%; padding: 30px 0 20px 0; }

  /* Layout paddings */
  main { padding: 15px; }

  /* Show info stack spacing */
  .show-info-wrapper { gap: 4px; }
  
  .show-label-outside { font-size: 12px; }
  .show-value { font-size: 1em; }
  .show-value--large { font-size: 1rem; }

  /* How-to blocks tighter */
  .howto, .howto-2 { padding: 12px; margin-bottom: 80px; }
  .section-title { font-size: 18px; margin: 16px 0; }

  /* Buttons and selectors */
  .color-selector { gap: 8px; align-items: center; }
  /* Small screen circular color buttons */
  .color-btn { 
    width: 60px; 
    height: auto;
    aspect-ratio: 1 / 1;
    padding: 0; 
    font-size: 0; 
    border-radius: 50%; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    box-sizing: border-box;
    flex: 0 0 auto;
  }

  /* Status bar spacing */
  .status-bar { gap: 6px; }
}

/* Larger logo from 480px and up */
@media (min-width: 480px) {
  h1 .logo {
    width: 80%;
    padding: 40px 0 24px 0;
  }
}

/* Single smaller size on very small screens */
@media (max-width: 420px) {
  .color-btn { width: 44px; }
  .color-selector { gap: 12px; }
}

/* Center the state-1 block above the countdown clock */
.show-info #state-1 {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}
.show-info #state-1 .topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}
.show-info #state-1 .app-title { text-align: center; }

/* Global black fallback behind all page backgrounds */
html, body { background-color: #000; }

body {
    font-family: "Excon", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, #05102D 0%, #591F56 50%, #05102D 100% );
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

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

header {
    /* background: rgba(255, 255, 255, 0.05); */
    padding: 20px 30px;
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(10px);
}

h1 {
    color: #4ecdc4;
    font-size: 2em;
    margin-bottom: 30px;
}

h1 .logo {
    /* width: 230px; */
    
    display: block;
    margin: 0 auto;
}

.status-bar {
    display: none; /* Hide status bar visuals but keep functionality */
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.state-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    background: #48c774;
    color: white;
    text-transform: capitalize;
}

.state-badge.show {
    background: #f39c12;
}

.state-badge.interactive {
    background: #3498db;
}

.state-badge.night {
    background: #2c3e50;
}

.state-badge.day {
    background: #f1c40f;
    color: #2c3e50;
}

.state-badge.evening {
    background: #9b59b6;
}

.current-show {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    background: #667eea;
    color: white;
}

.show-info-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
	width:100%;
}

.show-label-outside {
    color: var(--Beige, #CCB99C);
    text-align: center;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: 3px;
    display: flex;
    height: 42px;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    text-transform: uppercase;
}

.show-info {
    flex-wrap: wrap;
    padding: 15px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    
    display: flex;
    justify-content: center;
    align-items: center;
    width:100%;

	border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25) inset;
}

.show-info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ensure each show-info item (including the clock) spans the full width of the show-info container */
.show-info .show-info-item {
  width: 100%;
  align-self: stretch;
}

.show-label {
    font-size: 0.8em;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.show-value {
    font-size: 1.2em;
    font-weight: 600;
    color: #feca57;
    font-family: 'Courier New', monospace;
}

.show-value--large {
    text-align: center;
    font-family: "JetBrains Mono";
    text-transform: uppercase;
    font-size: 40px;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    background: var(--BEIGE-GRADIENT, linear-gradient(180deg, #DFCAAB 0%, #534C40 100%));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
}

@media (max-width: 420px) {
    .show-value--large {
        font-size: 30px;
    }
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.status-indicator.connected {
    background: #2ecc71;
    color: white;
}

.status-indicator.disconnected {
    background: #e74c3c;
    color: white;
}

.status-indicator.connecting {
    background: #f39c12;
    color: white;
}

main {
    padding: 40px;
    border-radius: 0 0px 10px 10px;
    backdrop-filter: blur(10px);
}

.section-title-box {
    margin: 10px 0 18px 0;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    text-shadow: 0 0 18px rgba(119,68,201,0.35);
}

@media (max-width: 768px) {
    body {
        padding: 20px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .color-selector {
        gap: 8px;
    }
    
    .color-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    main {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    header {
        padding: 45px 20px 15px 20px;
    }
    
    .status-bar {
        gap: 15px;
    }
    
    .show-info {
        gap: 20px;        
    }
    
    .show-label {
        font-size: 0.7em;
    }
    
}


/* ============================= Allt från Karin ============================= */

:root {
  --bg: #000000;
  --fg: #e2c8d0C0;
  --muted: #1f2937;
  --pad-height: 340px;
  --pad-radius: 16px;
  --content-max: clamp(300px, 92vw, 1000px);
	
}

/* Excon font (variable preferred) */
@font-face {
  font-family: "Excon";
  src: url("./fonts/fonts/Excon-Variable.woff2") format("woff2"),
       url("./fonts/fonts/Excon-Variable.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Static weights as fallback (optional) */
@font-face {
  font-family: "Excon";
  src: url("./fonts/fonts/Excon-Regular.woff2") format("woff2"),
       url("./fonts/fonts/Excon-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Excon";
  src: url("./fonts/fonts/Excon-Bold.woff2") format("woff2"),
       url("./fonts/fonts/Excon-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.page-title {
  margin: 50px 0 18px 0;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  text-shadow: 0 0 18px rgba(119,68,201,0.35);
}

/* Match section title to page-title styling */
.section-title {
  margin: 10px 0;
  font-size: 30px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #ccb99c;
}


/* Color selector buttons */
.color-selector {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 25px auto 16px auto;
  max-width: var(--content-max);
}

.color-btn {
  width: 60px;
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 0;
  font-size: 0;
  font-weight: 600;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.5s ease-out;
  background: rgba(255,255,255,0.05);
  color: #e0e0e0;
  font-family: "JetBrains Mono", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
	opacity:0.8;
  flex: 0 0 auto;
  /* Requested 3D look */
  box-shadow: -4px -4px 16px rgba(255, 255, 255, 0.1),
							0 0 2px rgba(0,0,0,1) inset,
              4px 4px 16px rgba(0, 0, 0, 0.18),
              8px 0px 16px 0 rgba(0, 0, 0, 0.5) inset;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.25));
}

@media (max-width: 420px) {
    .color-btn {
        width: 30px;
    }
}

/* Warm halo per color on selected (keep base inset shadows) */
.color-btn--red.selected {
	box-shadow: 0px 0px 32px rgba(255, 255, 255, 1),
              0 0 2px rgba(255,255,255,1) inset,
              8px 0px 16px 0 rgba(0, 0, 0, 0.25) inset;
  opacity:1;
  
}

.color-btn--green.selected {
  box-shadow: 0px 0px 32px rgb(255, 255, 255),
              0 0 2px rgba(255,255,255,0.75) inset,
              8px 0px 16px 0 rgba(0, 0, 0, 0.25) inset;
  opacity:1;
}

.color-btn--blue.selected {
  box-shadow: 0px 0px 32px rgb(255, 255, 255),
              0 0 2px rgba(255,255,255,0.75) inset,
              8px 0px 16px 0 rgba(0, 0, 0, 0.25) inset;
  opacity:1;
}

.color-btn--red {
  color: #C21450;
  background: radial-gradient(circle at 50% 45%, #e33662 0%, #c2143d 55%, #8f0018 100%);
}

.color-btn--green {
  color: #2FF2D2;
  background: radial-gradient(circle at 50% 45%, #2ff2ae 0%, #1bdc9b 55%, #0c8f68 100%);
}

.color-btn--blue {
  color: #3B82F6;
  background: radial-gradient(circle at 50% 45%, #58A5FF 0%, #3b82f6 55%, #1E4FE5 100%);
}

/* Pad simple container */
.pad {
  position: relative;
  width: 100%;
  max-width: var(--content-max);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  box-sizing: border-box;
  border-radius: var(--pad-radius);
  background: url("./top-layer.jpg") center / cover no-repeat, transparent;
  border: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  color: var(--fg);
  /* Ensure Android/Chrome delivers continuous pointer events */
  touch-action: none;
  /* Prevent disappearing by isolating and containing paint */
  overflow: hidden;
  /* Add a tiny background color to stabilize compositing */
  background-color: rgba(0,0,0,0.001);
  /* Stabilize compositing to avoid flicker/disappear during heavy updates */
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}



.howto {
  position: relative;
  width: 100%;
  max-width: var(--content-max);
  /* ensure horizontal centering */
  margin-left: auto;
  margin-right: auto;
  /* preserve vertical spacing */
  margin-bottom: 40px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
  /* Make anchor scroll settle with a small top margin */
  scroll-margin-top: 14px;	
}

.howto-2 {
  position: relative;
  width: 100%;
  max-width: var(--content-max);
  /* ensure horizontal centering */
  margin-left: auto;
  margin-right: auto;
  /* preserve vertical spacing */
  margin-top: 60px;
  margin-bottom: 120px; 
  padding: 16px;
  border-radius: var(--pad-radius);
  /* Make anchor scroll settle with a small top margin */
  scroll-margin-top: 14px;
  
  backdrop-filter: blur(10px);
}

/* Remove howto box shadow in State 0 and State 1 */
#state-0 .howto,
#state-1 .howto {
  box-shadow: none;
}


.howto, .howto-2 {
  display: flex;
  padding: 20px;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  flex: 1 0 0;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.25);
}


.howto__content {
  color: var(--fg);
  line-height: 1.5;
  opacity: 0.92;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-family: "Excon", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.howto__content .section-title {
  margin: 0;
  width: 100%;
  color:#ccb99c;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Standard howto body text (exclude the emphasized first paragraph and headings) */
.howto__content p:not(.first-text) {
  color: var(--Beige, #CCB99C);
  font-family: Excon;
  font-size: 17px;
  font-style: normal;
  font-weight: 350;
  line-height: 150%; /* 25.2px */
}

/* Emphasized lead paragraph */
.howto__content .first-text {
  font-size: 1.28em;
  font-weight: 500;
  color:#ccb99c;
}

.howto__content h2 {
  font-size: 1.16em;
  font-weight: 500;
  color:#ccb99c;
  font-family: "Excon", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  margin-top: 30px;
  margin-bottom: 4px;
  align-self: flex-start; /* override container's align-items:center */
  text-align: left;
}

.howto__content h2 + p { margin-top: 2px; }

/* Ensure exactly 10px space from big texts to the paragraph under them */
.howto__content .first-text + p { margin-top: 10px; }


/* Extra footer-like section centered at the bottom */
#extra {
  position: static;
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  margin-top: 0;
  margin-bottom: 16px;
  padding: 8px 12px;
  box-sizing: border-box;
}
#extra .extra-content {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ccb99c;
}
#extra .extra-content a {
  color: #ccb99c;
  text-decoration: none;
}


.pad__content {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--pad-radius);
  overflow: hidden;
  /* Ensure Android/Chrome delivers continuous pointer events */
  touch-action: none;
}

/* Simple canvas for drawing */
.pad__canvas {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border-radius: 8px;
  z-index: 1;
  /* Ensure Android/Chrome delivers continuous pointer events */
  touch-action: none;
}


/* Cursor */
.pad__cursor {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,1) 0%, rgba(34,211,238,0.9) 70%, rgba(34,211,238,0.3) 100%);
  box-shadow: 0 0 40px rgba(34,211,238,1), 0 0 60px rgba(34,211,238,0.9), 0 0 80px rgba(34,211,238,0.6);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--cursor-scale, 1));
  z-index: 5;
}


/* Pulse on tap */
.pad.pulse { animation: padpulse 2000ms ease-out; }
@keyframes padpulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,211,238,0.0); }
  50%  { box-shadow: 0 0 0 10px rgba(34,211,238,0.15); }
  100% { box-shadow: 0 0 0 0 rgba(34,211,238,0.0); }
}


/* Interaction affordances */
.pad, .pad__content { cursor: pointer; }
.actionbtn, .pad, .pad__content, .pad__canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pad, .pad * { -webkit-tap-highlight-color: transparent; }


/* Focus ring if tabbed */
.pad:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 2px; }

/* ===== Digital Clock styles ===== */

.section-title-clock {
  color: var(--Beige, #CCB99C);
  text-align: center;
  font-size: 14px;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 3px;
  display: flex;
  height: 42px;
  flex-direction: column;
  justify-content: center;
  align-self: stretch;
  margin: 30px auto 0 auto;
  text-transform: uppercase;
}

.clock {	
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--fg);
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(34,211,238,0.25);
}

.clock--digital {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0;
  margin: 5px auto;
  max-width: var(--content-max);
  padding: 0 12px;
  --digit-nudge-y: 0px;
}
/* Ensure centering inside the header show-info layout */
.show-info .show-info-item #clock {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Stretch the header clock digits to match the full width of .show-info */
.show-info #clock.clock--digital {
  /* responsive gaps */
  --digits-gap: clamp(6px, 1.2vw, 16px);
  --group-gap: clamp(12px, 2vw, 28px);
  /* compute each digit width from container width (6 digits total) */
  --digit-w: calc((100% - (3 * var(--digits-gap)) - (2 * var(--group-gap))) / 6);
  /* make boxes taller and text larger for readability */
  --digit-h: calc(var(--digit-w) * 1.50);
  --digit-fs: calc(var(--digit-w) * 0.62);
  /* keep clock within .show-info and add requested side padding */
  width: 100%;
  box-sizing: border-box;
  padding-left: 35px;
  padding-right: 35px;
}
.clock--digital .group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.clock--digital .group .digits { display: flex; gap: var(--digits-gap, 8px); width: 100%; }
.clock--digital .group .label {
  font-size: clamp(11px, 1.6vw, 13px);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #e8dcc8;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* More 3D clock */
.clock--digital .digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--digit-w, 100px);
  height: var(--digit-h, 110px);
  border-radius: var(--digit-radius, 4px);
  background: linear-gradient(180deg, #8a8578, #4c4339);
  opacity:0.8;
  box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
		
  color: #e8dcc8;
  font-family: "JetBrains Mono";
  font-size: var(--digit-fs, 50px);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-shadow: 
    0 1px 0 rgba(255,255,255,0.3),
    0 2px 2px rgba(0,0,0,0.5),
    0 4px 8px rgba(0,0,0,0.3),
    0 0 20px rgba(232, 220, 200, 0.2);
  position: relative;
  overflow: hidden;
  perspective: 600px;
  transform-style: preserve-3d;
}

.clock--digital .sep {
  display: inline-block;
  width: 10px;
  text-align: center;
  color: rgba(226,232,240,0.9);
  font-size: 34px;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(236,72,153,0.2);
}

.clock--digital {
  --digit-w: clamp(48px, 8vw, 78px);
  --digit-h: clamp(60px, 10vw, 92px);
  --digit-radius: clamp(3px, 1vw, 6px);
  --digit-fs: clamp(22px, 8vw, 40px);
  --digits-gap: clamp(4px, 1vw, 10px);
  --group-gap: clamp(12px, 5vw, 36px);
  display: flex;
  align-items: flex-start;
  gap: 0;
  /* span the same width as its parent show-info area */
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}
.clock--digital .group { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.clock--digital .group:not(:last-child) { margin-right: var(--group-gap); }
.clock--digital .group:not(:last-child) .digits { position: relative; }
.clock--digital .group:not(:last-child) .digits::after {
  content: ":";
  position: absolute;
  /* place exactly at the midpoint between digit groups */
  left: calc(100% + (var(--group-gap) / 2));
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(226,232,240,0.9);
  /* keep colon smaller than digits and scale with them */
  font-size: calc(var(--digit-fs, 34px) * 0.6);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(236,72,153,0.2);
  line-height: 1;
  pointer-events: none;
}

.clock--digital .digit .digit__text {
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(calc(-50% + var(--digit-nudge-y)));
  display: block; width: 100%; text-align: center; line-height: 1;
}

@media (max-width: 347px) {
  /* .clock--digital { gap: 6px; } */
  .clock--digital .digit { width: 36px; height: 48px; font-size: 24px; }
  .clock--digital .sep { width: 10px; font-size: 24px; }
}

.digit__wrap { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr 1fr; color: inherit; }
.digit__half { display: none; align-items: center; justify-content: center; background: inherit; color: inherit; border-left: inherit; border-right: inherit; position: relative; overflow: hidden; }
.digit__top { border-top: inherit; border-top-left-radius: var(--digit-radius, 3px); border-top-right-radius: var(--digit-radius, 3px); border-bottom: 1px solid rgba(0,0,0,0.3); }
.digit__bottom { border-bottom: inherit; border-bottom-left-radius: var(--digit-radius, 3px); border-bottom-right-radius: var(--digit-radius, 3px); }
.digit__face { position: absolute; inset: 0; display: block; color: inherit; z-index: 0; background: transparent; transform-style: preserve-3d; mask-image: none; }
.digit__face .digit__front, .digit__face .digit__back { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; }
.digit__face .digit__back { transform: rotateX(180deg); }
.digit__roller { position: absolute; inset: 0; display: flex; flex-direction: column; will-change: transform, filter; transform: translateY(-100%); }
.digit__item { height: 100%; display: block; position: relative; text-align: center; padding: 0; flex: 0 0 100%; }

.digit.is-scrolling .digit__roller { animation: wheelScrollDown 420ms cubic-bezier(0.15, 0.6, 0.2, 1) forwards; filter: blur(0.3px); }
@keyframes wheelScrollDown { 0% { transform: translateY(-100%); } 100% { transform: translateY(0%); } }

.digit__top.flip, .digit__bottom.flip { position: absolute; left: 0; right: 0; overflow: hidden; backface-visibility: hidden; transform-style: preserve-3d; visibility: hidden; pointer-events: none; z-index: 2; background: inherit; }
.digit__top.flip { top: 0; height: 100%; transform-origin: center top; position: absolute; }
.digit__bottom.flip { bottom: 0; height: 50%; transform-origin: center top; }
.digit__clip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.digit__top .digit__clip { bottom: 50%; }
.digit__bottom .digit__clip { top: 50%; }
@keyframes flipFold { 0% { transform: rotateX(0deg); } 100% { transform: rotateX(-90deg); } }
@keyframes flipUnfold { 0% { transform: rotateX(-90deg); } 100% { transform: rotateX(0deg); } }
.digit.is-flipping .digit__top.flip { transform: rotateX(-90deg); animation: flipUnfold 360ms ease-out forwards; }
.digit.is-flipping .digit__bottom.flip { animation: none; }
.digit.is-flipping .digit__top.flip { visibility: visible; }
.digit.is-flipping .digit__bottom.flip { visibility: hidden; }
.digit.is-spinning .digit__face { animation: wheelSpinToward 480ms cubic-bezier(0.2, 0.6, 0.2, 1) forwards; }
.digit.is-spinning .digit__half { display: none; }
.digit.is-spinning .digit__top.flip, .digit.is-spinning .digit__bottom.flip { visibility: hidden; }
@keyframes wheelSpinToward { 0% { transform: rotateX(0deg); } 55% { transform: rotateX(200deg); } 100% { transform: rotateX(180deg); } }
.digit.is-flipping .digit__half { display: none; }
.digit.is-flipping .digit__face { visibility: visible; }
.digit.is-flipping .digit__top { border-bottom-color: transparent; }
.digit__top.flip::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.digit__top.flip::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.25), rgba(255,255,255,0)); opacity: 0; }
@keyframes flapShadowReveal { 0% { opacity: 0.0; filter: blur(0.2px); } 40% { opacity: 0.65; } 100% { opacity: 0.0; } }
@keyframes flapCreaseBlink { 0% { opacity: 0; } 35% { opacity: 0.8; } 60% { opacity: 0.3; } 100% { opacity: 0; } }
.digit.is-flipping .digit__top.flip::after { animation: flapShadowReveal 360ms ease-out forwards; }
.digit.is-flipping .digit__top.flip::before { animation: flapCreaseBlink 360ms ease-out forwards; }


/* Animated glow for State 1 show name */
#state1ShowName {
  position: relative;
  z-index: 0;
  padding: 0 4px;
  border-radius: 8px;
  /* keep subtle readability without its own glow spot */
  /* text-shadow: 0 0 6px rgba(255,191,73,0.18), 0 0 10px rgba(60,110,220,0.16); */
}
/* (removed span-level glow layers to avoid double spots) */
/* Expand glow to cover the entire title area in State 1 */
#state-1 .app-title {
  position: relative;
  z-index: 0;
  text-shadow: 0 0 18px rgba(119,68,201,0.35);
}
#state-1 .app-title::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 240%;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  filter: blur(36px);
  opacity: 0.9;
  /* Single blended glow (mix controlled by custom properties) */
  background:
    radial-gradient(74% 74% at 50% 50%, rgba(40,110,230, var(--blue-a)), rgba(40,110,230,0.0) 82%),
    radial-gradient(66% 66% at 50% 50%, rgba(255,191,73, var(--amber-a)), rgba(255,191,73,0.0) 72%),
    radial-gradient(34% 34% at 50% 50%, rgba(255,205,100, var(--amber-a)), rgba(255,205,100,0.0) 70%);
  animation:
    titleGlowPulse var(--title-pulse-dur) ease-in-out infinite alternate,
    titleMixPulse var(--title-mix-dur) ease-in-out infinite alternate;
}

@keyframes titleGlowPulse {
  0%   { transform: translate(-50%, -50%) scale(0.95); opacity: 0.65; filter: blur(30px); }
  50%  { transform: translate(-50%, -50%) scale(1.06); opacity: 1.0; filter: blur(38px); }
  100% { transform: translate(-50%, -50%) scale(1.01); opacity: 0.85; filter: blur(34px); }
}

/* Animate the color mix between amber and blue; values jitter via duration/delay set by JS */
@keyframes titleMixPulse {
  /* Alternate cleanly: amber peak -> blue peak -> amber peak, equal intensities */
  0%   { --amber-a: 0.99; --blue-a: 0.35; }
  50%  { --amber-a: 0.35; --blue-a: 0.99; }
  100% { --amber-a: 0.99; --blue-a: 0.35; }
}



/* Show pointer cursor for interactive parts */
.actionbtn { cursor: pointer; }
.pad, .pad .pad__content { cursor: pointer; }
.actionbtn, .pad, .pad__content, .pad__canvas {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* disable long-press callout */
  -webkit-tap-highlight-color: transparent; /* remove blue flash on tap */
}




/* Mobile responsive styles */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .color-selector {
        gap: 20px;
    }
    
    .color-btn {
        padding: 12px 25px;
        font-size: 12px;
    }
    
    .howto__content p {
        font-size: 14px;
        color: #ccb99c;
    }
    
}

/* State 3: Updating Message */
#state-3 {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

#state-3.is-active {
  display: flex;
}

#state-3 header {
  width: 100%;
  max-width: var(--content-max);
  padding: 20px;
}

#state-3 .app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  padding: 40px 20px;
}

.updating-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  max-width: 600px;
  margin: 0 auto;
}

.updating-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.updating-title {
  color: #f5e6d3;
  font-family: "Excon", "JetBrains Mono", ui-monospace, monospace;
  font-size: 2em;
  font-weight: 500;
  margin: 0;
  text-shadow: 0 0 10px rgba(245, 230, 211, 0.3);
}

.updating-text {
  color: #ccb99c;
  font-family: "Excon", "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.2em;
  font-weight: 350;
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .updating-title {
    font-size: 1.5em;
  }
  
  .updating-text {
    font-size: 1em;
  }
}