:root {
  --album-size: clamp(110px, min(50vw, 65vh), 600px);
}

@media (max-width: 767px) {
  :root {
    --album-size: clamp(200px, 85vw, 350px);
  }
}
body {
  margin: 0;
  background-color: #000;
  color: #fff;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Flex', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  touch-action: none;
}

.scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  perspective: clamp(800px, 120vw, 2000px); 
  display: flex;
  align-items: center;
  justify-content: center;
}

.coverflow {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.album {
  position: absolute;
  width: var(--album-size);
  height: var(--album-size);
  top: 50%;
  left: 50%;
  transition: transform 0.38s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform-style: preserve-3d;
  cursor: pointer;
  pointer-events: all;
}

.album-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.25, 1);
  transform-style: preserve-3d;
}

.album.flipped .album-inner {
  transform: translateZ(calc(var(--album-size) * 0.3)) rotateY(180deg);
  cursor: default; 
}

.face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background-color: #000; 
  box-shadow: 0 20px 50px rgba(0,0,0,0.9);
}

.face.front {
  transform: rotateY(0deg) translateZ(1px);
}

.face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.face.front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 45%);
  pointer-events: none;
}

.face.back {
  transform: rotateY(180deg) translateZ(1px);
  border-radius: 4px;
}

.back-content {
  width: 100%;
  height: 100%;
  padding: 0; 
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  border: 2px solid #fff;
  background: linear-gradient(to bottom, #2a2a2a 0%, #151515 100%);
  overflow-y: auto; 
  border-radius: 4px;
  /* Cross-browser removal of the inverted scrollbar */
  scrollbar-width: none; 
  -ms-overflow-style: none; 
}

.back-content::-webkit-scrollbar { 
  display: none; 
}

.ios6-banner {
  width: 100%;
  height: auto; 
  min-height: clamp(16px, 2.5vw, 32px); 
  background: 
    linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 50%, rgba(0,0,0,0.2) 51%, rgba(0,0,0,0.1) 100%), 
    linear-gradient(to bottom, #4a4a4a 0%, #252525 100%); 
  border-bottom: 1px solid #0a0a0a;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 2px 5px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: flex-start; 
  padding: clamp(4px, 0.75vw, 8px) clamp(6px, 1.25vw, 12px); 
  flex-shrink: 0; 
  cursor: pointer; 
  box-sizing: border-box;
}

.ios6-banner h3 {
  margin: 0;
  font-size: clamp(0.45rem, 1.5vw, 0.9rem);
  font-weight: 600; 
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
  flex: 1;
}

.ios6-banner .close-btn {
  width: clamp(18px, 2.75vw, 28px);
  height: clamp(18px, 2.75vw, 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #3a3a3a 0%, #555555 100%);
  border: 1px solid #141414;
  border-radius: 50%;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: all 0.15s ease;
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.8),
    inset 0 -1px 0 rgba(255,255,255,0.15),
    inset 1px 0 0 rgba(0,0,0,0.6),
    inset -1px 0 0 rgba(255,255,255,0.1);
  position: relative;
}

.ios6-banner .close-btn:hover {
  background: linear-gradient(145deg, #454545 0%, #606060 100%);
  box-shadow: 
    inset 0 2px 5px rgba(0,0,0,0.9),
    inset 0 -1px 0 rgba(255,255,255,0.2),
    inset 1px 0 0 rgba(0,0,0,0.7),
    inset -1px 0 0 rgba(255,255,255,0.15);
}

.ios6-banner .close-btn:active {
  background: linear-gradient(145deg, #2a2a2a 0%, #454545 100%);
  box-shadow: 
    inset 0 3px 6px rgba(0,0,0,1),
    inset 0 -0.5px 0 rgba(255,255,255,0.1),
    inset 1px 0 0 rgba(0,0,0,0.8),
    inset -1px 0 0 rgba(255,255,255,0.05);
  transform: translateY(0.5px);
}

.ios6-banner .close-btn svg {
  width: 55%;
  height: 55%;
  stroke: #fff;
  stroke-width: 2.5;
}

.back-text-body {
  width: 100%;
  padding: clamp(8px, 1.75vw, 20px);
  box-sizing: border-box;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  cursor: text; 
  text-align: left;
}

.back-content p { 
  width: 100%;
  margin: clamp(4px, 1vw, 12px) 0; 
  font-size: clamp(1.0rem, 2.8vw, 1.8rem);
  color: #ccc; 
  line-height: 1.6; 
  font-weight: 400; 
  overflow-wrap: break-word; 
  word-wrap: break-word;
  word-break: break-word;
}

/* Markdown content styles */
.markdown-content {
  width: 100%;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: clamp(4px, 1vw, 8px) 0 clamp(2px, 0.5vw, 4px) 0;
  color: #fff;
  font-weight: 600;
}

.markdown-content h1 {
  font-size: clamp(0.7rem, 1.75vw, 1.1rem);
}

.markdown-content h2 {
  font-size: clamp(0.6rem, 1.5vw, 1rem);
}

.markdown-content h3 {
  font-size: clamp(0.55rem, 1.4vw, 0.9rem);
}

.markdown-content p {
  margin: clamp(2px, 0.5vw, 6px) 0;
  font-size: clamp(0.5rem, 1.4vw, 0.9rem);
  color: #ccc;
  line-height: 1.6;
}

.markdown-content ul,
.markdown-content ol {
  margin: clamp(2px, 0.5vw, 6px) 0;
  padding-left: clamp(8px, 1.5vw, 16px);
}

.markdown-content li {
  margin: clamp(1px, 0.25vw, 3px) 0;
  font-size: clamp(0.5rem, 1.4vw, 0.9rem);
  color: #ccc;
  line-height: 1.5;
}

.markdown-content a {
  color: #6a9fd4;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 3px;
  border-radius: 2px;
  font-size: clamp(0.45rem, 1.25vw, 0.8rem);
  color: #e0e0e0;
}

.markdown-content pre {
  background: rgba(0, 0, 0, 0.4);
  padding: clamp(4px, 1vw, 8px);
  border-radius: 4px;
  overflow-x: auto;
  margin: clamp(4px, 1vw, 8px) 0;
}

.markdown-content pre code {
  background: none;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 2px solid #6a9fd4;
  padding-left: clamp(4px, 1vw, 8px);
  margin: clamp(4px, 1vw, 8px) 0;
  color: #aaa;
  font-style: italic;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid #444;
  margin: clamp(6px, 1.5vw, 12px) 0;
}

.markdown-content img {
  max-width: 100%;
  border-radius: 4px;
  margin: clamp(4px, 1vw, 8px) 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: clamp(4px, 1vw, 8px) 0;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #444;
  padding: clamp(2px, 0.5vw, 4px);
  text-align: left;
  font-size: clamp(0.45rem, 1.25vw, 0.8rem);
}

.markdown-content th {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* Mobile-specific styles */
@media (max-width: 767px) {
  /* Title and artist below carousel tiles */
  .title-container h2 {
    font-size: clamp(0.9rem, 5vw, 1.2rem);
  }
  
  .title-container p {
    font-size: clamp(0.7rem, 3.5vw, 0.9rem);
  }
  
  /* Bigger pop-out text on mobile */
  .ios6-banner h3 {
    font-size: clamp(0.9rem, 4.5vw, 1.2rem);
  }
  
  .ios6-banner .close-btn {
    width: clamp(28px, 8vw, 40px);
    height: clamp(28px, 8vw, 40px);
  }
  
  .back-text-body {
    padding: clamp(12px, 4vw, 20px);
  }
  
  .markdown-content h1 {
    font-size: clamp(1rem, 5vw, 1.5rem);
  }
  
  .markdown-content h2 {
    font-size: clamp(0.9rem, 4.5vw, 1.3rem);
  }
  
  .markdown-content h3 {
    font-size: clamp(0.85rem, 4vw, 1.1rem);
  }
  
  .markdown-content p,
  .markdown-content li {
    font-size: clamp(0.8rem, 4vw, 1rem);
    line-height: 1.5;
  }
  
  .markdown-content ul,
  .markdown-content ol {
    padding-left: clamp(12px, 4vw, 20px);
  }
  
  .markdown-content code {
    font-size: clamp(0.75rem, 3.5vw, 0.9rem);
  }
  
  .markdown-content th,
  .markdown-content td {
    font-size: clamp(0.75rem, 3.5vw, 0.9rem);
    padding: clamp(4px, 1.5vw, 8px);
  }
}

/* Larger text on desktop */
@media (min-width: 768px) {
  .ios6-banner {
    min-height: clamp(24px, 3.5vw, 48px);
    padding: clamp(6px, 1vw, 12px) clamp(8px, 1.5vw, 16px);
  }

  .ios6-banner h3 {
    font-size: clamp(0.75rem, 2vw, 1.25rem);
  }

  .markdown-content h1 {
    font-size: clamp(1.25rem, 3vw, 2rem);
  }

  .markdown-content h2 {
    font-size: clamp(1.125rem, 2.75vw, 1.75rem);
  }

  .markdown-content h3 {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
  }

  .markdown-content p,
  .markdown-content li {
    font-size: clamp(0.875rem, 2vw, 1.25rem);
  }

  .markdown-content code {
    font-size: clamp(0.75rem, 1.75vw, 1rem);
  }

  .markdown-content th,
  .markdown-content td {
    font-size: clamp(0.75rem, 1.75vw, 1rem);
  }
}

.reflection-container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleY(-1);
  background-color: #000; 
  pointer-events: none;
}

.reflection-container::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,1) 80%);
}


.title-container {
  position: absolute;
  top: calc(50% + (var(--album-size) / 2) + clamp(8px, 1.5vw, 16px));
  left: 0;
  width: 100vw;
  text-align: center;
  z-index: 200; 
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.title-container h2 {
  margin: 0;
  font-size: clamp(0.6rem, 2.25vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.title-container p {
  margin: clamp(1px, 0.25vw, 4px) 0 0 0;
  font-size: clamp(0.425rem, 1.25vw, 0.7rem);
  color: #aaa;
  font-weight: 400;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

/* Mobile title and artist - must come after general styles to override */
@media (max-width: 767px) {
  .title-container h2 {
    font-size: clamp(1rem, 5.5vw, 1.4rem);
  }
  
  .title-container p {
    font-size: clamp(0.8rem, 4vw, 1rem);
  }
  
  /* More padding for iOS banner title on mobile */
  .ios6-banner {
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
  }
  
  .ios6-banner h3 {
    font-size: clamp(1rem, 5vw, 1.3rem);
  }
}

#swipe-hint {
  position: fixed;
  top: calc(50% - (var(--album-size) / 2) - clamp(40px, 8vw, 60px));
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 1rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 300;
}

#swipe-hint.visible { opacity: 1; }

/* Make swipe hint larger on mobile */
@media (max-width: 767px) {
  #swipe-hint {
    font-size: 1.1rem;
    top: calc(50% - (var(--album-size) / 2) - clamp(50px, 10vw, 70px));
  }
}

/* iOS-style navigation arrows - simple gray circles with triangle arrows */
.nav-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(30px, 3.5vw, 45px);
  height: clamp(30px, 3.5vw, 45px);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 150;
  transition: opacity 0.15s ease;
  align-items: center;
  justify-content: center;
  padding: 0;
  
  /* Simple opaque gray background */
  background: rgba(80, 80, 80, 0.85);
  
  color: #fff;
}

/* Triangle arrow icon */
.nav-arrow svg {
  width: 45%;
  height: 45%;
}

/* Left arrow positioning */
.nav-arrow-left {
  left: clamp(24px, 5vw, 56px);
}

/* Right arrow positioning */
.nav-arrow-right {
  right: clamp(24px, 5vw, 56px);
}

.nav-arrow:hover {
  background: rgba(100, 100, 100, 0.9);
}

.nav-arrow:active {
  background: rgba(60, 60, 60, 0.95);
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-arrow:disabled:hover {
  background: rgba(80, 80, 80, 0.85);
}

/* Show arrows only on desktop (non-mobile) */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
