:root {
  --bg: #0C0F0E;
  --fg: #FFFFFF;
  --accent: #91CFC3;
  --muted: #DEE0C7;
  --panel-bg: #0F1312;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  size-adjust: 92%;
  unicode-range: U+002E,U+0030-003A;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', 'Consolas', 'PingFang SC', monospace;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.48;
  letter-spacing: 1px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Match the main site: a fixed, non-scrolling shell with only the inner
   content area scrolling, instead of a scrolling page with sticky bars.
   Avoids both the WebKit sticky+overflow ghosting bug and mobile mis-sizing
   small text in a genuinely scrolling document. */
body {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.025) 2px, rgba(0,0,0,0.025) 3px,
    rgba(0,0,0,0.05) 3px, rgba(0,0,0,0.05) 4px,
    rgba(0,0,0,0.025) 4px, rgba(0,0,0,0.025) 5px);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid #FFFFFF;
  font-size: 13px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.bottombar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 7px 16px;
  border-top: 1px solid #FFFFFF;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}
.bottombar .nowrap { white-space: nowrap; }

/* Mirrors the main site's fs(13) = 13 - (isMobile?2:0) - (isNarrow?1:0),
   stepped at the same two width thresholds (680px, 410px) it uses. */
@media (max-width: 680px) {
  .bottombar { font-size: 11px; }
}
@media (max-width: 409px) {
  .bottombar { font-size: 10px; }
}

/* The scrolling region: tabs + card/dossier content move together, while
   .topbar and .bottombar (outside this element) stay genuinely fixed. */
.scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  gap: 12px;
  padding: 20px 16px 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.tab-btn {
  background: transparent;
  border: 1px solid #FFFFFF;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0px;
  padding: 8px 16px;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}
.tab-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(145,207,195,0.08); }

@media (hover: hover) {
  .tab-btn:hover { border-color: var(--accent); color: var(--accent); }
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px 16px;
  align-items: stretch;
  flex: 1;
  /* Extra breathing room at the true end of scroll (beyond the grid's own
     padding) so the last dossier box never sits flush against the footer. */
  margin-bottom: 24px;
}

.viewer-pane {
  border: 1px solid #FFFFFF;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.card-canvas {
  width: 100%;
  max-width: 420px;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.card-canvas canvas { display: block; }

.viewer-hint {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

.dossier-pane { display: flex; flex-direction: column; gap: 16px; }

.dossier-box {
  border: 1px solid #FFFFFF;
  background: var(--panel-bg);
  padding: 16px;
}

.dossier-header {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  border-bottom: 1px solid #FFFFFF;
  padding-bottom: 6px;
  margin-bottom: 0;
}

.field {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #FFFFFF;
  font-size: 13px;
}
.field:last-child { border-bottom: none; }
.field .label { color: var(--muted); opacity: 0.75; white-space: nowrap; }
.field .value { text-align: right; }

.bio-placeholder {
  color: #B5675E;
  font-style: italic;
  font-size: 13px;
  padding-top: 12px;
}

.topbar-back { font-size: 12px; }

@keyframes archive-glitch {
  0%, 100% { transform: translateX(0); }
  12% { transform: translateX(-6px); }
  24% { transform: translateX(5px); }
  36% { transform: translateX(-5px); }
  48% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  72% { transform: translateX(4px); }
  84% { transform: translateX(-2px); }
  92% { transform: translateX(2px); }
}
.layout.glitching { animation: archive-glitch 0.4s steps(1, jump-start); }

.corrupt-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(12px);
  background: var(--panel-bg);
  border: 1px solid #B5675E;
  color: #B5675E;
  padding: 10px 20px;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  white-space: nowrap;
}
.corrupt-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 680px) {
  body.is-mobile .layout {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }
  body.is-mobile .viewer-pane,
  body.is-mobile .dossier-pane {
    flex-shrink: 0;
  }
  body.is-mobile .tabs {
    padding: 16px 16px 0;
    gap: 8px;
  }
  body.is-mobile .tab-en { display: none; }
  body.is-mobile .title-en { display: none; }
  body.is-mobile .session-en { display: none; }
  body.is-mobile .name-ko { display: none; }
  body.is-mobile .bottombar {
    padding: 6px 10px;
    gap: 8px;
  }
  body.is-mobile .card-canvas {
    flex: none;
    width: 100%;
    max-width: none;
    aspect-ratio: 4 / 5;
  }
}
