:root {
  --bg: #05070d;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef2fb;
  --muted: #8f9cb5;
  --accent-1: #7c5cff;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --danger: #ff8090;
  --radius: 22px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 18px;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.42;
  animation: drift 22s ease-in-out infinite alternate;
}

.aurora span:nth-child(1) { background: var(--accent-1); top: -16vmax; left: -10vmax; }
.aurora span:nth-child(2) { background: var(--accent-2); bottom: -20vmax; right: -12vmax; animation-delay: -7s; opacity: 0.28; }
.aurora span:nth-child(3) { background: var(--accent-3); top: 40%; left: 55%; animation-delay: -14s; opacity: 0.2; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vmax, -3vmax, 0) scale(1.14); }
}

/* ---------- home ---------- */

body.page-home {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: clamp(14px, 3vh, 40px) 18px;
  overflow: hidden;
  overscroll-behavior: none;
}

.hero {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: 100%;
  text-align: center;
  animation: rise 0.5s ease both;
}

.avatar {
  flex: 0 0 auto;
  width: clamp(72px, 12.5vh, 108px);
  height: clamp(72px, 12.5vh, 108px);
  margin: 0 auto clamp(8px, 1.8vh, 16px);
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(from 140deg, var(--accent-1), var(--accent-2), var(--accent-3), var(--accent-1));
  box-shadow: 0 18px 50px -18px var(--accent-1);
}

.avatar img,
.avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #0c1120;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.name {
  margin: 0;
  font-size: clamp(1.4rem, 4.2vh, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #ffffff 20%, #b7c6ff 55%, #7ee7f5 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.handle {
  margin: 4px 0 0;
  color: var(--accent-2);
  font-size: 0.95rem;
  font-weight: 600;
}

.tagline {
  margin: clamp(6px, 1.3vh, 11px) auto clamp(11px, 2.3vh, 20px);
  max-width: 38ch;
  color: var(--muted);
  font-size: clamp(0.86rem, 1.9vh, 0.98rem);
}

.socials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.4vh, 12px);
  min-height: 0;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

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

.social {
  --brand: var(--accent-1);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.1vh, 10px);
  padding: clamp(12px, 2.1vh, 18px) 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.social::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.social:hover,
.social:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  box-shadow: 0 18px 38px -20px var(--brand);
  outline: none;
}

.social:hover::after,
.social:focus-visible::after { opacity: 1; }

.social-icon {
  display: grid;
  place-items: center;
  width: clamp(38px, 5.6vh, 48px);
  height: clamp(38px, 5.6vh, 48px);
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
}

.social-meta { display: grid; gap: 1px; width: 100%; min-width: 0; }

.social-label {
  font-weight: 700;
  font-size: clamp(0.9rem, 1.9vh, 1rem);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-sub {
  color: var(--muted);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-go {
  position: absolute;
  top: 9px;
  right: 11px;
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.45;
  transition: transform 0.22s ease, color 0.22s ease, opacity 0.22s ease;
}

.social:hover .social-go { transform: translate(2px, -2px); color: var(--brand); opacity: 1; }

/* A lone last tile spans the full width instead of leaving a gap. */
.social:last-child:nth-child(odd) { grid-column: 1 / -1; }

.foot {
  flex: 0 0 auto;
  margin: clamp(10px, 2vh, 18px) 0 0;
  color: #6c7791;
  font-size: 0.8rem;
}

/* ---------- gate ---------- */

.card {
  position: relative;
  width: 100%;
  max-width: 470px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9);
  animation: rise 0.45s ease both;
}

.card-center { text-align: center; }

.home-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.home-link:hover { color: var(--text); }

.progress {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.progress li {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  text-indent: -999em;
  overflow: hidden;
}

.progress li.current { background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); }
.progress li.done { background: #2fbe86; }

.thumb {
  padding: 1px;
  border-radius: 16px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent-1) 60%, transparent), transparent 60%);
}

.thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 15px;
  background: #0c1120;
}

.badge {
  display: inline-block;
  margin: 18px 0 10px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.title {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.status {
  margin: 0 0 8px;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.gate { display: grid; gap: 14px; }

.captcha-wrap { display: flex; justify-content: center; min-height: 78px; }

.btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 15px 20px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(100deg, var(--accent-1), #5b8bff 55%, var(--accent-2));
  background-size: 180% 100%;
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 16px 34px -16px var(--accent-1);
  transition: background-position 0.4s ease, transform 0.15s ease, box-shadow 0.22s ease;
}

.btn:hover:not(:disabled) {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -16px var(--accent-1);
}

.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn.loading .btn-label::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  margin-left: 0.5em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

.btn-ghost {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: none;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); box-shadow: none; }

.error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: 0.88rem;
}

.hint {
  margin: 0;
  color: #6c7791;
  font-size: 0.78rem;
  text-align: center;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* Short viewports: shed the least important lines so the hero still fits exactly. */
@media (max-height: 720px) {
  .social-sub { display: none; }
}

@media (max-height: 580px) {
  .tagline { display: none; }
  .foot { display: none; }
}

@media (max-width: 420px) {
  body { padding: 26px 14px; }
  .card { padding: 18px; }
}

@media (max-width: 330px) {
  .socials { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- ad step button ---------- */

[hidden] { display: none !important; }

.gate .ad-open.is-waiting {
  pointer-events: none;
  background: var(--surface-strong);
  color: var(--muted);
  box-shadow: none;
  transform: none;
}

/* ---------- home CTA ---------- */

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-bottom: clamp(12px, 2.2vh, 18px);
  padding: clamp(11px, 1.9vh, 15px) 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(100deg, var(--accent-1), #5b8bff 55%, var(--accent-2));
  background-size: 180% 100%;
  color: #fff;
  font-size: clamp(0.92rem, 1.9vh, 1rem);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 16px 34px -18px var(--accent-1);
  transition: background-position 0.4s ease, transform 0.18s ease;
}

.hero-cta:hover { background-position: 100% 0; transform: translateY(-2px); }
.hero-cta-go { transition: transform 0.18s ease; }
.hero-cta:hover .hero-cta-go { transform: translateX(3px); }

/* ---------- resource index ---------- */

body.page-list { align-items: flex-start; }

.list {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  animation: rise 0.45s ease both;
}

.list-head {
  margin-bottom: 26px;
  text-align: center;
}

.list-title {
  margin: 10px 0 6px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.search-wrap {
  margin: 0 0 18px;
}

.search-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.search-input::placeholder { color: var(--muted); }

.search-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-1) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 20%, transparent);
}

.res-empty {
  text-align: center;
  margin-top: 18px;
}

.list-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.res-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.res-card:hover {
  border-color: color-mix(in srgb, var(--accent-1) 45%, transparent);
  box-shadow: 0 12px 32px -20px var(--accent-1);
}

.res-thumb {
  display: block;
  position: relative;
  align-self: stretch;
  flex: 0 0 auto;
  width: 140px;
  overflow: hidden;
  background: #0c1120;
}

.res-thumb-empty {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #131c30, #0c1120);
}

.res-thumb-bg,
.res-thumb-fg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.res-thumb-bg {
  object-fit: cover;
  filter: blur(14px) brightness(0.6) saturate(1.1);
  transform: scale(1.15);
}

.res-thumb-fg {
  object-fit: contain;
}

.res-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.res-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.res-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
}

.res-go {
  margin-top: 2px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
}

.res-card:hover .res-go { color: #7ee7f5; }

@media (max-width: 480px) {
  .res-thumb { width: 96px; }
}

/* ---------- admin ---------- */

body.page-admin { align-items: flex-start; }

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

.admin {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  animation: rise 0.4s ease both;
}

.admin-narrow { max-width: 560px; }

.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-head-actions { display: flex; gap: 8px; }
.inline { display: inline; }

.mini {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.mini:hover { background: var(--surface-strong); border-color: color-mix(in srgb, var(--accent-1) 45%, transparent); }
.mini.danger { color: var(--danger); }
.mini.danger:hover { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }

.flash {
  margin: 0 0 16px;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, #2fbe86 40%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, #2fbe86 12%, transparent);
  color: #7fe3bb;
  font-size: 0.88rem;
}

.admin-list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.admin-thumb {
  flex: 0 0 78px;
  height: 46px;
  border-radius: 8px;
  background: #0c1120;
  overflow: hidden;
}

.admin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.admin-meta { display: grid; gap: 2px; flex: 1; min-width: 0; }
.admin-title { font-weight: 700; font-size: 0.95rem; }

.admin-tag {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
}

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

.stack { display: grid; gap: 16px; margin-top: 20px; }
.field { display: grid; gap: 6px; }

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  resize: vertical;
}

.input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-1) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 18%, transparent);
}

.input[readonly] { color: var(--muted); background: rgba(0, 0, 0, 0.4); }
.input.has-error { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }

.field-hint, .field-error { margin: 0; font-size: 0.78rem; }
.field-hint { color: #6c7791; }
.field-error { color: var(--danger); }

.btn-danger {
  background: linear-gradient(100deg, #d64562, #ff7a5c);
  box-shadow: 0 16px 34px -18px #d64562;
}

.empty { margin-top: 20px; }

html { scroll-behavior: smooth; }

body.page-article {
  align-items: flex-start;
  padding: 0 18px 56px;
}

.art-shell {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  gap: 26px;
}

.art-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0 4px;
  border-bottom: 1px solid var(--line);
}

.art-brand {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.art-back {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.art-back:hover { color: var(--text); }

.btn-inline {
  display: inline-block;
  width: auto;
  padding: 11px 18px;
  font-size: 0.9rem;
  border-radius: 12px;
}

.art-intro { display: grid; gap: 6px; }
.art-intro-lead { padding-top: 34px; }

.art {
  display: grid;
  gap: 18px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.art-kicker {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.art-title {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.art-dek {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.art h2 {
  margin: 10px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.art p {
  margin: 0;
  color: #d5dcec;
  font-size: 1.02rem;
  line-height: 1.75;
}

.art-cta {
  display: grid;
  gap: 12px;
  scroll-margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.art-step {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.art-cta .hint { margin: 0; text-align: center; }

.art-foot {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.art-index { display: grid; gap: 12px; }

.art-item {
  display: grid;
  gap: 5px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.15s ease, background 0.18s ease;
}

.art-item:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--surface-strong);
  transform: translateY(-2px);
}

.art-item-title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.art-item-dek {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 420px) {
  .art { padding: 22px 18px; }
  .art-cta { padding: 20px 18px; }
  .art-jump { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
