/* ========================================
   DESIGN PRINCIPLE: SQUARE/CUBE DESIGN
   ========================================
   This site uses an EXCLUSIVELY SQUARE/CUBE design language.
   ALL corners MUST be square - NO rounded corners anywhere.
   All border-radius values MUST be 0px or explicitly set to 0.
   Do NOT add rounded corners to any elements.
   ======================================== */

/* Core tokens */
:root {
  color-scheme: dark;
  --bg-primary: #000407;
  --bg-deep: #01030a;
  --text-primary: #f5f6ff;
  --text-secondary: rgba(231, 233, 255, 0.58);
  --neon-pink: #ff1cf7;
  --neon-cyan: #00f0ff;
  --neon-yellow: #fbff00;
  --panel-bg: rgba(3, 6, 16, 0.94);
  --panel-border: rgba(0, 240, 255, 0.35);
  --panel-glow: rgba(255, 28, 247, 0.25);
  --radius-lg: 0px;
  --radius-md: 0px;
  --radius-sm: 0px;
  --shadow-neon: 0 0 35px rgba(0, 240, 255, 0.3), 0 0 60px rgba(255, 28, 247, 0.18);
  --shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.75);
  --glass-backdrop: blur(24px);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

/* Ensure all elements have square corners - override any browser defaults or external styles */
/* CRITICAL: This MUST stay 0 to maintain square/cube design - DO NOT CHANGE */
*,
*::before,
*::after,
iframe,
button,
input,
select,
textarea,
div,
section,
article,
header,
footer,
main,
nav,
aside {
  border-radius: 0 !important; /* ENFORCED: Square/cube design - NO rounded corners */
}

body {
  margin: 0;
  min-height: 100vh;
  min-width: 0;
  padding: clamp(0.35rem, 1.2vw, 1rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.4rem, 1.2vw, 1rem);
  align-items: center;
  background: radial-gradient(ellipse at 15% 25%, rgba(255, 28, 247, 0.35), transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(0, 240, 255, 0.38), transparent 52%),
    radial-gradient(circle at 50% 90%, rgba(251, 255, 0, 0.22), transparent 48%),
    #000000;
  color: var(--text-primary);
  transition: background 0.6s ease;
}

body[data-ambient='off'] {
  background: var(--bg-primary);
}

a {
  color: var(--neon-cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

.background-gradient,
.background-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  transition: opacity 0.45s ease;
}

.background-gradient {
  background: conic-gradient(from 90deg at 20% 20%, rgba(255, 28, 247, 0.2), transparent 36%),
    conic-gradient(from 180deg at 80% 0%, rgba(0, 240, 255, 0.22), transparent 42%),
    radial-gradient(circle at 50% 100%, rgba(251, 255, 0, 0.14), transparent 52%);
  filter: blur(50px);
}

.background-noise {
  z-index: -1;
  opacity: 0.08;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

body[data-ambient='off'] .background-gradient,
body[data-ambient='off'] .background-noise {
  opacity: 0;
}

.app-header {
  width: min(1400px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(0.4rem, 1.3vw, 0.9rem);
  align-items: center;
  padding: clamp(0.4rem, 1vw, 0.9rem);
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #00f0ff;
  border-radius: 0px;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: 
    0 0 6px rgba(255, 28, 247, 0.3),
    0 0 12px rgba(0, 240, 255, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.6);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 0px;
  background: linear-gradient(135deg, #ff1cf7, #00f0ff);
  border: 2px solid #00f0ff;
  box-shadow: 0 0 8px rgba(255, 28, 247, 0.35), 0 0 14px rgba(0, 240, 255, 0.25);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 28, 247, 0.35), 0 0 14px rgba(0, 240, 255, 0.25);
  }
  50% {
    box-shadow: 0 0 10px rgba(255, 28, 247, 0.45), 0 0 18px rgba(0, 240, 255, 0.35);
  }
}

.brand-name {
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #ff1cf7, #00f0ff, #fbff00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

.view-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.divider {
  width: 1px;
  height: 34px;
  background: var(--border-soft);
}

.icon-button {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: var(--text-primary);
  opacity: 0.85;
}

.ambient-button {
  width: auto;
  padding: 0 1.2rem;
  gap: 0.7rem;
}

.ambient-button svg {
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.ambient-button .toggle-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.ambient-button[aria-pressed='false'] svg {
  opacity: 0.5;
}

.ambient-button[aria-pressed='false'] .toggle-label {
  color: rgba(231, 233, 255, 0.45);
}

.icon-button:hover {
  transform: translateY(-2px);
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.25);
}

.icon-button:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 3px;
}

.app-layout {
  width: min(1400px, 100%);
  min-width: 0;
  display: grid;
  gap: clamp(0.6rem, 1.6vw, 1.3rem);
  align-items: stretch;
  transition: grid-template-columns 0.45s ease;
}

/* Default split mode layout */
.app-layout[data-mode='split'],
.app-layout:not([data-mode]) {
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
}


.panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(0.45rem, 0.9vw, 0.75rem);
  padding: clamp(0.45rem, 1vw, 0.8rem);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  background: rgba(0, 0, 0, 0.96);
  border-radius: 0px;
  border: 2px solid #ff1cf7;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: 
    0 0 8px rgba(255, 28, 247, 0.3),
    0 0 14px rgba(0, 240, 255, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.6);
}

.player-panel.player-panel--focus {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(0.45rem, 0.9vw, 0.75rem);
  order: 1;
  width: 100%;
  max-width: 100%;
  align-items: stretch;
  justify-items: stretch;
}

.player-panel.player-panel--cinema {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  order: 1;
  width: 100%;
  max-width: 100%;
  gap: 0;
}

.player-panel.player-panel--chat {
  display: none;
}

.chat-panel {
  display: flex;
  flex-direction: column;
}

.chat-panel .panel-head {
  flex: 0 0 auto;
}

.chat-panel .chat-frame {
  flex: 0 0 auto;
  width: 100%;
}

.chat-panel.chat-panel--split .chat-frame,
.chat-panel.chat-panel--adaptable .chat-frame {
  flex: 1 1 auto;
}

.chat-panel.chat-panel--cinema .chat-frame {
  flex: 1 1 auto;
  height: 100%;
}

.chat-panel.chat-panel--focus {
  display: none;
}

.chat-panel.chat-panel--chat {
  align-items: stretch;
  justify-content: stretch;
  max-width: 100%;
  width: 100%;
  height: 100%;
}

.chat-panel.chat-panel--chat .chat-frame {
  flex: 1 1 auto;
  height: 100%;
  width: 100%;
}

.chat-panel.chat-panel--cinema {
  order: 2;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
}

.chat-panel.chat-panel--cinema .chat-frame {
  max-width: 100%;
  width: 100%;
  margin: 0;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.7rem, 1.2vw, 1rem);
}

.panel-meta p {
  margin-top: 0.35rem;
  max-width: none;
}

.panel-controls {
  display: flex;
  gap: clamp(0.65rem, 1.1vw, 0.9rem);
  flex-wrap: wrap;
}

.control {
  padding: 0.65rem 1.35rem;
  border-radius: 0px;
  border: 2px solid #00f0ff;
  background: linear-gradient(135deg, rgba(255, 28, 247, 0.25), rgba(0, 240, 255, 0.2));
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  min-width: 140px;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.control:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(255, 28, 247, 0.4), rgba(0, 240, 255, 0.35));
  border-color: #fbff00;
  box-shadow: 0 0 8px rgba(255, 28, 247, 0.4), 0 0 14px rgba(0, 240, 255, 0.3), 0 0 20px rgba(251, 255, 0, 0.25);
}

.control:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 3px;
}


.player-frame,
.chat-frame {
  position: relative;
  border-radius: 0px;
  overflow: hidden;
  background: #000000;
  border: 3px solid #00f0ff;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-shadow:
    0 0 6px rgba(0, 240, 255, 0.3),
    0 0 12px rgba(255, 28, 247, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.7);
  transition: width 0.3s ease, height 0.3s ease;
}

.player-frame {
  aspect-ratio: 16 / 9;
}

.player-frame-resizable {
  aspect-ratio: auto;
  resize: both;
  min-width: min(320px, 100%);
  min-height: 180px;
  overflow: auto;
}

.player-frame-split,
.player-frame-adaptable {
  max-width: 100%;
}

.player-frame-cinema {
  max-width: 100%;
  max-height: 100vh;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0;
}

.player-frame-focus {
  max-width: 100%;
  width: 100%;
  height: auto;
  max-height: none;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 9;
  margin: 0;
  resize: none !important;
  overflow: hidden;
}

.player-frame-chat {
  display: none;
}

.player-frame iframe,
.chat-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Note: Twitch player overlays (like "upcoming streams") cannot be hidden via CSS
   due to cross-origin iframe restrictions. This would require Twitch API modifications
   or custom player implementation. */

/* Base chat-frame styles - common to all modes */
/* Chat-frame base styles are defined with .player-frame above */
/* Mode-specific heights are handled by: .chat-frame-split, .chat-frame-adaptable, .chat-frame-cinema, .chat-frame-chat-mode */

.view-dock {
  width: min(1400px, 100%);
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: clamp(0.5rem, 1.2vw, 1rem);
  padding: clamp(0.6rem, 1.2vw, 0.9rem) clamp(0.8rem, 1.3vw, 1.3rem);
  border-radius: 0px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #fbff00;
  box-shadow: 
    0 0 8px rgba(251, 255, 0, 0.35),
    0 0 14px rgba(0, 240, 255, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: var(--glass-backdrop);
}

@media (max-width: 1200px) {
  .view-dock {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  
  .view-dock .dock-group {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.dock-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.dock-button {
  padding: 0.65rem 1.25rem;
  border-radius: 0px;
  border: 2px solid #00f0ff;
  background: rgba(0, 240, 255, 0.15);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  min-width: 115px;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.dock-button.active,
.dock-button:hover {
  transform: translateY(-2px);
  border-color: #fbff00;
  background: linear-gradient(135deg, rgba(251, 255, 0, 0.3), rgba(255, 28, 247, 0.25));
  box-shadow: 0 0 8px rgba(251, 255, 0, 0.4), 0 0 14px rgba(255, 28, 247, 0.3), 0 0 20px rgba(0, 240, 255, 0.25);
}

.dock-button:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 3px;
}

.info-grid {
  width: min(1400px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(0.8rem, 1.5vw, 1.2rem);
}

@media (max-width: 1400px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  padding: 1.1rem 1.4rem;
  border-radius: 0px;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #00f0ff;
  box-shadow: 
    0 0 6px rgba(0, 240, 255, 0.3),
    0 0 12px rgba(255, 28, 247, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.6);
}

.info-card h3 {
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
}

.info-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.info-card li a {
  font-weight: 500;
}

.app-footer {
  width: min(1400px, 100%);
  padding: 1rem 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-layout[data-mode='adaptable'] {
  grid-template-columns: minmax(0, 2.1fr) minmax(180px, 1fr);
}

.app-layout[data-mode='adaptable'] .player-panel {
  order: 1;
  min-width: 0;
}

.app-layout[data-mode='adaptable'] .chat-panel {
  order: 2;
  min-width: 0;
}

/* Adaptable mode responds to container width - compresses horizontally then stacks */
@media (max-width: 1600px) {
  .app-layout[data-mode='adaptable'] {
    grid-template-columns: minmax(0, 1.8fr) minmax(160px, 1fr) !important;
  }
}

@media (max-width: 1400px) {
  .app-layout[data-mode='adaptable'] {
    grid-template-columns: minmax(0, 1.4fr) minmax(140px, 1fr) !important;
  }
}

@media (max-width: 1200px) {
  .app-layout[data-mode='adaptable'] {
    grid-template-columns: minmax(0, 1.2fr) minmax(120px, 1fr) !important;
  }
}

@media (max-width: 1100px) {
  .app-layout[data-mode='adaptable'] {
    grid-template-columns: 1fr !important;
  }
  
  .app-layout[data-mode='adaptable'] .player-panel {
    order: 1 !important;
  }
  
  .app-layout[data-mode='adaptable'] .chat-panel {
    order: 2 !important;
  }
  
    /* Adaptable mode chat-frame handled by .chat-frame-adaptable classes */
}

@media (max-width: 600px) {
  .app-layout[data-mode='adaptable'] {
    grid-template-columns: 1fr;
  }
  
  .app-header {
    padding: clamp(0.4rem, 1vw, 0.8rem);
    gap: clamp(0.4rem, 1.2vw, 0.8rem);
    grid-template-columns: 1fr;
  }
  
  .app-header .brand-block {
    justify-content: center;
  }
  
  .app-header .header-status {
    justify-content: center;
  }
  
  .panel {
    padding: clamp(0.4rem, 0.9vw, 0.7rem);
    gap: clamp(0.4rem, 0.8vw, 0.7rem);
  }
  
  .player-frame {
    min-height: 180px;
  }
  
  /* Mobile chat-frame heights handled by mode-specific classes */
  
  .view-dock {
    flex-direction: column;
    align-items: stretch;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
}

/* Ensure split mode doesn't stack - keeps side-by-side layout */
.app-layout[data-mode='split'] {
  grid-template-columns: minmax(0, 2.1fr) minmax(320px, 1fr);
}

.app-layout[data-mode='cinema'] {
  grid-template-columns: 1fr;
  position: relative;
}

/* Dark intimate cinema mode - remove all neon, fuse chat with video */
body:has(.app-layout[data-mode='cinema']) {
  background: #000000 !important;
}

body:has(.app-layout[data-mode='cinema']) .background-gradient,
body:has(.app-layout[data-mode='cinema']) .background-noise {
  opacity: 0 !important;
}

body:has(.app-layout[data-mode='cinema']) .app-header,
body:has(.app-layout[data-mode='cinema']) .view-dock,
body:has(.app-layout[data-mode='cinema']) .info-grid,
body:has(.app-layout[data-mode='cinema']) .app-footer {
  opacity: 0.15;
  transition: opacity 0.3s ease;
}

body:has(.app-layout[data-mode='cinema']) .app-header:hover,
body:has(.app-layout[data-mode='cinema']) .view-dock:hover {
  opacity: 1;
}

.app-layout[data-mode='cinema'] .player-panel {
  position: relative;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  gap: 0;
  padding-right: 420px;
  min-height: 100vh;
}

.app-layout[data-mode='cinema'] .player-panel .panel-head {
  display: none;
}

.app-layout[data-mode='cinema'] .chat-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  min-height: 100vh;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  z-index: 1000;
  pointer-events: auto;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

.app-layout[data-mode='cinema'] .chat-panel .panel-head {
  display: none;
}

.app-layout[data-mode='cinema'] .chat-panel .chat-frame {
  display: none !important;
}

.app-layout[data-mode='cinema'] .chat-panel .chat-simple {
  display: flex !important;
  flex-direction: column;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: clamp(0.8rem, 1.5vw, 1.2rem);
  resize: none;
  overflow: hidden;
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  box-sizing: border-box;
}

.chat-simple {
  display: none;
}

/* Ensure chat-simple is visible in cinema mode */
.app-layout[data-mode='cinema'] .chat-simple {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(0.8rem, 1.2vw, 1.2rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  min-height: 0;
  max-height: 100%;
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease;
}

.chat-message:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chat-message-user {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-message-badge {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0px;
}

.chat-message-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
  padding: clamp(0.8rem, 1.2vw, 1rem);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  pointer-events: auto;
}

.chat-input {
  flex: 1 1 auto;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: 0px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.chat-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.chat-send {
  padding: 0.7rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 0px;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.chat-send:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.chat-send:active {
  background: rgba(255, 255, 255, 0.2);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.app-layout[data-mode='cinema'] .player-frame {
  border: none !important;
  box-shadow: none !important;
  background: #000000;
  width: 100% !important;
  height: 100vh !important;
  max-height: 100vh !important;
  min-width: 100% !important;
  min-height: 100vh !important;
  max-width: 100% !important;
  aspect-ratio: auto;
  resize: none !important;
  overflow: hidden;
  position: relative;
  margin: 0;
}

.app-layout[data-mode='cinema'] .player-frame iframe {
  border: none;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* Hide scrollbar on video iframe */
.app-layout[data-mode='cinema'] .player-frame iframe::-webkit-scrollbar {
  display: none;
}

.app-layout[data-mode='cinema'] .player-frame {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Responsive adjustments for cinema mode - mobile layout with chat below video */
@media (max-width: 900px) {
  .app-layout[data-mode='cinema'] {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 0;
  }
  
  .app-layout[data-mode='cinema'] .player-panel {
    padding-right: 0;
    min-height: auto;
    order: 1;
  }
  
  .app-layout[data-mode='cinema'] .player-frame {
    height: auto !important;
    min-height: auto !important;
    aspect-ratio: 16 / 9;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .app-layout[data-mode='cinema'] .chat-panel {
    width: 100% !important;
    position: static !important;
    height: auto !important;
    min-height: clamp(300px, 40vh, 500px) !important;
    max-height: 50vh !important;
    order: 2;
    padding: 0;
    z-index: 10;
  }
  
  .app-layout[data-mode='cinema'] .chat-panel .chat-simple {
    background: rgba(0, 0, 0, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(16px) !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: clamp(0.6rem, 1.2vw, 1rem) !important;
  }
}

/* Mode-specific chat-frame styles - each mode has its own class */

/* Split mode - side by side layout */
.chat-frame {
  resize: none;
}

.chat-frame-resizable {
  resize: both;
  min-width: min(260px, 100%);
  min-height: 260px;
  max-height: none;
  overflow: auto;
}

.chat-frame-split {
  min-height: clamp(320px, 46vh, 600px);
}

/* Adaptable mode - responsive, changes based on width */
.chat-frame-adaptable {
  min-height: clamp(320px, 46vh, 600px);
}

.chat-frame-adaptable.chat-frame-adaptable-stacked {
  min-height: clamp(300px, 40vh, 500px);
}

/* Cinema mode - chat overlay on video */
.chat-frame-cinema {
  min-height: 100%;
  height: 100%;
  max-height: 100%;
  resize: none !important;
}

/* Chat mode - full screen chat only */
.chat-frame-chat-mode {
  max-width: 100%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-width: 100%;
  min-height: 0;
  margin: 0;
  resize: none !important;
  overflow: hidden;
}

/* Mobile chat mode - full screen on mobile */
@media (max-width: 600px) {
  .app-layout[data-mode='chat'] {
    width: min(1400px, 100%) !important;
    height: calc(90vh - 6rem) !important;
  }
  
  .app-layout[data-mode='focus'] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
  
  .chat-frame-chat-mode {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    min-width: 100% !important;
  }
}

.app-layout[data-mode='focus'] {
  grid-template-columns: 1fr;
  justify-items: stretch;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  height: auto;
}

.app-layout[data-mode='focus'] .player-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(0.45rem, 0.9vw, 0.75rem);
  padding: clamp(0.45rem, 1vw, 0.8rem);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  height: auto;
  min-height: 0;
  background: rgba(0, 0, 0, 0.96);
  border-radius: 0px;
  border: 2px solid #ff1cf7;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: 
    0 0 8px rgba(255, 28, 247, 0.3),
    0 0 14px rgba(0, 240, 255, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.6);
}

.app-layout[data-mode='focus'] .player-frame {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  min-width: 100% !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9;
  margin: 0;
  resize: none !important;
  overflow: hidden;
  flex: 1 1 auto;
}

.app-layout[data-mode='focus'] .chat-panel {
  display: none;
}

.app-layout[data-mode='chat'] {
  grid-template-columns: 1fr;
  justify-items: stretch;
  width: 100vw;
  height: auto;
}

.app-layout[data-mode='chat'] .player-panel {
  display: none;
}

.app-layout[data-mode='chat'] .chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(0.45rem, 0.9vw, 0.75rem);
  padding: clamp(0.45rem, 1vw, 0.8rem);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  height: auto;
  min-height: 70vh;
  background: rgba(0, 0, 0, 0.96);
  border-radius: 0px;
  border: 2px solid #ff1cf7;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: 
    0 0 8px rgba(255, 28, 247, 0.3),
    0 0 14px rgba(0, 240, 255, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.6);
}

.app-layout[data-mode='chat'] .chat-panel .chat-frame {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  min-width: 100% !important;
  min-height: 70vh !important;
  margin: 0;
  resize: none !important;
  overflow: hidden;
}

/* Chat mode resizing handled by .chat-frame-chat-mode class above */

.dock-button[data-mode='focus']::after {
  content: ' •';
  color: rgba(255, 255, 255, 0.3);
}

.toast-notice {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 30px);
  padding: 0.8rem 1.5rem;
  background: rgba(3, 6, 16, 0.92);
  border-radius: 0px;
  border: 2px solid rgba(0, 240, 255, 0.5);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 6px rgba(255, 28, 247, 0.25), 0 0 12px rgba(0, 240, 255, 0.15);
  pointer-events: none;
}

.toast-notice.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 1280px) {
  .app-layout:not([data-mode='adaptable']):not([data-mode='cinema']):not([data-mode='focus']):not([data-mode='chat']) {
    grid-template-columns: minmax(0, 2.4fr) minmax(340px, 1fr);
  }
}

@media (min-width: 1600px) {
  .app-header,
  .app-layout,
  .view-dock,
  .info-grid,
  .app-footer {
    width: min(94vw, 2000px);
  }
}

@media (min-width: 2000px) {
  .app-header,
  .app-layout,
  .view-dock,
  .info-grid,
  .app-footer {
    width: min(96vw, 4000px);
  }

  .app-layout:not([data-mode='adaptable']):not([data-mode='cinema']):not([data-mode='focus']):not([data-mode='chat']) {
    grid-template-columns: minmax(0, 3fr) minmax(400px, 1fr);
  }

  /* Large screen chat-frame heights handled by mode-specific classes */
}

@media (min-width: 3200px) {
  .app-header,
  .app-layout,
  .view-dock,
  .info-grid,
  .app-footer {
    width: min(98vw, 4500px);
  }

  .app-layout:not([data-mode='adaptable']):not([data-mode='cinema']):not([data-mode='focus']):not([data-mode='chat']) {
    grid-template-columns: minmax(0, 3.2fr) minmax(420px, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

