/* ===== Tokens ===== */
:root {
  --shell: #1a1a1a;
  --shell-bg: #0a0a0a;
  --screen-bg: #050505;
  --fg: #8AFFA0;
  --fg-dim: #4a8a5a;
  --fg-deep: #2a5a35;
  --fg-highlight: #e0ffa0;
  --border: #1a3a1f;
  --border-strong: #2a2a2a;

  --font-pixel: "Press Start 2P", monospace;
  --font-crt: "VT323", monospace;
  --font-body: "JetBrains Mono", ui-monospace, monospace;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--shell-bg);
  color: var(--fg);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
img { display: block; image-rendering: pixelated; }
ul { list-style: none; padding: 0; margin: 0; }
a { color: var(--fg); text-decoration: none; border-bottom: 1px dotted var(--fg-dim); }
a:hover { color: var(--fg-highlight); border-bottom-color: var(--fg-highlight); }

/* ===== Chrome ===== */
.chrome {
  background: var(--shell);
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: inset -1px -1px 0 var(--border-strong), 0 0 20px rgba(138,255,160,0.06);
}

.tag {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #5a5a5a;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
}
.tag-top { margin-bottom: 8px; }
.tag-bottom {
  justify-content: center;
  color: var(--fg-deep);
  margin-top: 4px;
}

/* ===== Screens ===== */
.screen {
  background: var(--screen-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: inset 0 0 20px rgba(138,255,160,0.04);
  position: relative;
}

/* ===== Top screen (hero) ===== */
.screen-top {
  min-height: 140px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.hero-name {
  font-family: var(--font-pixel);
  font-size: clamp(14px, 3.5vw, 20px);
  color: var(--fg);
  line-height: 1.6;
  margin: 0 0 12px 0;
  letter-spacing: 1px;
}

.hero-lines {
  font-family: var(--font-crt);
  font-size: 16px;
  color: #6acc7a;
  line-height: 1.35;
  margin-bottom: 10px;
}
.hero-lines li { padding: 1px 0; }
.hero-lines .dim { color: var(--fg-deep); }
.hero-lines .label { color: var(--fg); }

.ticker {
  font-family: var(--font-crt);
  font-size: 14px;
  color: var(--fg-dim);
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.ticker .live {
  color: var(--fg);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.avatar {
  width: 72px;
  height: 72px;
  border: 1px solid var(--border);
  background: rgba(138,255,160,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: contain; }

/* ===== Bottom screen ===== */
.screen-bottom { min-height: 240px; }

.nav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.tile {
  font-family: var(--font-crt);
  font-size: 15px;
  border: 1px solid var(--border);
  padding: 8px 4px;
  text-align: center;
  color: var(--fg-dim);
  transition: color 120ms, border-color 120ms, background 120ms;
}
.tile:hover {
  color: var(--fg);
  border-color: var(--fg);
}
.tile[aria-current="true"] {
  color: var(--fg);
  border-color: var(--fg);
  background: rgba(138,255,160,0.06);
}

.hint {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--fg-deep);
  letter-spacing: 1px;
}

/* ===== Sections (content) ===== */
.content { padding-bottom: 24px; }

.section[hidden] { display: none; }
.section { animation: fade 160ms ease-out; }
@keyframes fade {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.section h2 {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg);
  margin: 0 0 10px 0;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
  letter-spacing: 1px;
}

.section h3 {
  font-family: var(--font-crt);
  font-size: 16px;
  color: var(--fg);
  margin: 12px 0 4px 0;
}

.section p, .section li {
  font-family: var(--font-body);
  font-size: 11px;
  line-height: 1.6;
}

.section ul.bullets { margin: 6px 0; }
.section ul.bullets li {
  padding-left: 14px;
  position: relative;
}
.section ul.bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--fg-dim);
}

.section .meta {
  font-family: var(--font-crt);
  font-size: 13px;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.section .acc { color: var(--fg-highlight); }

/* ===== SpiNlabs research preview ===== */
.spinlabs-preview {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  background: rgba(138,255,160,0.025);
  padding: 8px;
  margin: 12px 0 18px;
}
.spinlabs-preview-images {
  min-width: 0;
}
.spinlabs-preview-images img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  image-rendering: auto;
  border: 1px solid var(--border);
}
.spinlabs-preview h4 {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--fg);
  letter-spacing: 1px;
  margin: 0 0 7px;
}
.spinlabs-preview p {
  font-size: 10px;
  line-height: 1.5;
  color: var(--fg-dim);
  margin: 0 0 8px;
}
.spinlabs-read-more {
  display: inline-block;
  font-family: var(--font-crt);
  font-size: 14px;
  color: var(--fg-highlight);
  border-bottom-color: var(--fg-highlight);
}

/* ===== CTF featured cards ===== */
.featured {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 14px 0;
}
.featured .card {
  border: 1px solid var(--fg);
  padding: 8px;
  background: rgba(138,255,160,0.04);
}
.featured .card .event {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--fg);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.featured .card .result {
  font-family: var(--font-crt);
  font-size: 16px;
  color: var(--fg-highlight);
}
.featured .card .sub {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--fg-dim);
  margin-top: 2px;
}

.ctf-others {
  font-family: var(--font-crt);
  font-size: 14px;
  color: var(--fg-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 6px 0 14px 0;
}
.ctf-others .acc { color: var(--fg); }

/* ===== Mobile ===== */
@media (max-width: 700px) {
  body { padding: 10px; }

  .chrome { padding: 8px; }

  .screen-top {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .screen-top .avatar {
    width: 56px;
    height: 56px;
    margin-left: 0;
    align-self: start;
    order: -1;
  }
  .hero-name { font-size: 14px; }
  .hero-lines { font-size: 14px; }
  .ticker { font-size: 12px; }

  .nav {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
  }
  .tile { font-size: 13px; padding: 8px 2px; }

  .featured { grid-template-columns: 1fr; }

  .spinlabs-preview { grid-template-columns: 1fr; }
  .spinlabs-preview-images img { height: 110px; }

  .hint { font-size: 5px; }
}

@media (max-width: 380px) {
  .nav { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Blog ===== */
.blog-index .post-item {
  display: block;
  border-bottom: 1px dashed var(--border);
  padding: 10px 0;
  color: var(--fg);
  text-decoration: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.blog-index .post-item:first-child { padding-top: 0; }
.blog-index .post-item:last-child { border-bottom: none; }
.blog-index .post-item:hover { background: rgba(138,255,160,0.04); }
.blog-index .post-item .post-title {
  font-family: var(--font-crt);
  font-size: 18px;
  color: var(--fg);
  margin: 0 0 2px 0;
}
.blog-index .post-item:hover .post-title { color: var(--fg-highlight); }
.blog-index .post-item .post-meta {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--fg-dim);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.blog-index .post-item .post-excerpt {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--fg-dim);
  margin: 0;
  line-height: 1.5;
}

.blog-back {
  font-family: var(--font-crt);
  font-size: 14px;
  color: var(--fg-dim);
  padding: 4px 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.blog-back:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.prose { color: var(--fg); }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-pixel);
  color: var(--fg);
  letter-spacing: 1px;
  line-height: 1.4;
}
.prose h1 { font-size: 12px; margin: 16px 0 10px; }
.prose h2 { font-size: 10px; margin: 14px 0 8px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.prose h3 { font-size: 9px; margin: 12px 0 6px; }
.prose h4 { font-size: 8px; margin: 10px 0 4px; color: var(--fg-dim); }
.prose p, .prose li {
  font-family: var(--font-body);
  font-size: 11px;
  line-height: 1.65;
}
.prose ul, .prose ol { padding-left: 18px; margin: 6px 0 10px; }
.prose ul { list-style: none; }
.prose ul li { position: relative; padding-left: 2px; }
.prose ul li::before { content: "▸"; position: absolute; left: -14px; color: var(--fg-dim); }
.prose ol { list-style-type: decimal; }
.prose a { color: var(--fg-highlight); border-bottom: 1px dotted var(--fg-highlight); }
.prose a:hover { color: var(--fg); border-bottom-color: var(--fg); }
.prose blockquote {
  border-left: 2px solid var(--fg-dim);
  margin: 10px 0;
  padding: 4px 0 4px 12px;
  color: var(--fg-dim);
  font-style: italic;
}
.prose code {
  font-family: var(--font-body);
  font-size: 10.5px;
  color: var(--fg-highlight);
  background: rgba(138,255,160,0.08);
  padding: 1px 5px;
  border-radius: 2px;
}
.prose pre {
  background: rgba(138,255,160,0.04);
  border: 1px solid var(--border);
  padding: 10px 12px;
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 3px;
}
.prose pre code {
  background: none;
  padding: 0;
  color: var(--fg);
  font-size: 11px;
  line-height: 1.55;
  display: block;
  white-space: pre;
}
.prose hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 14px 0;
}
.prose img {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
}
.prose .nrp-overview-gallery,
.prose .nrp-afm-gallery {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
.prose .nrp-overview-gallery {
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  align-items: center;
}
.prose .nrp-afm-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prose .nrp-gallery-image {
  margin: 0;
  border: 1px solid var(--border);
  background: #0b0b0b;
  overflow: hidden;
}
.prose .nrp-gallery-image img {
  display: block;
  width: 100%;
  height: 158px;
  object-fit: cover;
  image-rendering: auto;
  margin: 0;
}
.prose .nrp-overview-gallery .nrp-gallery-image:first-child img {
  height: 230px;
  object-position: center 38%;
}
.prose .nrp-overview-gallery .nrp-gallery-image:last-child img {
  height: 190px;
  object-fit: contain;
  background: #fff;
}
.prose .nrp-gallery-image figcaption {
  font-family: var(--font-crt);
  font-size: 12px;
  line-height: 1.25;
  color: var(--fg-dim);
  padding: 5px 7px 6px;
  border-top: 1px solid var(--border);
}
.prose .nrp-note {
  color: var(--fg-dim);
  font-family: var(--font-crt);
  font-size: 13px;
}
@media (max-width: 520px) {
  .prose .nrp-overview-gallery,
  .prose .nrp-afm-gallery { grid-template-columns: 1fr; }
  .prose .nrp-overview-gallery .nrp-gallery-image:first-child img { height: 260px; }
  .prose .nrp-overview-gallery .nrp-gallery-image:last-child img,
  .prose .nrp-gallery-image img { height: auto; }
}
.prose table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 10.5px;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
}
.prose th {
  color: var(--fg);
  background: rgba(138,255,160,0.06);
  font-family: var(--font-crt);
  font-size: 13px;
  font-weight: normal;
}
