@font-face {
  font-family: 'Oswald';
  src: url('/fonts/Oswald-VariableFont_wght.ttf') format('truetype');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'FKT Echo';
  src: url('/fonts/FKTEcho_Rg.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'FKT Echo';
  src: url('/fonts/FKTEcho_Md.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Turntable Cabinet Body */
  --player-body-bg: #eae5d9;
  --player-body-bg-dark: #d8d2c4;
  --player-body-border: #b8b2a4;
  
  /* Knobs, Needles, Sliders */
  --dials-bg: #cbb086;
  --dials-bg-dark: #bba078;
  --dials-bg-light: #dfcaa4;
  --dials-border: #a48a64;
  
  /* Vinyl Record */
  --vinyl-bg: #0e1525;
  --vinyl-grooves: #17243c;
  --vinyl-label-bg: #f3af2b;
  --vinyl-label-text: #412a02;
  
  /* Inset display panels */
  --display-bg: #d7d1c1;
  --display-text: #412a02;

  /* Realistic vinyl concentric lines texture */
  --speckled2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='filter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.05'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0 0 1 1'/%3E%3C/feComponentTransfer%3E%3CfeComposite in='SourceGraphic' operator='in'/%3E%3CfeMorphology radius='1' operator='dilate'/%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Ccircle r='150%25'/%3E%3Cg fill='none' stroke='%23bef' stroke-width='99%25' filter='url(%23filter)'%3E%3Ccircle cx='50%25' cy='50%25' r='57%25' stroke-dasharray='2 60 .5 60'/%3E%3Ccircle cx='50%25' cy='50%25' r='71%25' stroke-dasharray='.5 43 2 47'/%3E%3C/g%3E%3C/svg%3E") no-repeat center;
}

body {
  overflow: hidden;
  background-color: transparent;
  padding: 0;
  margin: 0;
  font-family: "Oswald", sans-serif;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

main {
  width: 420px;
  height: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  padding: 12px;
}

.player-title {
  font-family: 'FKT Echo', serif;
  font-size: 26px; /* Enlarged title */
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--player-body-bg);
  margin: 0 0 6px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  opacity: 0.9;
  user-select: none;
  pointer-events: none;
}

/* SKEUOMORPHIC PLAYER BOX */
.playerBg {
  position: relative;
  height: 280px; /* Scaled up from 222px */
  width: 380px;  /* Scaled up from 300px */
  background-color: var(--player-body-bg);
  background: linear-gradient(135deg, var(--player-body-bg) 0%, var(--player-body-bg-dark) 100%);
  border-radius: 24px;
  box-shadow: 
    0 24px 50px rgba(0, 0, 0, 0.6),
    inset rgba(255, 255, 255, 0.4) 0 1px 2px,
    inset rgba(0, 0, 0, 0.08) 0 -1px 2px;
  overflow: visible; /* Prevents needle arm from getting clipped on the right */
  border: 1px solid var(--player-body-border);
}

.recordBg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% - 25px), -50%); /* Scaled offset: 20 * 1.26 = 25px */
  height: 265px; /* Scaled up from 210px */
  width: 265px;  /* Scaled up from 210px */
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

/* Update SVG fill dynamically */
.recordBg g {
  fill: var(--vinyl-bg);
}

.discBg {
  position: absolute;
  top: 7.8%;
  left: 10.1%;
  height: 88%;
  width: 65.12%;
  border-radius: 50%;
  background-color: var(--vinyl-grooves);
  background: var(--speckled2);
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
}

/* Spin animation triggered via JS play class */
.is-playing .discBg {
  animation: spin 8000ms linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.recordMiddle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% - 27.5px), calc(-50% + 2.5px)); /* Scaled offset: 22 * 1.26 = 27.5px */
  height: 82px; /* Scaled up from 65px */
  width: 82px;  /* Scaled up from 65px */
  border-radius: 50%;
  background-color: var(--vinyl-bg);
  border: 3px solid var(--vinyl-bg);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

/* Central Spindle Pin Removed */

#record-artwork {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transform: rotate(0deg);
  pointer-events: none;
}

.is-playing #record-artwork {
  animation: spin 8000ms linear infinite;
}

/* NEEDLE ARM ASSEMBLY */
.needleBox {
  position: absolute;
  height: 80%;
  width: 50%;
  top: 17%;
  right: 12%;
  transform-origin: top right;
  transform: rotate(-45deg); /* Reverted / off-state default */
  transition: transform 800ms cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 5;
  pointer-events: none;
}

.curvedNeedle {
  stroke: var(--dials-bg);
  stroke-linecap: round;
}

.curve {
  position: absolute;
  top: 0%;
  right: 0%;
  height: 140px; /* Scaled up from 111px */
  width: 57px;   /* Scaled up from 45px */
}

.needleSquare {
  background: var(--dials-bg);
  position: absolute;
  top: 0%;
  right: 0%;
  transform: translate(50%, -50%) rotate(45deg);
  height: 25px; /* Scaled up from 20px */
  width: 25px;  /* Scaled up from 20px */
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.needleSquare::before {
  content: '';
  background: var(--dials-bg-light);
  position: absolute;
  top: -95%;
  right: 0%;
  height: 100%;
  width: 100%;
  border-radius: 4px 4px 0 0;
}

.needleHead {
  background: var(--dials-bg);
  position: absolute;
  top: 67%;
  right: 37%;
  transform: translate(50%, -50%) rotate(55deg);
  height: 53px; /* Scaled up from 42px */
  width: 13px;  /* Scaled up from 10px */
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.needleHead::before {
  content: '';
  background: var(--dials-bg-dark);
  position: absolute;
  top: 80%;
  left: 50%;
  transform: translate(-50%);
  height: 40%;
  width: 125%;
  border-radius: 50% 50% 0 0;
}

/* CABINET DIALS AND METERS */
.knobTL {
  position: absolute;
  top: 4%;
  left: 4%;
  height: 14%;
  width: 10.36%;
  border-radius: 50%;
  background-color: var(--dials-bg);
  box-shadow: inset rgba(0,0,0,0.15) 0 1.5px 3px, 0 1px 1px rgba(255,255,255,0.4);
}

/* Play/Pause control knob */
.knobTR {
  position: absolute;
  top: 6%;
  right: 3.5%;
  height: 26%;
  width: 19.24%;
  border-radius: 50%;
  background-color: var(--dials-bg);
  box-shadow: 
    0 3px 8px rgba(0, 0, 0, 0.2),
    inset rgba(255, 255, 255, 0.4) 0 1px 2px;
  transition: transform 0.4s ease;
  cursor: pointer;
  z-index: 10;
}

.knobTR > i:nth-child(1) {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 66%;
  width: 66%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background-color: var(--vinyl-bg);
  border: 2px solid var(--dials-bg-light);
}

/* Clickable Play Overlay Button inside Knob */
.play-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: none;
}

/* Play Indicator Dot on dial */
.knobTR::after {
  content: '';
  position: absolute;
  width: 3.5px;
  height: 3.5px;
  background-color: var(--vinyl-label-bg);
  border-radius: 50%;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.3s ease;
}

.is-playing .knobTR {
  transform: rotate(35deg);
}

/* Tooltip on startup */
.play-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  padding: 6px 12px;
  background-color: var(--vinyl-bg);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  animation: tooltip-fade 0.4s 0.6s ease-out forwards;
  z-index: 20;
}

.play-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-style: solid;
  border-width: 5px 6px 0 6px;
  border-color: var(--vinyl-bg) transparent transparent transparent;
}

@keyframes tooltip-fade {
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.knobBL {
  position: absolute;
  bottom: 11.5%;
  left: 4.5%;
  height: 10%;
  width: 7.4%;
  border-radius: 50%;
  background-color: var(--dials-bg);
  box-shadow: inset rgba(0,0,0,0.15) 0 1.5px 3px;
}

.rectBL {
  position: absolute;
  bottom: 2.2%;
  left: 4%;
  height: 5%;
  width: 8%;
  background-color: var(--vinyl-bg);
  border: 1px solid var(--dials-bg-light);
}

.rectBL2 {
  position: absolute;
  bottom: 2.2%;
  left: 14%;
  height: 3%;
  width: 10%;
  background-color: var(--dials-bg-dark);
  border: 1px solid var(--dials-border);
}

.rectBR {
  position: absolute;
  bottom: 2%;
  left: 62%;
  height: 3.6%;
  width: 6%;
  background-color: var(--dials-bg-dark);
  border: 1px solid var(--dials-border);
}

.play-pause-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Oswald", sans-serif;
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  color: var(--dials-bg);
  z-index: 5;
  user-select: none;
  pointer-events: none;
}

/* VOLUME SLIDER CONTAINER (Centered Under Hinge Dial) */
.rectBR3 {
  position: absolute;
  bottom: 5%;
  left: 82.6%;
  height: 58%;
  width: 8.5%;
  background-color: var(--dials-bg-dark);
  border: 1px solid var(--dials-border);
}

.wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 60%;
  width: 100%;
}

/* Custom vertical range input */
.range {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  padding: 0;
  width: 140px; /* Scaled up length (fitted for 280px cabinet) */
  height: 16px;
  transform: translate(-50%, -50%) rotate(-90deg);
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
}

.range::-webkit-slider-runnable-track {
  box-sizing: border-box;
  border: none;
  width: 100%;
  height: 3px;
  background: var(--dials-bg-light);
  border-radius: 2px;
}

.range::-moz-range-track {
  box-sizing: border-box;
  border: none;
  width: 100%;
  height: 3px;
  background: var(--dials-bg-light);
  border-radius: 2px;
}

.range::-webkit-slider-thumb {
  margin-top: -11px; /* Offset for 25px height: (3 - 25)/2 = -11px */
  box-sizing: border-box;
  border: 1px solid var(--dials-bg);
  width: 15px;  /* Scaled up width */
  height: 25px; /* Scaled up height */
  border-radius: 2px;
  background: var(--vinyl-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  -webkit-appearance: none;
}

.range::-moz-range-thumb {
  box-sizing: border-box;
  border: 1px solid var(--dials-bg);
  width: 15px;  /* Scaled up width */
  height: 25px; /* Scaled up height */
  border-radius: 2px;
  background: var(--vinyl-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ALBUM SELECTOR LIST (3D Stacked Carousel) */
.album-select {
  position: relative;
  width: 265px;
  height: 265px;
  margin: 10px auto;
  perspective: 800px;
  transform-style: preserve-3d;
  display: block;
  box-sizing: border-box;
}

.album-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.4s, box-shadow 0.4s;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  background-color: var(--vinyl-bg);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.album-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

/* Card positions in the 3D stack */
.album-card.pos-left {
  transform: translateX(-25%) translateZ(-150px) rotateY(30deg) scale(0.85);
  opacity: 0.55;
  z-index: 5;
}

.album-card.pos-center {
  transform: translateX(0) translateZ(0) rotateY(0deg) scale(1);
  opacity: 1;
  z-index: 10;
  border-color: var(--vinyl-label-bg);
  box-shadow: 
    0 0 16px rgba(243, 175, 43, 0.5),
    0 12px 28px rgba(0, 0, 0, 0.45);
}

.album-card.pos-right {
  transform: translateX(25%) translateZ(-150px) rotateY(-30deg) scale(0.85);
  opacity: 0.55;
  z-index: 5;
}

/* Active card hover (retains scale pop but limits it to pos-center to avoid layout bugs) */
.album-card.pos-center:hover {
  transform: translateY(-4px) scale(1.025);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 
    0 16px 30px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.album-card.pos-center:hover img {
  transform: scale(1.06);
}

/* Hidden tooltip titles for album covers */
.album-hover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Show details only for active card on hover */
.album-card.pos-center:hover .album-hover-info {
  opacity: 1;
}

.album-hover-info .title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-hover-info .artist {
  font-size: 9px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Nav arrows for album tracks carousel */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateZ(200px);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--player-body-border);
  background-color: var(--player-body-bg);
  color: var(--vinyl-label-text);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  padding: 0;
  outline: none;
}

.nav-arrow:hover {
  background-color: var(--dials-bg-light);
  transform: translateY(-50%) scale(1.1) translateZ(200px);
}

.nav-arrow:active {
  background-color: var(--dials-bg);
  transform: translateY(-50%) scale(0.95) translateZ(200px);
}

.prev-arrow {
  left: -18px;
}

.next-arrow {
  right: -18px;
}
