@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400&display=swap');

@font-face {
  font-family: 'Terminalia';
  src: url('./Terminalia-Regular.woff2') format('woff2'),
       url('./Terminalia-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* Terminalia lacks glyphs for typographic quotes/ellipsis (renders them blank).
   Serve just those codepoints from a system font so titles like «...» / "..." show. */
@font-face {
  font-family: 'Terminalia';
  src: local('Segoe UI'), local('Arial'), local('DejaVu Sans');
  font-weight: normal;
  font-style: normal;
  unicode-range: U+00AB, U+00BB, U+2013-201F, U+2026, U+2032, U+2033;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Terminalia', 'Noto Sans JP', sans-serif;
  background-color: #000;
  overflow: hidden;
}

.abs-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  max-width: none;
  z-index: 0;
  transition: filter 0.2s ease;
}

.tabs-row .tab:first-child .abs-bg {
  object-position: right center !important;
}

.tabs-row .tab:last-child .abs-bg {
  object-position: right center !important;
}

.bottom-nav .nav-btn:first-child .abs-bg {
  object-position: right center !important;
}

.bottom-nav .nav-btn:last-child .abs-bg {
  object-position: right center !important;
}

.background-layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.bg-color {
  position: absolute;
  inset: 0;
  background-color: black;
}

.bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.55) 50%,
    rgba(0, 0, 0, 0.7) 100%
  );
}

.bg-dots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
}

.skull-flicker {
  animation: diode-blink 4s infinite;
}

@keyframes diode-blink {
  0%, 100% { filter: brightness(1) saturate(1); }
  3% { filter: brightness(1.5) saturate(1.8) contrast(1.2); }
  6% { filter: brightness(0.8) saturate(0.8); }
  9% { filter: brightness(1.8) saturate(2) contrast(1.3); }
  12% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1) saturate(1); }
  52% { filter: brightness(1.4) saturate(1.5); }
  54% { filter: brightness(1) saturate(1); }
}

.left-overlay-image {
  position: absolute;
  left: 0;
  top: -92px;
  width: 600px;
  height: 1200px;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.terminal-scroll {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: scroll-up 15s steps(80, end) infinite;
  mix-blend-mode: plus-lighter;
  opacity: 0.48;
}

.terminal-scroll img {
  width: 100%;
  height: 1200px;
  object-fit: cover;
  max-width: none;
}

@keyframes scroll-up {
  0% { transform: translateY(0); }
  100% { transform: translateY(-1200px); }
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  padding: 40px;
  gap: 40px;
  align-items: stretch;
  position: relative;
  z-index: 3;
}

.left-column {
  display: flex;
  flex-direction: column;
  width: 584px;
  flex-shrink: 0;
  position: relative;
}

.tabs-row {
  display: flex;
  gap: 8px;
  width: 100%;
  height: 50px;
  flex-shrink: 0;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.tab:not(.glitch-btn):hover { transform: scale(1.03); }
.tab:not(.glitch-btn):hover .abs-bg { filter: brightness(1.3) contrast(1.2); }
.tab:not(.glitch-btn):active { transform: scale(0.98); }

.inactive-tab {
  opacity: 0.5;
}

.tab-text {
  position: relative;
  font-size: 40px;
  color: black;
  z-index: 1;
  line-height: normal;
}

/* Блок со списком */
.list-container {
  width: 100%;
  background-color: rgba(17, 17, 17, 0.5);
  border: 3px solid white;
  border-bottom: none;
  flex-shrink: 0;
}

.list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
}

.list-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.list-item:hover { transform: scale(1.03); }
.list-item:hover .abs-bg { filter: brightness(1.3) contrast(1.2); }
.list-item:active { transform: scale(0.98); }

.active-item {
  min-height: 40px;
}

.inactive-item {
  height: 40px;
  opacity: 0.5;
}

.item-text-box {
  position: relative;
  z-index: 1;
  padding: 0 8px;
  width: 100%;
}

.item-text-box p {
  font-size: 32px;
  color: black;
  line-height: normal;
}

.media-preview {
  position: relative;
  width: 100%;
  height: 332px;
  flex-shrink: 0;
  border: 3px solid white;
}

.spacer-flex {
  flex: 1;
  min-height: 16px;
}

.bottom-nav {
  display: flex;
  gap: 8px;
  width: 100%;
  height: 50px;
  flex-shrink: 0;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1;
}

.nav-text {
  position: relative;
  font-size: 40px;
  color: black;
  z-index: 1;
}

.right-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: white;
  height: 50px;
  padding: 10px 12px;
  flex-shrink: 0;
  filter: drop-shadow(0px 0px 4.5px rgba(255, 255, 255, 0.25));
}

.panel-title {
  font-size: 40px;
  color: black;
  line-height: normal;
}

.window-controls {
  display: flex;
  gap: 11px;
}

.control-btn {
  position: relative;
  width: 35px;
  height: 35px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
}
.control-btn:hover { filter: brightness(1.25); }
.control-btn:active { transform: scale(0.92); }

/* Maximized: the reading panel expands to fill the whole window */
.app-container.maximized .left-column { display: none; }
.app-container.maximized .right-column {
  position: fixed;
  inset: 0;
  z-index: 15;
  padding: 40px;
  gap: 8px;
  background: rgba(5, 8, 10, 0.95);
}

/* Closed: the reading panel is dismissed until a file is chosen again */
.app-container.panel-closed .right-column { display: none; }

.control-border {
  position: absolute;
  inset: 0;
  border: 1px solid black;
  z-index: 1;
}

.icon-img {
  position: relative;
  z-index: 2;
  width: 25px;
  height: 25px;
}


.content-panel {
  flex: 1;
  position: relative;
  background-color: rgba(17, 17, 17, 0.5);
  border: 3px solid white;
  box-shadow: 0px 0px 9px rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.text-content {
  flex: 1;
  padding: 32px 48px 32px 32px;
  overflow-y: auto;
  color: white;
  text-shadow: 2px 4px 2.2px rgba(0, 0, 0, 0.25);
}

.text-content::-webkit-scrollbar {
  display: none; 
}
.text-content {
  scrollbar-width: none; 
}

.text-h1 {
  font-size: 32px;
  line-height: normal;
  margin: 0;
}

.text-p {
  font-size: 24px;
  line-height: normal;
  margin: 0;
}

.text-gap {
  height: 24px;
}

.text-list {
  font-size: 24px;
  line-height: 1.4;
  margin: 0;
  padding-left: 28px;
  list-style: disc;
}
.text-list li {
  margin-bottom: 12px;
}
/* Unavailable button (MEDIA LIB): glitch out on hover, no navigation */
.glitch-btn {
  cursor: not-allowed;
}
.glitch-btn:hover {
  animation: btn-glitch 0.4s steps(3, end) infinite;
}
.glitch-btn:hover .tab-text,
.glitch-btn:hover .nav-text,
.glitch-btn:hover .button-text {
  animation: txt-glitch 0.4s steps(3, end) infinite;
}
/* Naturalistic signal jitter — monochrome, no rainbow hue shifts */
@keyframes btn-glitch {
  0%, 100% { transform: translate(0, 0);      filter: none; }
  20%      { transform: translate(-1px, 0);   filter: brightness(1.08) contrast(1.08); }
  40%      { transform: translate(1px, -1px); filter: brightness(0.9); }
  60%      { transform: translate(-1px, 1px); filter: brightness(1.04); }
  80%      { transform: translate(1px, 0);    filter: contrast(1.12); }
}
@keyframes txt-glitch {
  0%, 100% { text-shadow: none;                                        opacity: 1; }
  30%      { text-shadow: 1px 0 rgba(255, 255, 255, 0.45), -1px 0 rgba(0, 0, 0, 0.6); opacity: 0.9; }
  60%      { text-shadow: -1px 0 rgba(255, 255, 255, 0.35);            opacity: 0.82; }
}

/* DISCORD (anchor) matches original button look + subtle press feedback */
a.nav-btn {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.1s ease;
}
a.nav-btn:hover { transform: scale(1.03); }
a.nav-btn:hover .abs-bg { filter: brightness(1.3) contrast(1.2); }
a.nav-btn:active { transform: scale(0.98); }

/* Terminal-style file loader: streams over the document while a file "reads" */
.terminal-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  padding: 32px 48px 32px 32px;
  overflow: hidden;
  color: #d6dadd;
  font-family: 'Terminalia', 'Noto Sans JP', monospace;
  font-size: 22px;
  line-height: 1.5;
  text-shadow: 0 0 4px rgba(220, 228, 232, 0.25);
  background: rgba(7, 9, 11, 0.82);
}
.terminal-loader.visible { display: block; }
.terminal-loader.error { background: rgba(11, 8, 9, 0.85); }

.terminal-loader .term-line {
  white-space: pre-wrap;
  word-break: break-word;
}
/* Monochrome by default; red is reserved strictly for read errors */
.terminal-loader .term-warn { color: #9a9ea1; text-shadow: none; }
.terminal-loader .term-error { color: #ff4d5e; text-shadow: 0 0 8px rgba(255, 60, 80, 0.55); }

.term-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  background: #d6dadd;
  vertical-align: -0.15em;
  margin-left: 2px;
  animation: term-blink 0.9s steps(2, start) infinite;
}
.terminal-loader.error .term-cursor { background: #ff4d5e; }
@keyframes term-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Typewriter caret while the lore text types in */
.type-caret {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  background: currentColor;
  vertical-align: -0.15em;
  margin-left: 1px;
  animation: term-blink 0.8s steps(2, start) infinite;
}

/* Persistent "corrupted file" screen (VEXEL) */
.file-error {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.file-error-code {
  font-size: 28px;
  color: #ff4d5e;
  text-shadow: 0 0 8px rgba(255, 60, 80, 0.6);
  margin: 0;
}
.glitch-text {
  font-size: 64px;
  letter-spacing: 4px;
  color: #ff4d5e;
  margin: 0;
  animation: txt-glitch 0.35s steps(2, end) infinite;
}
.corrupt-dump {
  font-family: 'Terminalia', monospace;
  font-size: 18px;
  line-height: 1.45;
  color: #b05560;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  animation: dump-flicker 1.2s steps(3, end) infinite;
}
@keyframes dump-flicker {
  0%, 100% { opacity: 0.8; }
  33% { opacity: 0.45; }
  66% { opacity: 0.95; }
}
.term-error { color: #ff4d5e; }

/* ============================================================
   Mobile adaptation — stack the two columns, let the page
   scroll, and scale the fixed-pixel UI down to the viewport.
   The reading panel keeps its own inner scroll so the file
   menu always stays reachable at the top.
   ============================================================ */
@media (max-width: 900px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  /* Decorative side scroll would cover the menu on a narrow screen */
  .left-overlay-image { display: none; }

  .app-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    padding: 20px 16px;
    gap: 16px;
  }

  .left-column {
    width: 100%;
    flex-shrink: 1;
  }

  /* The reading panel is hidden until a file is tapped; then it slides up as a
     fullscreen overlay above the list and is dismissed with the ✕ control. */
  .right-column { display: none; }
  .app-container.panel-open .right-column {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 20;
    width: auto;
    padding: 20px 16px;
    gap: 8px;
    background: rgba(5, 8, 10, 0.95);
    animation: panel-in 0.18s ease-out;
  }
  .app-container.panel-open .content-panel {
    flex: 1;
    height: auto;
  }
  @keyframes panel-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Panel is already fullscreen on phones, so the expand control is redundant */
  .window-controls .ctrl-max { display: none; }
  /* Bigger touch target for the close control */
  .control-btn { width: 40px; height: 40px; }

  .tabs-row { height: 44px; }
  .tab-text { font-size: 24px; }

  .list-wrapper { padding: 8px; gap: 4px; }
  .item-text-box p { font-size: 22px; }
  .active-item { min-height: 36px; }
  .inactive-item { height: 36px; }

  .media-preview { height: 160px; }

  /* No need to push the nav to the bottom once the layout scrolls */
  .spacer-flex { display: none; }

  .bottom-nav { height: 44px; }
  .nav-text { font-size: 22px; }

  .panel-header {
    height: auto;
    min-height: 44px;
    padding: 8px 10px;
  }
  .panel-title { font-size: 22px; }
  .window-controls { gap: 8px; }

  .text-content { padding: 20px 16px; }
  .text-h1 { font-size: 23px; }
  .text-p { font-size: 18px; }
  .text-gap { height: 18px; }
  .text-list { font-size: 18px; padding-left: 22px; }

  .terminal-loader {
    padding: 20px 16px;
    font-size: 16px;
  }

  .file-error-code { font-size: 20px; }
  .glitch-text { font-size: 40px; }
  .corrupt-dump { font-size: 13px; }
}

@media (max-width: 480px) {
  .tab-text { font-size: 20px; }
  .nav-text { font-size: 18px; }
  .item-text-box p { font-size: 20px; }
  .panel-title { font-size: 20px; }

  .content-panel { height: 58vh; }
  .text-h1 { font-size: 21px; }
  .text-p { font-size: 17px; }
  .text-list { font-size: 17px; }

  .terminal-loader { font-size: 14px; }
  .glitch-text { font-size: 32px; }
  .corrupt-dump { font-size: 11px; }
}
