* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #00e5ff;
  --accent-hover: #00b8d4;
  --purple: #7c4dff;
  --sidebar-w: 380px;
}

body {
  background: var(--bg-primary);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ===== LAYOUT ===== */

.layout {
  display: flex;
  height: 100vh;
}

/* ===== SIDEBAR ===== */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.1), rgba(0, 229, 255, 0.05));
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ===== TOP CONTROLS ===== */

.top-controls {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-info {
  font-size: 12px;
  color: var(--accent);
  min-height: 16px;
}

/* ===== TABS ===== */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  padding: 0 4px;
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 10px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== TAB PANELS ===== */

.tab-panels {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.tab-panel {
  display: none;
  padding: 16px 20px;
}

.tab-panel.active {
  display: block;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
}

.section-title:first-child {
  margin-top: 0;
}

/* ===== CONTROL ROWS ===== */

.control-row,
.color-row,
.slider-row,
.check-row {
  margin-bottom: 10px;
}

.control-row label,
.color-row label,
.slider-row label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.control-row input[type="text"],
.control-row input[type="number"],
.control-row input[type="password"],
.control-row input[type="date"],
.control-row textarea,
.control-row select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.control-row input:focus,
.control-row textarea:focus,
.control-row select:focus {
  border-color: var(--accent);
}

.control-row textarea {
  min-height: 120px;
  resize: vertical;
}

.control-row select {
  cursor: pointer;
}

/* COLOR PICKER ROW */

.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.color-row label {
  flex: 1;
  margin-bottom: 0;
}

.color-row input[type="color"] {
  width: 36px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  cursor: pointer;
  padding: 2px;
}

/* SLIDER ROW */

.slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-row .val {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.slider-row input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}

/* CHECKBOX */

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
}

.check-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* PAGE NAV */

.page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-nav span {
  font-size: 13px;
  color: var(--text);
  min-width: 40px;
  text-align: center;
}

.btn-sm {
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: var(--border);
}

/* ===== SIDEBAR ACTIONS ===== */

.sidebar-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.35);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ===== MAIN CONTENT ===== */

.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080b12;
  position: relative;
  overflow: hidden;
}

.main-content::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(124, 77, 255, 0.04), transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(0, 229, 255, 0.03), transparent 50%);
}

.preview-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 95%;
  max-height: 95%;
}

.preview-container img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s;
}

.preview-loading {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  z-index: 2;
}

.preview-loading.hidden {
  display: none;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== MODAL ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 40px;
  min-width: 400px;
  text-align: center;
}

.modal h2 {
  font-size: 22px;
  margin-bottom: 20px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s;
}

.modal p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

#modalResults {
  text-align: left;
  font-size: 13px;
  margin-bottom: 16px;
}

#modalResults .result-item {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-bottom: 6px;
  color: var(--accent);
}

/* ===== SCROLLBAR ===== */

.tab-panels::-webkit-scrollbar {
  width: 6px;
}

.tab-panels::-webkit-scrollbar-track {
  background: transparent;
}

.tab-panels::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===== MANUAL LIST ===== */
.manual-list {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 5px;
}

.manual-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  margin-bottom: 5px;
  border-radius: 4px;
}

.manual-info {
  display: flex;
  flex-direction: column;
}

.manual-info strong {
  font-size: 13px;
  color: #fff;
}

.manual-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-del {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.7;
  color: #ff5252;
  padding: 0 4px;
  width: auto;
  height: auto;
}

.btn-del:hover {
  opacity: 1;
  transform: scale(1.1);
}

#manualGameForm .control-row {
  margin-bottom: 8px;
}
