:root {
  --bg: #071018;
  --surface: #0c1822;
  --elevated: #122433;
  --border: rgba(125, 211, 252, 0.18);
  --ice: #7dd3fc;
  --ice-deep: #38bdf8;
  --text: #f8fafc;
  --muted: #94a3b8;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --discord: #5865f2;
  --font-display: "Kanit", sans-serif;
  --font-body: "Prompt", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  background-color: #050b12;
  background-image:
    linear-gradient(180deg, rgba(5, 11, 18, .42) 0%, rgba(5, 11, 18, .72) 42%, rgba(5, 11, 18, .92) 100%),
    url("../img/city-bg.png");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(125, 211, 252, .14), transparent 55%),
    radial-gradient(800px 400px at 100% 80%, rgba(56, 189, 248, .08), transparent 50%);
}
@media (max-width: 768px) {
  body { background-attachment: scroll; }
}
a { color: var(--ice); text-decoration: none; }
a:hover { color: var(--ice-deep); }
img { max-width: 100%; }

.container { max-width: 980px; margin: 0 auto; padding: 0 1rem; }
.container.narrow { max-width: 640px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.875rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.page-fade { animation: fade .35s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ice);
  margin: 0 0 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 16, 24, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}
.brand-link { display: flex; align-items: center; gap: .75rem; color: inherit; }
.brand-flag {
  width: 2.75rem; height: 2.75rem; object-fit: cover; object-position: center 28%;
  border-radius: .7rem; border: 1px solid var(--border);
  background: #0a1622; box-shadow: 0 0 16px rgba(56, 189, 248, .18);
}
.brand-icon {
  width: 2.5rem; height: 2.5rem; border-radius: .7rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--ice-deep); color: #041018; font-family: var(--font-display); font-weight: 900;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-weight: 700; }
.brand-sub { font-size: .65rem; letter-spacing: .14em; color: var(--muted); }
.nav-desktop { display: none; gap: .2rem; }
@media (min-width: 768px) { .nav-desktop { display: flex; } }
.nav-pill {
  display: inline-flex; align-items: center;
  padding: .45rem .85rem; border-radius: 999px; border: 1px solid transparent;
  color: var(--muted); font-family: var(--font-display); font-size: .875rem;
}
.nav-pill:hover { color: var(--ice); }
.nav-pill-sm { font-size: .75rem; padding: .35rem .7rem; }
.nav-link-active {
  border-color: var(--border);
  background: rgba(56, 189, 248, .12);
  color: var(--ice) !important;
}
.nav-mobile {
  display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .6rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) { .nav-mobile { display: none; } }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.header-user { display: none; align-items: center; gap: .5rem; padding: .2rem .5rem; border-radius: .5rem; color: inherit; }
@media (min-width: 640px) { .header-user { display: flex; } }
.header-avatar { width: 2rem; height: 2rem; border-radius: 999px; object-fit: cover; border: 1px solid var(--border); }
.header-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--elevated); color: var(--ice); font-weight: 700; font-size: .75rem;
}
.header-username { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; color: #cbd5e1; }
.points-pill {
  display: none; padding: .25rem .65rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ice); font-size: .75rem; font-weight: 700;
}
.points-pill.inline { display: inline-flex; margin-top: .4rem; }
@media (min-width: 640px) { .points-pill { display: inline-flex; } }

.main-content { min-height: calc(100vh - 160px); }
.site-footer { margin-top: 3rem; padding: 2rem 0; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: .875rem; }
.footer-brand { font-family: var(--font-display); margin: 0; color: var(--text); }
.footer-note { font-size: .75rem; margin: .4rem 0 0; }

.hero { padding: 2.5rem 0 0; }
.hero-city { padding: 4.2rem 0 2.2rem; }
.hero-kicker { letter-spacing: .2em; font-size: .7rem; color: var(--ice); margin: 0 0 .4rem; }
.hero-lead { max-width: 36rem; font-size: 1.05rem; }

.card {
  background: linear-gradient(160deg, rgba(18, 36, 51, .88), rgba(12, 24, 34, .82));
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}
.card h3 { font-family: var(--font-display); margin: .6rem 0 .35rem; font-size: 1rem; }
.card-grid, .poster-grid, .icon-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 700px) {
  .card-grid, .icon-grid { grid-template-columns: repeat(3, 1fr); }
  .poster-grid { grid-template-columns: 1fr; }
}
.poster-placeholder, .empty-shelf {
  min-height: 140px; display: flex; align-items: center; justify-content: center;
  background: #0a1a26; border-radius: .75rem; color: var(--muted);
}
.poster-img { width: 100%; border-radius: .75rem; display: block; }

.icon-tile { color: inherit; display: block; }
.icon-tile:hover { border-color: var(--ice-deep); }
.icon-mark {
  width: 3rem; height: 3rem; border-radius: .85rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(56, 189, 248, .15); color: var(--ice);
  font-family: var(--font-display); font-weight: 800; overflow: hidden;
}
.icon-mark img { width: 100%; height: 100%; object-fit: cover; }
.crumb { color: var(--muted); font-size: .85rem; margin: 0 0 1rem; }
.agency-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.rules-body { border-top: 1px solid var(--border); padding-top: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1.2rem; border-radius: .75rem; border: 0;
  background: var(--ice-deep); color: #041018;
  font-family: var(--font-display); font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); color: #041018; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.4rem; }
.btn-outline {
  background: transparent; color: var(--ice); border: 1px solid var(--border);
}
.btn-outline:hover { color: var(--ice); }
.btn-outline:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { color: #fff; }
.btn-discord-inline { background: var(--discord) !important; color: #fff !important; }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; font-size: .875rem; }
.field input, .field textarea {
  background: #071018; border: 1px solid var(--border); border-radius: .6rem;
  color: var(--text); padding: .6rem .75rem; font-family: inherit;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: .65rem .4rem; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 500; width: 34%; }

.status-card h2 { margin: 0 0 .4rem; font-family: var(--font-display); }
.status-ok { border-color: rgba(52, 211, 153, .4); }
.status-wait { border-color: rgba(56, 189, 248, .45); }
.status-warn { border-color: rgba(251, 191, 36, .45); }
.status-bad { border-color: rgba(248, 113, 113, .45); }

.shop-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.shop-wallet { min-width: 180px; }
.wallet-value { font-family: var(--font-display); font-size: 1.8rem; margin: .2rem 0 .8rem; }
.amount-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.profile-hero { display: flex; gap: 1rem; align-items: center; }
.profile-avatar { width: 5rem; height: 5rem; border-radius: 1rem; object-fit: cover; border: 1px solid var(--border); }
.profile-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.profile-tab {
  padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--border);
  color: var(--muted); font-size: .85rem;
}
.admin-nav { display: flex; flex-wrap: wrap; gap: .35rem; padding: 1rem 0 0; }

.code-block {
  display: block; padding: .75rem; background: #041018; border-radius: .5rem;
  word-break: break-all; font-size: .8rem; margin-top: .5rem;
}

.toast-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 80;
}
.toast-popup {
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: 1rem; padding: 1.25rem; max-width: 22rem; text-align: center;
}
.toast-hidden { display: none; }
.toast-title { margin: 0 0 .4rem; font-family: var(--font-display); }
.toast-message { color: var(--muted); margin: 0 0 1rem; }

.flag-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
@media (min-width: 900px) {
  .flag-grid { grid-template-columns: repeat(5, 1fr); }
}
.flag-card {
  color: inherit;
  text-align: center;
  padding: .9rem .75rem 1.1rem;
}
.flag-card:hover { border-color: var(--ice-deep); transform: translateY(-3px); }
.flag-card, .icon-tile { transition: transform .2s ease, border-color .2s ease; }
.flag-banner {
  width: 100%;
  height: 210px;
  object-fit: contain;
  display: block;
  margin: 0 auto .35rem;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.45));
}
.flag-card h3 { margin-top: 0; }
.country-hero {
  display: flex; gap: 1.25rem; align-items: center;
}
.country-hero-flag {
  width: 140px; height: 210px; object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.4));
}
@media (max-width: 640px) {
  .flag-grid { grid-template-columns: 1fr 1fr; }
  .flag-banner { height: 170px; }
  .country-hero { flex-direction: column; text-align: center; }
  .country-hero-flag { width: 120px; height: 180px; }
}
