/* ========================================================= */
/* KAYWAT 24/7 PERPETUAL LOFI RADIO STUDIO & BROADCASTER     */
/* Aesthetic faithfully based on Screenshot 2 (KayWat Anime)  */
/* ========================================================= */

.lofi-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #f4eee6;
  color: #111111;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.8s ease, color 0.8s ease;
}

/* Theme Variations */
.lofi-canvas-wrapper.theme-night {
  background-color: #1a1824;
  color: #f3f3f8;
}

.lofi-canvas-wrapper.theme-synthwave {
  background-color: #0f0a1c;
  color: #00ffcc;
}

/* 16:9 Aspect Ratio Frame Container */
.lofi-frame-container {
  position: relative;
  width: 100%;
  max-width: 1920px;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 1080px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 40px 60px;
  box-sizing: border-box;
}

/* Red Geometric Corner Framing Brackets (Screenshot 2) */
.lofi-bracket-top-left {
  position: absolute;
  top: 30px;
  left: 60px;
  width: 110px;
  height: 110px;
  border-top: 14px solid #e51d24;
  border-left: 14px solid #e51d24;
  pointer-events: none;
  z-index: 5;
}

.lofi-bracket-bottom-right {
  position: absolute;
  bottom: 50px;
  right: 80px;
  width: 14px;
  height: 110px;
  background-color: #e51d24;
  pointer-events: none;
  z-index: 5;
}

/* Top Bold Header "KAYWAT" */
.lofi-brand-header {
  margin-top: 10px;
  text-align: center;
  z-index: 10;
}

.lofi-brand-title {
  font-size: clamp(3rem, 7vw, 6.5rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1;
  color: #0a0a0a;
  text-transform: uppercase;
  margin-bottom: 4px;
  transition: color 0.5s ease;
}

.lofi-canvas-wrapper.theme-night .lofi-brand-title {
  color: #ffffff;
  text-shadow: 0 4px 20px rgba(255,255,255,0.15);
}

.lofi-canvas-wrapper.theme-synthwave .lofi-brand-title {
  color: #ff007f;
  text-shadow: 0 0 25px rgba(255, 0, 127, 0.7), 0 0 50px rgba(0, 255, 204, 0.4);
}

/* Center Stage with Anime Character & Desk */
.lofi-center-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 340px;
  z-index: 8;
}

/* Vertical Calligraphy "小貝鈴" (Screenshot 2) */
.lofi-calligraphy-right {
  position: absolute;
  right: calc(50% - 170px);
  top: 25%;
  font-family: 'Songti SC', 'STSong', 'SimSun', serif;
  font-size: clamp(2rem, 3.8vw, 3.6rem);
  font-weight: 800;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.35em;
  color: #111111;
  pointer-events: none;
  transition: color 0.5s ease;
}

.lofi-canvas-wrapper.theme-night .lofi-calligraphy-right {
  color: #e0e0e0;
}

.lofi-canvas-wrapper.theme-synthwave .lofi-calligraphy-right {
  color: #00ffcc;
  text-shadow: 0 0 15px rgba(0, 255, 204, 0.8);
}

/* Character Avatar Illustration */
.lofi-character-art {
  position: relative;
  width: clamp(260px, 32vw, 420px);
  height: clamp(260px, 32vw, 420px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gentle-breathe 4s ease-in-out infinite alternate;
}

@keyframes gentle-breathe {
  0% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-4px) scale(1.008); }
  100% { transform: translateY(0px) scale(1); }
}

/* Character Typing Hands Animation */
.lofi-hands {
  animation: typing-keys 0.3s ease-in-out infinite alternate;
  transform-origin: center;
}

@keyframes typing-keys {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-1.5px) rotate(0.5deg); }
  100% { transform: translateY(1px) rotate(-0.5deg); }
}

/* Laptop Apple Logo Glow */
.laptop-glow {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
  animation: laptop-pulse 2.5s ease-in-out infinite alternate;
}

@keyframes laptop-pulse {
  0% { opacity: 0.85; filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.6)); }
  100% { opacity: 1; filter: drop-shadow(0 0 14px rgba(255, 255, 255, 1)); }
}

/* Bottom Subtitle "itsKayWat 纖居" */
.lofi-bottom-brand {
  margin-bottom: 20px;
  text-align: center;
  z-index: 10;
}

.lofi-bottom-text {
  font-size: clamp(1.4rem, 2.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #111111;
  transition: color 0.5s ease;
}

.lofi-canvas-wrapper.theme-night .lofi-bottom-text {
  color: #f1f1f5;
}

.lofi-canvas-wrapper.theme-synthwave .lofi-bottom-text {
  color: #ffe600;
  text-shadow: 0 0 15px rgba(255, 230, 0, 0.7);
}

/* ========================================================= */
/* LOFI GIRL STYLE HUD OVERLAYS (Screenshot 1)              */
/* ========================================================= */

/* Now Playing Card (Top-Left) */
.lofi-now-playing-card {
  position: absolute;
  top: 28px;
  left: 36px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(16, 16, 24, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 10px 18px 10px 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  color: #ffffff;
  z-index: 20;
  transition: all 0.3s ease;
}

.lofi-now-playing-card:hover {
  transform: translateY(-2px);
  background: rgba(16, 16, 24, 0.95);
}

.lofi-cover-art {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff0055, #7a00ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  position: relative;
}

.lofi-cover-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lofi-track-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lofi-track-name {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lofi-track-artist {
  font-size: 11px;
  color: #a0a0b5;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Audio Visualizer Bars */
.lofi-eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  margin-left: 6px;
}

.lofi-eq-bar {
  width: 3px;
  background: #ff334b;
  border-radius: 2px;
  animation: eq-bounce 1s ease-in-out infinite alternate;
}

.lofi-eq-bar:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.lofi-eq-bar:nth-child(2) { height: 80%; animation-delay: 0.3s; }
.lofi-eq-bar:nth-child(3) { height: 60%; animation-delay: 0.15s; }
.lofi-eq-bar:nth-child(4) { height: 100%; animation-delay: 0.45s; }
.lofi-eq-bar:nth-child(5) { height: 50%; animation-delay: 0.25s; }

@keyframes eq-bounce {
  0% { transform: scaleY(0.2); }
  50% { transform: scaleY(1); }
  100% { transform: scaleY(0.4); }
}

/* Top-Right Stream Status Pills */
.lofi-stream-status {
  position: absolute;
  top: 28px;
  right: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

.lofi-live-badge {
  background: #ff0033;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 15px rgba(255, 0, 51, 0.4);
}

.lofi-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ffffff;
  animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.4; transform: scale(0.8); }
}

.lofi-pill-counter {
  background: rgba(16, 16, 24, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Floating Rain Particles Overlay */
.lofi-rain-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
  background: repeating-linear-gradient(
    transparent,
    transparent 40px,
    rgba(180, 210, 255, 0.15) 42px,
    transparent 45px
  );
  animation: rain-fall 0.45s linear infinite;
  z-index: 6;
}

.lofi-rain-overlay.active {
  opacity: 1;
}

@keyframes rain-fall {
  0% { transform: translateY(-50px); }
  100% { transform: translateY(50px); }
}

/* Analog Grain & Vinyl Dust Effect */
.lofi-grain-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.035;
  background: radial-gradient(circle, transparent 20%, rgba(0, 0, 0, 0.8) 120%);
  z-index: 7;
}

/* ========================================================= */
/* BROADCASTER CONTROL TOOLBAR (Expandable / Dockable)        */
/* ========================================================= */
.lofi-control-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(18, 18, 28, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 40px;
  padding: 8px 16px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
  z-index: 30;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.lofi-control-toolbar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.lofi-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.lofi-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.lofi-btn.active {
  background: #22c55e;
  color: #000;
  border-color: #22c55e;
  font-weight: 700;
}

.lofi-btn-red {
  background: #ff0044;
  color: #fff;
  border: none;
}

.lofi-btn-red:hover {
  background: #ff2266;
}

/* Modals & YouTube Setup Drawer */
.lofi-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 580px;
  background: #14141e;
  border: 2px solid #2a2a3e;
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  z-index: 100;
  color: #fff;
  display: none;
  flex-direction: column;
  gap: 18px;
}

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

.lofi-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2a2a3e;
  padding-bottom: 14px;
}

.lofi-modal-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lofi-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lofi-label {
  font-size: 12px;
  color: #a0a0b5;
  font-weight: 600;
}

.lofi-input {
  background: #0b0b12;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.lofi-input:focus {
  border-color: #22c55e;
}
