@font-face {
  font-family: "DungGeunMo";
  src: url("../assets/fonts/DungGeunMo.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #f7f1d0;
  --muted: #b8b29a;
  --panel: rgba(24, 24, 22, 0.88);
  --panel-strong: rgba(13, 14, 18, 0.94);
  --line: #4d463b;
  --accent: #ffd34d;
  --danger: #ff5f5f;
  --green: #76e07d;
  --blue: #6ab7ff;
  --font-ui: "DungGeunMo", "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111318;
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.22;
  image-rendering: pixelated;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#app,
.screen {
  position: fixed;
  inset: 0;
}

.boot-intro-screen {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;
  place-items: center;
  background: #000000;
  color: #ffffff;
  text-align: center;
  pointer-events: auto;
}

.boot-intro-screen.active {
  display: grid;
}

.boot-intro-copy {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 24px;
}

.boot-intro-copy strong {
  font-size: clamp(1.35rem, 4.6vw, 2.4rem);
  font-weight: 850;
}

.boot-intro-copy span {
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.86rem, 2.8vw, 1.18rem);
  font-weight: 650;
}

.boot-fullscreen-button {
  min-width: 156px;
  min-height: 48px;
  margin-top: 8px;
  border: 2px solid rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0;
}

.boot-fullscreen-button:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.18);
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  place-items: center;
  background: #000000;
  opacity: 1;
  pointer-events: auto;
  animation: splashBackdropFade 3.45s ease-in-out forwards;
}

.splash-screen.active {
  display: grid;
}

.splash-screen.done {
  display: none;
}

.splash-logo {
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  image-rendering: pixelated;
  opacity: 0;
  animation: splashLogoHold 3.45s ease-in-out forwards;
}

@keyframes splashBackdropFade {
  0% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes splashLogoHold {
  0% {
    opacity: 0;
    filter: brightness(1.08);
  }
  18% {
    opacity: 1;
  }
  58% {
    opacity: 1;
    filter: brightness(1);
  }
  100% {
    opacity: 0;
    filter: brightness(0.96);
  }
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hidden {
  display: none !important;
}

.menu-screen {
  display: none;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.045), transparent 34%),
    linear-gradient(#030303, #090909 56%, #020202);
}

.menu-screen.active {
  display: grid;
}

#mainScreen {
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.48) 100%),
    url("../assets/menu/main-bg.jpg") center center / cover no-repeat;
}

.menu-panel {
  width: min(620px, 92vw);
  padding: clamp(18px, 4.4vw, 38px);
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 0.96;
}

h1 {
  color: #ffffff;
  font-size: clamp(3rem, 9vw, 6.7rem);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.12), 0 4px 0 #000;
}

h2 {
  font-size: clamp(2rem, 7vw, 3.8rem);
}

.menu-copy {
  margin: 18px auto 22px;
  max-width: 38rem;
  color: var(--muted);
  line-height: 1.6;
  word-break: keep-all;
}

.small-copy {
  margin: 14px 0 0;
  color: #8d918b;
  font-size: 0.86rem;
}

.title-menu {
  display: grid;
  width: min(260px, 70vw);
  gap: 9px;
  margin: clamp(22px, 5.8vh, 42px) auto 0;
}

.title-menu-button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  background: rgba(4, 5, 7, 0.58);
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(0.82rem, 1.7vw, 0.94rem);
  font-weight: 800;
  letter-spacing: 0;
}

.title-menu-button:active {
  transform: translateY(1px);
  background: rgba(7, 8, 11, 0.74);
}

.main-icon-button {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(10, 11, 13, 0.7);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.38);
}

.main-fullscreen-button {
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
}

.fullscreen-corner-icon,
.fullscreen-corner-icon::before,
.fullscreen-corner-icon::after {
  display: block;
  width: 18px;
  height: 18px;
}

.fullscreen-corner-icon {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-left-color: transparent;
  border-bottom-color: transparent;
}

.fullscreen-corner-icon::before,
.fullscreen-corner-icon::after {
  content: "";
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.86);
}

.fullscreen-corner-icon::before {
  right: 10px;
  top: 10px;
  border-right-color: transparent;
  border-top-color: transparent;
}

.fullscreen-corner-icon::after {
  display: none;
}

.main-build-meta {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  gap: 2px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-align: left;
}

.main-build-meta strong {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
}

.codex-panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.58);
}

.codex-panel.active {
  display: grid;
}

.codex-window {
  width: min(900px, 94vw);
  height: min(620px, 88vh);
  max-height: min(620px, 88vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 13, 15, 0.96);
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.codex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.codex-header strong {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 900;
}

.codex-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.codex-tab {
  min-height: 36px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
  font-weight: 900;
}

.codex-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.codex-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1.05fr) minmax(240px, 0.95fr);
  overflow: hidden;
}

.codex-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.codex-entry {
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  touch-action: manipulation;
}

.codex-entry.active {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.12);
}

.codex-icon-canvas {
  width: 46px;
  height: 46px;
  display: block;
  border: 2px solid rgba(0, 0, 0, 0.42);
  background: var(--codex-color, #d6b48c);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 0 rgba(0, 0, 0, 0.28);
  image-rendering: pixelated;
}

.codex-info {
  min-height: 0;
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  text-align: left;
}

.codex-info span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
}

.codex-info h2 {
  margin-top: 8px;
  color: #ffffff;
  font-size: clamp(1.25rem, 3.2vw, 2rem);
}

.codex-info p {
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.58;
  word-break: keep-all;
}

#codexInfoStats {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.82rem;
}

.codex-weapon-details {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid rgba(247, 241, 208, 0.12);
}

.codex-weapon-details .weapon-action-buttons {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.codex-weapon-details .weapon-action-content {
  max-height: 280px;
}

@media (max-width: 760px) {
  .codex-body {
    grid-template-columns: 1fr;
  }

  .codex-grid {
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.main-return-row {
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-width: 132px;
  min-height: 48px;
  padding: 12px 18px;
  border: 3px solid #1c1c1c;
  border-radius: 6px;
  box-shadow: 0 5px 0 #111;
  font-weight: 900;
}

.primary-button {
  background: var(--accent);
  color: #1e1807;
}

.secondary-button {
  background: #2e343b;
}

.main-return-button {
  min-width: min(100%, 280px);
}

.primary-button:active,
.secondary-button:active,
.round-button:active,
.mode-button:active,
.small-hud-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #111;
}
