body {
  background: #121214;
  color: #f5f5f5;
  -webkit-tap-highlight-color: transparent;
}

.room {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: #171512;
  color: #f5f5f5;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 12px 8px;
}

.host {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 4px 0;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #2a241d;
  font-size: 16px;
  font-weight: 600;
}

.host-copy { min-width: 0; }

.host-name {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  color: rgba(245, 245, 245, 0.72);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d7b36a;
}

.room[data-mode="live"] .dot { background: #ef5d4a; }
.room[data-mode="offline"] .dot { background: rgba(245, 245, 245, 0.45); }
.room[data-mode="live"] .dot { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.viewers {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.viewers[hidden] { display: none; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.chips {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 12px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chips h1,
.chips span {
  margin: 0;
  flex: 0 0 auto;
  padding: 4px 0;
  background: transparent;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  white-space: nowrap;
}

#tags {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
}

#tags[hidden] { display: none; }

.stage {
  position: relative;
  width: calc(100% - 24px);
  margin: 4px 12px 0;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #000 center / cover no-repeat;
  overflow: hidden;
}

@supports not (aspect-ratio: 16 / 9) {
  .stage { height: 0; padding-top: 56.25%; }
}

.room.is-portrait .stage {
  width: min(calc(100% - 24px), 420px);
  margin-inline: auto;
  aspect-ratio: 9 / 16;
  max-height: 62dvh;
}

@supports not (aspect-ratio: 9 / 16) {
  .room.is-portrait .stage { height: 0; padding-top: 177.78%; }
}

.stage.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  aspect-ratio: auto;
}

#player-mount,
.empty,
.pending,
.stage-msg { position: absolute; inset: 0; }

#player-mount video,
.stage video,
#player-mount .tcplayer,
#player-mount .vcp-player {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  background: #000;
}

.empty,
.pending {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(12, 12, 14, 0.72);
}

.stage.has-cover .empty {
  background: linear-gradient(180deg, rgba(12, 12, 14, 0.35), rgba(12, 12, 14, 0.78));
}

.empty[hidden],
.pending[hidden],
.tap-play[hidden],
.stage-msg[hidden],
.notice[hidden] { display: none; }

.empty h2,
.pending p,
.stage-msg {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.pending p,
.stage-msg { font-size: 16px; letter-spacing: 0; }

.stage-msg {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 20px 28px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.ring {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(245, 245, 245, 0.25);
  border-top-color: #f5f5f5;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tap-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  min-width: 128px;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  background: #f5f5f5;
  color: #17171a;
  font-weight: 600;
}

.dock {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  padding-top: 12px;
}

.notice {
  max-height: 9.6em;
  margin: 0 12px 8px;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid rgba(244, 239, 230, 0.14);
  border-radius: 8px;
  background: #211c17;
  color: #f5f5f5;
  font-size: 15px;
  line-height: 1.55;
}

.danmaku {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  max-height: min(240px, 34dvh);
  margin: 0 12px 8px;
  overflow: hidden;
  pointer-events: none;
}

.danmaku:empty { display: none; }

.danmaku p {
  margin: 0;
  align-self: flex-start;
  max-width: 92%;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  color: #f5f5f5;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
  .danmaku p { animation: rise 0.28s ease-out; }
}

@keyframes rise {
  from { transform: translateY(8px); }
  to { transform: translateY(0); }
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 12px calc(10px + var(--safe-bottom));
}

.say {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.say[hidden] { display: none; }

.say input {
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border: 1px solid rgba(244, 239, 230, 0.14);
  border-radius: 8px;
  background: #211c17;
  color: #f5f5f5;
}

.say input::placeholder { color: rgba(245, 245, 245, 0.62); }

.say button,
.bar-actions button,
.sheet button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #f5f5f5;
  font-size: 14px;
  font-weight: 600;
}

.say button:active,
.bar-actions button:active,
.sheet button:active { transform: scale(0.98); }

.bar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

#fullscreen:disabled { opacity: 0.4; cursor: default; }

.say-feedback {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
  color: #ffb4a8;
  font-size: 14px;
}

.say-feedback:empty { display: none; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.55);
}

.sheet[hidden] { display: none; }

.sheet form {
  width: min(480px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 10px;
  background: #211c17;
}

.sheet h2 { margin: 0; font-size: 20px; font-weight: 600; }
.sheet label { display: grid; gap: 6px; font-size: 14px; }

.sheet input,
.sheet textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #171411;
  color: #f5f5f5;
}

.sheet textarea { min-height: 96px; resize: vertical; }
.sheet-help { margin: 0; color: rgba(245, 245, 245, 0.72); font-size: 14px; }
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions button { flex: 1; }

.sheet button[type="submit"] {
  background: #f5f5f5;
  color: #17171a;
}
