/*
 * neotrip 모바일 셸 드래프트 스타일
 *
 * 앱형 셸: 좌측 아이콘 레일 + 콘텐츠 페이지 + 하단 플레이 바 (UI 목업).
 * 다크 표면은 #121212/#1a1a1a 계열, 액센트는 #61b3e4.
 */

:root {
  --bg: #121212;
  --panel: #1a1a1a;
  --panel-raised: #202020;
  --text: #f0f0f5;
  --muted: #9a9aa5;
  --accent: #61b3e4;
  --accent-dim: #2e5a75;
  --accent-soft: rgba(97, 179, 228, 0.14);
  --danger: #ff4d6d;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 999px;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --rail-w: 64px;
  --rail-w-open: 208px;
  --playbar-h: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 앱 셸 레이아웃 ─────────────────────────────── */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg);
}

@media (min-width: 560px) {
  .app {
    box-shadow: inset 1px 0 0 var(--hairline), inset -1px 0 0 var(--hairline);
  }
}

.app-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

/* ── 좌측 아이콘 레일 ────────────────────────────── */

.rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
  padding: 16px 8px;
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  overflow: hidden;
  transition: width 0.25s ease, box-shadow 0.25s ease;
}

.rail.expanded {
  width: var(--rail-w-open);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rail-toggle,
.rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  flex: none;
}

.rail-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.rail-icon svg {
  display: block;
  width: 22px;
  height: 22px;
}

.rail-toggle .rail-icon {
  background: var(--panel-raised);
}

.rail-toggle .icon-close {
  display: none;
}

.rail.expanded .rail-toggle .icon-close {
  display: block;
}

.rail.expanded .rail-toggle .icon-open {
  display: none;
}

.rail-item:hover .rail-icon {
  border-color: var(--hairline-strong);
}

.rail-item[aria-current="true"] .rail-icon {
  background: var(--accent-soft);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.rail-toggle:active .rail-icon,
.rail-item:active .rail-icon {
  transform: scale(0.96);
}

.rail-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
}

.rail.expanded .rail-label {
  opacity: 1;
  transform: none;
}

/* ── 레일 확장 시 배경 스카림 ────────────────────── */

.rail-scrim {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.rail-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── 페이지 영역 ────────────────────────────────── */

.pages {
  flex: 1;
  min-width: 0;
  margin-left: var(--rail-w);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}

.pages::-webkit-scrollbar {
  width: 8px;
}

.pages::-webkit-scrollbar-track {
  background: transparent;
}

.pages::-webkit-scrollbar-thumb {
  border-radius: var(--radius-full);
  background: var(--hairline-strong);
}

.pages::-webkit-scrollbar-thumb:hover,
.pages::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}

.page {
  display: none;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.page.active {
  display: flex;
  animation: page-in 0.22s ease both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-head p {
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.page-body {
  max-width: 30ch;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.page-note {
  padding: 8px 14px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 0.75rem;
}

/* 페이지 일러스트 (인라인 SVG) */

.page-art {
  width: 100%;
  max-width: 300px;
  padding: 24px 20px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.page-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.art-line {
  stroke: var(--muted);
}

.art-slot {
  stroke: var(--hairline-strong);
}

.art-wave {
  stroke: var(--accent);
}

.art-wave-outer {
  opacity: 0.5;
}

.art-dot {
  fill: var(--accent);
  stroke: none;
}

.art-knob {
  fill: var(--panel-raised);
  stroke: var(--muted);
}

.art-knob-active {
  fill: var(--accent);
  stroke: var(--accent);
}

.art-rec {
  fill: var(--danger);
  stroke: none;
}

/* ── 소개 페이지: 히어로 이미지 · 메타 칩 · 링크 ── */

.page-hero {
  width: 100%;
  max-width: 480px;
}

.page-hero img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

#page-intro .page-head h2 {
  overflow-wrap: break-word;
}

#page-intro .page-body {
  max-width: 36ch;
  text-align: left;
}

#page-intro .page-body p + p {
  margin-top: 12px;
}

.page-link {
  padding: 8px 2px 2px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.2s ease;
}

.page-link:hover,
.page-link:focus-visible {
  border-color: var(--accent);
}

/* ── 하단 플레이 바 ─────────────────────────────── */

.playbar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--playbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--panel-raised);
}

/* 상단 진행 라인 */

.playbar-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.playbar-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.9s linear;
}

.playbar.playing .playbar-progress-fill {
  transition: width 1s linear;
}

/* 트랙 썸네일 자리 */

.playbar-thumb {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-dim), var(--panel));
  color: var(--text);
}

.playbar-thumb svg {
  display: block;
  width: 22px;
  height: 22px;
}

.playbar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.playbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playbar-artist {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 트랜스포트 버튼 */

.transport-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
  border-radius: 50%;
  transition: color 0.2s ease, transform 0.1s ease;
}

.transport-btn svg {
  display: block;
  width: 24px;
  height: 24px;
}

.transport-btn:hover {
  color: var(--text);
}

.transport-btn:active {
  transform: scale(0.92);
}

.playbar-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #121212;
  transition: transform 0.1s ease;
}

.playbar-btn:active {
  transform: scale(0.92);
}

.playbar-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}

.playbar-btn .icon-pause {
  display: none;
}

.playbar-btn.playing .icon-pause {
  display: block;
}

.playbar-btn.playing .icon-play {
  display: none;
}

/* ── 좁은 화면 ─────────────────────────────────── */

@media (max-width: 360px) {
  .pages {
    padding: 20px 14px;
  }

  .transport-btn {
    width: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page.active {
    animation: none;
  }

  .rail,
  .rail-label {
    transition: none;
  }

  .playbar-progress-fill {
    transition: none;
  }
}
