@font-face {
  font-family: 'Alkhemikal';
  src: url('../fonts/Alkhemikal.ttf') format('truetype');
}

:root {
  --pink:     #f072b0;
  --purple:   #b06cf4;
  --lavender: #c9a8f5;
  --rose:     #f5b8d8;
  --dim:      #7a5c9a;
  --dark:     #0e0b14;
  --panel-bg: rgba(14, 11, 22, 0.96);
}

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

body {
  background: var(--dark);
  height: 100vh;
  overflow: hidden;
  cursor: default;
  user-select: none;
}

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.content-body h2 {
  font-family: 'Alkhemikal', serif;
  font-size: 22px;
  color: var(--rose);
  font-weight: 400;
  margin-bottom: 18px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(245,184,216,0.2);
}
.content-body p {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  line-height: 1.9;
  color: #b8aece;
}
.content-body p + p { margin-top: 16px; }

.audio-wrap { display: flex; flex-direction: column; gap: 16px; }
.player-title {
  font-family: 'Alkhemikal', serif;
  font-size: 20px;
  color: var(--rose);
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px rgba(245,184,216,0.25);
}
.player-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--dim);
  margin-top: 4px;
}
audio {
  width: 100%;
  accent-color: var(--purple);
  opacity: 0.85;
}
.player-note {
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  color: #6a5e80;
  font-style: italic;
  line-height: 1.75;
}

.liner-section { margin-bottom: 26px; }
.liner-section:last-child { margin-bottom: 0; }
.liner-heading {
  font-family: 'Alkhemikal', serif;
  font-size: 17px;
  color: var(--purple);
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid #2a1f36;
  text-shadow: 0 0 8px rgba(176,108,244,0.3);
  letter-spacing: 0.04em;
}
.liner-entry {
  font-family: 'Lora', Georgia, serif;
  font-size: 13px;
  color: #7a6e90;
  line-height: 1.85;
  padding: 3px 0;
}
.liner-entry span { color: var(--lavender); font-style: normal; }

#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 32px 16px 32px 24px;
  pointer-events: none;
}

#site-title {
  font-family: 'Alkhemikal', serif;
  font-size: 30px;
  color: var(--rose);
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-shadow: 0 0 20px rgba(245,184,216,0.3), 0 0 50px rgba(176,108,244,0.12);
  margin-bottom: 6px;
  pointer-events: none;
  white-space: nowrap;
}

#site-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.12em;
  margin-bottom: 28px;
  white-space: nowrap;
  pointer-events: none;
}

.icon-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: all;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  cursor: pointer;
  background: transparent;
  transition: background 0.15s;
  width: 80px;
}
.icon-item:hover        { background: rgba(176,108,244,0.10); }
.icon-item.active       { background: rgba(176,108,244,0.16); }
.icon-item.active .icon-label { color: var(--rose); }
.icon-item.active .icon-img   { opacity: 1; }

.icon-img {
  width: 36px; height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0.7;
  transition: opacity 0.15s;
  filter: hue-rotate(260deg) saturate(1.4) brightness(1.15);
}
.icon-item:hover .icon-img { opacity: 1; }

.icon-label {
  font-family: 'Alkhemikal', serif;
  font-size: 15px;
  color: var(--lavender);
  letter-spacing: 0.04em;
  transition: color 0.15s;
  text-align: center;
  white-space: nowrap;
}
.icon-item:hover .icon-label { color: var(--rose); }

.win {
  position: fixed;
  z-index: 100;
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.15s;
  box-shadow:
    0 0 0 2px var(--dark),
    0 0 0 4px var(--dim),
    0 0 0 6px var(--dark),
    0 0 30px rgba(176,108,244,0.15);
  resize: both;
  overflow: hidden;
  min-width: 280px;
  min-height: 120px;
}
.win.visible {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}
.win.on-top {
  box-shadow:
    0 0 0 2px var(--dark),
    0 0 0 4px var(--purple),
    0 0 0 6px var(--dark),
    0 0 40px rgba(176,108,244,0.25);
}

.win-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  height: 38px;
  border-bottom: 1px solid #2a1f36;
  flex-shrink: 0;
  cursor: grab;
  background-image: radial-gradient(circle, rgba(176,108,244,0.25) 1px, transparent 1px);
  background-size: 6px 6px;
  position: relative;
}
.win-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent 40%, var(--panel-bg) 100%);
  pointer-events: none;
}
.win-bar:active { cursor: grabbing; }

.win-title {
  font-family: 'Alkhemikal', serif;
  font-size: 18px;
  color: var(--lavender);
  letter-spacing: 0.06em;
  text-shadow: 0 0 10px rgba(201,168,245,0.3);
  position: relative;
  z-index: 1;
}
.win-close {
  background: none;
  border: none;
  font-family: 'Alkhemikal', serif;
  font-size: 15px;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.1s;
  position: relative;
  z-index: 1;
  letter-spacing: 0.04em;
}
.win-close:hover { color: var(--pink); }

.win-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #2a1f36 transparent;
  user-select: text;
}

#mobile-title-bar,
#mobile-tab-bar,
#mobile-drawer,
#mobile-overlay { display: none; }

@media (max-width: 768px) {
  body { overflow: hidden; }

  #sidebar, .win { display: none !important; }

  #mobile-title-bar {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 20;
    padding: 18px 20px 12px;
    background: linear-gradient(to bottom, rgba(14,11,22,0.85) 0%, transparent 100%);
  }
  #mobile-title {
    font-family: 'Alkhemikal', serif;
    font-size: 26px;
    color: var(--rose);
    letter-spacing: 0.03em;
    text-shadow: 0 0 20px rgba(245,184,216,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #mobile-subtitle {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--dim);
    letter-spacing: 0.12em;
    margin-top: 3px;
  }

  #mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 20;
    background: rgba(14,11,22,0.92);
    border-top: 1px solid #2a1f36;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom));
    justify-content: space-around;
  }

  .mob-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 6px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
  }
  .mob-tab:active { background: rgba(176,108,244,0.15); }
  .mob-tab.active .mob-tab-img   { opacity: 1; }
  .mob-tab.active .mob-tab-label { color: var(--rose); }

  .mob-tab-img {
    width: 28px; height: 28px;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0.65;
    filter: hue-rotate(260deg) saturate(1.4) brightness(1.15);
    transition: opacity 0.15s;
  }
  .mob-tab-label {
    font-family: 'Alkhemikal', serif;
    font-size: 12px;
    color: var(--lavender);
    transition: color 0.15s;
    white-space: nowrap;
  }

  #mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(8,5,14,0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
  }
  #mobile-overlay.visible {
    opacity: 1;
    pointer-events: all;
  }

  #mobile-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    background: var(--panel-bg);
    height: 52vh;
    max-height: 96vh;
    min-height: 120px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), height 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 40px rgba(176,108,244,0.2), 0 0 0 1px #2a1f36;
    padding-bottom: max(70px, calc(60px + env(safe-area-inset-bottom)));
  }
  #mobile-drawer.open {
    transform: translateY(0);
  }
  #mobile-drawer.dragging {
    transition: none;
  }

  #drawer-handle {
    width: 100%;
    padding: 18px 0 14px;
    cursor: grab;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  #drawer-handle::after {
    content: '';
    display: block;
    width: 48px;
    height: 5px;
    background: var(--dim);
    border-radius: 3px;
  }
  #drawer-handle:active { cursor: grabbing; }

  .drawer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px 10px;
    flex-shrink: 0;
    border-bottom: 1px solid #2a1f36;
  }
  .drawer-title {
    font-family: 'Alkhemikal', serif;
    font-size: 20px;
    color: var(--lavender);
    letter-spacing: 0.05em;
  }
  .drawer-close {
    background: none;
    border: none;
    font-family: 'Alkhemikal', serif;
    font-size: 14px;
    color: var(--dim);
    cursor: pointer;
    letter-spacing: 0.04em;
  }
  .drawer-close:active { color: var(--pink); }

  .drawer-body {
    padding: 20px 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    user-select: text;
  }
}
