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

/* Accessibility: Visually hidden but available to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators */
*:focus-visible {
  outline: 2px solid #f0f0f0;
  outline-offset: 4px;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid #f0f0f0;
  outline-offset: 2px;
}

body {
  font-family: "Courier New", "Courier", monospace;
  line-height: 1.4;
  color: #f0f0f0;
  background-color: #0a0a0a;
  background-image: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.02) 2px,
      rgba(255, 255, 255, 0.02) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.02) 2px,
      rgba(255, 255, 255, 0.02) 4px
    );
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

#app {
  padding-left: 0px;
  padding-right: 0px;
  border: 3px solid #f0f0f0;
  background-color: #0a0a0a;
}
.container {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(20px) grayscale(100%);
  transition: backdrop-filter 0.3s ease;
}

.container:has(.album-artwork:hover),
.container.artwork-active {
  backdrop-filter: blur(20px) grayscale(0%);
}

main {
  width: 100%;
  max-width: 1200px;
}

/* Loading and Error States */
.loading,
.error {
  text-align: center;
  padding: 100px 20px;
  font-size: 1.5rem;
  color: #f0f0f0;
  letter-spacing: 0.3em;
  font-weight: bold;
}

.error {
  color: #ff0000;
  border: 2px solid #ff0000;
  padding: 40px;
}

.hidden {
  display: none;
}

/* Album Display Layout */
.album-display {
  display: grid;
  grid-template-columns: 0px 1fr 70px;
  gap: 40px;
  height: 100vh;
  max-height: calc(100vh - 40px);
  position: relative;
}

/* Vertical Metadata Boxes */
.metadata-left,
.metadata-right {
  display: flex;
  flex-direction: column;
  gap: 0px;
  justify-content: flex-start;
  padding-top: 0px;
  height: 100%;
  overflow: hidden;
}

.meta-box {
  border: 2px solid #f0f0f0;
  padding: 20px 10px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
  background-color: rgba(255, 255, 255, 0.02);
  flex: 1;
  overflow: hidden;
}

.meta-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  opacity: 0.6;
  font-weight: bold;
}

.meta-value {
  font-size: 1rem;
  letter-spacing: 0.1em;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* Center Content */
.content-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
  padding: 20px 0;
  height: 100%;
  overflow: hidden;
}

/* Artwork Container */
.artwork-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
}

/* Album Artwork */
.artwork-box {
  border: 3px solid #f0f0f0;
  padding: 0;
  background-color: rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 465px;
  flex-shrink: 1;
}

.artwork-box::before {
  content: "ARTWORK";
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
  z-index: 2;
  background-color: rgba(10, 10, 10, 0.8);
  padding: 5px 10px;
  border: 1px solid #f0f0f0;
}

.album-artwork {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: grayscale(100%) contrast(120%);
  transition: filter 0.3s ease;
}

.album-artwork:hover,
.album-artwork.active {
  filter: none;
}

.artwork-box.hidden {
  display: none;
}

/* Source Selector */
.source-selector {
  width: 100%;
}

.source-select {
  width: 100%;
  padding: 15px 20px;
  font-family: "Courier New", "Courier", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  background-color: #0a0a0a;
  color: #f0f0f0;
  border: 2px solid #f0f0f0;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  text-align: center;
}

.source-select:focus {
  outline: none;
  border-color: #ffffff;
  background-color: #1a1a1a;
}

.source-select option {
  background-color: #0a0a0a;
  color: #f0f0f0;
  padding: 10px;
}

.title-box {
  border: 3px solid #f0f0f0;
  padding: 60px 40px;
  background-color: rgba(255, 255, 255, 0.02);
  position: relative;
}

.title-box::before {
  content: "ALBUM";
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  opacity: 0.5;
}

.album-title {
  font-size: 2.5rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
  text-align: center;
  word-break: break-word;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
}

.platform-selector {
  width: 100%;
  display: flex;
  gap: 20px;
}

div:has(> select) {
  position: relative;
  width: 100%;
}

/* Generalized dropdown arrow for any div containing a select */
div:has(> select):before {
  position: absolute;
  top: 50%;
  right: 20px;
  content: " ";
  width: 0;
  height: 0;
  margin-top: -5px;
  border-style: solid;
  border-width: 8px 5px 0 5px;
  border-color: rgba(255, 255, 255, 0.25) transparent transparent transparent;
  pointer-events: none;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.platform-select {
  width: 100%;
  padding: 20px;
  font-family: "Courier New", "Courier", monospace;
  font-size: 1rem;
  letter-spacing: 0.1em;
  background-color: #0a0a0a;
  color: #f0f0f0;
  border: 2px solid #f0f0f0;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
}

.platform-select:focus {
  outline: none;
  border-color: #ffffff;
  background-color: #1a1a1a;
}

.platform-select option {
  background-color: #0a0a0a;
  color: #f0f0f0;
  padding: 10px;
}

.btn-listen {
  width: 100%;
  padding: 20px;
  font-family: "Courier New", "Courier", monospace;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.2em;
  border: 2px solid #f0f0f0;
  background-color: transparent;
  color: #f0f0f0;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.btn-shuffle {
  width: 60px;
  height: 60px;
  padding: 0;
  background-color: transparent;
  color: #f0f0f0;
  border: 2px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-listen:hover,
.btn-shuffle:hover {
  background-color: #f0f0f0;
  color: #0a0a0a;
}

.btn-listen:active,
.btn-shuffle:active {
  transform: scale(0.98);
}

.meta-info {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  opacity: 0.5;
  padding: 20px;
  border-top: 1px solid rgba(240, 240, 240, 0.2);
}

/* Settings Button */
.btn-settings {
  width: 60px;
  height: 60px;
  padding: 0;
  background-color: transparent;
  font-size: 1.5rem;
  border: 2px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: background-color 0.2s ease;
}
.btn-settings:hover {
  background-color: rgb(255, 255, 255);
}
.btn-settings:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(255, 255, 255);
  mix-blend-mode: overlay;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, mix-blend-mode 0s ease;
}

.btn-settings:hover::before {
  background-color: rgba(0, 0, 0, 1);
  mix-blend-mode: color-burn;
}

/* Responsive Design */
@media (max-width: 900px) {
  .album-display {
    grid-template-columns: 0px 1fr 80px;
    gap: 20px;
  }

  .meta-box {
    padding: 15px 8px;
    min-height: 120px;
    overflow: hidden;
  }

  .artwork-container {
    max-width: 500px;
  }

  .artwork-box {
    max-width: 400px;
    max-height: 350px;
  }

  .title-box {
    padding: 40px 20px;
  }

  .album-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .container {
    height: auto;
    min-height: 100vh;
    padding: 10px;
  }

  .album-display {
    grid-template-columns: 1fr;
    gap: 20px;
    height: auto;
    max-height: none;
  }

  .metadata-left,
  .metadata-right {
    flex-direction: column;
    padding-top: 0;
    justify-content: center;
    height: auto;
    overflow: visible;
    gap: 15px;
  }

  .meta-box {
    writing-mode: horizontal-tb;
    transform: none;
    min-height: auto;
    width: 100%;
    overflow: visible;
  }

  .meta-value {
    white-space: normal;
    overflow: visible;
    word-wrap: break-word;
    word-break: break-word;
  }

  .artwork-container {
    flex-direction: column;
    gap: 15px;
    max-width: 100%;
  }

  .btn-shuffle {
    width: 50px;
    height: 50px;
  }

  .artwork-box {
    max-width: 100%;
    max-height: 100%;
  }

  .artwork-box::before {
    font-size: 0.5rem;
    padding: 4px 8px;
  }

  .album-title {
    font-size: 1.5rem;
  }

  .title-box {
    padding: 30px 20px;
  }

  .platform-selector {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
  }

  .btn-settings {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    flex: 0 0 50px;
  }

  .platform-selector-dropdown {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    display: flex;
    align-items: stretch;
  }

  .platform-selector-dropdown .platform-select {
    height: 50px;
  }

  .btn-listen {
    flex: 1 1 100%;
    padding: 15px;
    font-size: 0.9rem;
  }

  .controls {
    gap: 15px;
  }

  .content-center {
    gap: 20px;
    padding: 10px 0;
    overflow: visible;
  }

  #app {
    border-width: 2px;
    padding: 15px;
  }

  .source-selector {
    margin-bottom: 20px;
  }

  .source-select,
  .platform-select {
    padding: 15px;
    font-size: 0.9rem;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 10, 10, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #0a0a0a;
  border: 3px solid #f0f0f0;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px;
  border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  font-weight: bold;
  margin: 0;
}

.btn-close {
  width: 32px;
  height: 32px;
  padding: 0;
  background-color: transparent;
  color: #f0f0f0;
  border: 2px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close:hover {
  background-color: #f0f0f0;
  color: #0a0a0a;
}

.btn-close:active {
  transform: scale(0.95);
}

.modal-body {
  padding: 30px;
}

.settings-description {
  font-size: 0.9rem;
  line-height: 1.6;
  opacity: 0.8;
  margin-bottom: 30px;
  letter-spacing: 0.05em;
}

.service-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border: 2px solid #f0f0f0;
  background-color: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
  cursor: pointer;
}

.service-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.service-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #000000;
}

.service-item label {
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  font-weight: bold;
  cursor: pointer;
  flex: 1;
  text-transform: uppercase;
}

.service-count {
  font-size: 0.8rem;
  opacity: 0.6;
  letter-spacing: 0.05em;
}

/* Mobile Responsive for Modal */
@media (max-width: 600px) {
  .modal {
    padding: 0;
    align-items: flex-start;
  }

  .modal-content {
    max-height: 100vh;
    height: 100vh;
    max-width: 100%;
    border-width: 0;
    border-top: 3px solid #f0f0f0;
  }

  .modal-header {
    padding: 20px;
  }

  .modal-header h2 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 20px;
  }

  .service-item {
    padding: 18px 15px;
    min-height: 56px;
  }

  .service-item label {
    font-size: 0.85rem;
  }

  .service-item input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
}
