:root {
  --bg: #0a1219; --bg2: #0e1a24; --card: rgba(20, 34, 46, .72); --line: #22404d;
  --text: #e9f3f1; --muted: #8ba6ad;
  --accent: #3ddfb0; --accent2: #f4b942; --accent3: #57a8ff;
  --ok: #46d99a; --warn: #f4b942; --err: #ff6b6b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 500px at 85% -10%, #1d4a4633 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 30%, #27476e33 0%, transparent 60%),
    linear-gradient(180deg, #0a1219 0%, #0c1a20 55%, #0a1219 100%);
  background-color: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}

/* ---------- Sky blobs (Palworld-Vibe) ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35;
  animation: drift 26s ease-in-out infinite alternate;
}
.blob.b1 { width: 480px; height: 480px; top: -160px; right: -100px; background: #3ddfb044; }
.blob.b2 { width: 380px; height: 380px; top: 40%; left: -140px; background: #57a8ff33; animation-delay: -8s; }
.blob.b3 { width: 320px; height: 320px; bottom: -120px; right: 22%; background: #f4b9422e; animation-delay: -16s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.12); }
}

/* ---------- Nav ---------- */
.topnav {
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px; min-height: 62px;
  background: rgba(12, 22, 30, .78); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.12rem; font-weight: 800; letter-spacing: .02em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand .logo { width: 30px; height: 30px; }
.navlinks { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.navlinks a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted); text-decoration: none; padding: 7px 13px;
  border-radius: 9px; font-size: .9rem; transition: all .15s;
}
.navlinks a svg { width: 17px; height: 17px; flex: none; }
.navlinks a:hover { color: var(--accent); background: rgba(61, 223, 176, .08); }
.navlinks a.active {
  color: var(--accent); background: rgba(61, 223, 176, .12);
  box-shadow: inset 0 0 0 1px rgba(61, 223, 176, .25);
}
.burger {
  display: none; background: none; border: 1px solid var(--line);
  color: var(--text); border-radius: 9px; padding: 6px 8px; cursor: pointer;
}
.navuser { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.navuser img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent); }
.navuser .uname { font-weight: 600; font-size: .88rem; }
.navuser .pts {
  color: var(--warn); font-weight: 700; font-size: .82rem;
  background: rgba(244, 185, 66, .1); border: 1px solid rgba(244, 185, 66, .3);
  border-radius: 999px; padding: 3px 10px;
}
.navuser a.mini { color: var(--muted); font-size: .8rem; text-decoration: none; }
.navuser a.mini:hover { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), #2bb892);
  color: #06231a; border: 0; font-weight: 700;
  padding: 9px 18px; border-radius: 10px; cursor: pointer; font-size: .9rem;
  text-decoration: none; transition: all .15s;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.big { padding: 13px 26px; font-size: 1rem; border-radius: 12px; }
.btn.ghost {
  background: rgba(20, 34, 46, .6); border: 1px solid var(--line);
  color: var(--text); font-weight: 600;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.small { padding: 5px 12px; font-size: .8rem; }
.btn.buy { background: linear-gradient(135deg, var(--warn), #e09a1f); color: #33200a; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 30px 20px 70px; }
.page { display: none; animation: fadein .25s ease; }
.page.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h1 { font-size: 1.55rem; margin-bottom: 6px; }
.sub { color: var(--muted); margin-bottom: 18px; }
.cardbox {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px;
  backdrop-filter: blur(8px); box-shadow: 0 8px 30px #0005;
}
.rules { white-space: pre-wrap; line-height: 1.7; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 52px 20px 38px; position: relative; }
.herobadge {
  display: inline-block; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(61, 223, 176, .4);
  background: rgba(61, 223, 176, .08); border-radius: 999px; padding: 5px 14px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; line-height: 1.15;
  background: linear-gradient(120deg, #eafff7 20%, var(--accent) 55%, var(--accent2) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); margin: 12px 0 20px; font-size: 1.05rem; }
.statuspill {
  display: inline-block; padding: 8px 20px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: .92rem;
}
.statuspill.on { border-color: var(--ok); color: var(--ok); box-shadow: 0 0 22px #46d99a33; }
.statuspill.off { border-color: var(--err); color: var(--err); }
.heroactions { margin-top: 26px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cards3 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-top: 40px;
}
.cards3 .mini-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; text-align: center; backdrop-filter: blur(8px);
  transition: transform .18s, border-color .18s;
}
.mini-card:hover { transform: translateY(-3px); border-color: rgba(61, 223, 176, .4); }
.mini-card b {
  font-size: 1.6rem; display: block; margin-bottom: 4px;
  color: var(--accent);
}
.mini-card span { color: var(--muted); font-size: .85rem; }

.featuregrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; margin-top: 16px;
}
.feature {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; transition: transform .18s, border-color .18s;
}
.feature:hover { transform: translateY(-3px); border-color: rgba(244, 185, 66, .45); }
.feature .ficon { font-size: 1.7rem; display: block; margin-bottom: 10px; }
.feature h3 { font-size: 1rem; margin-bottom: 6px; color: var(--accent2); }
.feature p { color: var(--muted); font-size: .87rem; line-height: 1.55; }

/* ---------- Shop ---------- */
.catchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.catchip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 7px 15px; font-size: .85rem; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.catchip span {
  background: rgba(0,0,0,.25); border-radius: 999px; padding: 1px 8px;
  font-size: .72rem;
}
.catchip:hover { border-color: rgba(61, 223, 176, .5); color: var(--text); }
.catchip.active {
  background: rgba(61, 223, 176, .14); border-color: var(--accent);
  color: var(--accent); font-weight: 700;
}
.catchip.active span { background: rgba(61, 223, 176, .2); }

/* ---------- Ticket-Form ---------- */
.tickform { display: flex; flex-direction: column; gap: 9px; }
.tickform select, .tickform input {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 13px; border-radius: 9px; font-size: .88rem; font-family: inherit;
}
.tickform select:focus, .tickform input:focus { outline: none; border-color: var(--accent); }
.tickform .btn { align-self: flex-start; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-size: .9rem;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--accent); }
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px; display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s, border-color .15s;
}
.item:hover { transform: translateY(-2px); border-color: rgba(61, 223, 176, .45); }
.item .iname { font-weight: 700; }
.item .meta { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: .72rem; border: 1px solid var(--line); background: rgba(0,0,0,.2); }
.r0 { color: #c8c8c8; } .r1 { color: #57d967; } .r2 { color: #57a8ff; }
.r3 { color: #b96bff; } .r4, .r5 { color: #ffb347; }
.price { color: var(--warn); font-weight: 800; font-size: 1.02rem; }
.buyrow { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.buyrow select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 6px 8px; border-radius: 8px; width: 64px;
}
#shop-notice { margin-bottom: 14px; }
.notice {
  background: rgba(244, 185, 66, .08); border: 1px solid rgba(244, 185, 66, .5);
  color: var(--warn); border-radius: 12px; padding: 11px 15px; font-size: .88rem;
}
.notice b { color: var(--accent2); }

/* ---------- Guilds / Status ---------- */
.guildcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-bottom: 12px; backdrop-filter: blur(8px);
}
.guildcard h3 { margin-bottom: 6px; }
.guildcard h3 .badge { border-color: rgba(61, 223, 176, .4); color: var(--accent); }
.mchip {
  display: inline-block; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; margin: 3px 4px 0 0; font-size: .8rem;
}
.kvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.kvgrid div {
  background: var(--bg2); border-radius: 9px; padding: 9px 13px; font-size: .85rem;
  min-width: 0; overflow-wrap: anywhere; word-break: break-word;
  border: 1px solid transparent;
}
.kvgrid div:hover { border-color: var(--line); }
.kvgrid b {
  color: var(--accent); font-weight: 600; display: block;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px;
}

/* ---------- Dashboard ---------- */
.dashgrid { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: stretch; }
.dashgrid .cards3 { grid-template-columns: repeat(3, 1fr); }
.dashchar { display: flex; align-items: center; gap: 14px; }
.dashav { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--accent); }
.dashrow {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .87rem;
}
.dashrow:last-child { border-bottom: 0; }
.dashrow .dim { color: var(--muted); font-size: .78rem; text-align: right; white-space: nowrap; }
@media (max-width: 860px) {
  .dashgrid { grid-template-columns: 1fr; }
  .dashgrid .cards3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Footer ---------- */
footer {
  background: rgba(12, 22, 30, .85); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  padding: 20px 26px; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 10px;
  color: var(--muted); font-size: .85rem;
}
.footbrand { display: flex; flex-direction: column; gap: 2px; }
.footbrand b { color: var(--text); font-size: .95rem; }
.footright a { color: var(--muted); text-decoration: none; margin-left: 16px; transition: color .15s; }
.footright a:hover { color: var(--accent); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 99;
}
.toast {
  background: var(--bg2); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 11px 18px; font-size: .9rem; min-width: 260px;
  box-shadow: 0 6px 24px #0008; backdrop-filter: blur(8px);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }

@media (max-width: 860px) {
  .burger { display: block; margin-left: auto; }
  .navlinks {
    display: none; order: 3; width: 100%; flex-direction: column; padding: 8px 0;
  }
  body.nav-open .navlinks { display: flex; }
  .topnav { flex-wrap: wrap; padding: 10px 16px; }
  .navuser { order: 2; margin-left: 0; }
  .navuser .uname { display: none; }
  .hero { padding: 34px 12px 26px; }
}
