/* Crowd Stats Customizer Styles — re-themed to #0f172a / #0891b2 / #22d3ee / #f0abfc */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700&family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;600;700&family=JetBrains+Mono:wght@400;600;700&family=Bebas+Neue&family=Oswald:wght@300;400;500;600&family=Roboto:wght@300;400;500;700&family=Open+Sans:wght@300;400;600;700&family=Montserrat:wght@300;400;500;600&family=Poppins:wght@300;400;500;600&family=Rajdhani:wght@400;600;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #0891b2;
  --secondary-color: #0f172a;
  --accent-color: #f0abfc;
  --bright-color: #22d3ee;
  --bg-deep: #0b1120;
  --bg-panel: rgba(26, 26, 26, 0.8);
  --bg-panel-header: rgba(26, 26, 26, 0.7);
  --bg-panel-solid: #1a1a1a;
  --bg-inset: rgba(30, 30, 30, 0.8);
  --text-light: #e7eefb;
  --text-gray: #8499b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --success-color: #34d399;
  --warning-color: #fbbf24;
  --error-color: #f87171;
  --border-radius: 10px;
  --glow: rgba(8, 145, 178, 0.35);
}

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

/* Changelog Modal Styles */
.changelog-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7);
  display: none; justify-content: center; align-items: center; z-index: 1000;
}
.changelog-modal {
  background: #111827; border-radius: 10px; max-width: 700px; max-height: 80vh; width: 90%; overflow: hidden;
}
.changelog-modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  background: linear-gradient(135deg, #0891b2, #22d3ee); color: #04121a;
}
.changelog-modal-header h3 { margin: 0; font-size: 16px; }
.changelog-modal-close { background: transparent; border: none; color: #04121a; cursor: pointer; font-size: 18px; padding: 4px 8px; }
.changelog-modal-close:hover { color: #fff; }
.changelog-modal-content { padding: 16px; background: #0b1120; color: #e7eefb; overflow-y: auto; max-height: calc(80vh - 60px); }
.changelog-modal-content h1, .changelog-modal-content h2, .changelog-modal-content h3 { color: #e7eefb; }
.changelog-modal-content a { color: #22d3ee; }

@font-face {
  font-family: 'GamestationCond';
  src: url('../fonts/GamestationCond.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

html { height: 100%; }

body {
  font-family: 'Inter', 'Roboto', sans-serif;
  background:
    radial-gradient(circle at 80% -10%, rgba(8, 145, 178, 0.18), transparent 45%),
    radial-gradient(circle at 0% 110%, rgba(240, 171, 252, 0.10), transparent 45%),
    linear-gradient(160deg, #0b1120 0%, #0f172a 55%, #081020 100%);
  color: var(--text-light);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Header */
.header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--bg-panel-header);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.header-logo { width: 160px; max-width: 100%; height: auto; display: block; }

.header-divider {
  width: 2px; align-self: stretch;
  background: linear-gradient(to bottom, rgba(34, 211, 238, 0.35), rgba(34, 211, 238, 0));
  border-radius: 999px; flex-shrink: 0;
}

.header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  margin: 0;
  background: linear-gradient(90deg, var(--primary-color), var(--bright-color));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-align: center;
}

.header-overlay-url { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.header-overlay-url h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem; margin: 0; flex-shrink: 0; white-space: nowrap;
  background: linear-gradient(90deg, var(--primary-color), var(--bright-color));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header-overlay-url h3 i { color: var(--primary-color); -webkit-text-fill-color: var(--primary-color); }
.header p { font-size: 1.2rem; color: var(--text-gray); font-weight: 300; }
.header-overlay-url .url-help,
.url-help {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-gray);
  font-style: italic;
  font-weight: 400;
}

/* Container */
.container { display: flex; gap: 12px; max-width: 100%; margin: 0 auto; flex: 1 1 auto; min-height: 0; width: 100%; overflow: hidden; }

.settings-panel {
  flex: 1; max-width: 30%;
  background: var(--bg-panel);
  border-radius: var(--border-radius); padding: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3); backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  height: 100%; min-height: 0; overflow-y: auto;
}

.preview-panel {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-panel); border-radius: var(--border-radius); padding: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3); backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  height: 100%; min-height: 0; overflow: hidden;
}

.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.panel-header-main { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px 16px; min-width: 0; flex: 1; }
.panel-header h2 { font-size: 1.35rem; font-weight: 500; display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin: 0; font-family: 'Inter', sans-serif; }
.panel-header h2 i { color: var(--primary-color); }

.preview-support-note {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 0; max-width: none;
  padding: 5px 10px; font-size: 0.78rem; line-height: 1.35; color: var(--text-gray);
  background: rgba(8, 145, 178, 0.10); border: 1px solid rgba(34, 211, 238, 0.20); border-radius: 999px;
}
.preview-support-note i { color: var(--bright-color); font-size: 0.78rem; }
.preview-support-note a { color: var(--accent-color); text-decoration: none; font-weight: 500; }
.preview-support-note a:hover { color: var(--bright-color); text-decoration: underline; }
.preview-support-note strong { color: var(--text-light); font-weight: 600; }

.panel-header-actions { display: flex; align-items: center; gap: 12px; }
.panel-header-actions .connection-indicator {
  position: static; display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; background: rgba(0, 0, 0, 0.45); border-radius: 999px;
  font-size: 0.78rem; font-weight: 500; letter-spacing: 0.03em; color: #aab8cf;
  border: 1px solid var(--border-color); white-space: nowrap;
}
.panel-header-actions .connection-indicator .sb-logo { width: 20px; height: 20px; flex-shrink: 0; display: block; object-fit: contain; }
.panel-header-actions .connection-indicator .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #5a6a82; flex-shrink: 0; }
.panel-header-actions .connection-indicator.connecting .status-dot { background: var(--warning-color); animation: preview-pulse-dot 1s infinite; }
.panel-header-actions .connection-indicator.connected .status-dot { background: var(--success-color); box-shadow: 0 0 8px var(--success-color); }
.panel-header-actions .connection-indicator.disconnected .status-dot { background: var(--error-color); }

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

/* Settings sections */
.settings-section { margin-bottom: 30px; padding: 20px; background: rgba(30, 30, 30, 0.6); border-radius: var(--border-radius); border: 1px solid rgba(255, 255, 255, 0.05); }
.settings-section h3 { font-size: 1.3rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; color: var(--text-light); }
.settings-section h3 i { color: var(--accent-color); }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-gray);
  font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.platform-toggle-ico {
  width: 14px;
  height: 14px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(74%) sepia(28%) saturate(2000%) hue-rotate(165deg);
}

.setting-group { margin-bottom: 20px; position: relative; }
.setting-group::after {
  content: ""; position: absolute; inset: -9px; border-radius: var(--border-radius);
  border: 1px solid rgba(8, 145, 178, 0.15); box-shadow: 0 0 18px rgba(8, 145, 178, 0.25);
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
.setting-group:hover::after { opacity: 1; border-color: rgba(8, 145, 178, 0.35); }
.setting-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-gray); }

.style-select, input[type="color"], input[type="range"], input[type="number"], input[type="text"].text-input, input[type="password"].text-input, input[type="password"] {
  width: 100%; padding: 12px; border-radius: var(--border-radius);
  background: rgba(40, 40, 40, 0.8); border: 1px solid var(--border-color);
  color: var(--text-light); font-size: 1rem; font-family: inherit;
  box-sizing: border-box; -webkit-appearance: none; appearance: none;
}
input[type="number"]:focus, input[type="text"].text-input:focus, input[type="password"].text-input:focus, input[type="password"]:focus {
  outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}
input[type="color"] { height: 50px; cursor: pointer; padding: 4px; }
input[type="range"] { padding: 0; }
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }

.value-display { display: inline-block; margin-top: 5px; padding: 5px 10px; background: var(--primary-color); border-radius: var(--border-radius); font-weight: 500; font-family: 'IBM Plex Mono', monospace; }

/* Buttons */
.refresh-button, .alert-button {
  padding: 12px 20px; border-radius: var(--border-radius); border: none;
  font-size: 1rem; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: all 0.3s ease;
}
.refresh-button { padding: 8px 14px; font-size: 0.9rem; background: rgba(40, 40, 40, 0.8); color: var(--text-light); border: 1px solid var(--border-color); }
.alert-button { background: rgba(40, 40, 40, 0.8); color: var(--text-light); border: 1px solid var(--border-color); flex: 1; justify-content: center; }
.refresh-button:hover, .alert-button:hover { background: rgba(60, 60, 60, 0.8); transform: translateY(-2px); }

/* Preview */
.preview-container { flex: 1 1 auto; min-height: 0; display: flex; }
#crowd-stats-preview {
  width: 100%; height: 100%; min-height: 0; border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: radial-gradient(circle at 80% -10%, rgba(8,145,178,0.15), transparent 50%), linear-gradient(160deg,#0b1120,#0f172a);
}

/* Collapsible preview controls */
.preview-controls { padding: 0; background: rgba(30, 30, 30, 0.65); border-radius: var(--border-radius); border: 1px solid rgba(255, 255, 255, 0.08); flex-shrink: 0; overflow: hidden; }
.preview-controls.is-open { border-color: rgba(34, 211, 238, 0.42); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.test-controls-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: transparent; border: none; color: var(--text-light); cursor: pointer; font: inherit; text-align: left; }
.test-controls-toggle:hover { background: rgba(255,255,255,0.04); }
.test-controls-toggle-label { display: inline-flex; align-items: center; gap: 10px; font-size: 0.95rem; font-weight: 500; }
.test-controls-toggle-label > i { color: var(--accent-color); font-size: 1rem; }
.test-controls-meta { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.test-controls-hint { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-gray); padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.preview-controls.is-open .test-controls-hint { color: var(--text-light); background: rgba(8,145,178,0.24); border-color: rgba(34,211,238,0.4); }
.test-controls-hint-open { display: none; }
.preview-controls.is-open .test-controls-hint-closed { display: none; }
.preview-controls.is-open .test-controls-hint-open { display: inline; }
.test-controls-chevron { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; font-size: 0.7rem; color: var(--text-gray); background: rgba(255,255,255,0.05); transition: transform 0.28s ease; }
.preview-controls.is-open .test-controls-chevron { transform: rotate(180deg); color: var(--bright-color); background: rgba(8,145,178,0.18); }
.test-controls-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.32s ease; }
.preview-controls.is-open .test-controls-body { grid-template-rows: 1fr; }
.test-controls-body-inner { overflow: hidden; min-height: 0; opacity: 0; transform: translateY(-6px); transition: opacity 0.22s ease, transform 0.22s ease; padding: 0 12px; }
.preview-controls.is-open .test-controls-body-inner { opacity: 1; transform: translateY(0); padding: 2px 12px 12px; }
.alert-buttons { display: flex; gap: 15px; flex-wrap: wrap; }

/* Overlay URL */
.url-container { display: flex; gap: 10px; align-items: center; }
.url-input { flex: 1; padding: 8px 12px; background: rgba(30, 30, 30, 0.8); border: 2px solid var(--border-color); border-radius: var(--border-radius); color: var(--text-light); font-size: 13px; font-family: 'IBM Plex Mono', monospace; min-width: 0; }
.url-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(8,145,178,0.15); }
.generate-button, .copy-button { padding: 8px 12px; border: none; border-radius: var(--border-radius); font-weight: 600; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.generate-button { background: linear-gradient(90deg, var(--primary-color), var(--bright-color)); color: #04121a; box-shadow: 0 4px 15px var(--glow); }
.generate-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--glow); }
.copy-button { background: linear-gradient(90deg, var(--accent-color), #d86fdc); color: #2a0f33; box-shadow: 0 4px 15px rgba(240,171,252,0.3); }
.copy-button:hover:not(:disabled) { transform: translateY(-2px); }
.copy-button:disabled { background: rgba(100,110,130,0.5); color: rgba(255,255,255,0.5); cursor: not-allowed; box-shadow: none; }
.copy-button.copied { animation: pulse 0.3s ease; }
@keyframes pulse { 0%{transform:scale(1);} 50%{transform:scale(1.05);} 100%{transform:scale(1);} }
.url-buttons { display: flex; gap: 8px; flex-shrink: 0; }

/* Range slider */
input[type="range"].range-input { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 5px; background: linear-gradient(90deg, var(--primary-color), var(--bright-color)); outline: none; opacity: 0.8; }
input[type="range"].range-input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--text-light); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
input[type="range"].range-input::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--text-light); cursor: pointer; border: none; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.range-value { font-weight: 500; color: var(--text-light); }

/* Footer */
.site-footer {
  position: relative; flex-shrink: 0; padding: 4px 14px;
  background: var(--bg-panel); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  backdrop-filter: blur(10px); border: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; z-index: 100;
}
.footer-privacy { position: relative; }
.footer-privacy-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(148,163,184,0.15); background: rgba(30, 30, 45, 0.8); color: #94a3b8; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; font-family: inherit; }
.footer-privacy-toggle:hover, .footer-privacy.is-open .footer-privacy-toggle { color: #e2e8f0; border-color: rgba(34,211,238,0.45); background: rgba(34,211,238,0.12); }
.footer-privacy-panel { position: absolute; bottom: calc(100% + 10px); left: 50%; width: min(440px, calc(100vw - 40px)); padding: 12px 14px; background: rgba(18, 22, 32, 0.97); border: 1px solid rgba(34,211,238,0.28); border-left: 3px solid var(--bright-color); border-radius: 10px; box-shadow: 0 14px 36px rgba(0,0,0,0.45); opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(-50%) translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease; z-index: 200; }
.footer-privacy.is-open .footer-privacy-panel { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.footer-privacy-panel p { margin: 0; font-size: 12px; line-height: 1.55; color: #aab8cf; }
.footer-privacy-panel strong { color: var(--bright-color); }

.fa-ko-fi::before { content: "\f0f4"; display: inline-block; font-size: 1.1em; line-height: 0.45em; margin: -0.45em 0 0 -0.2em; overflow-y: hidden; padding-top: 0.45em; }
.fa-ko-fi::after { color: #000; content: "\f004"; font-size: 50%; font-weight: 900; margin: 0.5em 0 0 -2em; position: absolute; }

.footer-branding { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; font-family: 'Inter', sans-serif; }
.footer-branding a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
.footer-branding a:hover { color: var(--accent-color); }
.footer-divider { width: 1px; height: 16px; background: linear-gradient(to bottom, transparent, rgba(148,163,184,0.4), transparent); }
.footer-socials { display: flex; align-items: center; gap: 8px; }
.footer-socials a { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; background: rgba(30, 30, 45, 0.8); color: #94a3b8; font-size: 13px; transition: all 0.25s ease; border: 1px solid rgba(148,163,184,0.15); }
.footer-socials a img { width: 14px; height: 14px; object-fit: contain; filter: brightness(0) saturate(100%) invert(70%) sepia(10%) saturate(400%) hue-rotate(180deg) brightness(0.95); transition: filter 0.25s ease; }
.footer-socials a:hover img { filter: brightness(0) saturate(100%) invert(100%); }
.footer-socials a:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.footer-socials a.twitch:hover { background: #9146ff; color: #fff; border-color: #9146ff; }
.footer-socials a.youtube:hover { background: #ff0000; color: #fff; border-color: #ff0000; }
.footer-socials a.tiktok:hover { background: linear-gradient(135deg,#25f4ee,#fe2c55); color: #fff; border-color: #fe2c55; }
.footer-socials a.kick:hover { background: #53fc18; color: #020617; border-color: #53fc18; }
.footer-socials a.twitter:hover { background: #1da1f2; color: #fff; border-color: #1da1f2; }
.footer-socials a.coffee:hover { background: #ff5e5b; color: #fff; border-color: #ff5e5b; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(11,17,32,0.5); border-radius: var(--border-radius); }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: var(--border-radius); }
* { scrollbar-width: thin; scrollbar-color: var(--primary-color) rgba(11,17,32,0.5); }

/* Responsive */
@media (max-width: 1200px) {
  body { height: auto; max-height: none; overflow: auto; }
  .container { flex-direction: column; overflow: visible; flex: none; }
  .settings-panel, .preview-panel { width: 100%; max-width: 100%; height: auto; max-height: none; }
  .preview-panel { min-height: 60vh; }
  .preview-container { min-height: 420px; }
}
@media (max-width: 768px) {
  body { padding: 10px; overflow: auto; height: auto; max-height: none; }
  .header { flex-direction: column; align-items: stretch; }
  .header h1 { font-size: 2rem; }
  .alert-buttons { flex-direction: column; }
  .alert-button { width: 100%; }
  .url-container { flex-direction: column; align-items: stretch; }
  .url-buttons { flex-direction: column; align-items: stretch; }
  .generate-button, .copy-button { justify-content: center; }
}

.footer-changelog { position: relative; }
