/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-color: #000000;
  --text-color: #ffffff;
  --accent-color: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #000;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Splash Screen */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease-out;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

#splash-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* Main Canvas - full screen */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 0;
  background: #000;
}

#canvas-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Touch zones for mobile navigation */
.touch-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.2s;
}

#touch-zone-left {
  left: 0;
}

#touch-zone-right {
  right: 0;
}

/* Visual feedback on touch/hover */
.touch-zone:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.touch-zone:active {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Hide touch zones on desktop (where mouse is primary) */
@media (hover: hover) and (pointer: fine) {
  .touch-zone {
    display: none;
  }
}

#display-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: none;
}

#display-image.loaded {
  display: block;
}

#loading,
#error {
  font-size: 1.2rem;
  color: #666;
}

#error {
  color: #ff4444;
}

/* Controls - minimal black */
#controls {
  background: #000;
  padding: 1rem 0.5rem calc(2rem + env(safe-area-inset-bottom)) 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Transport Controls - minimal white buttons on black */
.transport-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.transport-controls button {
  background: transparent;
  border: none;
  color: #8c8c8c;
  padding: 0.6rem 0.3rem;
  cursor: pointer;
  transition: opacity 0.2s;
  min-width: 32px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.transport-controls button img {
  width: 32px;
  height: 32px;
  display: block;
  opacity: 0.55;
}

.transport-controls button:active {
  opacity: 0.5;
}

/* Image counter in center */
.image-counter {
  font-size: 2rem;
  color: #8c8c8c;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  min-width: 88px;
  text-align: center;
  user-select: none;
  flex: 0 0 auto;
  position: relative;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}

.image-counter.is-pending,
.image-counter.is-fetching {
  color: #9b7f7f;
}

.image-counter.is-fetching::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.15rem);
  width: 0.65rem;
  height: 0.65rem;
  margin-left: -0.325rem;
  border: 2px solid rgba(155, 127, 127, 0.35);
  border-top-color: currentColor;
  border-radius: 999px;
  animation: image-counter-spin 0.8s linear infinite;
}

@keyframes image-counter-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Mobile Optimized */
@media (max-width: 768px) {
  .transport-controls {
    gap: 1.5rem;
  }

  .transport-controls button {
    padding: 0.8rem 0.3rem;
    min-width: 40px;
  }

  .transport-controls button img {
    width: 28px;
    height: 28px;
  }

  .image-counter {
    font-size: 1.6rem;
    min-width: 72px;
  }

  #canvas-container {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }

  #controls {
    padding: 0.8rem 0.3rem calc(2.5rem + env(safe-area-inset-bottom)) 0.3rem;
  }
}

/* Footer - for notification button and other actions */
footer {
  background: #000;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom)) 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid #222;
}

#btn-notifications {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

#btn-notifications:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

#btn-notifications:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
  footer {
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom)) 0.5rem;
  }

  #btn-notifications {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}
