* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #050506;
  touch-action: none;
  user-select: none;
}
body[data-theme="paper"] { background: #f2f2f2; }

#portrait { position: fixed; inset: 0; display: block; cursor: crosshair; touch-action: none; }

#welcome {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  font: 15px/1.6 ui-monospace, Menlo, monospace;
  color: #e9e9e9;
}
#welcome[hidden], #toast[hidden], #playlist-pop[hidden], #controls[hidden], #continue-btn[hidden], .ctrl-btn[hidden] { display: none !important; }
#welcome h1 { font-size: clamp(22px, 5vw, 28px); letter-spacing: 0.08em; }
#welcome .small { color: #888; font-size: 13px; }
.button {
  margin-top: 8px;
  padding: 10px 22px;
  border: 1px solid #e9e9e9;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.button:hover { background: #e9e9e9; color: #000; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: min(640px, 92vw);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(20, 20, 20, 0.88);
  color: #eee;
  font: 12.5px/1.5 ui-monospace, Menlo, monospace;
  z-index: 15;
  text-align: center;
  backdrop-filter: blur(8px);
}
#toast pre { margin-top: 8px; padding: 8px; background: #000; border-radius: 6px; white-space: pre-wrap; user-select: text; text-align: left; }

#controls {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 20px);
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(12, 12, 16, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  animation: fadeSlideUp 0.7s ease-out both;
}

#continue-btn {
  position: fixed;
  left: 50%;
  bottom: calc(18dvh + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 22;
  padding: 8px 16px;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 247, 252, 0.86);
  font: 500 11px/1 ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.08);
  animation: continueAppear 0.6s ease-out both, softPulse 2.4s ease-in-out 0.6s infinite;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
#continue-btn.light-btn {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
}
#continue-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.6); }
#continue-btn:active { transform: translateX(-50%) scale(0.96); }
body[data-theme="paper"] #continue-btn {
  background: rgba(255, 255, 255, 0.88);
  color: #333;
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

@keyframes continueAppear {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 200, 120, 0.14); }
  50% { box-shadow: 0 0 30px rgba(255, 210, 140, 0.34); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ctrl-btn {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #efefef;
  font: 12px/1 ui-monospace, Menlo, monospace;
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
}
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.45); }
.ctrl-btn:active { transform: scale(0.96); }
.ctrl-accent { border-color: rgba(255, 215, 130, 0.48); color: #ffe7b0; }
.ctrl-label {
  max-width: min(170px, 34vw);
  overflow: hidden;
  text-overflow: ellipsis;
  border-color: transparent;
  background: transparent;
  color: #cfcfcf;
}

body[data-theme="paper"] #controls {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.14);
}
body[data-theme="paper"] .ctrl-btn {
  background: rgba(0, 0, 0, 0.05);
  color: #181818;
  border-color: rgba(0, 0, 0, 0.2);
}
body[data-theme="paper"] .ctrl-btn:hover { background: rgba(0, 0, 0, 0.1); }
body[data-theme="paper"] .ctrl-accent { border-color: rgba(160, 100, 0, 0.45); color: #7a4b00; }
body[data-theme="paper"] .ctrl-label { background: transparent; border-color: transparent; color: #333; }

#playlist-pop {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(320px, 90vw);
  max-height: 44dvh;
  overflow-y: auto;
  z-index: 25;
  padding: 8px;
  border-radius: 14px;
  background: rgba(14, 14, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  font: 12px/1.4 ui-monospace, Menlo, monospace;
  color: #eee;
}
.pl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.pl-item:hover { background: rgba(255, 255, 255, 0.08); }
.pl-item.active { background: rgba(255, 220, 140, 0.16); color: #ffe7b0; }
.pl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

@media (max-width: 520px) {
  .ctrl-btn { padding: 7px 10px; font-size: 11.5px; }
  #controls { gap: 4px; padding: 4px 6px; }
}
