:root {
  --bg-0: #12131a;
  --bg-1: #171821;
  --bg-2: #1e1f2b;
  --surface: #20222f;
  --surface-soft: #262938;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f3f5;
  --text-soft: #b5bac1;
  --accent: #5865f2;
  --accent-strong: #4752c4;
  --ok: #3ba55d;
  --warn: #faa81a;
  --danger: #ed4245;
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.35);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(88, 101, 242, 0.22), transparent 60%),
    radial-gradient(1000px 520px at 90% 0%, rgba(88, 101, 242, 0.16), transparent 58%),
    linear-gradient(180deg, #10121a 0%, #0e1017 100%);
}

body.page {
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(17, 19, 27, 0.82);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.header-actions form {
  margin: 0;
}

.title {
  margin: 0;
  font-size: clamp(1.22rem, 2.5vw, 1.75rem);
  letter-spacing: 0.01em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.title-medium {
  font-size: 1.1rem;
}

.subtitle {
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  line-height: 1.45;
  font-size: 0.94rem;
}

.accent {
  color: #91a0ff;
}

.page-waiting main,
.page-gallery main {
  flex: 1;
}

.page-waiting main {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(160deg, rgba(88, 101, 242, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.015)),
    var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem;
}

.waiting-card {
  max-width: 920px;
  margin-inline: auto;
  padding: 1.8rem;
}

.auth-container {
  max-width: 700px;
}

.auth-card {
  max-width: 700px;
  position: relative;
  padding-top: 3rem;
}

.auth-back-corner {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  margin-bottom: 0.6rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-ready {
  background: rgba(59, 165, 93, 0.2);
  color: #91e0aa;
}

.badge-waiting {
  background: rgba(250, 168, 26, 0.18);
  color: #ffd592;
}

.badge-locked {
  background: rgba(88, 101, 242, 0.2);
  color: #bfc7ff;
}

.form {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.waiting-form {
  margin-top: 1.25rem;
  gap: 1.2rem;
}

.waiting-submit {
  width: 100%;
}

.auth-form {
  margin-top: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field > span {
  color: #d2d6dc;
  font-size: 0.84rem;
}

.input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-1);
  color: var(--text);
  padding: 0.76rem 0.85rem;
  font-size: 0.93rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: rgba(88, 101, 242, 0.85);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.turnstile-wrapper {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  margin-top: 0.3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 0.72rem 1.12rem;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background-color 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #6a76ff, #5865f2);
  box-shadow: 0 10px 24px rgba(88, 101, 242, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #7480ff, #5e69f3);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #ef5356, #db3e41);
  box-shadow: 0 10px 24px rgba(219, 62, 65, 0.32);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: #d9dde3;
  padding: 0.32rem 0.82rem;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.chip:hover {
  border-color: rgba(88, 101, 242, 0.55);
  background: #2a2d3f;
}

.chip-active {
  background: rgba(88, 101, 242, 0.24);
  border-color: rgba(88, 101, 242, 0.7);
  color: #dfe3ff;
}

.auth-back-link {
  color: #d7dcff;
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.55);
}

.auth-submit {
  width: 100%;
}

.auth-footnote {
  margin-top: 1rem;
}

.text-link {
  color: #aab4ff;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.flash-stack {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.flash {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 0.66rem 0.8rem;
  font-size: 0.9rem;
}

.flash-success {
  background: rgba(59, 165, 93, 0.14);
  color: #9ae2b0;
  border-color: rgba(59, 165, 93, 0.35);
}

.flash-warning {
  background: rgba(250, 168, 26, 0.14);
  color: #ffd592;
  border-color: rgba(250, 168, 26, 0.35);
}

.flash-error {
  background: rgba(237, 66, 69, 0.14);
  color: #ffc4c4;
  border-color: rgba(237, 66, 69, 0.36);
}

.gallery-search-wrap {
  margin-bottom: 1rem;
}

.gallery-search-form {
  display: flex;
  gap: 0.62rem;
  align-items: center;
  flex-wrap: wrap;
}

.gallery-search-input {
  width: min(460px, 100%);
}

.gallery-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.gallery-list-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.gallery-link-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background:
    linear-gradient(150deg, rgba(88, 101, 242, 0.14), transparent 42%),
    var(--surface-soft);
  box-shadow: var(--shadow-md);
  display: grid;
  align-content: start;
  gap: 0.72rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}

.gallery-item {
  background: transparent;
  border: none;
  box-shadow: none;
}

.image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #161824;
  box-shadow: var(--shadow-md);
  cursor: zoom-in;
  padding: 0;
  outline: none;
}

.image-wrapper img,
.image-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-wrapper-video {
  background:
    linear-gradient(150deg, rgba(88, 101, 242, 0.2), transparent 55%),
    #161824;
}

.image-wrapper-video::after {
  content: "▶";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  z-index: 2;
}

.media-badge {
  position: absolute;
  left: 0.55rem;
  top: 0.55rem;
  z-index: 3;
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-badge-image {
  background: rgba(59, 165, 93, 0.95);
  color: #08210f;
}

.media-badge-video {
  background: rgba(88, 101, 242, 0.95);
  color: #f2f3ff;
}

.empty-state {
  margin-top: 0.5rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.015);
}

.empty-state h2 {
  margin: 0;
}

.empty-state p {
  margin: 0.55rem 0 0;
  color: var(--text-soft);
}

.pagination {
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pagination-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pagination-ellipsis {
  color: #8d94a3;
  user-select: none;
}

.pagination-link {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: #ebedf0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
}

.pagination-link:hover {
  border-color: rgba(88, 101, 242, 0.65);
}

.pagination-link-current {
  background: rgba(88, 101, 242, 0.26);
  border-color: rgba(88, 101, 242, 0.72);
}

.pagination-link-disabled {
  opacity: 0.46;
  pointer-events: none;
}

.account-layout {
  display: grid;
  gap: 1rem;
}

.admin-generate-form {
  grid-template-columns: minmax(180px, 280px) auto;
  align-items: end;
}

.code-list {
  display: grid;
  gap: 0.62rem;
}

.code-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.018);
  padding: 0.7rem 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #c6cdff;
  font-size: 0.92rem;
}

.code-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.code-meta form {
  margin: 0;
}

.code-revoke-btn {
  padding: 0.22rem 0.7rem;
  font-size: 0.75rem;
}

.lightbox-open,
.adblock-locked {
  overflow: hidden;
}

.adblock-checking {
  overflow: hidden;
}

.adblock-checking .header,
.adblock-checking main {
  pointer-events: none;
  user-select: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 10, 0.86);
  backdrop-filter: blur(6px);
}

.lightbox-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(980px, 100vw - 2.5rem);
  max-height: min(84vh, 100vh - 3rem);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  background: #0f1119;
}

.lightbox-image-wrapper {
  position: relative;
  padding-bottom: 66%;
  background: #0a0c13;
}

.lightbox-image-wrapper img,
.lightbox-image-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--line-strong);
  background: rgba(21, 24, 34, 0.9);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  top: 0.7rem;
  right: 0.75rem;
  width: 2.15rem;
  height: 2.15rem;
  font-size: 1.24rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  font-size: 1.7rem;
}

.lightbox-prev {
  left: 0.8rem;
}

.lightbox-next {
  right: 0.8rem;
}

.adblock-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(7, 8, 12, 0.92);
  backdrop-filter: blur(8px);
}

.adblock-gate[hidden] {
  display: none !important;
}

.adblock-gate-card {
  width: min(560px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(155deg, rgba(88, 101, 242, 0.2), transparent 48%),
    var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 1.2rem;
}

.adblock-gate-actions {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .container {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .waiting-card {
    padding: 1.15rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .gallery-search-input {
    width: 100%;
  }

  .admin-generate-form {
    grid-template-columns: 1fr;
  }

  .pagination {
    justify-content: center;
  }

  .lightbox-content {
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .lightbox-image-wrapper {
    padding-bottom: 0;
    height: 100dvh;
  }
}
