/* ===========================================================
   Palworld Mobile Hub — main stylesheet
   Mobile-first, dark gaming theme, no frameworks.
   =========================================================== */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #ff9d3c;
  --accent-hover: #ffb668;
  --accent-alt: #5ec8d8;
  --border: #30363d;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --radius: 8px;
  --max-width: 740px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--text-primary); }
h1 { font-size: 1.75rem; margin: 0.4em 0 0.5em; }
h2 { font-size: 1.35rem; margin: 1.4em 0 0.6em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
h3 { font-size: 1.1rem; margin: 1.1em 0 0.4em; color: var(--accent-alt); }
p { margin: 0 0 1em; color: var(--text-primary); }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: 0.4em; }
em { color: var(--text-secondary); }
strong { color: var(--text-primary); }

.table-wrap {
  overflow-x: auto;
  margin: 1em 0;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.92rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-wrap table { margin: 0; }
th, td {
  border: 1px solid var(--border);
  padding: 0.55em 0.7em;
  text-align: left;
}
th { background: var(--bg-card); color: var(--accent-alt); }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0.7em 1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.logo {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; color: var(--text-primary); }

.menu-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 42px;
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
}

.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.site-nav.open { display: block; }
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.5em;
}
.site-nav li { margin: 0; }
.site-nav a {
  display: block;
  padding: 0.7em 0.8em;
  color: var(--text-primary);
  border-radius: var(--radius);
}
.site-nav a:hover, .site-nav a.active {
  background: var(--bg-card);
  color: var(--accent);
  text-decoration: none;
}

/* ---------------- Breadcrumb ---------------- */
.breadcrumb {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.8em 1em 0;
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  padding: 0;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 0.4em; color: var(--border); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb li[aria-current="page"] { color: var(--text-primary); }

/* ---------------- Main content ---------------- */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1em 1em 3em;
}
.content-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4em 1.2em;
}
.content-image {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1em 0;
  background: var(--bg-card);
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.hub-search { margin-bottom: 1.2em; }
.hub-search label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.4em;
}
.hub-search input {
  width: 100%;
  padding: 0.7em 0.9em;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
}
.hub-search input:focus { outline: 2px solid var(--accent); }

/* ---------------- CPA gate ---------------- */
.cpa-gate {
  margin: 1.4em 0;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,157,60,0.08), rgba(255,157,60,0.02));
  padding: 1.2em;
  text-align: center;
}
.cpa-gate__lock { font-size: 1.6rem; display: block; margin-bottom: 0.3em; }
.cpa-gate__message { color: var(--text-primary); font-weight: 600; margin-bottom: 0.8em; }
.cpa-gate__button {
  background: var(--accent);
  color: #1a1200;
  border: none;
  padding: 0.75em 1.6em;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.cpa-gate__button:hover { background: var(--accent-hover); }
.cpa-gate__content { margin-top: 1em; text-align: left; }

/* Skeleton loader shown in .cpa-gate__content while locked-content.json fetches */
.cpa-skeleton { display: flex; flex-direction: column; gap: 10px; }
.cpa-skeleton__line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border) 37%, var(--bg-card) 63%);
  background-size: 400% 100%;
  animation: cpa-skeleton-shimmer 1.4s ease infinite;
}
@keyframes cpa-skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---------------- Codes / copy button ---------------- */
.code-row { display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
.copy-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-alt);
  padding: 0.3em 0.7em;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

/* ---------------- Tier badges ---------------- */
.tier-s { color: var(--danger); font-weight: 700; }
.tier-a { color: var(--warning); font-weight: 700; }
.tier-b { color: var(--accent-alt); font-weight: 700; }
.tier-c { color: var(--text-secondary); font-weight: 700; }

/* ---------------- Related pages ---------------- */
.related-pages {
  margin-top: 1.4em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1em 1.2em;
}
.related-pages h2 { margin-top: 0; font-size: 1.05rem; border: none; padding: 0; }
.related-pages ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5em; }
.related-pages a { display: block; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  margin-top: 2em;
}
.footer-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1.6em 1em;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.disclaimer { max-width: var(--max-width); }
.footer-nav { display: flex; gap: 1em; margin: 0.8em 0; flex-wrap: wrap; }
.footer-nav a { color: var(--text-secondary); }
.footer-nav a:hover { color: var(--accent); }
.last-updated { margin: 0.3em 0; }
.copyright { margin: 0.3em 0 0; }

/* ---------------- 404 page ---------------- */
.error-page { text-align: center; padding: 3em 1em; }
.error-page h1 { font-size: 3rem; color: var(--accent); }

/* ---------------- Tablet ---------------- */
@media (min-width: 768px) {
  .menu-toggle { display: none; }
  .site-nav {
    display: block;
    position: static;
    background: none;
    border: none;
  }
  .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2em;
    padding: 0;
  }
  .site-nav a { padding: 0.5em 0.7em; font-size: 0.88rem; }
  .site-main { padding: 1.5em 1.5em 3.5em; }
  h1 { font-size: 2.1rem; }
}

/* ---------------- Desktop ---------------- */
@media (min-width: 1024px) {
  .header-inner, .footer-inner { padding-left: 2em; padding-right: 2em; }
  .content-card { padding: 2em 2.4em; }
  h1 { font-size: 2.35rem; }
}

/* ---------------- SEO/Mobile audit: touch target minimum sizing (44px) ---------------- */
.site-nav a, .menu-toggle, .cpa-gate__button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.site-nav a { justify-content: flex-start; }
