:root {
  --bg: #080a0d;
  --bg-soft: #0d1117;
  --panel: #12161c;
  --panel-strong: #171d24;
  --text: #f5f7f6;
  --muted: #a8b3ad;
  --quiet: #728078;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #4ade80;
  --accent-strong: #22c55e;
  --cyan: #38bdf8;
  --amber: #fbbf24;
  --rose: #fb7185;
  --violet: #a78bfa;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.11), transparent 34rem),
    linear-gradient(315deg, rgba(56, 189, 248, 0.08), transparent 32rem),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.26;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

html.auth-pending body > :not(.password-gate),
body.auth-locked > :not(.password-gate) {
  visibility: hidden;
}

html.auth-pending,
body.auth-locked {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.password-gate {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #050607;
  opacity: 1;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.password-gate.is-exiting {
  opacity: 0;
  visibility: hidden;
}

.password-card {
  width: min(100%, 360px);
  display: grid;
  gap: 12px;
}

.password-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 0 14px;
  text-align: center;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.password-field input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}

.password-error {
  min-height: 24px;
  margin: 0;
  color: var(--rose);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 13, 0.82);
  backdrop-filter: blur(16px);
}

.nav-wrap {
  width: min(100% - 32px, var(--max-width));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 32px rgba(74, 222, 128, 0.12);
}

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

.brand-text {
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
  transition: color 180ms ease, background 180ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--text);
}

.page-shell {
  position: relative;
  width: min(100% - 32px, var(--max-width));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.narrow-shell {
  width: min(100% - 32px, 860px);
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: end;
  padding: 24px 0 42px;
}

.hero-copy h1,
.page-title h1,
.admin-placeholder h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy p:last-child,
.page-title p:last-child,
.admin-placeholder p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel,
.archive-controls,
.admin-placeholder,
.post-detail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 24px;
}

.hero-panel span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.hero-panel strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 2rem;
}

.hero-panel p {
  margin: 10px 0 0;
  color: var(--quiet);
  line-height: 1.6;
}

.section-block {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.15rem);
}

.text-link {
  color: var(--accent);
  font-weight: 800;
  transition: color 180ms ease;
}

.text-link:hover,
.text-link:focus-visible {
  color: #bbf7d0;
}

.carousel {
  position: relative;
  min-height: 392px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 22, 28, 0.8);
  box-shadow: var(--shadow);
}

.carousel-track {
  position: relative;
  min-height: 392px;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  opacity: 0;
  pointer-events: none;
  transform: translateX(28px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.carousel-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.slide-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
}

.slide-content h3 {
  margin: 14px 0 12px;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.slide-content p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.75;
}

.button {
  display: inline-flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 800;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.12);
}

.primary-button {
  color: #041008;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #a7f3d0);
}

.slide-art,
.post-visual,
.post-hero-visual {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  border-left: 1px solid var(--line);
  background:
    radial-gradient(circle at 22% 18%, rgba(74, 222, 128, 0.42), transparent 34%),
    radial-gradient(circle at 82% 22%, rgba(56, 189, 248, 0.32), transparent 38%),
    linear-gradient(135deg, rgba(167, 139, 250, 0.36), rgba(8, 10, 13, 0.26) 46%, rgba(74, 222, 128, 0.24)),
    #10151b;
}

.slide-art::before,
.post-visual::before,
.post-hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(135deg, rgba(8, 10, 13, 0.14), rgba(8, 10, 13, 0.42));
  pointer-events: none;
}

.slide-art::after,
.post-visual::after,
.post-hero-visual::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  height: 44%;
  background: linear-gradient(to top, rgba(8, 10, 13, 0.6), transparent);
  pointer-events: none;
}

.slide-art img,
.post-visual img,
.post-hero-visual img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
}

.generated-art span {
  position: absolute;
  z-index: 2;
}

.art-type {
  top: 44px;
  left: 44px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.art-title {
  left: 44px;
  bottom: 44px;
  max-width: min(72%, 420px);
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  font-weight: 900;
  line-height: 0.95;
}

.type-announcement {
  --type-color: var(--accent);
}

.type-update {
  --type-color: var(--cyan);
}

.type-hotfix {
  --type-color: var(--rose);
}

.type-event {
  --type-color: var(--amber);
}

.type-devlog {
  --type-color: var(--violet);
}

.type-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--type-color, var(--accent)) 50%, transparent);
  border-radius: 999px;
  color: var(--type-color, var(--accent));
  background: color-mix(in srgb, var(--type-color, var(--accent)) 10%, transparent);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.post-date {
  color: var(--quiet);
  font-size: 0.9rem;
  font-weight: 700;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.carousel-controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(8, 10, 13, 0.76);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.14);
}

.carousel-dots {
  display: flex;
  gap: 8px;
}

.dot-button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transition: width 180ms ease, background 180ms ease;
}

.dot-button.is-active {
  width: 26px;
  background: var(--accent);
}

.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-card {
  min-width: 0;
  min-height: 254px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 22, 28, 0.76);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(-3px);
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(23, 29, 36, 0.94);
}

.post-card .post-visual {
  min-height: 128px;
  border-left: 0;
  border-bottom: 1px solid var(--line);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.card-body h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.card-body .text-link {
  margin-top: auto;
}

.latest-panel {
  position: sticky;
  top: 96px;
}

.latest-list {
  display: grid;
  gap: 10px;
}

.latest-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 22, 28, 0.7);
  transition: border-color 180ms ease, background 180ms ease;
}

.latest-item:hover,
.latest-item:focus-within {
  border-color: rgba(74, 222, 128, 0.34);
  background: rgba(23, 29, 36, 0.92);
}

.latest-item h3 {
  margin: 0;
  font-size: 1rem;
}

.archive-controls {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 800;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.tab-button:hover,
.tab-button:focus-visible,
.tab-button.is-active {
  color: var(--text);
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.12);
}

.control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #0c1015;
  padding: 0 13px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(74, 222, 128, 0.65);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.12);
}

.field textarea {
  min-height: 220px;
  padding-top: 12px;
  resize: vertical;
  line-height: 1.6;
}

.page-title {
  padding: 24px 0 30px;
}

.page-title h1 {
  margin-bottom: 12px;
}

.post-detail {
  overflow: hidden;
}

.post-header {
  display: grid;
  gap: 16px;
  padding: 34px;
}

.post-header h1 {
  margin: 0;
  font-size: clamp(2.05rem, 6vw, 4rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.post-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.post-hero-visual {
  min-height: 330px;
  border-left: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.post-body {
  padding: 34px;
  color: #dbe3df;
  line-height: 1.85;
}

.post-body h2,
.post-body h3 {
  margin: 28px 0 10px;
  color: var(--text);
  line-height: 1.2;
}

.post-body p {
  margin: 0 0 18px;
}

.post-body ul {
  margin: 0 0 20px;
  padding-left: 22px;
}

.post-body li {
  margin-bottom: 8px;
}

.post-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--accent);
  font-weight: 900;
}

.related-block {
  margin-top: 28px;
}

.admin-placeholder {
  margin-top: 46px;
  padding: 44px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.admin-form,
.admin-list-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
}

.admin-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.admin-list-panel {
  position: sticky;
  top: 96px;
  margin-top: 0;
  padding: 18px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

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

.danger-button {
  color: #ffe4e6;
  border-color: rgba(251, 113, 133, 0.36);
  background: rgba(251, 113, 133, 0.1);
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: rgba(251, 113, 133, 0.68);
  background: rgba(251, 113, 133, 0.16);
}

.admin-status {
  min-height: 24px;
  margin: 0;
  color: var(--accent);
  font-weight: 800;
}

.empty-state,
.loading-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(8, 10, 13, 0.72);
}

.footer-wrap {
  width: min(100% - 32px, var(--max-width));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--quiet);
}

.footer-wrap p {
  margin: 0;
}

.footer-wrap a {
  color: var(--muted);
  font-weight: 800;
}

[data-animate] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms ease, transform 420ms ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .page-hero,
  .home-columns,
  .admin-grid,
  .carousel-slide {
    grid-template-columns: 1fr;
  }

  .latest-panel,
  .admin-list-panel {
    position: static;
  }

  .slide-art {
    min-height: 240px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .carousel,
  .carousel-track {
    min-height: 650px;
  }

  .news-grid,
  .compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .nav-wrap {
    width: min(100% - 24px, var(--max-width));
  }

  .brand-text {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    position: absolute;
    top: 72px;
    right: 12px;
    left: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(8, 10, 13, 0.98);
    box-shadow: var(--shadow);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    min-height: 44px;
  }

  .page-shell {
    width: min(100% - 24px, var(--max-width));
    padding-top: 28px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .slide-content,
  .post-header,
  .post-body,
  .admin-placeholder {
    padding: 24px;
  }

  .carousel,
  .carousel-track {
    min-height: 680px;
  }

  .carousel-controls {
    right: 12px;
    bottom: 12px;
  }

  .news-grid,
  .compact-grid,
  .control-row {
    grid-template-columns: 1fr;
  }

  .post-card {
    min-height: 0;
  }
}

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