:root {
  --accent: #f2c072;
  --accent-soft: rgba(242, 192, 114, 0.25);
  --panel-bg: rgba(15, 10, 30, 0.62);
  --panel-border: rgba(255, 200, 120, 0.28);
  --text: #f5e9d0;
  --muted: #b8ac94;
  --danger: #e07b7b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: #0a0612;
}

body {
  background-image: url('https://raw.githubusercontent.com/veyra-empire/assets/master/bg-install.png');
  background-image: image-set(
    url('https://raw.githubusercontent.com/veyra-empire/assets/master/bg-install.png') 1x,
    url('https://raw.githubusercontent.com/veyra-empire/assets/master/bg-install-2x.png') 2x
  );
  background-image: -webkit-image-set(
    url('https://raw.githubusercontent.com/veyra-empire/assets/master/bg-install.png') 1x,
    url('https://raw.githubusercontent.com/veyra-empire/assets/master/bg-install-2x.png') 2x
  );
  background-size: cover;
  background-position: center bottom;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

@media (max-width: 768px) and (orientation: portrait) {
  body {
    background-image: url('https://raw.githubusercontent.com/veyra-empire/assets/master/bg-install-m.png');
  }
}

.overlay {
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(10, 6, 18, 0.35) 0%, rgba(10, 6, 18, 0.1) 30%, rgba(10, 6, 18, 0.6) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8vh 20px 40px;
}

.panel {
  width: 100%;
  max-width: 720px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  padding: 36px 36px 28px;
}

h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: 0.18em;
  margin: 0 0 6px;
  text-align: center;
  color: var(--accent);
  text-shadow: 0 2px 20px rgba(242, 192, 114, 0.3);
}

.subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 28px;
  color: var(--muted);
}

form.email-form {
  display: flex;
  gap: 10px;
  margin: 20px 0 14px;
}

input[type="email"] {
  flex: 1;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

button, .install-btn {
  padding: 12px 22px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #1a0d05;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
button:hover, .install-btn:hover {
  background: #ffd18a;
  box-shadow: 0 4px 16px rgba(242, 192, 114, 0.35);
  transform: translateY(-1px);
}

.footer-note {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.greeting h2 {
  font-family: 'Cinzel', serif;
  font-weight: 400;
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: 0.05em;
}
.greeting .email-line {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.tier-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.tier-probationary { color: #9aa4af; }
.tier-member       { color: #d7dbe0; }
.tier-tester       { color: #f2c072; }
.tier-owner        { color: #e87070; }

.scripts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 600px) {
  .scripts-grid { grid-template-columns: 1fr; }
  .panel { padding: 24px 20px; }
  h1 { font-size: 1.8rem; }
}

.script-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.script-card:hover {
  border-color: var(--panel-border);
  background: rgba(0, 0, 0, 0.38);
}
.script-card h3 {
  font-family: 'Cinzel', serif;
  font-weight: 400;
  font-size: 1.05rem;
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.script-meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.script-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  flex: 1;
}

.script-thumb {
  align-self: flex-start;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  cursor: zoom-in;
  overflow: hidden;
  line-height: 0;
  transition: border-color 0.12s, transform 0.12s;
}
.script-thumb:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.script-thumb img {
  display: block;
  max-width: 200px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: cover;
}
.install-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 8px 18px;
  font-size: 0.88rem;
}

.tier-pill {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  vertical-align: middle;
  margin-left: 6px;
}

.script-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.thread-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
  padding-bottom: 1px;
  transition: color 0.12s, border-color 0.12s;
}
.thread-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}
.sort-bar .label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-right: 4px;
}
.sort-btn {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.sort-btn:hover { border-color: var(--accent-soft); color: var(--accent); }
.sort-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(242, 192, 114, 0.08);
}
.sort-dir {
  margin-left: auto;
  min-width: 42px;
  text-align: center;
  font-weight: 600;
}

.denied-icon {
  font-size: 3rem;
  text-align: center;
  color: var(--danger);
  margin-bottom: 12px;
}
.denied-msg {
  text-align: center;
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 22px;
}

.empty-state {
  text-align: center;
  padding: 20px 0 10px;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-top: 22px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 1px dotted var(--muted);
}
.back-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.tampermonkey-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
.tampermonkey-hint a,
.footer-note a { color: var(--accent); }

.trust-notice {
  margin: 0 0 18px;
  padding: 10px 0;
  border-top: 1px dotted var(--panel-border);
  border-bottom: 1px dotted var(--panel-border);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}
.trust-notice strong {
  color: var(--text);
  letter-spacing: 0.04em;
}

.tm-banner {
  margin: 0 0 18px;
  padding: 10px 14px;
  background: rgba(242, 192, 114, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  text-align: center;
}
.tm-banner a { color: var(--accent); }

/* Submission form (submit.html) */
.panel-wide { max-width: 820px; }

.form-row {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-optional {
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(184, 172, 148, 0.6);
  margin-left: 6px;
}
.form-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.form-warning {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(242, 192, 114, 0.1);
  border: 1px solid rgba(242, 192, 114, 0.35);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #f2c072;
}
.form-warning strong { color: #f5e9d0; font-weight: 600; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.form-source {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
  min-height: 180px;
}
.form-source.drag-over {
  border-color: var(--accent);
  background: rgba(242, 192, 114, 0.06);
}

.source-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.source-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.source-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(242, 192, 114, 0.14);
  border: 1px solid rgba(242, 192, 114, 0.5);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease;
}
.source-upload-btn:hover  { background: rgba(242, 192, 114, 0.22); }
.source-upload-btn:active { background: rgba(242, 192, 114, 0.3); }
.source-upload-input:focus + .source-upload-hint,
.source-upload-btn:focus-within {
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.source-upload-hint {
  font-size: 0.78rem;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 0;
}

.mode-row { display: flex; flex-direction: column; }
.mode-options { display: flex; gap: 14px; flex-wrap: wrap; }
.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.mode-option input { margin: 0; }
.mode-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.attest {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}
.attest input { margin: 3px 0 0; flex-shrink: 0; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}
.form-actions .install-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.form-actions .install-btn:disabled:hover {
  background: var(--accent);
}

.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(224, 123, 123, 0.08);
  border: 1px solid rgba(224, 123, 123, 0.4);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.88rem;
  line-height: 1.5;
}

.version-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.version-row .form-input {
  flex: 1;
}
.version-row input[readonly] {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.45);
  cursor: not-allowed;
}
.version-btn {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.version-btn:hover { color: var(--accent); border-color: var(--accent); }
.version-btn-confirm {
  background: var(--accent);
  color: #1a0d05;
  border-color: var(--accent);
}
.version-btn-confirm:hover { background: #ffd18a; color: #1a0d05; }

.form-file {
  padding: 8px 10px;
  font-size: 0.88rem;
  cursor: pointer;
}
.form-file::file-selector-button {
  padding: 6px 12px;
  margin-right: 10px;
  font-family: inherit;
  font-size: 0.82rem;
  background: rgba(242, 192, 114, 0.12);
  color: var(--accent);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
}
.form-file::file-selector-button:hover {
  background: rgba(242, 192, 114, 0.22);
}

.screenshot-preview {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}
.screenshot-preview img {
  max-width: 220px;
  max-height: 140px;
  border-radius: 4px;
  display: block;
}
.screenshot-clear {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: inherit;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
}
.screenshot-clear:hover {
  color: var(--danger);
  border-color: rgba(224, 123, 123, 0.4);
}

.open-submissions {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: rgba(224, 123, 123, 0.08);
  border: 1px solid rgba(224, 123, 123, 0.4);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}
.open-submissions-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.open-submissions-header strong { color: var(--danger); }
.open-submissions-count { color: var(--muted); font-size: 0.82rem; }

.open-submissions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.open-submissions-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  flex-wrap: wrap;
}
.open-submissions-label { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.open-submissions-label strong { color: var(--accent); font-weight: 600; }

.cancel-banner-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--danger);
  color: #1a0d05;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, transform 0.1s;
}
.cancel-banner-btn:hover { background: #f09999; transform: translateY(-1px); }
.cancel-banner-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Floating toasts (fixed top-right). Click to dismiss; auto-dismiss after 6s. */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 40px);
  width: 380px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  cursor: pointer;
  background: rgba(15, 10, 30, 0.92);
  color: var(--text);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-color: rgba(130, 200, 130, 0.45); }
.toast-error   { border-color: rgba(224, 123, 123, 0.55); }
.toast-info    { border-color: var(--panel-border); }

@media (max-width: 600px) {
  .toast-container { top: 10px; right: 10px; width: calc(100vw - 20px); }
}

/* Lightbox for screenshot thumbnails. Backdrop click or ESC closes. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: rgba(10, 6, 18, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.lightbox-img {
  max-width: min(95vw, 1400px);
  max-height: calc(95vh - 60px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: default;
}
.lightbox-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 90vw;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  font-size: 1.8rem;
  line-height: 1;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lightbox-close:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(242, 192, 114, 0.08);
}

.loading-msg {
  text-align: center;
  color: var(--muted);
  padding: 30px 0;
  font-size: 0.95rem;
}

[hidden] { display: none !important; }
