:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1d4ed8;
  --accent-dark: #1e3a8a;
}

* {
  box-sizing: border-box;
}

body.policy-page {
  margin: 0;
  font-family:
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.support-page {
  background: #f1f3f6;
}

.page-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 96px 20px 120px;
}

.page-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

.support-page .page-card {
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  border-top: 3px solid #334155;
}

.page-title {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
}

.section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.section h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.section p,
.section li {
  color: #374151;
  line-height: 1.7;
  font-size: 15px;
}

.placeholder {
  background: #f8fafc;
  border: 1px dashed #cbd5f5;
  padding: 12px 14px;
  border-radius: 10px;
  color: #475569;
  font-size: 14px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 20px 0 8px;
  font-weight: 700;
}

.markdown-body h1 {
  font-size: 22px;
}

.markdown-body h2 {
  font-size: 18px;
}

.markdown-body h3 {
  font-size: 16px;
}

.markdown-body p {
  margin: 8px 0 12px;
  color: #374151;
  line-height: 1.7;
  font-size: 15px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 8px 0 16px 18px;
  color: #374151;
  line-height: 1.7;
  font-size: 15px;
}

.markdown-body code {
  background: #eef2ff;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.page-nav {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 1000;
  display: flex;
  gap: 8px;
}

.page-nav button,
.page-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.08);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.page-nav button:hover,
.page-nav a:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 20px;
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 50;
}

.site-footer .footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
  padding: 0 40px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.footer-links a {
  color: #e2e8f0;
  text-decoration: none;
}

.footer-links a:hover {
  color: #93c5fd;
}

.footer-game-info {
  font-size: 10px;
}

.footer-game-info table {
  border-collapse: collapse;
  width: 100%;
  max-width: 240px;
  table-layout: fixed;
}

.footer-game-info td {
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0;
  width: 33.333%;
  vertical-align: top;
}

.footer-game-info .label {
  font-weight: 700;
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  padding: 2px 3px;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  display: block;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.footer-game-info .value {
  color: #e2e8f0;
  padding: 2px 3px;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  display: block;
  word-wrap: break-word;
}

@media (max-width: 640px) {
  .page-wrap {
    padding: 84px 16px 120px;
  }

  .page-card {
    padding: 22px 18px;
  }

  .footer-game-info table {
    width: 100%;
  }
}

/* Homepage footer override */
body:not(.policy-page):not(.support-page) .site-footer {
  height: 86px;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(205, 220, 255, 0.4);
  background: #06153a;
  color: #e7eeff;
  z-index: 120;
}

body:not(.policy-page):not(.support-page) .site-footer .footer-inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 24px;
  padding: 0;
  flex-wrap: nowrap;
}

body:not(.policy-page):not(.support-page) .footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

body:not(.policy-page):not(.support-page) .footer-links a {
  color: #f5f7ff;
  text-decoration: none;
}

body:not(.policy-page):not(.support-page) .footer-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

body:not(.policy-page):not(.support-page) .footer-game-info {
  font-size: 9px;
}

body:not(.policy-page):not(.support-page) .footer-game-info table {
  width: 210px;
  max-width: 210px;
  table-layout: fixed;
  border-collapse: collapse;
}

body:not(.policy-page):not(.support-page) .footer-game-info td {
  border: 1px solid rgba(171, 190, 232, 0.55);
  padding: 0;
}

body:not(.policy-page):not(.support-page) .footer-game-info .label,
body:not(.policy-page):not(.support-page) .footer-game-info .value {
  font-size: 8px;
  line-height: 1.2;
}

@media (max-width: 1024px) {
  body:not(.policy-page):not(.support-page) .site-footer {
    height: 74px;
    padding: 7px 10px;
  }

  body:not(.policy-page):not(.support-page) .site-footer .footer-inner {
    justify-content: center;
    gap: 10px;
  }

  body:not(.policy-page):not(.support-page) .footer-game-info {
    display: none;
  }

  body:not(.policy-page):not(.support-page) .footer-links {
    font-size: 11px;
    flex-wrap: wrap;
  }
}

/* Legacy-compatible top info bar (based on previous styles.css/mobile.css layout) */
body:not(.policy-page):not(.support-page) #gameSection .user-section {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 360 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body:not(.policy-page):not(.support-page) #gameSection .user-section-content {
  width: 100% !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 5px 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

@media (max-width: 1024px) {
  body:not(.policy-page):not(.support-page) #gameSection .user-section-content {
    justify-content: flex-start !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding: 5px 8px !important;
    gap: 6px !important;
  }

  body:not(.policy-page):not(.support-page)
    #gameSection
    .user-section-content::-webkit-scrollbar {
    display: none;
  }
}

/* Critical state override: defeat legacy duplicate rules in default/portrait/landscape */
body:not(.policy-page):not(.support-page).state-login #loginSection {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body:not(.policy-page):not(.support-page).state-login #gameSection {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

body:not(.policy-page):not(.support-page).state-game #loginSection {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

body:not(.policy-page):not(.support-page).state-game #gameSection {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body:not(.policy-page):not(.support-page).state-game #gameSection .user-section,
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  .user-section-content,
body:not(.policy-page):not(.support-page).state-game #gameSection .game-grid,
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  .card-game-group,
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  .slot-game-group,
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  .card_game_list,
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  .slot_game_list {
  visibility: visible !important;
  opacity: 1 !important;
}

body:not(.policy-page):not(.support-page).state-game #gameSection #userInfo,
body:not(.policy-page):not(.support-page).state-game #gameSection #userMoney,
body:not(.policy-page):not(.support-page).state-game #gameSection #userWallet,
body:not(.policy-page):not(.support-page).state-game #gameSection #depositBtn,
body:not(.policy-page):not(.support-page).state-game #gameSection #withdrawBtn,
body:not(.policy-page):not(.support-page).state-game #gameSection #itemBtn,
body:not(.policy-page):not(.support-page).state-game #gameSection #logoutButton,
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  img[data-kind="6"] {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Slot list layout authority: centered + orientation columns */
body:not(.policy-page):not(.support-page).state-game
  #gameSection
  .slot_game_list {
  display: grid !important;
  margin: 0 auto !important;
  justify-content: center !important;
}

@media (orientation: landscape) {
  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    .slot_game_list {
    grid-template-columns: repeat(5, minmax(0, 304px)) !important;
    gap: 12px !important;
  }
}

@media (orientation: portrait) {
  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    .user-section {
    height: auto !important;
    min-height: 86px !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    .user-section-content {
    width: 100% !important;
    max-width: 1200px !important;
    display: grid !important;
    grid-template-columns: 98px minmax(110px, 1fr) minmax(110px, 1fr) minmax(
        110px,
        1fr
      ) !important;
    grid-template-rows: 34px 34px !important;
    align-items: center !important;
    gap: 4px 6px !important;
    padding: 4px 8px !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    .user-section-content
    > * {
    min-width: 0;
  }

  body:not(.policy-page):not(.support-page).state-game #gameSection #userInfo {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    height: 32px !important;
    font-size: 11px !important;
    padding: 0 8px !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #userInfo
    .user-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  body:not(.policy-page):not(.support-page).state-game #gameSection #userMoney {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 6px !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #userWallet {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 6px !important;
  }

  body:not(.policy-page):not(.support-page).state-game #gameSection #itemBtn {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    justify-self: start;
    width: 98px !important;
    height: 34px !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #logoutButton {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    justify-self: start;
    width: 98px !important;
    height: 34px !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #depositBtn {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
    justify-self: start;
    width: 52px !important;
    height: 26px !important;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #withdrawBtn {
    grid-column: 4 / 5;
    grid-row: 2 / 3;
    justify-self: start;
    width: 52px !important;
    height: 26px !important;
  }

  body:not(.policy-page):not(.support-page).state-game #gameSection #depositBtn,
  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #withdrawBtn,
  body:not(.policy-page):not(.support-page).state-game #gameSection #itemBtn,
  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    #logoutButton {
    margin: 0 !important;
    padding: 0 !important;
    align-self: center;
  }

  body:not(.policy-page):not(.support-page).state-game
    #gameSection
    .slot_game_list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 760px !important;
    gap: 10px !important;
  }
}

/* FullHD baseline correction (현재 대비 25% 축소) */
@media (orientation: landscape) and (min-width: 1025px) {
  :root {
    --home-header-bar-h: 42px;
    --home-header-strip-h: 18px;
    --home-header-total-h: 255px;
    --home-footer-h: 65px;
  }

  body:not(.policy-page):not(.support-page) #gameSection .user-section-content,
  body:not(.policy-page):not(.support-page) #gameSection .game-grid,
  body:not(.policy-page):not(.support-page) #loginSection .login-layout {
    transform: scale(0.75);
    transform-origin: top center;
  }

  body:not(.policy-page):not(.support-page) #gameSection .slot_game_list {
    grid-template-columns: repeat(5, minmax(0, 228px)) !important;
    gap: 9px !important;
  }
}

body:not(.policy-page):not(.support-page).state-login #errorMessage.show,
body:not(.policy-page):not(.support-page).state-login
  #errorMessage[style*="display: block"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
