:root {
  --bg-main: #0c0f17;
  --bg-card: #151a24;
  --bg-card-hover: #1b212e;
  --bg-input: #090c13;
  --border-color: #263044;
  --border-focus: #3b82f6;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --accent-party: #ec4899;
  --accent-party-hover: #db2777;
  --danger: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

.app-container {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  background: rgba(59, 130, 246, 0.15);
  padding: 8px;
  border-radius: var(--radius-md);
}

.main-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

/* Supported Sites Bar */
.supported-sites-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(21, 26, 36, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.bar-title {
  color: #cbd5e1;
  font-weight: 600;
}

.sites-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.site-pill {
  background: #1e2638;
  border: 1px solid var(--border-color);
  color: #94a3b8;
  font-size: 0.725rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
}

/* Content & Cards */
.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.input-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.input-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.provider-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.input-group {
  display: flex;
  gap: 10px;
  position: relative;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
  opacity: 0.7;
}

.input-group input {
  flex: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 14px 12px 42px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-main);
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Room Hero Box */
.room-hero-box {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(59, 130, 246, 0.1));
  border: 2px solid rgba(236, 72, 153, 0.4);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.15);
}

.room-hero-top {
  margin-bottom: 14px;
}

.room-badges-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.room-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
  border-radius: 999px;
}

.site-tag {
  font-size: 0.725rem;
  font-weight: 700;
  padding: 3px 8px;
  background: #1e293b;
  color: #38bdf8;
  border-radius: 6px;
}

.pulse-icon {
  color: #ec4899;
  animation: pulse 1.5s infinite;
}

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

.sub-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fbcfe8;
  margin-bottom: 6px;
}

.room-code-input {
  background: rgba(0, 0, 0, 0.6) !important;
  color: #f472b6 !important;
  font-size: 0.95rem !important;
  font-weight: 600;
  border-color: rgba(236, 72, 153, 0.5) !important;
}

.btn-accent {
  background-color: #ec4899 !important;
  color: #fff !important;
  border: none !important;
}

.btn-accent:hover {
  background-color: #db2777 !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #ec4899, #3b82f6);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-watchparty {
  background-color: var(--accent-party);
  color: #fff;
  text-decoration: none;
}

.btn-watchparty:hover {
  background-color: var(--accent-party-hover);
}

.btn-copy {
  background-color: #273347;
  color: #e2e8f0;
  padding: 8px 14px;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
}

.btn-copy:hover {
  background-color: #334155;
  color: #fff;
}

.btn-copy.copied {
  background-color: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.btn-text-only {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-text-only:hover {
  color: var(--danger);
}

/* Quick Examples */
.quick-examples {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.pill-btn {
  background: #1e2638;
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover {
  background: #2b364d;
  color: #fff;
  border-color: var(--primary);
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Results */
.result-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

.source-group {
  margin-bottom: 18px;
}

.group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.link-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.code-input {
  flex: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.subtitles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-item-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  background: #1e293b;
  border-radius: 4px;
  color: #e2e8f0;
  min-width: 65px;
  text-align: center;
}

/* Video Preview */
.preview-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.preview-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.preview-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: #1e293b;
  padding: 2px 8px;
  border-radius: 4px;
  color: #94a3b8;
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

video {
  width: 100%;
  height: 100%;
  display: block;
}

/* History Card */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f141d;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.history-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item-title {
  color: #e2e8f0;
  font-weight: 500;
  cursor: pointer;
}

.history-item-title:hover {
  color: var(--primary);
  text-decoration: underline;
}

.history-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-text {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--accent);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  z-index: 1000;
  animation: slideIn 0.25s ease;
}

.toast-icon {
  color: var(--accent);
  font-weight: bold;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Footer */
.main-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 12px;
}
