:root {
  --bg: #fdf3d9;
  --sidebar-bg: #f7e6bd;
  --card-bg: #fffaf0;
  --card-bg-2: #fff3da;
  --border: #e8d4a3;
  --text: #4a2e05;
  --text-dim: #7a5c33;
  --text-faint: #a8875a;
  --green: #7a9c3a;
  --green-dark: #64801f;
  --gold: #d4880e;
  --red: #c0392b;
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg: #1c1710;
  --sidebar-bg: #221b12;
  --card-bg: #2a2115;
  --card-bg-2: #332818;
  --border: #4a3c26;
  --text: #f0e6d2;
  --text-dim: #c9b896;
  --text-faint: #8a7a5c;
  --green: #8fbb4a;
  --green-dark: #6f9636;
  --gold: #e6a52a;
  --red: #e05545;
}

:root[data-theme="dark"] body::before,
:root[data-theme="dark"] .auth-screen::before {
  filter: blur(55px) brightness(0.55);
}

/* 다크모드에서도 그대로 밝은 골드톤으로 남아있던 카드/아이콘 배경 보정 */
:root[data-theme="dark"] .auth-screen {
  background: var(--bg);
}

:root[data-theme="dark"] .property-image,
:root[data-theme="dark"] .house-thumb {
  background: linear-gradient(160deg, #3a2e18, #52400f);
}

:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .shortcut-icon,
:root[data-theme="dark"] .bank-icon,
:root[data-theme="dark"] .list-icon,
:root[data-theme="dark"] .rank-badge {
  background: var(--card-bg-2);
}

/* 계좌 잔고 배너는 항상 같은 밝은 사진 배경이라, 다크모드에서도 글씨는 어둡게 고정 */
:root[data-theme="dark"] .balance-card .card-title,
:root[data-theme="dark"] .balance-label,
:root[data-theme="dark"] .balance-amount,
:root[data-theme="dark"] .bank-card .card-title,
:root[data-theme="dark"] .bank-card .bank-account-label,
:root[data-theme="dark"] .bank-card .bank-balance {
  color: #4a2e05;
}

:root[data-theme="dark"] .bank-card .bank-icon {
  background: #ffedc2;
}

body, .card, .sidebar, .topbar-actions .icon-btn, input, textarea, select {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* 배경에만 깔리는 은은한 골드 톤 색상 덩어리들 -- 콘텐츠 뒤(z-index:-1)에서 크게 움직여 일렁이는 느낌을 준다 */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 25%, rgba(212, 136, 14, 0.6), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(255, 197, 92, 0.6), transparent 42%),
    radial-gradient(circle at 75% 80%, rgba(240, 169, 46, 0.6), transparent 42%),
    radial-gradient(circle at 20% 85%, rgba(230, 140, 20, 0.55), transparent 42%);
  filter: blur(55px);
  animation: bgShimmer 12s ease-in-out infinite alternate;
  will-change: transform;
}

/* scale()은 프레임마다 블러를 다시 계산시켜 렉을 유발하므로 GPU가 값싸게 처리하는 translate()만 사용 */
@keyframes bgShimmer {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-8%, 6%); }
  100% { transform: translate(7%, -7%); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 20px;
  font-weight: 700;
  font-size: 16px;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.logo-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--green);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-dim);
  transition: background .15s, color .15s, transform .15s ease;
}

.nav-item:hover {
  background: #f0dfae;
  color: var(--text);
  transform: translateX(3px);
}

.nav-item .nav-icon {
  transition: transform .2s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.15);
}

.nav-item.active {
  background: var(--green);
  color: #fdf3d9;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.online-box {
  padding: 10px 12px;
}

.online-label {
  font-size: 12px;
  color: var(--text-faint);
}

.online-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
}

.online-count span {
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 400;
}

.copyright {
  font-size: 11px;
  color: var(--text-faint);
  padding: 8px 12px 0;
}

.playlist-widget {
  padding: 10px 12px 4px;
}

.yt-hidden-player {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.mp-track {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.mp-thumb-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--card-bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mp-thumb-placeholder {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.mp-meta {
  min-width: 0;
  flex: 1;
}

.mp-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-seek-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.mp-time {
  font-size: 10px;
  color: var(--text-faint);
  flex-shrink: 0;
  min-width: 26px;
}

.mp-range {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.mp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

.mp-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

.mp-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mp-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  line-height: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mp-btn svg {
  width: 15px;
  height: 15px;
}

.mp-btn:hover {
  background: var(--card-bg-2);
}

.mp-btn.mp-play svg {
  width: 19px;
  height: 19px;
}

.mp-btn.mp-play {
  color: var(--gold);
}

.mp-btn.mp-toggle.active {
  color: var(--gold);
}

.mp-volume-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.mp-volume-row .mp-range {
  flex: 1;
}

.mp-vol-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 28px 40px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 20px;
}

.topbar-title h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.topbar-title p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.10);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(.96);
  box-shadow: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .6;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { background: var(--card-bg); }

.btn-green {
  background: var(--green);
  color: #fdf3d9;
}

.btn-green:hover { background: var(--green-dark); }

.btn-dark {
  background: #4a2e05;
  color: #fdf3d9;
}

.btn-dark:hover { background: #6b4415; }

.btn-white {
  background: #fffaf0;
  color: var(--text);
  border: 1px solid var(--border);
}

.icon-btn {
  position: relative;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card-bg);
}

.notif-jump-highlight {
  animation: notifJumpFlash 1.6s ease;
  border-radius: 8px;
}

@keyframes notifJumpFlash {
  0% { background: rgba(212,136,14,.28); }
  100% { background: transparent; }
}

.notif-wrap {
  position: relative;
}

.notif-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 300px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px;
  z-index: 50;
}

.notif-dropdown-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.notif-dm-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background .2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}

.switch input:checked + .switch-slider {
  background: var(--green);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffe9b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.caret { color: var(--text-faint); font-size: 11px; }

/* ---------- 로그인 / 회원가입 화면 ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 0;
  overflow: hidden;
  background: #fff1d7;
  padding: 20px;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 25%, rgba(212, 136, 14, 0.6), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(255, 197, 92, 0.6), transparent 42%),
    radial-gradient(circle at 75% 80%, rgba(240, 169, 46, 0.6), transparent 42%),
    radial-gradient(circle at 20% 85%, rgba(230, 140, 20, 0.55), transparent 42%);
  filter: blur(55px);
  animation: bgShimmer 12s ease-in-out infinite alternate;
  will-change: transform;
}

.auth-card-doge {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0 26px 32px;
  text-align: center;
}

.doge-banner {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
}

.auth-desc {
  color: #7a5c33;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.auth-error {
  color: var(--red);
  font-size: 12px;
  min-height: 14px;
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
}

.discord-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  background: linear-gradient(135deg, #ffcf5c, #f0a92e);
  color: #4a2e05;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(180, 120, 10, 0.3);
}

.discord-login-btn:hover {
  background: linear-gradient(135deg, #ffdb7f, #f6b746);
}

.discord-logo {
  font-size: 15px;
}

.doge-footer {
  margin-top: 22px;
  font-size: 12px;
  color: #a8875a;
}

/* ---------- Grid rows ---------- */
.row {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.row-3 { grid-template-columns: 1.1fr 1.3fr 1fr; }
.row-2 { grid-template-columns: 1.5fr 1fr; }

@media (max-width: 1100px) {
  .row-3, .row-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow .2s ease, transform .2s ease;
}

.card + .card {
  margin-top: 18px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 700;
}

.card-title .more {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
}

/* ---------- 보유 금액 카드 ---------- */
.balance-card {
  position: relative;
  overflow: hidden;
  background: url('vendor/images/balance-banner.png') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.balance-label {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 10px;
}

.balance-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 18px;
}

.coin-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #4a3200;
  flex-shrink: 0;
}

.balance-actions {
  display: flex;
  gap: 10px;
}

.balance-actions .btn { flex: 1; }

/* ---------- 배너 ---------- */
.banner-card {
  position: relative;
  overflow: hidden;
  background: url('vendor/images/nation-bank-banner.png') center/cover no-repeat;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
}

.banner-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20,12,4,.65), rgba(20,12,4,0) 65%);
}

.banner-text {
  position: relative;
  z-index: 1;
}

.banner-text .sub {
  font-size: 12px;
  letter-spacing: .3em;
  color: #ffe9b0;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.nation-bank-amount {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: #fff8ea;
  text-shadow: 0 1px 6px rgba(0,0,0,.55);
}

/* ---------- 사이드바 로고 옆 DVD 화면보호기 스타일 튕기는 도지코인 ---------- */
.logo {
  position: relative;
  overflow: hidden;
  min-height: 64px;
}

.dvd-logo {
  position: absolute;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0,0,0,.28);
  z-index: 1;
  will-change: transform;
}

/* ---------- 바로가기 메뉴 ---------- */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.shortcut-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 6px;
  font-size: 12px;
  color: var(--text-dim);
  transition: transform .12s, border-color .12s;
}

.shortcut-item:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  color: var(--text);
}

.shortcut-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #ffedc2;
}

/* ---------- 추천 매물 ---------- */
.property-card { padding: 0; overflow: hidden; }
.property-card .card-title { padding: 20px 20px 0; }

.property-image {
  height: 160px;
  margin: 14px 20px 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffe9b8, #f3d18a 50%, #e0b25c);
  position: relative;
  overflow: hidden;
}

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 0;
}

.fav-btn.active { color: var(--gold); }

#featuredCarouselTrack {
  transition: transform 0.28s ease, opacity 0.28s ease;
}

#featuredCarouselTrack.featured-notransition {
  transition: none !important;
}

#featuredCarouselTrack.featured-slide-out {
  transform: translateX(-24px);
  opacity: 0;
}

#featuredCarouselTrack.featured-slide-in {
  transform: translateX(24px);
  opacity: 0;
}

.property-image::after {
  content: "🏡";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  opacity: .5;
}

.property-image.has-3d::after,
.property-image.has-photo::after {
  content: none;
}

.property-image.has-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.property-body {
  padding: 16px 20px 20px;
}

.tag {
  display: inline-block;
  background: var(--green);
  color: #fdf3d9;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  margin-bottom: 8px;
}

.property-body h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.property-loc {
  color: var(--text-faint);
  font-size: 12px;
  margin-bottom: 8px;
}

.property-price {
  color: var(--gold);
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 12px;
}

.property-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding-bottom: 14px;
}

.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.dots span.active { background: var(--green); }

/* ---------- 은행 카드 (홈 화면 계좌 잔고 배너와 동일한 사진 사용) ---------- */
.bank-card {
  background: url('vendor/images/balance-banner.png') center/cover no-repeat;
}

.bank-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.bank-account-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.bank-balance {
  font-size: 22px;
  font-weight: 800;
}

.bank-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: #ffedc2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.bank-actions { display: flex; gap: 10px; }
.bank-actions .btn { flex: 1; }

/* ---------- 리스트 (거래내역 / 공지) ---------- */
.list { display: flex; flex-direction: column; gap: 4px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  transition: background-color .15s ease, padding-left .15s ease;
  border-radius: 6px;
}

.list-row:hover {
  background-color: var(--card-bg-2);
  padding-left: 8px;
}

.list-row:last-child { border-bottom: none; }

.list-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: #ffedc2;
  flex-shrink: 0;
}

.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 13px; font-weight: 600; }
.list-sub { font-size: 11px; color: var(--text-faint); }

.list-amount { font-size: 13px; font-weight: 700; text-align: right; }
.list-amount.pos { color: var(--green); }
.list-amount.neg { color: var(--red); }
.list-amount.pending { color: var(--gold); }
.list-amount.rejected { color: var(--red); text-decoration: line-through; }
.list-date { font-size: 11px; color: var(--text-faint); text-align: right; }

.notice-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}
.notice-tag.event { background: rgba(122,156,58,.15); color: var(--green); }
.notice-tag.notice { background: rgba(60,110,220,.12); color: #3c6edc; }
.notice-tag.update { background: rgba(212,136,14,.15); color: var(--gold); }
.notice-tag.rejected { background: rgba(192,57,43,.15); color: var(--red); }

/* ---------- 일반 페이지 (준비중 뷰용) ---------- */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.stat-box {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-box .label { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; }
.stat-box .value { font-size: 20px; font-weight: 800; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--text-faint); font-weight: 600; font-size: 12px; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #ffedc2;
  font-weight: 700;
  font-size: 12px;
}
.rank-badge.gold { background: #ffe38f; color: #8a5c08; }
.rank-badge.silver { background: #e6e6e6; color: #6b6b70; }
.rank-badge.bronze { background: #f0d4b8; color: #8a4a1f; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.shop-item {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: transform .18s ease, box-shadow .18s ease;
}

.shop-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
}

.shop-item-thumb {
  position: relative;
  margin-bottom: 8px;
}

.shop-item .icon {
  font-size: 30px;
}

/* 마우스 올리면 딜레이 없이 바로 뜨는 툴팁 (네이티브 title 속성은 1초 정도 지연이 있어서 직접 구현) */
.instant-tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.instant-tooltip .instant-tooltip-content {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  background: #222;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-line;
  min-width: 140px;
  text-align: left;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  pointer-events: none;
}

.instant-tooltip:hover .instant-tooltip-content {
  display: block;
}

.zoom-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 0;
}

.shop-item .name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.shop-item .price {
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.admin-user-card {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.admin-user-card .admin-user-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-user-card .admin-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.admin-user-card .admin-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-user-card .admin-user-name {
  font-weight: 700;
  font-size: 14px;
}

.admin-user-card .admin-user-field {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  padding: 3px 0;
}

.admin-user-card .admin-user-field span:last-child {
  color: var(--text);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 520px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12px; color: var(--text-dim); }

.form-field input, .form-field textarea, .form-field select {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(122, 156, 58, .25);
}

.form-field textarea { resize: vertical; font-family: inherit; }

/* ---------- 팝업 모달 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: modalOverlayFadeIn .18s ease;
}

@keyframes modalOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  animation: modalCardPopIn .25s cubic-bezier(.22,1,.36,1);
}

@keyframes modalCardPopIn {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 화면(뷰) 전환 시 콘텐츠가 살짝 떠오르며 나타나는 효과 */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#viewContainer.view-fade-in {
  animation: viewFadeIn .3s ease;
}

.modal-card-wide {
  max-width: 720px;
}

/* 미니게임 "크게 보기": 네이티브 Fullscreen API 대신 뷰포트 전체를 덮는 CSS 방식이라
   브라우저 권한/제스처 제약 없이 항상 동작한다 */
.minigame-maximized {
  max-width: none !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
}

.minigame-maximized #minigameModalBody {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.minigame-maximized #minigameFrameWrap {
  flex: 1;
  min-height: 0;
}

.minigame-maximized #minigameFrame {
  height: 100% !important;
}

.viewer-container {
  width: 100%;
  height: 480px;
  border-radius: 10px;
  overflow: hidden;
  background: #14171d;
}

.viewer-container canvas {
  display: block;
}

.viewer-status {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 10px;
  min-height: 16px;
}

.viewer-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

.viewer-credit {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

.viewer-credit a,
.copyright a {
  color: var(--text-faint);
  text-decoration: underline;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 { margin: 0; font-size: 16px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 16px;
  padding: 2px 6px;
}

.modal-close:hover { color: var(--text); }

#houseRegisterForm .form-field { margin-bottom: 14px; }

.house-card {
  display: flex;
  gap: 14px;
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  align-items: center;
}

.house-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffe9b8, #f0b429);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.house-info { flex: 1; }
.house-info h4 { margin: 0 0 4px; font-size: 14px; }
.house-info p { margin: 0; font-size: 12px; color: var(--text-faint); }

.community-post {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.community-post .meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.community-post h4 { margin: 0 0 6px; font-size: 14px; }
.community-post p { margin: 0; font-size: 13px; color: var(--text-dim); }

.faq-item {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
}

.faq-item .q { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.faq-item .a { font-size: 13px; color: var(--text-dim); }
