/* ceetsw.com
   font:   IBM BIOS (ibm_bios.ttf)
   theme:  pixel art game UI — greys + lime accent
*/

@font-face {
  font-family: 'IBM BIOS';
  src: url('/assets/fonts/ibm_bios.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* greys */
  --bg:        #181818;
  --bg-dark:   #0e0e0e;
  --bg-mid:    #1e1e1e;
  --bg-panel:  #252525;
  --bg-hi:     #2e2e2e;

  /* 3-value pixel border (light edge / flat / dark edge) */
  --b-hi:   #545454;
  --b-mid:  #383838;
  --b-lo:   #0a0a0a;

  /* text */
  --fg:     #b8b8b8;
  --fg-dim: #585858;
  --fg-hi:  #e0e0e0;

  /* accent */
  --accent:    #e3ff00;
  --accent-lo: #8ab200;

  --font: 'IBM BIOS', monospace;
}

/* ─── reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
}

/* ─── base ───────────────────────────────────────────────── */
html {
  min-height: 100%;
  background: #000; /* pre-canvas fallback */
}

body {
  min-height: 100%;
  min-height: 100dvh;
  background: transparent; /* canvas shows through */
  color: var(--fg);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.6;
  font-synthesis: none;
}

/* ─── deathmatch background canvas ───────────────────────── */
#deathmatch-bg {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 0;
  display: block;
  width: 1920px;
  height: 1080px;
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--fg-hi);
  text-decoration: none;
}

code, pre, button, input, textarea, select, svg text {
  font-family: var(--font);
}

pre {
  background: var(--bg-dark);
  border-top: 1px solid var(--b-lo);
  border-left: 1px solid var(--b-lo);
  border-right: 1px solid var(--b-hi);
  border-bottom: 1px solid var(--b-hi);
  padding: 10px 12px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 11px;
  line-height: 1.5;
}

/* ─── game window (inner pages) ──────────────────────────── */
.game-win {
  width: min(980px, calc(100% - 48px));
  max-width: 980px;
  margin: 24px auto;
  min-height: calc(100dvh - 48px);
  background: var(--bg);
  border-top: 1px solid var(--b-hi);
  border-left: 1px solid var(--b-hi);
  border-right: 1px solid var(--b-lo);
  border-bottom: 1px solid var(--b-lo);
  position: relative;
  z-index: 1;
}

.game-win-bar {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--b-mid);
  display: flex;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 10;
}

.game-win-title {
  padding: 7px 14px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--accent);
  border-right: 1px solid var(--b-mid);
  flex-shrink: 0;
}

.game-win-title:hover {
  color: var(--fg-hi);
}

.game-win-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.game-win-nav a {
  padding: 7px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-right: 1px solid var(--b-mid);
  display: flex;
  align-items: center;
  transition: color 0.1s, background 0.1s;
}

.game-win-nav a:hover {
  color: var(--fg);
  background: var(--bg-mid);
}

.game-win-nav a.active {
  color: var(--accent);
  background: var(--bg-mid);
}

.game-win-body {
  padding: 24px 24px 32px;
}

/* ─── panel blocks ───────────────────────────────────────── */
/* raised: like a button/card in old DOS UI */
.panel {
  background: var(--bg-panel);
  border-top: 1px solid var(--b-hi);
  border-left: 1px solid var(--b-hi);
  border-right: 1px solid var(--b-lo);
  border-bottom: 1px solid var(--b-lo);
  margin-bottom: 16px;
}

.panel-head {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--b-mid);
  padding: 4px 10px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--accent);
}

.panel-body {
  padding: 10px;
}

/* sunken: input wells / content areas */
.panel-inset {
  background: var(--bg-dark);
  border-top: 1px solid var(--b-lo);
  border-left: 1px solid var(--b-lo);
  border-right: 1px solid var(--b-hi);
  border-bottom: 1px solid var(--b-hi);
}

/* ─── search ─────────────────────────────────────────────── */
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-dark);
  border-top: 1px solid var(--b-lo);
  border-left: 1px solid var(--b-lo);
  border-right: 1px solid var(--b-hi);
  border-bottom: 1px solid var(--b-hi);
  padding: 6px 10px;
}

.search-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
  flex-shrink: 0;
}

.search-input {
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: 12px;
  padding: 0;
  outline: none;
  flex: 1;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--fg-dim);
  opacity: 0.5;
}

/* ─── section label ──────────────────────────────────────── */
.section-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--b-mid);
  padding-bottom: 4px;
  margin-bottom: 10px;
}

/* ─── concepts ───────────────────────────────────────────── */
.concepts-section {
  margin-bottom: 24px;
}

.concept-count {
  font-size: 10px;
  color: var(--fg-dim);
  padding: 5px 0;
}

.concept-no-results {
  font-size: 11px;
  color: var(--fg-dim);
  padding: 10px 0;
  display: none;
}

.concepts-list {
  list-style: none;
}

.concepts-list.hidden {
  display: none;
}

.concept-item {
  border-top: 1px solid var(--b-mid);
  padding: 9px 6px;
  display: grid;
  grid-template-columns: 84px 1fr 72px;
  gap: 12px;
  align-items: start;
  transition: background 0.08s;
}

.concept-item:last-child {
  border-bottom: 1px solid var(--b-mid);
}

.concept-item:hover {
  background: var(--bg-hi);
}

.concept-item.hidden {
  display: none;
}

.concept-item-meta {
  font-size: 10px;
  color: var(--fg-dim);
  padding-top: 1px;
}

.concept-body {
  min-width: 0;
}

.concept-title {
  display: inline-block;
  font-size: 12px;
  color: var(--fg-hi);
  margin-bottom: 3px;
}

.concept-title:hover {
  color: var(--accent);
}

.concept-item-summary {
  font-size: 11px;
  color: var(--fg);
  opacity: 0.65;
  margin-bottom: 5px;
}

.concept-item-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.concept-item-tag {
  font-size: 10px;
  color: var(--fg-dim);
  border: 1px solid var(--b-mid);
  padding: 0 4px;
}

.concept-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 1px;
}

.concept-link {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.concept-link:hover {
  color: var(--accent);
}

/* grouped episodes */
.concept-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.concept-group {
  background: var(--bg-panel);
  border-top: 1px solid var(--b-hi);
  border-left: 1px solid var(--b-hi);
  border-right: 1px solid var(--b-lo);
  border-bottom: 1px solid var(--b-lo);
  padding: 8px 10px;
  flex: 1 1 180px;
  max-width: 260px;
}

.concept-group h3 {
  font-size: 11px;
  font-weight: normal;
  color: var(--accent);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--b-mid);
}

.concept-topic-list {
  list-style: none;
}

.concept-topic-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-top: 1px solid var(--b-lo);
}

.concept-topic-list li:first-child {
  border-top: none;
}

.concept-topic-list a {
  font-size: 11px;
  color: var(--fg);
  min-width: 0;
  overflow-wrap: anywhere;
}

.concept-topic-list a:hover {
  color: var(--accent);
}

.concept-topic-list span {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--fg-dim);
}

/* ─── projects ───────────────────────────────────────────── */
.projects-list {
  list-style: none;
}

.project-item {
  border-top: 1px solid var(--b-mid);
  padding: 10px 6px;
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  gap: 14px;
  align-items: start;
  transition: background 0.08s;
}

.project-item:last-child {
  border-bottom: 1px solid var(--b-mid);
}

.project-item:hover {
  background: var(--bg-hi);
}

.project-name {
  font-size: 12px;
}

.project-name a {
  color: var(--fg-hi);
  transition: color 0.1s;
}

.project-name a:hover {
  color: var(--accent);
}

.project-desc {
  font-size: 11px;
  color: var(--fg);
  opacity: 0.7;
  line-height: 1.5;
  min-width: 0;
}

.project-status {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-align: right;
}

.project-status.active {
  color: var(--accent);
}

/* ─── landing ────────────────────────────────────────────── */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.landing-card {
  width: min(400px, 100%);
  background: var(--bg-panel);
  border-top: 2px solid var(--b-hi);
  border-left: 2px solid var(--b-hi);
  border-right: 2px solid var(--b-lo);
  border-bottom: 2px solid var(--b-lo);
  position: relative;
  z-index: 2;
}

.landing-card-bar {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--b-mid);
  padding: 5px 12px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.landing-card-body {
  padding: 28px 24px 22px;
  text-align: center;
}

.landing-logo {
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
  line-height: 0;
}

.landing-logo-img {
  display: block;
  width: min(68%, 260px);
  max-height: 125px;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
}

.landing-title {
  font-size: 18px;
  font-weight: normal;
  text-transform: uppercase;
  color: var(--fg-hi);
  margin-bottom: 8px;
}

.landing-sub {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 22px;
  line-height: 1.8;
}

.landing-sep {
  height: 1px;
  background: var(--b-mid);
  margin: 0 -24px 18px;
}

.landing-nav {
  list-style: none;
  text-align: left;
}

.landing-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.nav-cursor {
  color: var(--accent);
  font-size: 10px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.08s;
}

.landing-nav-item:hover .nav-cursor {
  opacity: 1;
}

.landing-nav-item a {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--fg);
  transition: color 0.1s;
}

.landing-nav-item:hover a {
  color: var(--accent);
}

/* ─── episode viewer ─────────────────────────────────────── */
.episode-viewer {
  width: min(980px, calc(100% - 48px));
  max-width: 980px;
  margin: 24px auto;
  min-height: calc(100dvh - 48px);
  background: var(--bg);
  border-top: 1px solid var(--b-hi);
  border-left: 1px solid var(--b-hi);
  border-right: 1px solid var(--b-lo);
  border-bottom: 1px solid var(--b-lo);
  position: relative;
  z-index: 1;
}

.episode-viewer-bar {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--b-mid);
  display: flex;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 10;
}

.episode-shell-header {
  margin: 16px 24px 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--b-hi);
  border-left: 1px solid var(--b-hi);
  border-right: 1px solid var(--b-lo);
  border-bottom: 1px solid var(--b-lo);
  padding: 10px 14px;
}

.episode-kicker {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.episode-shell-header h1 {
  font-size: 13px;
  font-weight: normal;
  color: var(--accent);
  line-height: 1.3;
}

.episode-frame {
  display: block;
  width: calc(100% - 48px);
  margin: 0 24px;
  min-height: 420px;
  border-top: 1px solid var(--b-lo);
  border-left: 1px solid var(--b-lo);
  border-right: 1px solid var(--b-hi);
  border-bottom: 1px solid var(--b-hi);
  background: var(--bg-mid);
}

.episode-error {
  font-size: 11px;
  color: var(--fg-dim);
  padding: 10px 24px;
}

/* ─── responsive ─────────────────────────────────────────── */

/* prevent horizontal overflow on all screen sizes */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* ── tablet / large phone (≤ 700px) ───────────────────────── */
@media (max-width: 700px) {
  body {
    font-size: 11px;
  }

  #deathmatch-bg {
    width: 1920px;
    height: 1080px;
  }

  .game-win,
  .episode-viewer {
    width: calc(100% - 28px);
    margin: 14px auto;
    min-height: calc(100dvh - 28px);
  }

  /* nav bar: scrollable horizontally, touch-friendly height */
  .game-win-bar,
  .episode-viewer-bar {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .game-win-bar::-webkit-scrollbar,
  .episode-viewer-bar::-webkit-scrollbar { display: none; }

  .game-win-title,
  .game-win-nav a {
    padding-top: 11px;
    padding-bottom: 11px;
    min-height: 44px;
    white-space: nowrap;
  }

  .game-win-nav {
    flex: 1 0 auto;
  }

  /* content areas */
  .game-win-body {
    padding: 16px 14px 24px;
  }

  .landing {
    position: fixed;
    inset: 0;
    padding: 16px;
    align-items: center;
    justify-content: center;
    min-height: 0;
    height: 100dvh;
    overflow: hidden;
  }

  .landing-card {
    width: min(400px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: hidden;
  }

  .landing-logo {
    margin-bottom: 14px;
  }

  .landing-logo-img {
    width: min(58vw, 190px);
    max-height: 92px;
  }

  /* lists: single column */
  .project-item,
  .concept-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .concept-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .concept-group {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }

  .concept-topic-list li {
    align-items: flex-start;
  }

  .project-status {
    text-align: left;
  }

  .search-row {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .search-label {
    width: 100%;
  }

  .search-input {
    flex-basis: 100%;
    min-height: 28px;
  }

  /* episode viewer */
  .episode-frame {
    width: calc(100% - 28px);
    margin: 0 14px;
  }

  .episode-shell-header {
    margin: 12px 14px 10px;
  }
}

/* ── small phone (≤ 480px) ─────────────────────────────────── */
@media (max-width: 480px) {

  .game-win,
  .episode-viewer {
    width: calc(100% - 20px);
    margin: 10px auto;
    min-height: calc(100dvh - 20px);
  }

  /* landing card */
  .landing-card-body {
    padding: 18px 16px 16px;
  }

  .landing-logo-img {
    width: min(52vw, 170px);
    max-height: 82px;
  }

  .landing-sub {
    font-size: 9px;
    overflow-wrap: anywhere;
  }

  .landing-sep {
    margin: 0 -16px 14px;
  }

  .landing-title {
    font-size: 15px;
  }

  /* concept groups go full width */
  .concept-group {
    flex: 1 1 100%;
  }

  .concept-groups {
    gap: 6px;
  }

  .concept-topic-list li {
    flex-direction: column;
    gap: 0;
  }

  /* tighter concept list rows */
  .concept-item {
    padding: 7px 4px;
  }

  .concept-item-meta {
    font-size: 9px;
  }

  /* episode header */
  .episode-shell-header {
    margin: 10px 10px 8px;
    padding: 8px 10px;
  }

  .episode-frame {
    width: calc(100% - 20px);
    margin: 0 10px;
  }

  .episode-error {
    padding: 10px 14px;
  }
}
