:root {
  --bg-dark: #120e0a;
  --bg-panel: #1e1710;
  --bg-card: #281f15;
  --stone-light: #a39581;
  --stone-mid: #6e6252;
  --stone-dark: #3d352b;
  --accent-amber: #ffae00;
  --accent-orange: #ff5e1a;
  --accent-green: #4cd964;
  --accent-red: #ff3b30;
  --text-main: #f7efe2;
  --text-muted: #b8a993;
  --pixel-font: 'Press Start 2P', 'DungGeunMo', monospace;
  --body-font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@font-face {
  font-family: 'DungGeunMo';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/DungGeunMo.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(255, 136, 0, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 75%, rgba(255, 68, 0, 0.07) 0%, transparent 50%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0px, rgba(0,0,0,0.18) 1px, transparent 1px, transparent 4px);
  color: var(--text-main);
  font-family: var(--body-font);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header / Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 14, 10, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--stone-dark);
  padding: 0.75rem 1.5rem;
}

.nav-container {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--accent-amber);
  font-family: var(--pixel-font);
  font-size: 1.3rem;
  text-shadow: 2px 2px 0 #000;
}

.brand-badge {
  background: var(--accent-orange);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 2px solid #000;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  font-family: var(--pixel-font);
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--accent-amber);
}

/* Hero & Game Section */
.arcade-section {
  max-width: 1160px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-banner {
  text-align: center;
  margin-bottom: 1.25rem;
}

.hero-tag {
  display: inline-block;
  font-family: var(--pixel-font);
  background: #2f2316;
  color: var(--accent-amber);
  border: 2px solid var(--stone-mid);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-family: var(--pixel-font);
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  color: var(--accent-amber);
  text-shadow: 4px 4px 0 #000, -2px -2px 0 #5b2c06;
  margin-bottom: 0.4rem;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 640px;
  margin: 0 auto;
}

/* Arcade Cabinet Frame */
.cabinet-frame {
  width: 100%;
  max-width: 960px;
  background: linear-gradient(180deg, #3b2f23 0%, #241b13 100%);
  border: 6px solid var(--stone-mid);
  border-radius: 14px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.8),
    inset 0 2px 0 rgba(255, 255, 255, 0.15),
    0 0 0 4px #000;
  padding: 1rem;
  position: relative;
}

.cabinet-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: #140f0a;
  border: 2px solid var(--stone-dark);
  border-radius: 8px;
  font-family: var(--pixel-font);
}

.cabinet-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--accent-amber);
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-green);
}

.cabinet-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.retro-btn {
  font-family: var(--pixel-font);
  font-size: 0.8rem;
  background: #33271b;
  color: var(--text-main);
  border: 2px solid var(--stone-light);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  box-shadow: 0 3px 0 #000;
}

.retro-btn:hover {
  background: var(--accent-orange);
  color: #fff;
  border-color: #fff;
}

.retro-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000;
}

.retro-btn.active {
  background: var(--accent-amber);
  color: #000;
  border-color: #fff;
}

/* Screen & CRT Overlay */
.screen-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 4px solid #0e0a07;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.9);
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.crt-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.28) 50%),
    radial-gradient(circle at center, transparent 65%, rgba(0, 0, 0, 0.55) 100%);
  background-size: 100% 4px, 100% 100%;
  z-index: 5;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.crt-overlay.hidden {
  opacity: 0;
}

/* Quick Controls Strip */
.controls-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.9rem;
  background: #17120c;
  border: 2px solid var(--stone-dark);
  border-radius: 8px;
  font-family: var(--pixel-font);
  font-size: 0.8rem;
}

.key-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

kbd {
  background: #3a2f23;
  color: var(--accent-amber);
  border: 2px solid var(--stone-light);
  border-bottom-width: 4px;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-family: var(--pixel-font);
  font-size: 0.75rem;
}

/* Touch Controls for Mobile / Tablet */
.touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.9rem;
  padding: 0.5rem;
  user-select: none;
  -webkit-user-select: none;
}

.dpad-group, .action-group {
  display: flex;
  gap: 0.6rem;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: #33271a;
  border: 3px solid var(--stone-light);
  color: var(--accent-amber);
  font-family: var(--pixel-font);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #000;
  touch-action: manipulation;
  cursor: pointer;
}

.touch-btn:active {
  transform: translateY(3px);
  background: var(--accent-orange);
  color: #fff;
}

.touch-btn.action-club {
  background: #6b2414;
  border-color: #ff7b54;
  color: #fff;
}

.touch-btn.action-jump {
  background: #1f4e29;
  border-color: #65d67c;
  color: #fff;
}

.touch-btn.action-axe {
  background: #5a4214;
  border-color: #ffd166;
  color: #fff;
}

@media (max-width: 820px) {
  .touch-controls {
    display: flex;
  }
}

/* Info Sections */
.content-container {
  max-width: 1160px;
  margin: 0 auto 4rem;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.section-title {
  font-family: var(--pixel-font);
  font-size: 1.5rem;
  color: var(--accent-amber);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-shadow: 2px 2px 0 #000;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.stone-card {
  background: var(--bg-card);
  border: 3px solid var(--stone-dark);
  border-radius: 10px;
  padding: 1.35rem;
  box-shadow: 0 6px 0 #0b0806;
  transition: transform 0.15s, border-color 0.15s;
}

.stone-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-amber);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.65rem;
  display: inline-block;
}

.stone-card h3 {
  font-family: var(--pixel-font);
  font-size: 1.05rem;
  color: var(--accent-amber);
  margin-bottom: 0.5rem;
}

.stone-card p {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.mini-badge {
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: #18120c;
  border: 1px solid var(--stone-mid);
  border-radius: 4px;
  color: var(--text-main);
}

/* Stage Selector Cards */
.stage-selector-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Footer */
.site-footer {
  background: #0d0a07;
  border-top: 3px solid var(--stone-dark);
  padding: 2rem 1.25rem;
  text-align: center;
  font-family: var(--pixel-font);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--accent-amber);
  text-decoration: none;
}

/* The cabinet is framed like a carved stone tablet, with the artwork as its marquee. */
:root {
  --bg-dark: #17120f;
  --bg-panel: #30271f;
  --bg-card: #302820;
  --stone-light: #c6ae8c;
  --stone-mid: #81705e;
  --stone-dark: #4b4035;
  --accent-amber: #ffce69;
  --accent-orange: #e77b39;
  --text-main: #fff1d2;
  --text-muted: #c7b8a1;
}
body {
  background: radial-gradient(ellipse at 50% 0, #493023 0, #211915 34%, #15110e 75%);
}
.site-header {
  position: relative;
  background: #17120f;
  border-bottom: 1px solid #67523d;
  padding-block: 1rem;
}
.nav-container, .arcade-section, .content-container { max-width: 1240px; }
.brand { color: #f9d593; font-size: 1.1rem; letter-spacing: -.04em; }
.brand small { font-size: .56em; color: #b99a77; letter-spacing: .05em; }
.brand-badge { background: #4d3727; color: #f2c784; font-size: .55rem; border-color: #8e684b; border-radius: 0; }
.nav-links a { font-family: var(--body-font); font-weight: 700; font-size: .88rem; color: #d9cab3; }
.nav-links a:hover { color: #ffd27b; }
.arcade-section { margin-top: 1.4rem; }
.hero-banner {
  width: 100%;
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  padding: clamp(2rem, 5vw, 4rem);
  margin-bottom: 2.1rem;
  background: linear-gradient(90deg, rgba(25, 15, 17, .97) 0%, rgba(31, 18, 19, .85) 29%, rgba(31, 18, 19, .15) 70%), url('../assets/hero_banner.png') center / cover no-repeat;
  border: 4px solid #846849;
  box-shadow: 0 0 0 3px #1b130e, 0 15px 0 #0e0b09;
}
.hero-tag, .card-number {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #ffd182;
  font-family: var(--pixel-font);
  font-size: .58rem;
  line-height: 1.8;
  letter-spacing: .06em;
}
.hero-title {
  max-width: 550px;
  margin: .75rem 0;
  font-family: 'DungGeunMo', var(--body-font);
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  letter-spacing: -.04em;
  color: #ffe0a0;
  text-shadow: 4px 4px 0 #532b1b, 7px 7px 0 #1a1010;
}
.hero-title span {
  display: block;
  margin-top: .7rem;
  font-family: var(--pixel-font);
  font-size: clamp(.65rem, 1.6vw, 1rem);
  line-height: 1.5;
  letter-spacing: 0;
  color: #fff0d4;
  text-shadow: 2px 2px #291711;
}
.hero-subtitle { max-width: 410px; margin: 0; color: #f2e3ca; font-size: .98rem; }
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.35rem;
  padding: .65rem 1rem;
  border: 2px solid #f4c37b;
  background: #a64425;
  color: #fff2d3;
  box-shadow: 0 4px 0 #401c16;
  font-weight: 800;
  text-decoration: none;
}
.hero-cta:hover { background: #c45b2b; }
.cabinet-frame {
  max-width: 1100px;
  padding: clamp(.65rem, 2vw, 1.3rem);
  border: 4px solid #8f7a60;
  border-radius: 4px;
  background: linear-gradient(135deg, #64513f, #352920 45%, #51402f);
  box-shadow: inset 0 0 0 3px #30251d, 0 0 0 4px #1a130f, 0 24px 50px #0009;
}
.cabinet-topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .7rem 1rem;
  padding: .9rem;
  background: #211a16;
  border-color: #75614e;
  border-radius: 0;
}
.cabinet-status { grid-column: 1 / -1; font-size: .58rem; letter-spacing: .08em; }
.status-dot { width: 8px; height: 8px; border-radius: 0; background: #a9d274; box-shadow: 0 0 8px #a9d274; }
.stage-selector-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.hero-selector-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}
.hero-btn {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .45rem .65rem;
  text-align: left;
  background: linear-gradient(145deg, #2d231b, #1d1611);
  border: 2px solid #6e5b49;
}
.hero-btn.active {
  background: linear-gradient(145deg, #52381c, #332110);
  border-color: #ffd27b;
  color: #fff5dd;
  box-shadow: inset 0 0 0 1px #ffd27b, 0 3px 0 #000;
}
.hero-mini-icon {
  width: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  flex-shrink: 0;
  background: rgba(15, 11, 8, 0.65);
  border: 1px solid #594839;
}
.hero-btn-info {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  min-width: 0;
}
.hero-btn-info span {
  font: .44rem/1.3 var(--pixel-font);
  color: #64f5ff;
}
.hero-btn-info strong {
  font-size: .86rem;
  color: #ffe29e;
}
.hero-btn-info small {
  font-size: .72rem;
  color: #d6c5ad;
}
.touch-btn.action-dash {
  background: #17495c;
  border-color: #64f5ff;
  color: #fff;
}
.retro-btn { border-radius: 0; font-family: 'DungGeunMo', var(--body-font); font-size: .82rem; }
.stage-btn {
  position: relative;
  min-height: 70px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: .15rem;
  padding: .5rem .65rem;
  color: #fff5dd;
  text-align: left;
  border: 2px solid #75614e;
  background-position: center;
  background-size: cover;
  text-shadow: 1px 2px 2px #000;
}
.stage-btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, #130d0de8, #130d0d22); }
.stage-btn span, .stage-btn strong { position: relative; z-index: 1; }
.stage-btn span { color: #ffd28b; font: .48rem/1.5 var(--pixel-font); }
.stage-btn strong { font-size: .88rem; }
.stage-jungle { background-image: url('../assets/bg_jungle.png'); }
.stage-cave { background-image: url('../assets/bg_cave.png'); }
.stage-boss { background-image: url('../assets/bg_boss.png'); }
.stage-btn.active, .stage-btn:hover { color: #fff5dd; border-color: #ffd27b; }
.stage-btn.active::after { content: ''; position: absolute; inset: 2px; border: 1px solid #ffd27b; pointer-events: none; }
.cabinet-actions { align-content: center; max-width: 270px; gap: .4rem; }
.cabinet-actions .retro-btn { flex: 1 1 46%; padding: .42rem .5rem; }
.screen-wrapper { border-width: 6px; border-radius: 2px; box-shadow: 0 0 0 2px #958066, inset 0 0 30px #000; }
.controls-strip { border-radius: 0; border-color: #6a5847; color: #ddcdb3; font-family: 'DungGeunMo', var(--body-font); font-size: .8rem; }
kbd { border-radius: 0; font-size: .55rem; }
.touch-btn { border-radius: 4px; }
.content-container { gap: 4rem; margin-top: 3rem; }
.section-title { font-family: 'DungGeunMo', var(--body-font); font-size: clamp(1.6rem, 3vw, 2.2rem); color: #f2d29d; }
.section-title::before { content: ''; width: 9px; height: 1.1em; background: #d78b46; box-shadow: 3px 3px #57351e; }
.stone-card {
  border: 2px solid #665644;
  border-top: 4px solid #9c876a;
  border-radius: 2px;
  background: linear-gradient(140deg, #3d332a, #2b241f 70%);
  box-shadow: 0 6px 0 #100d0b;
}
.stone-card h3 { font-family: 'DungGeunMo', var(--body-font); font-size: 1.16rem; color: #f2d29d; }
.stone-card p { line-height: 1.7; }
.card-number { display: block; margin-bottom: 1rem; color: #d79d62; }
.bestiary-icon { display: block; width: 96px; height: 96px; margin: 0 0 .7rem; image-rendering: pixelated; }
.mini-badge { border-radius: 0; font-family: 'DungGeunMo', var(--body-font); font-size: .73rem; color: #ead8bd; }
.site-footer { font-family: 'DungGeunMo', var(--body-font); border-color: #514235; }
a:focus-visible, button:focus-visible { outline: 3px solid #ffde8d; outline-offset: 3px; }
@media (max-width: 820px) {
  .nav-container { justify-content: center; }
  .nav-links { justify-content: center; flex-wrap: wrap; gap: .7rem 1rem; }
  .hero-banner { min-height: 360px; background-position: 57% center; }
  .cabinet-topbar { grid-template-columns: 1fr; }
  .cabinet-actions { max-width: none; }
}
@media (max-width: 520px) {
  .hero-banner { min-height: 330px; padding: 1.4rem; background-image: linear-gradient(90deg, rgba(25, 15, 17, .97) 0%, rgba(31, 18, 19, .9) 55%, rgba(31, 18, 19, .48) 100%), url('../assets/hero_banner.png'); background-position: 55% center; }
  .hero-title { font-size: 3.2rem; }
  .hero-subtitle { font-size: .88rem; }
  .stage-btn { min-height: 64px; padding: .35rem; }
  .stage-btn span { font-size: .4rem; }
  .stage-btn strong { font-size: .72rem; }
  .touch-controls { gap: .35rem; padding: .25rem 0; }
  .dpad-group, .action-group { gap: .3rem; }
  .touch-btn { width: 48px; height: 48px; font-size: .65rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
.stage-btn.stage-jungle { background-image: url('../assets/bg_jungle.png'); }
.stage-btn.stage-cave { background-image: url('../assets/bg_cave.png'); }
.stage-btn.stage-boss { background-image: url('../assets/bg_boss.png'); }

/* 8-Stage Expansion Thumbnail Backgrounds */
.stage-btn.stage-jungle { background-image: url('../assets/bg_jungle.png'); }
.stage-btn.stage-swamp { background-image: url('../assets/bg_swamp.png'); }
.stage-btn.stage-cave { background-image: url('../assets/bg_cave.png'); }
.stage-btn.stage-ice { background-image: url('../assets/bg_ice.png'); }
.stage-btn.stage-desert { background-image: url('../assets/bg_desert.png'); }
.stage-btn.stage-volcano { background-image: url('../assets/bg_volcano.png'); }
.stage-btn.stage-sky { background-image: url('../assets/bg_sky.png'); }
.stage-btn.stage-boss { background-image: url('../assets/bg_boss.png'); }

/* World Map Banner & Pixel Item Showcase Strip */
.world-map-banner {
  margin-bottom: 1.5rem;
  border: 4px solid #846849;
  box-shadow: 0 0 0 3px #1b130e, 0 10px 0 #0e0b09;
  background: #17120f;
  overflow: hidden;
}

.world-map-banner img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.item-showcase-box {
  margin-top: 1.5rem;
  padding: 1.35rem;
  border: 2px solid #665644;
  border-top: 4px solid #9c876a;
  background: linear-gradient(140deg, #352b22, #241d17 75%);
  box-shadow: 0 6px 0 #100d0b;
}

.item-showcase-box h3 {
  font-family: 'DungGeunMo', var(--body-font);
  color: #f2d29d;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.item-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.75rem;
}

.item-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  background: #1d1611;
  border: 1px solid #675544;
  font-family: 'DungGeunMo', var(--body-font);
  font-size: 0.82rem;
  color: #f0dfbe;
}

.item-chip canvas {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

@media (max-width: 820px) {
  .hero-selector-bar,
  .stage-selector-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
