@font-face {
  font-display: swap;
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/vt323-v18-latin-regular.woff2') format('woff2');
}

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

body {
  font-family: 'VT323', monospace;
  background: url('https://i.imgur.com/0qcVYoh.png');
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ── Topbar ── */
#topbar {
  position: relative;
  width: 100vw;
  height: 30px;
  background: #d7d7d7;
  border: 1px solid #222;
  border-width: 1px 0 1px 0;
  color: #222;
  text-shadow: 0 1px #ededed;
  font-size: 20px;
  line-height: 28px;
  box-shadow: inset 0 1px #ededed;
  z-index: 10;
}

/* ── Logo on wallpaper ── */
#logo-wrap {
  display: flex;
  justify-content: center;
  padding-top: 18px;
  padding-bottom: 4px;
}

#site-logo {
  width: 240px;
  height: auto;
  opacity: 0.6;
  filter: drop-shadow(0 0 8px #5fbb46);
}

/* ── Outer terminal shell ── */
#terminal {
  position: relative;
  margin: 0 auto 40px;
  width: 580px;
  max-width: 96vw;
  background: #d7d7d7;
  border-radius: 2px;
  border: 1px solid #222;
  box-shadow: 1px 1px #222, inset 1px 1px #fff;
  text-shadow: 0 1px #ededed;
  padding-bottom: 14px;
}

#terminal::before {
  position: absolute; top: 6px; left: 6px;
  width: 16px; height: 16px;
  background: linear-gradient(135deg, #b1b1b1, #d7d7d7);
  border: 1px solid #222;
  box-shadow: inset 1px 1px #fff, 1px 1px #fff;
  content: '';
}

#terminal::after {
  position: absolute; top: 6px; right: 6px;
  width: 16px; height: 16px;
  background: linear-gradient(135deg, #b1b1b1, #d7d7d7);
  border: 1px solid #222;
  box-shadow: inset 1px 1px #fff, 1px 1px #fff;
  content: '';
}

/* ── Header — title centred with decorative side bars ── */
#header {
  color: #222;
  text-align: center;
  line-height: 28px;
  font-size: 22px;
  position: relative;
  letter-spacing: 3px;
  /* enough padding so the text never overlaps the bars */
  padding: 0 80px;
}

#header::before {
  position: absolute;
  top: 6px; left: 30px;
  /* width stops well before the text */
  width: 90px;
  height: 1px;
  background: #ebebeb;
  box-shadow:
    0 1px #b7b7b8,
    0 4px #ebebeb,  0 5px #b7b7b8,
    0 8px #ebebeb,  0 9px #b7b7b8,
    0 12px #ebebeb, 0 13px #b7b7b8,
    0 16px #ebebeb, 0 17px #b7b7b8,
    /* right column starts 310px from left edge of pseudo-element */
    310px 0px #ebebeb,  310px 1px #b7b7b8,
    310px 4px #ebebeb,  310px 5px #b7b7b8,
    310px 8px #ebebeb,  310px 9px #b7b7b8,
    310px 12px #ebebeb, 310px 13px #b7b7b8,
    310px 16px #ebebeb, 310px 17px #b7b7b8;
  content: '';
}

/* ── Inner dark window ── */
#window {
  position: relative;
  margin: 4px 10px 0;
  padding: 12px 16px 16px;
  background: #464646;
  box-shadow: -1px -1px #b4b4b5, 1px 1px #fff;
  font-size: 20px;
  color: #5fbb46;
  text-shadow: none;
  overflow-y: auto;
  max-height: 80vh;
}

#window::-webkit-scrollbar { width: 8px; }
#window::-webkit-scrollbar-track { background: #333; }
#window::-webkit-scrollbar-thumb { background: #5fbb46; }

/* ── Colors ── */
.bright { color: #88ff66; }
.dim    { color: #7a9970; }
.hidden { display: none !important; }

/* ── Cursor ── */
cursor { animation: blink 1s step-end infinite; }
@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
.blink { animation: blink 1.2s step-end infinite; }

/* ── Rule ── */
.rule { border: none; border-top: 1px solid #3a5a32; margin: 10px 0; }

/* ── Section heading ── */
.section-head { font-size: 20px; margin-bottom: 6px; }

/* ── Track header: cover + info side by side ── */
#track-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

#track-cover {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 1px solid #5fbb46;
  flex-shrink: 0;
}

#track-info {
  flex: 1;
  line-height: 1.5;
  word-break: break-word;
}

/* ── Mini player ── */
#player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 4px;
  flex-wrap: wrap;
}

#progress-wrap { flex: 1; min-width: 100px; }

#progress-track {
  height: 5px;
  background: #333;
  border: 1px solid #5fbb46;
  cursor: pointer;
  margin-bottom: 2px;
}

#progress-fill { height: 100%; width: 0%; background: #5fbb46; }
#time-display  { font-size: 16px; }

/* ── Pricing ── */
.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
  padding: 2px 0;
}

.total-row {
  border-top: 1px solid #3a5a32;
  padding-top: 4px;
  margin-top: 2px;
  font-size: 22px;
}

/* ── Buttons ── */
.term-btn {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: #5fbb46;
  background: #2a2a2a;
  border: 1px solid #5fbb46;
  padding: 1px 10px;
  cursor: pointer;
  white-space: nowrap;
  text-shadow: none;
  line-height: 1.4;
}

.term-btn:hover    { background: #5fbb46; color: #2a2a2a; }
.term-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.full-btn {
  display: block; width: 100%;
  font-size: 22px; padding: 5px 10px;
  margin-top: 8px; letter-spacing: 1px;
}

.small-btn { font-size: 16px; padding: 0 6px; }

.dim-btn { color: #7a9970; border-color: #7a9970; }
.dim-btn:hover { background: #7a9970; color: #2a2a2a; }

/* ── Wallet row ── */
#wallet-row {
  display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}

#pay-status { font-size: 18px; min-height: 22px; margin-top: 4px; }

/* ── Related tracks ── */
#related-list { margin-top: 6px; }

.rel-item {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #333;
  font-size: 18px;
  gap: 8px;
}

.rel-thumb {
  width: 40px; height: 40px;
  object-fit: cover;
  border: 1px solid #3a5a32;
  flex-shrink: 0;
}

.rel-name { flex: 1; color: #88ff66; cursor: pointer; }
.rel-name:hover { text-decoration: underline; }
.rel-price-tag { color: #7a9970; white-space: nowrap; }

/* ── Album section ── */
.album-title-row {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 8px; margin: 6px 0 4px;
}

.album-track-list {
  margin: 4px 0 8px 12px;
  font-size: 17px;
}

.album-track-row {
  padding: 1px 0;
  color: #7a9970;
}

.album-opts {
  display: flex; flex-direction: column;
  gap: 6px; margin-top: 6px;
}

.album-opt-btn {
  display: block; width: 100%;
  font-size: 20px; padding: 4px 10px;
  text-align: left;
}

/* ── Modals shared ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center;
  justify-content: center; z-index: 999;
}

#rel-modal, #ship-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center;
  justify-content: center; z-index: 999;
}

#rel-modal-inner, #ship-modal-inner {
  background: #464646;
  border: 1px solid #5fbb46;
  box-shadow: 2px 2px 0 #5fbb46, -1px -1px #b4b4b5;
  padding: 16px 20px;
  width: 340px; max-width: 95vw;
  font-family: 'VT323', monospace;
  font-size: 20px; color: #5fbb46;
  display: flex; flex-direction: column;
  gap: 8px; text-shadow: none;
  max-height: 90vh; overflow-y: auto;
}

#rel-cover {
  width: 100%; max-height: 160px;
  object-fit: cover;
  border: 1px solid #5fbb46;
}

#rel-player { display: flex; align-items: center; gap: 12px; }
#rel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Shipping form ── */
.field-row {
  display: flex; align-items: baseline;
  gap: 6px; flex-wrap: wrap;
}

.field-row label { color: #7a9970; white-space: nowrap; font-size: 18px; }

.field-row input {
  flex: 1; min-width: 120px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: #2a2a2a;
  border: 1px solid #5fbb46;
  color: #88ff66;
  padding: 2px 6px;
  outline: none;
}

.field-row input::placeholder { color: #3a5a32; }
.field-row input:focus { border-color: #88ff66; }

#ship-status { font-size: 18px; min-height: 20px; }
#ship-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Links ── */
a { color: #5fbb46; }
a:hover { color: #88ff66; }

/* ════════════════════════════════════════
   MOBILE — big, generous, readable
   ════════════════════════════════════════ */
@media (max-width: 600px) {
  body { padding-bottom: 40px; }

  #logo-wrap { padding-top: 10px; }
  #site-logo  { width: 180px; }

  #terminal {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin: 0 0 24px;
  }

  /* Keep corner gems visible but shrink slightly */
  #terminal::before, #terminal::after { width: 12px; height: 12px; top: 8px; }
  #terminal::after { right: 8px; }

  /* Header — shrink bar widths on mobile to avoid overlap */
  #header {
    font-size: 20px;
    padding: 0 50px;
    letter-spacing: 2px;
  }

  #header::before {
    width: 50px;
    box-shadow:
      0 1px #b7b7b8, 0 4px #ebebeb, 0 5px #b7b7b8,
      0 8px #ebebeb, 0 9px #b7b7b8, 0 12px #ebebeb, 0 13px #b7b7b8,
      0 16px #ebebeb, 0 17px #b7b7b8,
      220px 0px #ebebeb,  220px 1px #b7b7b8,
      220px 4px #ebebeb,  220px 5px #b7b7b8,
      220px 8px #ebebeb,  220px 9px #b7b7b8,
      220px 12px #ebebeb, 220px 13px #b7b7b8,
      220px 16px #ebebeb, 220px 17px #b7b7b8;
  }

  #window {
    font-size: 19px;
    padding: 10px 12px 14px;
    max-height: none; /* let it scroll naturally on mobile */
  }

  #track-cover { width: 70px; height: 70px; }

  .price-row  { font-size: 18px; }
  .total-row  { font-size: 20px; }
  .full-btn   { font-size: 20px; padding: 6px 10px; }
  .term-btn   { font-size: 18px; }
  .section-head { font-size: 18px; }

  .rel-item   { font-size: 17px; }
  .rel-thumb  { width: 36px; height: 36px; }

  .album-opt-btn { font-size: 18px; }

  #rel-modal-inner, #ship-modal-inner {
    width: 98vw;
    padding: 12px 14px;
    font-size: 18px;
  }

  .field-row input { font-size: 17px; }
}
