:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #171c22;
  --border: #252b32;
  --text: #f2f2f2;
  --muted: #8e969f;
  --accent: #ff6a00;
  --accent-2: #ff8533;
  --accent-soft: #e8a268;
  --green: #3ecf8e;
  --red: #ff5d5d;
  --topbar-h: 64px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; row-gap: 8px;
  padding: 14px 24px;
  background: rgba(18, 22, 27, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  min-height: var(--topbar-h);
}
header.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,106,0,0.6) 20%, rgba(255,133,51,0.4) 50%, rgba(255,106,0,0.6) 80%, transparent);
  opacity: 0.7;
}
header.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; letter-spacing: 0.3px; color: #fff; text-decoration: none; transition: color 0.25s ease; }
header.topbar .brand:hover { text-decoration: none; color: var(--accent); }
header.topbar .brand-logo {
  height: 34px; width: 34px; border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
header.topbar .brand:hover .brand-logo {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(255,106,0,0.12), 0 4px 14px rgba(255,106,0,0.2);
  transform: rotate(-4deg) scale(1.05);
}
header.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
header.topbar nav a {
  position: relative;
  padding: 6px 2px;
  color: var(--text); font-size: 0.92rem; text-decoration: none;
  transition: color 0.25s ease;
}
header.topbar nav a::after {
  content: "";
  position: absolute; left: 50%; bottom: 0; width: 0; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.28s ease, left 0.28s ease;
}
header.topbar nav a:hover { color: #fff; text-decoration: none; }
header.topbar nav a:hover::after { width: 100%; left: 0; }
header.topbar .userbox { color: var(--muted); font-size: 0.88rem; }

.nav-dd { position: relative; }
.nav-dd-menu {
  display: none;
  position: absolute; top: 100%; left: 0; margin-top: 0;
  background: rgba(23, 28, 34, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 10px;
  min-width: 200px; padding: 14px 6px 6px; z-index: 200;
  box-shadow: 0 14px 32px rgba(0,0,0,0.5);
}
.nav-dd-menu a { display: block; padding: 8px 10px; border-radius: 7px; font-size: 0.88rem; white-space: nowrap; text-decoration: none; transition: background 0.2s ease, color 0.2s ease; }
.nav-dd-menu a::after { display: none; }
.nav-dd-menu a:hover { background: rgba(255,106,0,0.1); color: var(--accent); text-decoration: none; }
.nav-dd:hover .nav-dd-menu, .nav-dd:focus-within .nav-dd-menu { display: block; }

main { max-width: 1400px; margin: 0 auto; padding: 30px 24px 80px; }

.card {
  background: var(--panel);
  border: 1px solid rgba(232,162,104,0.35);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 14px 0;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.section-nav {
  position: fixed;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 7px;
  z-index: 150;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
.section-nav a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 9px;
  font-size: 1.15rem;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.section-nav a:hover { background: var(--panel-2); transform: scale(1.08); }
.section-nav a.active { background: var(--accent); color: #0f1115; }
.section-nav a.active:hover { background: var(--accent); }
.section-nav a:hover::after {
  content: attr(title);
  position: absolute;
  right: 46px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}
.section-nav a { position: relative; }
@media (max-width: 1100px) {
  .section-nav { display: none; } /* not enough room beside the content */
}

/* Admin editor pages: same floating strip, but every page (14 items) needs 2 columns to stay short */
.admin-section-nav {
  display: grid;
  grid-template-columns: repeat(2, 36px);
  grid-auto-flow: row;
}

h1 { font-size: 1.6rem; color: #fff; margin: 0 0 18px; }
h2 { font-size: 1.15rem; color: #fff; margin: 0 0 10px; }

table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { background: var(--panel-2); color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; }

code {
  background: #11141b;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  color: var(--green);
}

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.pill-ok   { background: rgba(62,207,142,0.15); color: var(--green); }
.pill-good { background: rgba(158,209,62,0.15); color: #9ed13e; }
.pill-warn { background: rgba(255,156,51,0.15); color: #ff9c33; }
.pill-bad  { background: rgba(255,93,93,0.15);  color: var(--red); }
.pill-lvl  { background: var(--panel-2); border: 1px solid var(--border); color: var(--accent-2); font-family: monospace; }

.meter { position: relative; display: inline-block; vertical-align: middle; width: 70px; height: 8px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.meter-fill.ok   { background: var(--green); }
.meter-fill.good { background: #9ed13e; }
.meter-fill.warn { background: #ff9c33; }
.meter-fill.bad  { background: var(--red); }
.meter-label { margin-left: 8px; font-size: 0.82rem; color: var(--muted); }

.skin-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.skin-box {
  width: 165px; height: 300px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.78rem; text-align: center;
  overflow: hidden;
  flex-shrink: 0;
}
.skin-box img { width: 100%; height: 100%; object-fit: cover; }

table.skin-collection td { text-align: center; vertical-align: middle; }
table.skin-collection th { text-align: center; }
.skin-thumb-box {
  width: 64px; height: 110px;
  margin: 0 auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.68rem; text-align: center;
  overflow: hidden;
}
.skin-thumb-box img { width: 100%; height: 100%; object-fit: cover; }

.caravan-box {
  width: 200px; height: 150px;
  background: var(--panel-2);
  border-radius: 0;
  text-align: center; vertical-align: middle;
  overflow: hidden;
}
.caravan-box img { width: 100%; height: 100%; object-fit: contain; }

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 28px;
}
.login-card h1 { text-align: center; font-size: 1.4rem; margin-bottom: 22px; }
.login-card label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 4px; }
.login-card input {
  width: 100%; padding: 9px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 0.95rem;
}
.login-card button {
  width: 100%; margin-top: 18px; padding: 10px;
  background: var(--accent); border: none; border-radius: 8px;
  color: #0f1115; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.login-card button:hover { opacity: 0.9; }
.error-box {
  background: rgba(255,93,93,0.1); border: 1px solid var(--red); color: var(--red);
  padding: 10px 14px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 14px;
}

footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.8rem; }

/* Admin editor pages (/ucp/admin/*.php) */
nav.subtabs { position: sticky; top: var(--topbar-h); z-index: 90; display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--border); margin-bottom: 16px; }
nav.subtabs a { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: 0.85rem; color: var(--text); }
nav.subtabs a:hover { color: var(--accent); border-color: var(--accent-soft); text-decoration: none; }
nav.subtabs a.active { background: var(--accent); border-color: var(--accent-soft); color: #0f1115; font-weight: 600; }
table.edittable input[type=text], table.edittable input[type=number] {
  width: 100%; min-width: 70px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 7px; color: var(--text); font-size: 0.86rem;
}
table.edittable select { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; color: var(--text); font-size: 0.86rem; }
table.edittable td { vertical-align: middle; }
table.edittable .chk { text-align: center; vertical-align: middle; width: 1%; white-space: nowrap; }
.save-btn { background: var(--accent); border: none; border-radius: 6px; padding: 6px 14px; color: #0f1115; font-weight: 700; font-size: 0.82rem; cursor: pointer; }
.save-btn:hover { opacity: 0.9; }
.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.flash.ok { background: rgba(62,207,142,0.1); border: 1px solid var(--green); color: var(--green); }
.flash.err { background: rgba(255,93,93,0.1); border: 1px solid var(--red); color: var(--red); }
