:root {
  --bg: #05070d;
  --bg-2: #0e1730;
  --panel: #10182b;
  --panel-2: #17254a;
  --card: #0f1118;
  --ink: #fff3d9;
  --muted: #9fb2d9;
  --red: #ff234e;
  --red-dark: #ac0b2a;
  --blue: #2047ff;
  --blue-dark: #0f2076;
  --gold: #ffd53d;
  --gold-dark: #d18400;
  --line: #0b0d14;
  --white: #ffffff;
  --shadow: rgba(0, 0, 0, 0.45);
  --pixel-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55);
  font-family: "Courier New", ui-monospace, monospace;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at top, rgba(255, 35, 78, 0.16), transparent 30%),
    radial-gradient(circle at bottom, rgba(32, 71, 255, 0.14), transparent 40%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.archive-app {
  min-height: 100dvh;
  width: 100%;
  overflow: visible;
}

.boot-screen,
.archive-screen {
  min-height: 100dvh;
  width: min(100%, 700px);
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    clamp(16px, 4vw, 28px)
    max(18px, env(safe-area-inset-bottom));
}

.boot-screen {
  display: grid;
  place-items: center;
  transition: opacity 0.35s steps(3), transform 0.35s steps(3);
}

.boot-screen.is-leaving {
  opacity: 0;
  transform: scale(1.02);
}

.boot-shell {
  position: relative;
  width: min(100%, 580px);
}

.boot-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.12) 0 2px,
      transparent 2px 4px
    );
  mix-blend-mode: screen;
  animation: scanMove 6s linear infinite;
}

.boot-panel {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--line);
  padding: clamp(20px, 4vw, 32px);
  background:
    linear-gradient(180deg, rgba(255, 35, 78, 0.08), rgba(32, 71, 255, 0.08)),
    linear-gradient(180deg, #11182d 0%, #0b1020 100%);
  box-shadow:
    0 0 0 4px var(--gold),
    0 0 0 8px var(--red),
    12px 12px 0 rgba(0, 0, 0, 0.48);
  text-align: center;
}

.boot-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(transparent 0 95%, rgba(255, 213, 61, 0.18) 95% 100%);
  background-size: 100% 6px;
  opacity: 0.18;
}

.boot-kicker,
.system-label,
.footer-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.boot-kicker {
  color: var(--gold);
}

.boot-logo {
  display: block;
  width: min(100%, 440px);
  margin: 18px auto 14px;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.35));
}

.boot-subtitle {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.power-button,
.discover-button,
.settings-button,
.settings-window header button,
.settings-window section button,
.settings-list button {
  border: 4px solid var(--line);
  color: var(--line);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--pixel-shadow);
}

.power-button {
  min-width: 180px;
  min-height: 58px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #ffe46a 0%, var(--gold) 56%, var(--gold-dark) 100%);
  font-size: clamp(18px, 4vw, 22px);
  letter-spacing: 0.03em;
}

.power-button:hover {
  filter: brightness(1.04);
}

.power-button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.power-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.boot-sequence {
  margin-top: 22px;
}

.boot-message {
  min-height: 1.8em;
  margin: 0 0 12px;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.loading-track {
  height: 18px;
  padding: 3px;
  border: 4px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.loading-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red) 0%, var(--gold) 50%, var(--blue) 100%);
  transition: width 0.45s steps(10);
}

.boot-hint {
  margin: 18px 0 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  animation: blink 1.2s steps(2) infinite;
}

.archive-screen {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 18px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s steps(2), transform 0.25s steps(2);
}

.archive-screen.is-ready {
  opacity: 1;
  transform: none;
}

.archive-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 4px solid var(--line);
  padding: 14px 14px 12px;
  background:
    linear-gradient(180deg, rgba(255, 35, 78, 0.12), rgba(32, 71, 255, 0.12)),
    linear-gradient(180deg, #10182b 0%, #0d1424 100%);
  box-shadow:
    0 0 0 4px var(--gold),
    8px 8px 0 rgba(0, 0, 0, 0.35);
}

.archive-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.archive-mini-logo {
  width: 86px;
  height: auto;
  flex: 0 0 auto;
  image-rendering: pixelated;
}

.archive-header h1 {
  margin: 5px 0 0;
  color: var(--white);
  font-size: clamp(24px, 7vw, 38px);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

.system-label {
  color: var(--gold);
}

.discovery-stage {
  display: block;
  min-height: 0;
}

.stage-message {
  margin: 0 0 10px;
  text-align: center;
  color: var(--gold);
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 700;
  letter-spacing: 0.08em;
  min-height: 1.4em;
}

.dossier-card {
  position: relative;
  width: min(100%, 460px);
  margin: 0 auto;
  border: 4px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 35, 78, 0.08), rgba(32, 71, 255, 0.05)),
    #1a1320;
  box-shadow:
    0 0 0 4px var(--gold),
    0 0 0 8px var(--red),
    10px 10px 0 rgba(0, 0, 0, 0.38);
  overflow: visible;
}

.dossier-card.is-closed {
  aspect-ratio: 4 / 5;
  min-height: clamp(330px, 90vw, 500px);
}

.dossier-card.is-closed .mystery-card {
  min-height: 100%;
  align-content: center;
  padding: 38px 18px;
}

.card-corners::before,
.card-corners::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--gold);
  border-style: solid;
}

.card-corners::before {
  top: 12px;
  left: 12px;
  border-width: 4px 0 0 4px;
}

.card-corners::after {
  right: 12px;
  bottom: 12px;
  border-width: 0 4px 4px 0;
}

.mystery-card {
  display: grid;
  place-items: center;
  gap: 18px;
  text-align: center;
  font-weight: 700;
  color: var(--ink);
}

.mystery-card p {
  margin: 0;
  font-size: clamp(18px, 5vw, 24px);
  color: var(--white);
}

.mystery-card small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.mystery-sticker {
  position: absolute;
  top: 20px;
  right: 18px;
  border: 3px solid var(--line);
  padding: 5px 7px;
  background: var(--red);
  color: var(--white);
  font-size: 9px;
  line-height: 1;
  transform: rotate(8deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.pixel-folder {
  position: relative;
  width: 98px;
  height: 66px;
  margin: 0 auto;
  border: 4px solid var(--line);
  background: linear-gradient(180deg, #ffe169 0%, #ffc600 100%);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.32);
}

.pixel-folder::before {
  content: "";
  position: absolute;
  width: 34px;
  height: 12px;
  top: -16px;
  left: 8px;
  border: 4px solid var(--line);
  border-bottom: 0;
  background: #ffd53d;
}

.pixel-folder span {
  position: absolute;
  inset: 12px 14px;
  border: 4px solid var(--red);
}

.pixel-folder.empty {
  opacity: 0.55;
}

.photo-card {
  height: auto;
  padding: clamp(12px, 3.5vw, 20px);
}

.photo-frame {
  display: block;
  width: 100%;
  height: auto;
  border: 6px solid var(--line);
  background: #0a0b11;
  box-shadow: inset 0 0 0 4px var(--blue), 4px 4px 0 rgba(0, 0, 0, 0.35);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: min(150vh, 900px);
  object-fit: contain;
  background: #0a0b11;
}

.photo-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding-top: 10px;
  font-size: clamp(9px, 2.5vw, 11px);
  font-weight: 700;
  color: var(--ink);
}

.photo-caption span:last-child {
  color: var(--gold);
}

.discover-button {
  min-height: 58px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #ff5379 0%, var(--red) 60%, var(--red-dark) 100%);
  color: var(--white);
  font-size: clamp(14px, 4vw, 18px);
  letter-spacing: 0.02em;
}

.discover-button:not(:disabled):hover {
  filter: brightness(1.04);
}

.discover-button:not(:disabled):active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.discover-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.button-spark {
  margin-right: 6px;
  color: var(--gold);
}

.footer-note {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
}

.settings-button {
  width: 48px;
  height: 48px;
  padding: 0;
  background: linear-gradient(180deg, #ffe46a 0%, var(--gold) 56%, var(--gold-dark) 100%);
  font-size: 24px;
  flex: 0 0 auto;
}

.settings-button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.favourite-button {
  color: transparent;
  text-shadow:
    -1px -1px 0 var(--line),
    1px -1px 0 var(--line),
    -1px 1px 0 var(--line),
    1px 1px 0 var(--line);
}

.favourite-button.is-active {
  color: var(--red);
  text-shadow: none;
}

.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(4px);
}

.settings-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(100%, 560px);
  height: 100dvh;
  max-height: calc(100dvh - 24px);
  margin: auto;
  border: 4px solid var(--line);
  background: linear-gradient(180deg, #11182d 0%, #0b1020 100%);
  box-shadow:
    0 0 0 4px var(--gold),
    0 0 0 8px var(--red),
    12px 12px 0 rgba(0, 0, 0, 0.45);
}

.settings-window header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 4px solid var(--line);
  background: linear-gradient(180deg, #1c2850 0%, #15203f 100%);
}

.settings-window h2,
.settings-window h3 {
  margin: 0;
  color: var(--white);
}

.settings-window header button,
.settings-window section button,
.settings-list button {
  min-height: 38px;
  background: linear-gradient(180deg, #ffe46a 0%, var(--gold) 56%, var(--gold-dark) 100%);
}

.settings-scroll {
  overflow: auto;
  padding: 16px;
}

.settings-scroll section {
  padding: 14px 0;
  border-bottom: 3px dashed rgba(255, 213, 61, 0.4);
}

.settings-scroll p {
  font-size: 12px;
  color: var(--muted);
}

.settings-scroll input {
  width: 100%;
  margin: 12px 0;
  color: var(--ink);
}

.settings-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.settings-list > div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 3px solid var(--line);
  padding: 5px;
  background: rgba(255, 255, 255, 0.06);
}

.settings-list img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 2px solid var(--gold);
}

.settings-list span {
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
}

.settings-list button {
  min-height: 30px;
  font-size: 10px;
  background: linear-gradient(180deg, #ff5379 0%, var(--red) 60%, var(--red-dark) 100%);
  color: var(--white);
}

.skin-0 { --gold: #ffd53d; --red: #ff234e; }
.skin-1 { --gold: #ffe169; --red: #ff3d68; }
.skin-2 { --gold: #ffcd47; --red: #e52570; }
.skin-3 { --gold: #fddb6f; --red: #ff3156; }

.dossier-card::after {
  content: "CONFIDENTIEL";
  position: absolute;
  right: 12px;
  bottom: 42px;
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: 3px 5px;
  font-size: 9px;
  transform: rotate(-5deg);
  opacity: 0.8;
}

.dossier-card.is-revealing .photo-card {
  animation: reveal 0.48s steps(5);
}

.dossier-card.is-filing .photo-card {
  animation: filing 0.32s steps(3) forwards;
}

.dossier-card.is-searching .mystery-card {
  animation: searching 0.68s steps(4);
}

.dossier-card.is-closed .mystery-card {
  animation: idle 0.9s steps(2) infinite;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: scale(0.55) rotate(-7deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.04) rotate(2deg);
  }
  to {
    transform: none;
  }
}

@keyframes filing {
  to {
    opacity: 0;
    transform: translateX(115%) rotate(12deg) scale(0.8);
  }
}

@keyframes searching {
  50% {
    transform: translateX(7px) rotate(2deg);
  }
}

@keyframes idle {
  50% {
    transform: translateY(-4px);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes scanMove {
  from {
    transform: translateY(-12px);
  }
  to {
    transform: translateY(12px);
  }
}

@media (min-width: 760px) {
  .archive-app {
    max-width: 720px;
    margin: 0 auto;
  }

  .dossier-card {
    max-width: 480px;
  }
}

@media (max-width: 520px) {
  .archive-brand {
    align-items: flex-start;
  }

  .archive-mini-logo {
    width: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* DAZ CONSOLE STARTUP */

.boot-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: #030408;
  overflow: hidden;
  transition: opacity 0.5s ease;
}

.boot-screen.is-leaving {
  opacity: 0;
  transform: none;
  pointer-events: none;
}

.power-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.power-button {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 64px;
  padding: 15px 28px;
  background: #0b1020;
  border: 3px solid #ffd53d;
  color: #ffd53d;
  box-shadow: 0 0 22px #ffd53d30, 6px 6px 0 #000;
  font-size: 19px;
  letter-spacing: 0.1em;
  font-weight: 900;
  cursor: pointer;
  animation: powerPulse 2s ease-in-out infinite;
}

.power-button:hover {
  background: #ffd53d;
  color: #080910;
  box-shadow: 0 0 38px #ffd53d70;
}

.power-button:active {
  transform: scale(0.96);
}

.power-symbol {
  font-family: Arial, sans-serif;
  font-size: 29px;
  line-height: 1;
}

.console-intro {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #030408;
  isolation: isolate;
}

.console-light {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 0;
  height: 2px;
  background: #d7e4ff;
  box-shadow: 0 0 22px 5px #234dff;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.console-intro.is-playing .console-light {
  animation: consoleLine 1.2s ease-in-out forwards;
}

.console-glow {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    #1436ad55 0%,
    #0b164522 26%,
    transparent 60%
  );
  opacity: 0;
}

.console-intro.is-playing .console-glow {
  animation: consoleGlow 3.2s ease-in-out 0.7s both;
}

.console-logo-stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(80vw, 560px);
  max-height: 65dvh;
  opacity: 0;
  transform: scale(0.75);
}

.console-logo {
  display: block;
  width: 100%;
  max-height: 65dvh;
  object-fit: contain;
  image-rendering: auto;
  filter: brightness(1.12) drop-shadow(0 0 22px #152bff55);
}

.console-intro.is-playing .console-logo-stage {
  animation: consoleReveal 2.6s cubic-bezier(.15,.8,.25,1) 0.85s both;
}

.console-status {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(8%, 30px);
  width: min(300px, 75vw);
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
}

.console-intro.is-playing .console-status {
  animation: statusAppear 0.5s ease 2.6s forwards;
}

.console-status .boot-message {
  color: #ffd53d;
  font-size: 11px;
  letter-spacing: 0.13em;
  margin: 0 0 12px;
}

.console-status .loading-track {
  height: 10px;
  border: 2px solid #29418a;
  padding: 2px;
  background: #070b16;
}

.console-status .loading-track span {
  height: 100%;
  background: #ffd53d;
  transition: width 0.35s steps(12);
}

.console-intro.is-finishing {
  animation: consoleExit 0.65s ease-in forwards;
}

@keyframes powerPulse {
  50% { box-shadow: 0 0 32px #ffd53d60, 6px 6px 0 #000; }
}

@keyframes consoleLine {
  0% { width: 0; opacity: 0; }
  25% { width: 12%; opacity: 1; }
  65% { width: 90%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

@keyframes consoleGlow {
  20%, 65% { opacity: 1; }
  100% { opacity: 0.4; }
}

@keyframes consoleReveal {
  0% { opacity: 0; transform: scale(0.75); filter: blur(18px); }
  25% { opacity: 0.8; filter: blur(5px); }
  55% { opacity: 1; transform: scale(1.04); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes statusAppear {
  to { opacity: 1; }
}

@keyframes consoleExit {
  70% { filter: brightness(2); opacity: 1; }
  100% { filter: brightness(3); opacity: 0; transform: scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .console-intro.is-playing .console-light,
  .console-intro.is-playing .console-glow,
  .console-intro.is-playing .console-logo-stage,
  .console-intro.is-playing .console-status,
  .console-intro.is-finishing {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }

  .console-logo-stage,
  .console-status {
    opacity: 1;
  }
}


/* 8-BIT TYPOGRAPHY */

:root {
  --font-pixel: "Press Start 2P", monospace;
}

/* Main titles */
.archive-header h1,
.settings-window h2,
.settings-window h3,
.mystery-card p {
  font-family: var(--font-pixel);
  letter-spacing: 0;
  line-height: 1.5;
}

/* Main buttons */
.power-button,
.discover-button {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: clamp(11px, 2.5vw, 14px);
  line-height: 1.8;
  letter-spacing: 0;
}

/* Secondary buttons */
.settings-window section button,
.settings-list button {
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1.6;
}

/* Specific title sizes */
.archive-header h1 {
  font-size: clamp(14px, 3.5vw, 23px);
  line-height: 1.6;
}

.settings-window h2 {
  font-size: clamp(13px, 3vw, 18px);
}

.settings-window h3 {
  font-size: 11px;
}

.mystery-card p {
  font-size: clamp(12px, 3vw, 16px);
}

/* Small text stays unchanged */
.system-label,
.boot-kicker,
.boot-message,
.boot-subtitle,
.boot-hint,
.stage-message,
.footer-note,
.photo-caption,
.mystery-card small,
.mystery-sticker,
.settings-scroll p,
.settings-list span,
.settings-scroll input {
  font-family: "Courier New", ui-monospace, monospace;
}
