html {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: #F6BB7E;
  transition: background-color 0.3s ease;
}

html.dark {
  background-color: #1F2938;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

canvas {
  max-width: 350px;
  width: 90vw;
  height: auto;
  display: block;
}

.fallback-image {
  display: none;
  max-width: 350px;
  width: 90vw;
  height: auto;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}

.toggle-track {
  display: flex;
  align-items: center;
  position: relative;
  width: 120px;
  height: 36px;
  border-radius: 18px;
  background: rgba(198, 95, 40, 0.15);
  transition: background 0.3s ease;
  overflow: hidden;
}

html.dark .toggle-track {
  background: rgba(212, 145, 90, 0.2);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: 30px;
  border-radius: 15px;
  background: #9B4B1C;
  transition: transform 0.3s ease, background 0.3s ease;
}

.theme-toggle.is-dark .toggle-thumb {
  transform: translateX(100%);
  background: #9B5B2E;
}

.toggle-label {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
  font-family: "new-spirit", serif;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 36px;
  transition: color 0.3s ease;
  user-select: none;
  pointer-events: none;
}

/* Light mode: active "Light" is white on thumb, inactive "Dark" is dark brown on track */
.toggle-label--light {
  color: #fff;
}

.toggle-label--dark {
  color: #7B3A15;
}

/* Dark mode: active "Dark" is white on thumb, inactive "Light" is light tan on track */
.theme-toggle.is-dark .toggle-label--light {
  color: #D1A880;
}

.theme-toggle.is-dark .toggle-label--dark {
  color: #fff;
}

.theme-toggle:hover .toggle-track {
  background: rgba(198, 95, 40, 0.25);
}

html.dark .theme-toggle:hover .toggle-track {
  background: rgba(212, 145, 90, 0.3);
}

.site-footer {
  font-family: "new-spirit", serif;
  font-weight: 600;
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
  padding: 1rem 0;
  font-size: 0.85rem;
  color: #7E3D1D;
  pointer-events: none;
  transition: color 0.3s ease;
}

html.dark .site-footer {
  color: #4DB882;
}
