@import url('https://fonts.googleapis.com/css2?family=Roboto&family=Noto+Sans+JP&family=Orbitron&family=DS-Digital&family=Gaegu&family=Nosifer&family=DotGothic16&family=Zen+Kurenaido&family=Rock+Salt&family=Special+Elite&family=Share+Tech+Mono&family=VT323&family=Cutive+Mono&family=Press+Start+2P&family=Yuji+Syuku&family=Train+One&family=M+PLUS+Rounded+1c&display=swap');

body {
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding-top: 55px;
    padding-bottom: 40px;
    transition: background-color 0.3s;
    overflow: hidden;
    height: 100vh;
    box-sizing: border-box;
}

.container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: stretch;
    height: 100%;
    width: 100vw;
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-sizing: border-box;
    position: relative; /* Ensure absolute children like #controls.collapsed stay within bounds */
}

#clock-display {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

#analog-clock-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}


#controls {
    width: 400px;
    background-color: #ffffff;
    padding: 20px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    transition: transform 0.3s ease;
    z-index: 100;
}

#controls.collapsed {
    transform: translateX(100%);
    position: absolute;
    right: 0;
    top: 0;
}

h2, h4 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
h4 {
    margin-top: 20px;
}


.control-group {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.control-group label {
    white-space: nowrap;
}

.force-hidden {
    display: none !important;
}

.force-visible {
    display: grid !important;
}

.control-group select,
.control-group input:not([type="checkbox"]) {
   width: 100%;
   box-sizing: border-box;
}


.control-group input[type="range"] {
    width: 100%; /* For full width in flex container */
}

.control-group input[type="color"] {
    min-width: 40px;
    padding: 2px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* For checkbox groups where label comes first */
.control-group input[type="checkbox"] {
    grid-column: 2;
    justify-self: end;
}

/* Make toggles look like toggles */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background-color: #adadad; /* Darker for better contrast */
  transition: background-color 0.2s;
  cursor: pointer;
}
input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: white;
  transition: transform 0.2s;
}
input[type="checkbox"]:checked {
  background-color: #4CAF50; /* Green */
}
input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

/* Controls Toggle Button */
#toggle-controls-btn {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

#toggle-controls-btn:hover {
    background-color: #f0f0f0;
}

/* UI Hidden Mode */
body.ui-hidden {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.ui-hidden .common-header,
.ui-hidden .common-footer,
.ui-hidden #controls,
.ui-hidden #toggle-controls-btn {
    display: none !important;
}

.ui-hidden #clock-display {
    height: 100vh !important;
}

/* Accordion Styles */
details {
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 10px;
}

details summary {
    padding: 10px;
    background-color: #f9f9f9;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: '▶ ';
    font-size: 0.8em;
}

details[open] summary::before {
    content: '▼ ';
}

details .content {
    padding: 10px;
}

/* Digital Clock Animations */
.digital-component {
    display: inline-block;
    position: relative;
    vertical-align: top;
}

.animate-fade {
    animation: fade-in 0.5s ease-out;
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-slide-up {
    animation: slide-up-in 0.5s ease-out;
}
@keyframes slide-up-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-slide-down {
    animation: slide-down-in 0.5s ease-out;
}
@keyframes slide-down-in {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-zoom {
    animation: zoom-in 0.5s ease-out;
}
@keyframes zoom-in {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-flip {
    animation: flip-in 0.5s ease-out;
    backface-visibility: hidden;
}
@keyframes flip-in {
    from { transform: rotateX(-90deg); opacity: 0; }
    to { transform: rotateX(0); opacity: 1; }
}
