* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #0f0f0f;
  color: #f1f1f1;
}
.top-wrap {
  max-width: 420px;
  margin: 10vh auto;
  padding: 32px;
  background: #1b1b1b;
  border-radius: 12px;
}
.top-wrap h1 {
  font-size: 20px;
  margin-bottom: 24px;
}
.top-wrap button, .top-wrap input {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border-radius: 8px;
  border: 1px solid #333;
  margin-bottom: 12px;
}
.top-wrap button {
  background: #ff0033;
  color: #fff;
  border: none;
  cursor: pointer;
}
.top-wrap input {
  background: #0f0f0f;
  color: #fff;
}
.shuffle-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #ccc;
  margin: -4px 0 16px;
}
.shuffle-check input { width: auto; margin: 0; }
.top-wrap .divider {
  text-align: center;
  margin: 20px 0;
  color: #777;
  font-size: 13px;
}
.error-msg { color: #ff6b6b; font-size: 13px; margin-top: -6px; margin-bottom: 12px; min-height: 16px; }

/* room.html */
.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1b1b1b;
}
.room-header .room-id { font-weight: bold; letter-spacing: 1px; }
.leave-btn {
  background: #333;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
}
.leave-btn:hover { background: #ff0033; }

.host-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #161616;
}
.host-bar input {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #0f0f0f;
  color: #fff;
}
.host-bar button {
  padding: 10px 18px;
  border-radius: 6px;
  border: none;
  background: #ff0033;
  color: #fff;
  cursor: pointer;
}
.shuffle-btn {
  background: #333 !important;
  white-space: nowrap;
}
.shuffle-btn.active {
  background: #1db954 !important;
}
.playlist-status {
  max-width: 960px;
  margin: 0 auto 4px;
  text-align: center;
  color: #1db954;
  font-size: 13px;
}

.player-wrap {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 16px auto;
  aspect-ratio: 16 / 9;
  background: #000;
}
#player { width: 100%; height: 100%; }
.viewer-shield {
  position: absolute;
  inset: 0;
  /* 視聴者はクリック不可（プレイヤー操作を封じる） */
  pointer-events: auto;
  background: transparent;
}
.hint {
  text-align: center;
  color: #888;
  font-size: 13px;
  margin-top: 8px;
}

.playlist-panel {
  max-width: 960px;
  margin: 16px auto;
  max-height: 320px;
  overflow-y: auto;
  background: #161616;
  border-radius: 8px;
  padding: 6px;
}
.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  color: #ccc;
}
.playlist-item.host-clickable { cursor: pointer; }
.playlist-item.host-clickable:hover { background: #232323; }
.playlist-item.active {
  background: #2a0d12;
  color: #fff;
  border: 1px solid #ff0033;
}
.playlist-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #000;
}
.playlist-title {
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.playlist-index {
  font-size: 12px;
  color: #888;
  width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.members-bar {
  padding: 4px 16px 0;
  font-size: 12px;
  color: #888;
}

.name-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.name-box {
  background: #1b1b1b;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  width: 280px;
}
.name-box p { margin: 0 0 12px; font-size: 14px; }
.name-box input {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #0f0f0f;
  color: #fff;
  margin-bottom: 12px;
}
.name-box button {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: #ff0033;
  color: #fff;
  cursor: pointer;
}

.chat-panel {
  max-width: 960px;
  margin: 16px auto 24px;
  background: #161616;
  border-radius: 8px;
  padding: 10px;
}
.chat-messages {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.chat-message {
  padding: 4px 2px;
  font-size: 13px;
  line-height: 1.4;
}
.chat-name { color: #ff5c7a; font-weight: bold; }
.chat-time { color: #666; font-size: 11px; margin-left: 4px; }
.chat-text { color: #eee; word-break: break-word; white-space: pre-wrap; }
.chat-input-row {
  display: flex;
  gap: 8px;
}
.chat-input-row input {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #0f0f0f;
  color: #fff;
}
.chat-input-row button {
  padding: 10px 18px;
  border-radius: 6px;
  border: none;
  background: #ff0033;
  color: #fff;
  cursor: pointer;
}
