:root {
  --bg-main: #02030a;
  --bg-elevated: #070817;
  --bg-soft: #0c0e22;
  --accent: #ffffff;
  --accent-soft: rgba(79, 124, 255, 0.12);
  --accent-strong: rgba(0, 0, 0, 0.7);
  --text-main: #ffffff;
  --text-muted: #ffffff;
  --border-subtle: #000000;
  --danger: #ff7675;
  --success: #2ecc71;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #000000 0, #000000 50%);
  color: var(--text-main);
  display: flex;
  justify-content: center;
}

.page {
  width: 100%;
  max-width: 1100px;
  padding: 24px 16px 32px;
}

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

.top-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-nav-toggle {
  display: none;
  width: 34px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.top-nav-toggle-bar {
  position: relative;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.top-nav-toggle-bar::before,
.top-nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
  transition: transform 0.12s ease-out, opacity 0.12s ease-out, top 0.12s ease-out, bottom 0.12s ease-out;
}

.top-nav-toggle-bar::before {
  top: -5px;
}

.top-nav-toggle-bar::after {
  bottom: -5px;
}

.top-nav.open .top-nav-toggle-bar {
  background: transparent;
}

.top-nav.open .top-nav-toggle-bar::before {
  top: 0;
  transform: rotate(45deg);
}

.top-nav.open .top-nav-toggle-bar::after {
  bottom: 0;
  transform: rotate(-45deg);
}

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

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-strong);
}

.logo-text-main {
  font-size: 18px;
  font-weight: 600;
}

.logo-text-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-label {
  font-size: 11px;
  color: var(--text-muted);
}

.card {
  background: linear-gradient(135deg, #000000, #000000);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
  padding: 16px 16px 14px;
}

.card-full {
  margin-top: 4px;
}

.slide-card {
  margin-bottom: 10px;
}

.slide-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 320px;
  border-radius: 10px;
  overflow: hidden;
  background: #02030a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.slide-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

.slide-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.slide-image.active {
  opacity: 1;
}

.slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 2;
}

.slide-nav-prev {
  left: 8px;
}

.slide-nav-next {
  right: 8px;
}

.card-narrow {
  max-width: 420px;
  margin: 0 auto;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-field {
  flex: 1;
  min-width: 150px;
}

.ad-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.ad-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ad-link-input {
  flex: 1;
}

.ad-link-remove {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.4);
  color: #e0e3ff;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.ad-link-remove:hover {
  border-color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.08);
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #000000;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  background: #05081b;
}

/* Select polish (dropdown) */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 34px; /* space for arrow */
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.75) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.75) 50%, transparent 50%),
    linear-gradient(to right, rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.08));
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%,
    calc(100% - 34px) 50%;
  background-size: 6px 6px, 6px 6px, 1px 18px;
  background-repeat: no-repeat;
}

select:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

select:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Make options readable on dark theme (best-effort across browsers) */
select option {
  background: #000000;
  color: var(--text-main);
}

textarea {
  width: 100%;
  min-height: 220px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #000000;
  color: var(--text-main);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  background: #05081b;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.btn-primary {
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #000000;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, filter 0.12s ease-out;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.75);
}

.btn-primary-red {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(255, 71, 87, 0.55);
}

.btn-primary-red:hover {
  filter: brightness(1.08);
}

.btn-primary-red:active {
  box-shadow: 0 8px 18px rgba(255, 71, 87, 0.7);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.8);
}

.btn-ghost {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  color: #e0e3ff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease-out;
}

.btn-ghost:hover {
  background: rgba(79, 124, 255, 0.22);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}

.btn-ghost:active {
  transform: translateY(1px);
}

.btn-danger {
  border-color: rgba(255, 118, 117, 0.5);
  color: #ff7675;
}

.btn-danger:hover {
  background: rgba(255, 118, 117, 0.18);
  border-color: rgba(255, 118, 117, 0.9);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 11px;
}

.status {
  font-size: 12px;
  margin-bottom: 6px;
}

.status-success {
  color: var(--success);
}

.status-error {
  color: var(--danger);
}

.list {
  margin-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 6px;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.list-full {
  max-height: none;
}

.list-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-y: visible;
}

.list::-webkit-scrollbar {
  width: 6px;
}

.list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.script-item {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: #000000;
  padding: 8px 9px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.08s ease-out;
}

.list-grid .script-item {
  width: calc(50% - 4px);
}

.script-row {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.script-item:hover {
  border-color: var(--accent-strong);
  background: #000000;
  transform: translateY(-1px);
}

.script-main {
  flex: 1;
  min-width: 0;
}

.script-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.script-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.script-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.script-game {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  color: #cfd5ff;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.script-date {
  opacity: 0.8;
}

.script-preview {
  margin: 6px 0 0;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: #f3f4ff;
  background: #02030b;
  border-radius: 7px;
  padding: 6px 7px;
  max-height: 140px;
  overflow: hidden;
  white-space: pre;
}

.script-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  white-space: nowrap;
}

.pagination {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.page-link,
.page-ellipsis {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  font-size: 11px;
  color: #e0e3ff;
  text-decoration: none;
}

.page-link.current {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #02030a;
  font-weight: 600;
}

/* Mobile/Tablet header: dùng hamburger để tránh wrap xuống dòng */
@media (max-width: 900px) {
  .page-header {
    align-items: flex-start;
  }

  .top-nav {
    position: relative;
  }

  .top-nav-toggle {
    display: inline-flex;
  }

  .top-actions {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.92);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.85);
    padding: 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 210px;
    display: none;
    z-index: 50;
  }

  .top-actions form {
    width: 100%;
  }

  .top-actions .btn-ghost.btn-sm,
  .top-actions button.btn-ghost.btn-sm {
    width: 100%;
    justify-content: flex-start;
  }

  .top-nav.open .top-actions {
    display: flex;
  }
}

@media (max-width: 700px) {

  .script-row {
    flex-direction: column;
    align-items: stretch;
  }

  .list-grid .script-item {
    width: 100%;
  }

  .script-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.copy-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent-strong);
  color: var(--text-main);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.copy-toast.error {
  border-color: var(--danger);
}

.raw-page {
  margin: 0;
  min-height: 100vh;
  background: #02030a;
  color: #f5f7ff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.raw-container {
  max-width: 920px;
  margin: 20px auto 32px;
  padding: 0 18px;
}

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

.raw-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.raw-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.raw-actions {
  display: flex;
  gap: 6px;
}

.raw-code {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #02020a;
  border: 1px solid #181a28;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
  color: #ffffff;
  white-space: pre;
  overflow: auto;
}

.raw-code.raw-locked {
  user-select: none;
  filter: blur(10px);
  opacity: 0.45;
  pointer-events: none;
}

.gate-card {
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  max-width: 420px;
  margin-inline: auto;
}

.gate-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  text-align: center;
}

.gate-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-align: center;
}

.gate-panel {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.35);
}

.gate-panel-title {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 4px;
}

.gate-panel-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.gate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.gate-main-action {
  flex: 1;
  justify-content: center;
}

.gate-video {
  width: 100%;
}

.gate-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #000;
}

.gate-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 11px;
}

.gate-progress-label {
  color: var(--text-muted);
}

.gate-progress-pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 136, 0.4);
  color: #00e676;
  font-weight: 600;
}

.gate-progress-bar {
  margin-top: 6px;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.gate-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e676, #4cd964);
  transition: width 0.2s ease-out;
}

.gate-unlock-btn {
  margin-top: 10px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: not-allowed;
}

.gate-unlock-btn.enabled {
  background: linear-gradient(135deg, #4cd964, #00e676);
  color: #02030a;
  border-color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.gate-unlock-btn .lock-icon {
  font-size: 14px;
}

.raw-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
}

.raw-badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
  z-index: 999;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: 100%;
  max-width: 420px;
  /* Nền khung popup - trước là xanh đậm (#050618) */
  /* Đổi sang đen + hiệu ứng blur cho cảm giác trong suốt */
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.modal-close {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px 0;
}

.modal-tab {
  flex: 1;
  padding: 6px 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #e0e3ff;
  font-size: 12px;
  cursor: pointer;
}

.modal-tab.active {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #02030a;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 6px 10px 10px;
  overflow-y: auto;
}

.auth-form {
  margin-top: 4px;
}

.auth-hidden {
  display: none !important;
}

