/* Rosewood Radio – Hero-Layout mit Artwork-Hintergrund + Live-Chat (Etappe 2).
   Feinschliff/weitere Fantasy-Deko kommt ggf. in einer späteren Etappe. */

:root {
  color-scheme: dark;
  --bg: #14100a;
  --surface: rgba(24, 18, 12, 0.78);
  --text: #f4e9d8;
  --text-dim: #cdb999;
  --accent: #e6b45a;
  --accent-dim: #a9762f;
  --border: rgba(230, 180, 90, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

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

/* --- Hero --- */

.hero {
  position: relative;
  min-height: 100vh;
  background-image: url('/assets/img/hero-radio.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 8, 5, 0) 40%,
    rgba(10, 8, 5, 0.55) 75%,
    rgba(10, 8, 5, 0.9) 100%
  );
  pointer-events: none;
}

.hero-overlay {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

/* --- Player-Karte --- */

.player {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.now-playing .label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.song-title {
  margin: 0.4rem 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  word-break: break-word;
}

audio {
  width: 100%;
}

.play-button {
  margin-top: 1.25rem;
  padding: 0.65rem 1.6rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #f2c878, var(--accent-dim));
  color: #241a0d;
  font-weight: 700;
  cursor: pointer;
}

.play-button:hover {
  filter: brightness(1.08);
}

.status {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  min-height: 1em;
}

/* --- Chat --- */

.chat-box {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  list-style: none;
  margin: 0;
  padding: 0.9rem 1rem;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.chat-message {
  line-height: 1.35;
  word-break: break-word;
}

.chat-time {
  color: var(--text-dim);
  font-size: 0.72rem;
  margin-right: 0.4rem;
}

.chat-name {
  color: var(--accent);
  font-weight: 700;
  margin-right: 0.35rem;
}

.chat-name::after {
  content: ':';
}

.chat-text {
  color: var(--text);
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 0.85rem;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-send {
  flex-shrink: 0;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #241a0d;
  font-weight: 700;
  cursor: pointer;
}

.chat-send:hover {
  filter: brightness(1.08);
}

.chat-name-edit-button {
  flex-shrink: 0;
  width: 2.3rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-name-edit-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Info-Button + Panel --- */

.info-button {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.info-button:hover,
.info-button[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.info-panel {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + 3rem);
  z-index: 5;
  width: min(300px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 2.2rem 1.1rem 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.info-panel[hidden] {
  display: none;
}

.info-panel p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

.info-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

.info-close:hover {
  color: var(--accent);
}

@media (max-width: 400px) {
  .info-button {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .info-panel {
    right: 0.75rem;
    bottom: calc(0.75rem + 3rem);
  }
}

/* --- Präsenz-Button + Panel (unten links, Etappe 4) --- */

.presence-button {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 5;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.presence-button:hover,
.presence-button[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.presence-dot {
  color: var(--accent);
}

.presence-panel {
  position: fixed;
  left: 1rem;
  bottom: calc(1rem + 3rem);
  z-index: 5;
  width: min(220px, calc(100vw - 2rem));
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 2.2rem 1.1rem 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.presence-panel[hidden] {
  display: none;
}

.presence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-word;
}

.presence-empty {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.presence-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

.presence-close:hover {
  color: var(--accent);
}

@media (max-width: 400px) {
  .presence-button {
    left: 0.75rem;
    bottom: 0.75rem;
  }

  .presence-panel {
    left: 0.75rem;
    bottom: calc(0.75rem + 3rem);
  }

  /* Wenig Platz auf schmalen Screens -> nur Punkt+Zahl statt "X online" */
  .presence-label {
    display: none;
  }
}

/* --- Namens-Abfrage (einmalig, Overlay) --- */

.chat-name-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(10, 8, 5, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chat-name-overlay[hidden] {
  display: none;
}

.chat-name-form {
  width: min(340px, 100%);
  background: #201a12;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chat-name-form p {
  margin: 0 0 1rem;
  color: var(--text);
}

.chat-name-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.chat-name-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-name-form button {
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #241a0d;
  font-weight: 700;
  cursor: pointer;
}

.chat-name-form button:hover {
  filter: brightness(1.08);
}
