/* =========================================================
 * TOKENS
 * ========================================================= */
:root {
  --bg0: #080a0f;
  --bg1: #0c0f1a;
  --bg2: #101420;
  --surface: rgba(255,255,255,0.055);
  --surface2: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.09);
  --border2: rgba(255,255,255,0.14);
  --text: rgba(255,255,255,0.93);
  --muted: rgba(255,255,255,0.52);
  --accent: #7ab4ff;
  --accent-glow: rgba(122,180,255,0.18);
  --danger: #ff6b6b;
  --ok: #7affca;
  --warn: #ffe07a;
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 8px 32px rgba(0,0,0,0.55);
  --font: 'Syne', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* =========================================================
 * RESET + BASE
 * ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg0);
  overflow-x: hidden;
  line-height: 1.55;
}

/* =========================================================
 * BACKGROUNDS
 * ========================================================= */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(122,180,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122,180,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* =========================================================
 * LAYOUT
 * ========================================================= */
.shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 56px;
  position: relative;
  z-index: 1;
}
.effect-card--ghost {
  opacity: 0.4;
  border-color: rgba(122,180,255,0.5);
}

.brand__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
}
/* =========================================================
 * TOPBAR
 * ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  backdrop-filter: blur(16px);
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(122,180,255,0.25), rgba(122,255,202,0.15));
  border: 1px solid rgba(122,180,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.brand__title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.brand__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  font-family: var(--mono);
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================================================
 * CARDS
 * ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px 22px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: cardIn 0.3s ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.card__label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 6px;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

p { margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 13px; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--warn);
}

/* =========================================================
 * GRID
 * ========================================================= */
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* =========================================================
 * INPUTS
 * ========================================================= */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.hint {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--mono);
}

.inp {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inp:focus {
  border-color: rgba(122,180,255,0.5);
  box-shadow: 0 0 0 3px rgba(122,180,255,0.12);
}
.inp::placeholder { color: rgba(255,255,255,0.22); }
.inp-sm {
  padding: 8px 10px;
  font-size: 13px;
}
select.inp {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

input[type="file"].inp {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  padding: 7px 10px;
}
input[type="file"].inp::file-selector-button {
  background: rgba(122,180,255,0.14);
  border: 1px solid rgba(122,180,255,0.3);
  border-radius: 6px;
  color: var(--accent);
  padding: 4px 10px;
  margin-right: 10px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
}

/* =========================================================
 * BUTTONS
 * ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: rgba(255,255,255,0.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.07); }
.btn-accent {
  background: rgba(122,180,255,0.18);
  border-color: rgba(122,180,255,0.4);
  color: #a8ccff;
}
.btn-accent:hover { background: rgba(122,180,255,0.26); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-danger {
  background: rgba(255,107,107,0.12);
  border-color: rgba(255,107,107,0.3);
  color: #ff9a9a;
  padding: 5px 9px;
  font-size: 12px;
}
.btn-danger:hover { background: rgba(255,107,107,0.2); }

/* =========================================================
 * AUTH PANEL
 * ========================================================= */
.auth-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
@media (max-width: 500px) {
  .auth-row { flex-direction: column; }
}

/* =========================================================
 * STATUS MESSAGES
 * ========================================================= */
.status-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid transparent;
  animation: fadeIn 0.2s ease;
}
.status-info  { background: rgba(122,180,255,0.1); border-color: rgba(122,180,255,0.25); color: var(--accent); }
.status-ok    { background: rgba(122,255,202,0.1); border-color: rgba(122,255,202,0.25); color: var(--ok); }
.status-error { background: rgba(255,107,107,0.1); border-color: rgba(255,107,107,0.25); color: var(--danger); }

/* =========================================================
 * PILL / STATUS INDICATOR
 * ========================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(0,0,0,0.2);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--mono);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #888;
  box-shadow: 0 0 6px currentColor;
  transition: background 0.3s;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(122,180,255,0.15);
  border: 1px solid rgba(122,180,255,0.25);
  font-size: 12px;
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 500;
  vertical-align: middle;
  margin-left: 8px;
}

/* =========================================================
 * SECTION DIVIDER
 * ========================================================= */
.section-divider {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* =========================================================
 * EFFECTS LIST
 * ========================================================= */
.effects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.effects-header h2 { margin: 0; }
.effects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 16px;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.empty-state__icon { font-size: 28px; opacity: 0.5; }

/* =========================================================
 * EFFECT CARDS
 * ========================================================= */
.effect-card {
  --card-accent: #7ab4ff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-accent);
  border-radius: var(--r);
  background: rgba(0,0,0,0.22);
  overflow: hidden;
  animation: cardIn 0.2s ease both;
  transition: border-color 0.2s;
}

.effect-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.effect-card__drag {
  color: var(--muted);
  font-size: 16px;
  cursor: grab;
  flex-shrink: 0;
  opacity: 0.5;
}
.effect-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.effect-card__fields {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.field-inline label {
  min-width: 120px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.field-inline .inp {
  flex: 1;
}
@media (max-width: 560px) {
  .field-inline { flex-direction: column; align-items: stretch; }
  .field-inline label { min-width: 0; }
}

/* =========================================================
 * VEC3 INPUT
 * ========================================================= */
.vec3-row {
  display: flex;
  gap: 8px;
}
.vec3-sub {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.vec3-label {
  font-size: 10px;
  font-family: var(--mono);
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-left: 2px;
}

/* =========================================================
 * FILE INPUT WRAPPER
 * ========================================================= */
.file-input-wrap { width: 100%; }

/* =========================================================
 * EFFECT TIP
 * ========================================================= */
.effect-tip {
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-style: italic;
}

/* =========================================================
 * UPLOAD CARD
 * ========================================================= */
.upload-card { }

.upload-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
@media (max-width: 500px) {
  .upload-actions { flex-direction: column; align-items: stretch; }
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 999px;
  transition: width 0.25s ease;
  width: 0%;
}

.mod-link {
  display: inline-block;
  padding: 10px 16px;
  background: rgba(122,255,202,0.12);
  border: 1px solid rgba(122,255,202,0.3);
  border-radius: var(--r-sm);
  color: var(--ok);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s;
}
.mod-link:hover { background: rgba(122,255,202,0.2); }

.mod-id {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* =========================================================
 * ANIM
 * ========================================================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* =========================================================
 * SCROLLBAR
 * ========================================================= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* =========================================================
 * TABS
 * ========================================================= */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 5px;
}
.tab {
  flex: 1;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.tab:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.tab-active {
  background: rgba(122,180,255,0.15);
  border-color: rgba(122,180,255,0.35);
  color: var(--accent);
  box-shadow: 0 2px 12px rgba(122,180,255,0.1);
}

/* =========================================================
 * EVENT GRID (edit tab)
 * ========================================================= */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.event-card {
  border: 1px solid var(--border2);
  border-radius: var(--r);
  background: rgba(0,0,0,0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
  animation: cardIn 0.2s ease both;
}
.event-card:hover { border-color: rgba(122,180,255,0.4); transform: translateY(-2px); }
.event-card__logo {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: rgba(0,0,0,0.3);
}
.event-card__logo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: rgba(122,180,255,0.08);
}
.event-card__body {
  padding: 10px 12px 4px;
  flex: 1;
}
.event-card__name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.event-card__id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.event-card .btn {
  margin: 0 12px 12px;
  width: calc(100% - 24px);
}

/* =========================================================
 * EDITING HEADER
 * ========================================================= */
.editing-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
/* =========================================================
 * SCREEN PREVIEW
 * ========================================================= */
.sp-wrap {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.sp-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.sp-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.sp-note {
  font-size: 10px;
  color: rgba(255,255,255,0.28);
  font-family: var(--mono);
}
.sp-tag-display {
  color: rgba(122,180,255,0.7);
}
.sp-screen {
  position: relative;
  width: 288px;
  background: #05060d;
  border: 1px solid rgba(122,180,255,0.2);
  border-radius: 5px;
  overflow: hidden;
}
.sp-grid-h {
  position: absolute;
  top: 50%; left: 0; right: 0;
  border-top: 1px dashed rgba(255,255,255,0.06);
  pointer-events: none;
}
.sp-grid-v {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  border-left: 1px dashed rgba(255,255,255,0.06);
  pointer-events: none;
}
.sp-el {
  position: absolute;
  display: none;
  border-radius: 2px;
  pointer-events: none;
  min-width: 2px;
  min-height: 2px;
  box-sizing: border-box;
}
.sp-el-before {
  border: 2px dashed rgba(122,180,255,0.9);
  background: rgba(122,180,255,0.07);
}
.sp-el-after {
  border: 1.5px solid rgba(122,255,202,0.85);
  background: rgba(122,255,202,0.12);
}
.sp-legend {
  position: absolute;
  top: 4px;
  left: 6px;
  display: none;
  gap: 8px;
  pointer-events: none;
}
.sp-legend-before {
  font-size: 9px;
  font-family: var(--mono);
  color: rgba(122,180,255,0.6);
}
.sp-legend-after {
  font-size: 9px;
  font-family: var(--mono);
  color: rgba(122,255,202,0.8);
}
.sp-readout {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 9px;
  font-family: var(--mono);
  color: rgba(255,255,255,0.3);
  pointer-events: none;
  max-width: 280px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-empty {
  display: none;
  padding: 10px 12px;
  font-size: 11px;
  font-family: var(--mono);
  color: rgba(255,255,255,0.2);
  font-style: italic;
}
.sp-ppu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.sp-ppu-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sp-ppu-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.22);
  font-family: var(--mono);
}
