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

:root {
  --accent: #FF5C00;
  --bg: #0A0A0A;
  --surface: #1A1A1A;
  --fg: #FFFFFF;
  --fg-muted: #888;
  --radius: 16px;
}

html, body {
  height: 100%;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== GROUP LIST VIEW ===== */
.group-list {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 env(safe-area-inset-bottom);
}

.group-list-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 16px 20px 12px;
  border-bottom: 1px solid #222;
}

.group-list-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.group-list-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.group-list-header span {
  font-size: 13px;
  color: var(--fg-muted);
}

.fullscreen-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #333;
  color: var(--fg);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.fullscreen-btn:active {
  background: #333;
}

.groups {
  padding: 8px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.group-card:active {
  transform: scale(0.97);
  background: #252525;
}

.group-card-info h2 {
  font-size: 16px;
  font-weight: 600;
}

.group-card-info p {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.group-card-count {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* ===== VIEWER VIEW ===== */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.viewer.active {
  transform: translateY(0);
}

/* Overlay (header + dots) floats on top of fullscreen image */
.viewer-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.25s;
}

.viewer-overlay.hidden {
  opacity: 0;
}

.viewer-overlay > * {
  pointer-events: auto;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: calc(12px + env(safe-area-inset-top));
  min-height: 48px;
  flex-shrink: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.viewer-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  color: var(--fg);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.viewer-back:active {
  background: #333;
}

.viewer-title {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  flex: 1;
}

.viewer-counter {
  font-size: 12px;
  color: var(--fg-muted);
  min-width: 36px;
  text-align: right;
}

/* Carousel */
.carousel-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.carousel-track.dragging {
  transition: none;
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  flex-wrap: wrap;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #444;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* Swipe-down hint */
.swipe-hint {
  width: 36px;
  height: 4px;
  background: #555;
  border-radius: 2px;
  margin: 8px auto 0;
  flex-shrink: 0;
}
