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

html {
  background: #000;
}

body {
  font-family: 'Comfortaa', sans-serif;
  background: #000;
  color: #ecd9af;
  height: 100dvh;
  width: 100vw;
}

/* ---- Main clock view ---- */

#clock-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

#clock-canvas {
  /* sized by JS */
}

#info-btn {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  font-family: 'Comfortaa', sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  color: #ecd9af;
  opacity: 0.3;
  background: none;
  border: 2px solid #ecd9af;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}

#info-btn:hover {
  opacity: 0.6;
}

/* ---- Settings view ---- */

#settings-view {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10;
  transition: opacity 0.3s;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#settings-view.hidden {
  display: none;
}

.settings-layout {
  display: flex;
  height: 100dvh;
  width: 100vw;
}

.settings-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-clock-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#preview-canvas {
  width: 100%;
  max-height: 100%;
}

.settings-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  gap: 16px;
  border-top: 1px solid rgba(236, 217, 175, 0.15);
}

.settings-divider {
  width: 1px;
  background: rgba(236, 217, 175, 0.15);
  flex-shrink: 0;
}

.settings-right {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
}

.settings-right h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
}

.settings-right p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ---- Toggle ---- */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

.toggle-row.disabled {
  opacity: 0;
  pointer-events: none;
}

.toggle {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: rgba(236, 217, 175, 0.15);
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}

.toggle-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ecd9af;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.15s ease-in-out;
}

.toggle.on .toggle-thumb {
  left: 20px;
}

/* ---- Segmented picker ---- */

.picker-row {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(236, 217, 175, 0.08);
  transition: opacity 0.2s;
}

.picker-row.disabled {
  opacity: 0;
  pointer-events: none;
}

.picker-option {
  flex: 1;
  font-family: 'Comfortaa', sans-serif;
  font-size: 14px;
  color: #ecd9af;
  background: transparent;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.picker-option.selected {
  background: rgba(236, 217, 175, 0.25);
}

/* ---- Close button ---- */

#close-btn {
  font-family: 'Comfortaa', sans-serif;
  font-size: 15px;
  color: #ecd9af;
  opacity: 0.6;
  background: none;
  border: none;
  cursor: pointer;
  align-self: flex-end;
  padding: 8px 0;
  transition: opacity 0.2s;
}

#close-btn:hover {
  opacity: 1;
}

/* ---- Responsive: phone layout ---- */

@media (max-width: 768px) {
  body {
    overflow-y: auto;
  }

  .settings-layout {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }

  .settings-left {
    flex: none;
  }

  .settings-clock-preview {
    flex: none;
    height: 200px;
  }

  .settings-controls {
    flex: none;
  }

  .settings-divider {
    width: auto;
    height: 1px;
    background: rgba(236, 217, 175, 0.15);
  }

  .settings-right {
    flex: none;
    overflow-y: visible;
    padding-bottom: max(40px, env(safe-area-inset-bottom, 0px));
  }
}
