@font-face {
  font-family: "SynthMono";
  src: local("Consolas"), local("Courier New"), monospace;
}

:root {
  --bg: #0a0b10;
  --bg-2: #0f1122;
  --text: #e6f1ff;
  --muted: #9fb3c8;
  --brand: #00e6ff;
  --brand-2: #8a2be2;
  --card: #141726;
  --accent: #ff2e88;
  --glow: rgba(0, 230, 255, 0.5);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% 10%, #0d0f1a 0%, transparent 60%),
    radial-gradient(1000px 600px at 90% 90%, #0b0e18 0%, transparent 55%),
    linear-gradient(120deg, var(--bg) 0%, var(--bg-2) 100%);
  font-family: "SynthMono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  overflow-x: hidden;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  padding: 28px 22px;
  background: linear-gradient(180deg, #0b0f1e 0%, #0b0d16 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 1px;
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background:
    conic-gradient(from 180deg at 50% 50%, var(--brand), var(--accent), var(--brand-2), var(--brand));
  filter: drop-shadow(0 0 6px var(--glow));
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  transition: 180ms ease;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.nav a.active {
  color: var(--text);
  background: rgba(255,255,255,0.12);
}

.content {
  padding: 28px 28px 80px 28px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.site-title {
  font-size: 14px;
  color: var(--muted);
}

.search {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.search input {
  /* width: 420px; */
  width: auto;
  max-width: 100%;
  background: #0e1224;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: 160ms ease;
}

.search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,230,255,0.15);
}

.grid {
  --size: 260px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--size), 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: linear-gradient(180deg, #121527, #0e1222);
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  transform: translateZ(0);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 230, 255, 0.35);
  box-shadow:
    0 6px 24px rgba(0,0,0,0.35),
    0 0 30px rgba(0,230,255,0.12);
}

.thumb {
  aspect-ratio: 16/9;
  background: #0c1022;
  object-fit: cover;
  width: 100%;
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.title {
  font-size: 16px;
  color: var(--text);
}

.desc {
  font-size: 12px;
  color: var(--muted);
  height: 42px;
  overflow: hidden;
}

.pill {
  align-self: start;
  font-size: 11px;
  color: #0c1222;
  padding: 6px 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
  box-shadow: 0 0 10px rgba(0,230,255,0.2);
}

.footer {
  margin-top: auto;
  padding: 18px 0 26px 0;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text);
}

.detail {
  width: min(1200px, 100%);
  margin: 0;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.detail-hero {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.detail h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
}

.content p,
.detail p {
  font-size: 16.5px;
  line-height: 1.75;
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  background: linear-gradient(90deg, var(--accent) 0%, var(--brand) 100%);
  color: #0b0f1e;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(255,46,136,0.25);
  transition: transform 180ms ease;
}

.play:hover { transform: translateY(-2px); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
}

.related {
  margin-top: 20px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* shrink related cards on detail page */
.related .thumb { aspect-ratio: 4/3; }
.related .card .card-body { padding: 10px; }
.related .card .title { font-size: 13px; }
.related .card .desc { font-size: 11px; height: 32px; }
.related .card .pill { font-size: 10px; padding: 5px 7px; }

/* mobile navigation */
.menu-toggle{
  display: none;
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.sidebar-meta{font-size:12px;color:#9fb3c8;}

.form-block{display:grid;gap:12px;max-width:640px;margin:14px 0;}
.form-block input,.form-block textarea{
  background:#0e1224;color:var(--text);border:1px solid rgba(255,255,255,0.1);
  border-radius:10px;padding:12px 14px;outline:none;transition:160ms ease;
}
.form-block input:focus,.form-block textarea:focus{
  border-color:var(--brand);box-shadow:0 0 0 3px rgba(0,230,255,0.15);
}

@media (max-width: 1024px) {
  .layout { grid-template-columns: 220px 1fr; }
}

@media (min-width: 1440px) {
  .detail h1 { font-size: 34px; }
  .content p,
  .detail p { font-size: 18px; }
}

@media (max-width: 1200px) {
  .detail { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(180deg, #0b0f1e 0%, #0b0d16 100%);
  }
  .menu-toggle{ display:inline-flex; }
  .nav{
    display:none;
    position:absolute;
    left:0; right:0;
    top:58px;
    background:#0b0f1e;
    border-bottom:1px solid rgba(255,255,255,0.06);
    box-shadow:0 10px 30px rgba(0,0,0,0.35);
    padding: 12px 16px 14px 16px;
    z-index: 15;
  }
  .sidebar.open .nav{
    display:grid;
    grid-auto-flow: row;
    gap:10px;
  }
  .sidebar-meta{ display:none; }
  .content { padding: 18px; }
  .detail { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 520px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* prevent horizontal overflow on small screens for homepage grid */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; gap: 12px; }
}

/* enlarge related cards on desktop and clamp description to two lines */
@media (min-width: 1200px) {
  .related-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .related .thumb { aspect-ratio: 16/9; }
  .related .card .card-body { padding: 12px; }
  .related .card .title { font-size: 15px; }
  .related .card .desc {
    font-size: 12.5px;
    height: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}
