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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1e1e1e;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #c8a96e;
  --accent-dim: rgba(200, 169, 110, 0.12);
  --nav-height: 64px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  padding-bottom: var(--nav-height);
}

/* Network wires between icons */
#wire-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}



/* Floating background icons */
#bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.bg-icon {
  position: absolute;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 300;
  overflow: hidden;
}

.bg-icon.today {
  box-shadow: 0 0 0 2px var(--accent);
}

.bg-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Content above bg */
header, .view, nav, .modal-overlay {
  position: relative;
  z-index: 3;
}

/* Header */
header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 26px;
  height: 16px;
  flex-shrink: 0;
}

header p {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.08em;
}

.lang-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 10px;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.lang-toggle:active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Section label */
.section-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 20px 20px 16px;
}

#library-filter {
  display: block;
  margin: 16px auto 14px 0;
  width: 180px;
  max-width: calc(100% - 40px);
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c8a96e' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

#library-filter:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── HOME ── */

#home-intro {
  min-height: calc(100dvh - 56px - var(--nav-height));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 24px 20px;
  gap: 20px;
}

/* TODAY'S MIX toggle button */
.today-toggle {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: inherit;
  transition: all 0.2s;
}

.today-toggle:active {
  background: var(--accent-dim);
}


/* 最新コンテンツ: 余白を持たせて背景アイコンを見せる */
#home-latest-wrap,
#concept-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s ease;
}

#home-latest-wrap.collapsed,
#concept-wrap.collapsed {
  opacity: 0;
  pointer-events: none;
}

.concept-holder {
  position: relative;
  width: calc(100% - 40px);
  max-width: 340px;
  padding: 40px 28px 36px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.concept-holder .card-close {
  top: -18px;
  right: -18px;
}

.concept-wires {
  display: block;
  width: 200px;
  max-width: 70%;
  height: auto;
  margin: -16px auto 14px;
  color: var(--accent);
  pointer-events: none;
}

#concept-wrap:not(.collapsed) .concept-holder {
  animation: concept-enter 0.55s ease;
}

@keyframes concept-enter {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

.concept-title {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.35em;
  color: var(--accent);
  text-align: center;
  text-transform: uppercase;
  margin: 0 0 22px;
}

.concept-divider {
  width: 80%;
  max-width: 260px;
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0.8;
}

.concept-text {
  font-size: 13px;
  line-height: 1.9;
  color: var(--text);
  letter-spacing: 0.01em;
  text-align: center;
  margin: 18px 0;
  line-break: strict;
  text-wrap: pretty;
}

.concept-mark {
  display: block;
  width: 32px;
  height: 18px;
  margin: 8px auto;
  color: var(--accent);
}

.concept-sub {
  margin: 20px 0 0;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
}

.home-card-holder {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 0 20px;
}

.card-close {
  position: absolute;
  top: -18px;
  right: 2px;
  z-index: 5;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-family: inherit;
}

.card-close:active {
  border-color: var(--accent);
  color: var(--accent);
}

#home-latest {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#home-latest .card {
  width: 100%;
  max-width: 380px;
  margin: 0;
  border-radius: 4px;
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

#home-latest .mix-symbol {
  padding: 0 16px 32px;
}

#home-latest .artist-icon {
  border: 2px solid var(--accent);
}

#home-latest .play-btn {
  width: 85%;
  margin-left: auto;
  margin-right: auto;
}

/* ── CARD (共通) ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.card-artists {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.artist-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.artist-name {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  min-height: 3em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.artist-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
  font-weight: 300;
  overflow: hidden;
  flex-shrink: 0;
}

.artist-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.mix-symbol {
  font-size: 22px;
  color: var(--accent);
  font-weight: 300;
  padding: 0 10px 32px;
  flex-shrink: 0;
}

.play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
  padding: 16px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-height: 52px;
}

.play-btn:active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}

/* ── LIBRARY ── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.grid .card {
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 12px 16px;
  margin-bottom: 0;
  background: var(--surface);
}

.grid .card:nth-child(2n) {
  border-right: none;
}

.grid .card:nth-child(-n+2) {
  border-top: 1px solid var(--border);
}

.grid .artist-icon {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.grid .artist-name {
  font-size: 9px;
  letter-spacing: 0.02em;
}

.grid .mix-symbol {
  font-size: 14px;
  padding: 0 6px 20px;
}

.grid .play-btn {
  margin: 16px auto 0;
  padding: 10px;
  font-size: 10px;
  min-height: 40px;
  letter-spacing: 0.15em;
  width: 85%;
}

/* ── Bottom nav ── */
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--accent);
}

#nav-today.pulse-new .nav-icon {
  color: var(--accent);
  animation: nav-pulse 2s ease-in-out infinite;
}

@keyframes nav-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.25); opacity: 1; }
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

/* View toggle */
.view {
  display: none;
}

.view.active {
  display: block;
}

#library.view.active {
  height: calc(var(--app-vh, 100svh) - var(--header-height, 76px) - var(--nav-height));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Video modal (ほぼフルスクリーン) ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.modal-title {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.15em;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-mute {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
}

.modal-mute .icon-muted,
.modal-mute .icon-unmuted {
  display: none;
}

.modal-mute.muted .icon-muted,
.modal-mute:not(.muted) .icon-unmuted {
  display: block;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.modal-video {
  width: 100vw;
  height: 100dvh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.video-frame {
  position: relative;
  width: 78%;
  aspect-ratio: 9 / 16;
  border: 2px solid var(--accent);
  box-shadow:
    0 0 0 8px #111,
    0 0 0 10px var(--border),
    0 30px 80px rgba(0, 0, 0, 0.9);
}

#modal-video-player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#video-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

#video-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

#video-indicator {
  position: absolute;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.6));
  display: flex;
  align-items: center;
  justify-content: center;
}

#video-indicator.flash {
  animation: indicator-fade 0.8s forwards;
}

@keyframes indicator-fade {
  0%   { opacity: 1; transform: scale(1); }
  60%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1); }
}

/* TODAY'S MIX 衝突リアクション */
.collision-ripple {
  position: fixed;
  pointer-events: none;
  z-index: 2;
  border: 2px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  opacity: 1;
  animation: ripple-expand 1.4s ease-out forwards;
}

@keyframes ripple-expand {
  0% {
    width: 20px;
    height: 20px;
    opacity: 0.9;
    border-width: 3px;
  }
  100% {
    width: 360px;
    height: 360px;
    opacity: 0;
    border-width: 1px;
  }
}

.collision-title {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent);
  font-size: 16px;
  letter-spacing: 0.15em;
  text-shadow:
    0 0 6px #000,
    0 0 14px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  white-space: nowrap;
  animation: collision-title-fade 2.2s ease-in-out forwards;
}

@keyframes collision-title-fade {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
}

/* ─────────────────────────────────────────────────
   PC view: モバイル枠で表示する
   430px幅でセンタリングし、外側はダークで「スマホを置いた」見え方に。
   ───────────────────────────────────────────────── */
html {
  background: #050505;
}

@media (min-width: 460px) {
  body {
    /* 430px幅に既に制約済み。外側に縦の境界線を入れて枠感を出す */
    box-shadow: 0 0 0 1px var(--border);
    background: var(--bg);
  }

  /* 全画面 fixed 要素を 430px 幅にセンタリングする
     ※ #wire-canvas はJS側でwindow座標で描画するため、CSS幅は制約しない。
       描画される線は icon 位置（430px内）に依存するため、視覚的には自然に枠内に収まる。 */
  #bg-layer,
  nav,
  .modal-overlay,
  #home-latest-wrap,
  #concept-wrap {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
  }

  /* 動画モーダル内の動画ビューは 100vw を使っているため、フレーム幅に合わせる */
  .modal-video {
    width: 100% !important;
  }

  /* center-positioned overlay 系（既に translate を使っているので、ベースの translate を保持しつつ枠内に収める） */
  .today-toggle,
  .collision-title {
    left: 50% !important;
  }
}