body {
  margin: 0;
  padding: 0;
  background: #2c3e50;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* 전체 앱 컨테이너 */
.app-container {
  width: 390px;
  height: 844px;
  max-width: 100vw;
  max-height: 100vh;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

/* 헤더 스타일 */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 18px;
  font-weight: bold;
  text-decoration: none;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo::before {
  content: "🎮";
  font-size: 20px;
}

.nav-menu {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  color: white;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.3s ease;
  font-size: 12px;
}

.nav-menu a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 메인 컨텐츠 영역 */
.main-content {
  flex: 1;
  position: relative;
  background: #f8f9fa;
  min-height: 0; /* flex 아이템이 줄어들 수 있도록 */
}

#gameContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  background: linear-gradient(to bottom, #87ceeb, #98fb98);
}

/* UI — 중복 정의 제거 및 반투명 배경 유지 */
.ui {
  position: absolute;
  top: 10px;
  left: 10px;
  color: white;
  font-size: 14px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
  border-radius: 5px;
  user-select: none;
  pointer-events: none;
}

/* 푸터 스타일 */
.footer {
  background: #34495e;
  color: #bdc3c7;
  padding: 12px 15px;
  text-align: center;
  flex-shrink: 0;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 10px;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #ecf0f1;
}

.footer-info {
  font-size: 9px;
  color: #95a5a6;
  line-height: 1.2;
}

.footer-info p {
  margin: 2px 0;
}

/* === Bottom Tabbar === */
.footer-nav {
  background: #1f2937; /* 다크 */
  color: #e5e7eb;
  padding: 10px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.tabbar {
  display: flex;
  gap: 12px;
  background: #2b303b;
  padding: 8px 10px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 20px rgba(0, 0, 0, 0.25);
}

.tab {
  appearance: none;
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #9ca3af; /* 비활성 텍스트 */
  min-width: 60px;
  cursor: pointer;
}

.tab .icon {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: #3a3f4a; /* 비활성 아이콘 배경 */
}

.tab .icon svg {
  width: 22px;
  height: 22px;
  color: #cbd5e1;
}
.tab .label {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.2px;
}

.tab:hover {
  color: #e5e7eb;
}
.tab:hover .icon svg {
  color: #e5e7eb;
}

.tab.active {
  color: #111827;
}
.tab.active .icon {
  background: linear-gradient(135deg, #ffd54f, #f59e0b); /* 골드 그라데이션 */
}
.tab.active .icon svg {
  color: #111827; /* 활성 아이콘 컬러 */
}

.tab:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* 모바일에서 전체폭 사용 */
@media (max-width: 480px) {
  .tabbar {
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
  }
  .tab {
    min-width: 54px;
    padding: 6px;
  }
  .tab .icon {
    width: 34px;
    height: 34px;
  }
  .tab .icon svg {
    width: 20px;
    height: 20px;
  }
  .tab .label {
    font-size: 10px;
  }
}

/* 모바일에서는 전체 화면 */
@media (max-width: 480px) {
  body {
    align-items: stretch;
  }

  .app-container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ===================== */
/*  Sleek Bottom Tabbar  */
/* ===================== */

:root {
  --bar-bg: rgba(17, 24, 39, 0.72); /* 다크 유리 */
  --bar-border: rgba(255, 255, 255, 0.08);
  --chip: #2c313c; /* 아이콘 원 배경 */
  --chip-border: rgba(255, 255, 255, 0.06);
  --muted: #a7b0bf; /* 비활성 텍스트 */
  --text: #e5e7eb; /* 라벨 기본 */
  --accent1: #ffd54f; /* 활성 그라데이션 */
  --accent2: #f59e0b;
}

/* 기존 텍스트 푸터는 숨김(있다면) */
.footer {
  display: none !important;
}

.footer-nav {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.25));
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

/* 가운데 ‘떠 있는’ 카드형 바 + 블러 */
.tabbar {
  width: min(92%, 420px);
  margin: 6px auto;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--bar-bg);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid var(--bar-border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* 탭 버튼 */
.tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px 4px 4px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  flex: 1;
  min-width: auto;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.15s ease;
}

/* 아이콘 원형 */
.tab .icon {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -6px 12px rgba(0, 0, 0, 0.25);
  position: relative;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

/* 아이콘 벡터 */
.tab .icon svg {
  width: 20px;
  height: 20px;
  color: #cbd5e1;
  transition: color 0.2s ease, transform 0.2s ease;
}

/* 라벨 */
.tab .label {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.2px;
  color: var(--text);
  opacity: 0.75;
  transition: opacity 0.2s ease, color 0.2s ease;
}

/* 호버/프레스 인터랙션 */
.tab:hover .icon {
  transform: translateY(-1px);
}
.tab:active .icon {
  transform: translateY(0) scale(0.97);
}
.tab:hover .icon svg {
  transform: translateY(-0.5px);
}

/* 활성 상태 */
.tab.active {
  color: #111827;
}
.tab.active .icon {
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.tab.active .icon svg {
  color: #1f2937;
}
.tab.active .label {
  opacity: 1;
}

/* 안쪽 얇은 윤곽 링(유광) */
.tab .icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

/* 포커스 접근성 */
.tab:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* 모바일 튜닝 */
@media (max-width: 480px) {
  .tabbar {
    width: min(94%, 360px);
    padding: 8px 10px;
    border-radius: 14px;
  }
  .tab .icon {
    width: 36px;
    height: 36px;
  }
  .tab .icon svg {
    width: 19px;
    height: 19px;
  }
  .tab .label {
    font-size: 10px;
  }
}

/* ===================== */
/*  Gold Skeuomorphic Tabbar  */
/* ===================== */

:root {
  --gold-bg-outer: rgba(17, 10, 4, 0.65);
  --gold-plate-top: #7a4c17;
  --gold-plate-mid: #6a4113;
  --gold-plate-bot: #5a3610;
  --gold-chip1: #fff2c7;
  --gold-chip2: #ffd56e;
  --gold-chip3: #e6a83d;
  --gold-chip-dull: #f7cf6d;
  --gold-stroke: rgba(255, 225, 160, 0.45);
  --gold-inner-stroke: rgba(255, 240, 200, 0.65);
  --gold-text: #fff3cf;
  --gold-text-dim: #efd39b;
  --icon-dark: #3d2808;
}

/* 푸터 영역(안쪽에 플로팅 골드 플레이트를 깔기 위한 베이스) */
.footer-nav.gold {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--gold-bg-outer));
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 플레이트 컨테이너 */
.tabbar.gold {
  width: min(92%, 420px);
  margin: 0;
  padding: 12px 14px;
  background: transparent; /* 실제 배경은 ::before에서 그림 */
  border: 0;
  box-shadow: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  position: relative;
  isolation: isolate;
}

/* 골드 플레이트(입체감) */
.tabbar.gold::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--gold-plate-top) 0%, var(--gold-plate-mid) 42%, var(--gold-plate-bot) 100%);
  box-shadow: inset 0 2px 0 rgba(255, 235, 170, 0.55), /* 상단 하이라이트 */ inset 0 -10px 24px rgba(0, 0, 0, 0.45), /* 하단 음영 */ 0 10px 28px rgba(0, 0, 0, 0.35); /* 외곽 그림자 */
  z-index: 0;
}

/* 탭 버튼(아이콘 위, 라벨 아래) */
.tabbar.gold .tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 4px 6px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--gold-text-dim);
  flex: 1;
  min-width: auto;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease, color 0.2s ease;
}

/* 아이콘 칩(비활성은 무광, 활성은 광택) */
.tabbar.gold .tab .icon {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 30% 30%, #ffefba 0%, var(--gold-chip-dull) 55%, #b57b28 100%);
  border: 1px solid var(--gold-inner-stroke);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -8px 16px rgba(0, 0, 0, 0.22), 0 6px 12px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tabbar.gold .tab .icon svg {
  width: 20px;
  height: 20px;
  color: #5a3a10;
  transition: color 0.2s ease, transform 0.15s ease;
}

.tabbar.gold .tab .label {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.3px;
  color: var(--gold-text-dim);
  text-shadow: 0 1px 0 rgba(90, 50, 10, 0.5);
  font-weight: 600;
  opacity: 0.9;
}

/* 호버/프레스 */
.tabbar.gold .tab:hover .icon {
  transform: translateY(-1px);
}
.tabbar.gold .tab:active .icon {
  transform: translateY(0) scale(0.97);
}

/* 활성 상태 */
.tabbar.gold .tab.active .icon {
  background: radial-gradient(120% 120% at 30% 30%, var(--gold-chip1) 0%, var(--gold-chip2) 55%, var(--gold-chip3) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -10px 18px rgba(0, 0, 0, 0.25), 0 0 0 2px var(--gold-stroke), 0 12px 20px rgba(228, 170, 64, 0.35);
  filter: none;
}
.tabbar.gold .tab.active .icon svg {
  color: var(--icon-dark);
}
.tabbar.gold .tab.active .label {
  color: var(--gold-text);
  opacity: 1;
}

/* 라이트 하이라이트 바(아이콘 아래 얇은 유광) */
.tabbar.gold .tab::after {
  content: "";
  display: block;
  width: 32px;
  height: 6px;
  margin: 4px auto 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0));
  opacity: 0.25;
}

/* 모바일 튜닝 */
@media (max-width: 480px) {
  .tabbar.gold {
    width: min(94%, 360px);
    padding: 10px 10px;
    border-radius: 14px;
  }
  .tabbar.gold::before {
    border-radius: 14px;
  }
  .tabbar.gold .tab .icon {
    width: 36px;
    height: 36px;
  }
  .tabbar.gold .tab .icon svg {
    width: 19px;
    height: 19px;
  }
  .tabbar.gold .tab .label {
    font-size: 10px;
  }
}

/* === Compact gold footer (remove extra top gap) === */
.footer-nav.gold {
  /* 위쪽 여백 제거, 아래는 안전영역 유지 */
  padding: 0px;
}

/* 골드 플레이트 자체의 세로 여백도 살짝 축소 */
.tabbar.gold {
  padding: 0px;
}

/* 버튼 내부도 조금 컴팩트하게 */
.tabbar.gold .tab {
  /* 8px 4px 6px → 6px 4px 4px */
  padding: 6px 4px 4px;
}
.tabbar.gold .tab::after {
  /* 하이라이트 바 간격 축소 */
  margin: 2px auto 0;
}

/* === Footer horizontal gutter control === */
:root {
  --footer-gutter: 12px;
} /* 좌우 여백(px). 0이면 꽉 차게 */

/* 플레이트를 컨테이너 폭에 맞춰 꽉 채우기 */
.tabbar.gold {
  width: 100%; /* ← 92%/420px 제한 제거 */
  margin: 0; /* 좌우 중앙 간격 제거 */
  box-sizing: border-box;
}

/* 아이콘/라벨이 너무 붙으면 gap만 살짝 늘리세요 */
.tabbar.gold {
  gap: 12px;
}

/* 모바일에서 좌우 여백 더 줄이고 싶으면 */
@media (max-width: 480px) {
  :root {
    --footer-gutter: 8px;
  }
}

/* ===== Line Icon Skin for Gold Tabbar ===== */
.footer-nav.gold.line { /* 상단 여백은 이전 설정 유지 */}
.tabbar.gold.line{
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
}
.tabbar.gold.line::before{ border-radius: 14px; }

/* 원판(칩) 배경 제거 → 선형만 보이게 */
.tabbar.gold.line .tab .icon{
  width: 40px; height: 40px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* 선형 아이콘 공통 스타일 */
.tabbar.gold.line .tab .icon svg{
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: inherit; /* 탭의 글자색과 동일 */
}

/* 비활성/활성 색상 */
.tabbar.gold.line .tab{
  color: var(--gold-text-dim);         /* 비활성 라벨/아이콘 */
}
.tabbar.gold.line .tab .label{
  color: currentColor;
  opacity: .85;
}
.tabbar.gold.line .tab.active{
  color: var(--gold-text);             /* 활성 라벨/아이콘 색 */
}
.tabbar.gold.line .tab.active .label{
  opacity: 1;
}

/* 하이라이트 바/글로우 제거(선형 미니멀 룩) */
.tabbar.gold.line .tab::after{ display:none; }

/* 인터랙션 */
.tabbar.gold.line .tab:hover .icon{ transform: translateY(-1px); }
.tabbar.gold.line .tab:active .icon{ transform: translateY(0) scale(.97); }

/* 모바일 튜닝 */
@media (max-width: 480px){
  .tabbar.gold.line{ padding: 8px 10px; }
  .tabbar.gold.line .tab .icon{ width: 36px; height: 36px; }
  .tabbar.gold.line .tab .icon svg{ width: 20px; height: 20px; }
  .tabbar.gold.line .tab .label{ font-size: 10px; }
}
