:root {
  --bg: #0b0f0c;
  --panel: #131a15;
  --panel-2: #18211b;
  --line: #243029;
  --line-2: #33433a;
  --text: #eaf0e6;
  --muted: #93a397;
  --accent: #8bd25f;
  --accent-2: #f2a541;
  --accent-ink: #0b130a;
  --bad: #e5675f;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 15px/1.55 "Prompt", system-ui, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, #2a3a1c55, transparent 60%),
    radial-gradient(700px 400px at -10% 10%, #3a2a1255, transparent 60%),
    var(--bg);
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- header / nav (shared) ---------- */
.top {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 32px);
  background: rgba(11, 15, 12, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 4px 10px #0008); }
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.status { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot.off { background: var(--bad); }
.nav { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #0f1511; }
.nav a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.nav a:hover { color: var(--text); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
.top .spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.muted { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.card { background: linear-gradient(160deg, #161e18f2, #111713f5); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }

/* ---------- home ---------- */
.hero-logo { width: 150px; height: 150px; object-fit: contain; filter: drop-shadow(0 10px 24px #000a); margin: -10px 0; }
.hero {
  display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center;
  margin: 18px clamp(16px, 3vw, 32px) 0; padding: 22px 24px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(115deg, #1b2716ee, #121813f2 60%), radial-gradient(circle at 90% 0%, #f2a54122, transparent 50%);
}
.kicker { color: var(--accent-2); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.hero h2 { margin: 6px 0 4px; font-size: clamp(22px, 3vw, 30px); }
.hero p { margin: 0; color: #b9c4b5; max-width: 620px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)); gap: 10px; text-align: center; }
.stat { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #0f1511; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .label { font-size: 12px; color: var(--muted); }

.layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; padding: 16px clamp(16px, 3vw, 32px) 28px; height: calc(100vh - 200px); min-height: 520px; }
.map-wrap { position: relative; min-height: 400px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#map { position: absolute; inset: 0; background: #0b2233; }
.map-note {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; max-width: 420px;
  background: rgba(11, 15, 12, .9); border: 1px solid var(--line); padding: 8px 12px; border-radius: 10px; font-size: 13px; color: var(--muted);
}
.side { display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.promo { position: relative; overflow: hidden; background: linear-gradient(140deg, #2a2312, #151a12 70%); border-color: #f2a54144; }
.promo h2 { color: #ffd59a; }
.promo .btn { margin-top: 6px; }

.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 120px 1fr 52px; gap: 8px; align-items: center; padding: 5px 0; font-size: 14px; }
.bars .bar { height: 8px; background: #22302a; border-radius: 4px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #c6ec8f); border-radius: 4px; }
.bars .count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars .empty { display: block; color: var(--muted); text-align: center; }
.bars li.sum { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding: 4px 0 10px; margin-bottom: 4px; border-bottom: 1px solid #22302a; color: var(--muted); font-size: 13px; }
.bars li.sum b { color: var(--text, #fff); font-size: 15px; }

/* ---------- skins ---------- */
.skin-page { padding: 18px clamp(16px, 3vw, 32px) 32px; }
.skin-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.skin-head h2 { margin: 4px 0 2px; font-size: clamp(22px, 3vw, 30px); }
.skin-head p { margin: 0; color: #b9c4b5; max-width: 640px; }
.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.skin-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(330px, .9fr); gap: 16px; align-items: start; }
.viewer { overflow: hidden; padding: 0; }
#stage { position: relative; height: min(64vh, 640px); min-height: 380px; background: radial-gradient(ellipse at 50% 85%, #3b4d2a40, transparent 45%), linear-gradient(#141c15, #0c110d 80%); }
#stage canvas { display: block; width: 100%; height: 100%; }
.stage-top, .stage-foot { position: absolute; inset: 12px 14px auto; display: flex; justify-content: space-between; gap: 12px; color: #b8c2b4; font-size: 12px; pointer-events: none; }
.stage-top strong { color: var(--text); letter-spacing: .06em; font-size: 12.5px; }
.stage-foot { inset: auto 14px 12px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: #d7d2c4; font-size: 14px; pointer-events: none; }
.status-line { color: var(--accent); font-size: 12px; }
.status-line.error { color: #ff9f86; }
.growth-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); }
.growth-row label { min-width: 150px; font-size: 14px; }
.growth-row label b { color: var(--accent); font-variant-numeric: tabular-nums; }
.growth-row small { display: block; color: var(--muted); font-size: 12px; }
input[type=range] { flex: 1; accent-color: var(--accent); }
.chip-btn { border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel-2); padding: 7px 11px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip-btn.on { background: var(--accent-2); border-color: var(--accent-2); color: #1e1206; }
.chip-btn:disabled { opacity: .35; cursor: not-allowed; }

.panel { display: flex; flex-direction: column; gap: 12px; }
.species-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); }
.species-card:hover { border-color: var(--accent); }
.species-card .icon { font-size: 26px; width: 36px; text-align: center; }
.species-card b { display: block; font-size: 16px; }
.species-card small { color: var(--muted); font-size: 12.5px; }
.species-card .chev { margin-left: auto; color: var(--muted); }
.species-card select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: 12px; background: #0e1410; }
.seg button { border: 0; border-radius: 9px; background: transparent; padding: 7px 4px; color: #c7cfc3; font-size: 13px; line-height: 1.25; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.patterns { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.original-pick { width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px; background: #0e1410; }
.regions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.region { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #101612; text-align: left; font-size: 13px; }
.region i { width: 18px; height: 18px; border-radius: 5px; border: 1px solid #ffffff30; flex: none; box-shadow: inset 0 0 0 1px #0004; }
.region span { flex: 1; }
.region em { color: var(--muted); font-style: normal; font-size: 10.5px; font-family: ui-monospace, Consolas, monospace; }
.region:hover { border-color: #5d7a4d; }
.region.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #142012; }
.region:disabled { opacity: .38; cursor: not-allowed; }
.picker { padding: 11px; border: 1px solid var(--line-2); border-radius: 12px; background: #0e1410; display: flex; flex-direction: column; gap: 10px; }
.picker-head { display: flex; gap: 8px; align-items: center; }
.picker-head .seg { flex: 1; }
.hex { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.hex input { width: 92px; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px; background: #090d0a; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; text-transform: uppercase; }
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.swatches button { aspect-ratio: 1.5; border: 1px solid #00000066; border-radius: 4px; padding: 0; }
.swatches button:hover { outline: 2px solid #fffa; outline-offset: 1px; }
.wheel { display: none; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.wheel input { width: 100%; height: 120px; border: 1px solid var(--line-2); border-radius: 10px; background: none; padding: 2px; cursor: pointer; }
.picker.wheel-mode .swatches { display: none; }
.picker.wheel-mode .wheel { display: flex; }
.shades-head { color: var(--muted); font-size: 12px; margin-top: 2px; }
.shades { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.shades button { aspect-ratio: 1.6; border: 1px solid #00000066; border-radius: 4px; padding: 0; cursor: pointer; }
.shades button.base { outline: 2px solid var(--accent, #f2a93b); outline-offset: 1px; }
.shades button:hover { outline: 2px solid #fffa; outline-offset: 1px; }
.shade { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.actions button { padding: 9px 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); font-size: 12.5px; font-weight: 600; }
.actions button:hover { border-color: var(--accent); color: #d8f3c3; }
.send { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid #f2a54155; background: linear-gradient(140deg, #2a2312, #161a12); }
.send .btn { width: 100%; }
.send-state { font-size: 12.5px; color: #e9d3ac; }
.note { margin: 0; color: var(--muted); font-size: 12px; }
details { border-top: 1px solid var(--line); padding-top: 10px; color: var(--muted); font-size: 12.5px; }
details summary { cursor: pointer; color: #c7cfc3; }
details .file { display: block; margin-top: 8px; }

footer.foot { display: flex; justify-content: space-between; gap: 12px; padding: 14px clamp(16px, 3vw, 32px) 22px; color: #7c8a7f; font-size: 12px; border-top: 1px solid var(--line); }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .map-wrap { height: 60vh; }
  .hero { grid-template-columns: auto 1fr; }
  .hero .stats { grid-column: 1 / -1; }
  .hero-logo { width: 110px; height: 110px; }
  .skin-grid { grid-template-columns: 1fr; }
  #stage { height: 52vh; min-height: 320px; }
}
@media (max-width: 760px) {
  .top { gap: 10px; }
  .top .spacer { display: none; }
  .top > .btn, .account { margin-left: auto; }
  .nav { order: 3; width: 100%; }
  .nav a { flex: 1; text-align: center; }
}
@media (max-width: 560px) {
  .growth-row { flex-wrap: wrap; }
  .growth-row label { min-width: 0; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  footer.foot { flex-direction: column; }
}

/* ---------- map layers, admin editor, Prime checklist ---------- */
.zone-label span {
  display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; padding: 2px 8px; border-radius: 999px;
  background: rgba(11, 15, 12, .82); border: 1px solid; color: #f1f5ec; font: 600 12px "Prompt", sans-serif;
}
.spawn-pin { font-size: 20px; line-height: 26px; text-align: center; filter: drop-shadow(0 2px 3px #000); }
#map.placing { cursor: crosshair; }
.leaflet-control-layers { background: rgba(19, 26, 21, .92); color: var(--text); border: 1px solid var(--line-2) !important; border-radius: 10px !important; font: 13px "Prompt", sans-serif; }
.leaflet-control-layers label { margin: 2px 0; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #18211b; color: var(--text); }
.pop-actions { display: flex; gap: 6px; margin-top: 8px; }
.pop-actions button { border: 1px solid var(--line-2); background: #0f1511; color: var(--text); border-radius: 7px; padding: 4px 9px; font: 12px "Prompt", sans-serif; cursor: pointer; }
.pop-actions button[data-act="delete"] { border-color: #e5675f88; color: #ffb2a8; }
.small { font-size: 12px; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.tools .btn { padding: 7px 6px; font-size: 13px; }
.tools .btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.editor-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.editor-row input, .editor-row select { min-width: 0; flex: 1; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px; background: #0e1410; }
.editor-row .radius { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.editor-row .radius input { width: 70px; flex: none; }
.prime-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.prime-head b { font-size: 16px; }
.prime-head span:nth-child(2) { color: var(--muted); font-size: 13px; }
.prime-ok { margin-left: auto; color: #ffd36b; font-weight: 700; font-size: 13px; }
.prime-wait { margin-left: auto; color: var(--accent-2); font-size: 13px; }
.prime-bar { height: 8px; background: #22302a; border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.prime-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2a541, #ffd36b); border-radius: 4px; }
.prime-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.prime-list li label { display: flex; gap: 9px; align-items: flex-start; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #0f1511; cursor: pointer; font-size: 13.5px; }
.prime-list li.done label { border-color: #8bd25f66; background: #142012; }
.prime-list input { accent-color: var(--accent); margin-top: 3px; }
.prime-list small { display: block; color: var(--muted); font-size: 11.5px; }
.prime-warn { color: #ffb2a8; font-size: 13px; margin: 0 0 8px; }
.cannibal { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid #e5675f55; border-radius: 9px; background: #1d1311; font-size: 13.5px; cursor: pointer; }
.cannibal.on { border-color: var(--bad); color: #ffb2a8; }
.cannibal input { accent-color: var(--bad); }
#map { background: radial-gradient(ellipse at 50% 45%, #13241c 0%, #0b1712 60%, #08110d 100%); }
.grid-label span { display: inline-block; white-space: nowrap; padding: 1px 6px; border-radius: 6px; background: rgba(8, 17, 13, .85); color: #8fb39a; font: 600 11px ui-monospace, Consolas, monospace; }
.grid-label.gl-top span { transform: translate(-50%, 4px); }
.grid-label.gl-left span { transform: translate(4px, -50%); }
.coord-readout { padding: 5px 10px; border-radius: 8px; background: rgba(11, 15, 12, .88); border: 1px solid var(--line-2); color: #d8f3c3; font: 600 12px ui-monospace, Consolas, monospace; }
.calib { margin-top: 6px; }
.calib summary { margin-bottom: 6px; }
.calib-row { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.calib-row input { min-width: 0; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: #0e1410; font: 12px ui-monospace, Consolas, monospace; }
.calib-row .btn { padding: 6px 9px; font-size: 12px; }
.calib-row .btn.on { background: var(--accent-2); border-color: var(--accent-2); color: #1e1206; }
.calib-pin b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-2); color: #1e1206; border: 2px solid #fff; font: 700 12px "Prompt", sans-serif; box-shadow: 0 2px 6px #000; }
.place-label span { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; padding: 1px 7px; border-radius: 6px; background: rgba(11, 15, 12, .7); color: #f1e6c8; font: italic 600 12px "Prompt", sans-serif; letter-spacing: .02em; text-shadow: 0 1px 2px #000; }

#map.map-far .place-label.minor { display: none; } /* minor names only when zoomed in */
/* Points shrink with distance: coloured dots for the whole island, icons once zoomed in */
.point-pin span { transition: transform .15s ease; }
#map.map-mid .point-pin span { transform: scale(.75); }
#map.map-far .point-pin span { transform: scale(.38); font-size: 0; background: var(--c); border: 4px solid rgba(255,255,255,.9); box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
#map.map-far .point-pin.g-animals span { transform: scale(.48); }
.point-pin:hover span { transform: scale(1.1) !important; font-size: 15px !important; background: rgba(12, 16, 13, .9) !important; border-color: var(--c) !important; z-index: 5; }
.point-pin:hover { z-index: 3000 !important; }

/* Admin rainbow: animated tag next to the name and the Skin Lab toggle */
@keyframes rainbow-shift { to { background-position: 200% 0; } }
.admin-tag, .rainbow-btn.on {
  background: linear-gradient(90deg, #ff4d4d, #ffb84d, #f5f54d, #5cff6e, #4dd2ff, #9b6bff, #ff4dd8, #ff4d4d) 0 0 / 200% 100%;
  animation: rainbow-shift 3s linear infinite;
}
.admin-tag { -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.rainbow-btn.on { color: #111; border-color: transparent; font-weight: 700; }
.tone-row[hidden] { display: none; }
.tone-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 16px 14px; }
.tone-row > span { font-size: 13px; margin-right: 4px; }
.tone-row small { color: var(--muted); font-size: 11px; margin-left: 4px; }
.tone-chip { border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); padding: 6px 12px; font-size: 12px; font-weight: 700; }
.tone-chip.on { background: var(--sw); border-color: transparent; color: #1a1a1a; box-shadow: 0 0 10px rgba(255,255,255,.18); }
.tone-chip[data-tone="black"].on { color: #ffb27a; box-shadow: 0 0 10px rgba(255,90,0,.35); }

/* Map points: round pin per kind, ringed in its group colour; faded while waiting for review */
.point-pin span { display: block; width: 28px; height: 28px; line-height: 24px; text-align: center; font-size: 15px; border-radius: 50%; border: 2px solid; background: rgba(12, 16, 13, .85); box-shadow: 0 2px 5px rgba(0, 0, 0, .6); }
.point-pin.pending span { opacity: .5; border-style: dashed; }
.pop-note { margin: 6px 0 0; padding: 5px 8px; border-radius: 6px; background: rgba(255, 255, 255, .06); font-size: 12px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 4px 0; font-size: 12.5px; }
.lg-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg-item b { color: var(--accent); }
#suggestBody select, #suggestBody input, #pointKind { width: 100%; margin: 4px 0; }
.sg-or { text-align: center; margin: 6px 0 2px; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.review-list .btn { padding: 3px 8px; }
button.link { background: none; border: 0; padding: 0; color: var(--text); font-weight: 700; cursor: pointer; }

/* In-game colour codes: one row per region, the code button copies it */
.gc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gc-sub { font-size: 12.5px; color: var(--accent); }
.gc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.gc-list li { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 4px 8px; }
.gc-sw { width: 18px; height: 18px; border-radius: 5px; border: 1px solid #ffffff33; }
.gc-name { font-size: 13px; } .gc-name small { color: var(--muted); margin-left: 4px; }
.gc-code { font: 700 12.5px ui-monospace, Consolas, monospace; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; }
.gc-rgb { grid-column: 2 / 4; color: var(--muted); font-size: 11px; margin-top: -3px; }

/* Admin panel */
.admin-page { max-width: 1200px; margin: 0 auto; padding: 18px 16px 40px; display: grid; gap: 16px; }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.admin-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-page .mt { margin-top: 16px; }
.admin-page .quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.admin-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; font-size: 13px; }
.players-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.players-head input { max-width: 280px; }
.table-wrap { overflow-x: auto; }
table.players { width: 100%; border-collapse: collapse; font-size: 13px; }
table.players th, table.players td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.players th { color: var(--muted); font-weight: 600; }
.admin-dialog { background: var(--panel, #131a15); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px; width: min(440px, 92vw); }
.admin-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.admin-dialog h3 { margin: 0 0 4px; }
.admin-dialog .lbl { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.admin-dialog .short { width: 90px; flex: none; }
.admin-dialog .dlg-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.btn.danger { background: #8c2a22; border-color: #8c2a22; color: #fff; }

.nav a[hidden] { display: none; }

/* Live positions on the map: you (pulsing lime) and other players (admins only) */
.live-me { overflow: visible; }
.live-me i { position: relative; display: block; width: 30px; height: 30px; transition: transform .6s ease; filter: drop-shadow(0 0 4px #b46bff) drop-shadow(0 0 10px rgba(180,107,255,.85)); animation: live-glow 1.8s ease-in-out infinite; }
.live-me i::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #e4c6ff, #9b4dff 60%, #6a1fd6); clip-path: polygon(50% 0, 92% 92%, 50% 70%, 8% 92%); }
@keyframes live-glow { 0%,100% { filter: drop-shadow(0 0 3px #b46bff) drop-shadow(0 0 8px rgba(180,107,255,.7)); } 50% { filter: drop-shadow(0 0 6px #d6a8ff) drop-shadow(0 0 16px rgba(180,107,255,1)); } }
.live-other i { display: block; width: 14px; height: 14px; border-radius: 50%; background: #ffb347; border: 2px solid #fff; box-sizing: border-box; }
.live-other span { position: absolute; left: 16px; top: -3px; white-space: nowrap; font: 600 11px "Prompt", sans-serif; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; }

/* admin: Prime editor in the player dialog */
.prime-admin { display: grid; gap: 4px; margin-bottom: 8px; max-height: 280px; overflow-y: auto; }
.prime-admin .pchk { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }

/* ===================== Theme v2 (2026-11): jungle background, red + gold, Kanit — matches the app ===================== */
:root {
  --bg: #07080a; --panel: rgba(12, 13, 15, .78); --panel-2: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
  --text: #f1f2f0; --muted: #a3a8ac; --accent: #e5393e; --accent-2: #f2a93b; --gold2: #ffc65c; --accent-ink: #fff;
}
body {
  font-family: "Kanit", "Prompt", system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(7, 8, 10, .92) 0, rgba(7, 8, 10, .55) 26%, rgba(7, 8, 10, 0) 55%),
    linear-gradient(180deg, rgba(7, 8, 10, .3) 0, rgba(7, 8, 10, .78) 560px, rgba(7, 8, 10, .92) 100%),
    #07080a url(/bg.webp) 65% top / cover no-repeat fixed;
}
.top { background: rgba(8, 9, 11, .78); border-bottom: 1px solid var(--line); }
.brand h1 { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.dot.on { background: #4ade80; box-shadow: 0 0 10px #4ade80; }
.nav { background: rgba(0, 0, 0, .4); border-color: var(--line); }
.nav a.on { background: var(--accent); color: #fff; }
.btn { background: rgba(255, 255, 255, .06); border-color: var(--line-2); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--accent-2)); border: 0; color: #2a1a03; box-shadow: 0 6px 18px rgba(242, 169, 59, .3); }
.btn.ghost { background: rgba(0, 0, 0, .45); }
.btn.big { padding: 12px 20px; font-size: 15.5px; border-radius: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.kicker { color: var(--accent-2); }
.stat .num, .bars .count { color: var(--gold2); }
.bars .bar { background: rgba(255, 255, 255, .08); }
.bars .bar i { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.promo { background: linear-gradient(140deg, rgba(60, 36, 10, .82), rgba(14, 12, 10, .85) 70%); border-color: rgba(242, 169, 59, .3); }
input[type=range] { accent-color: var(--accent); }
kbd { display: inline-block; padding: 0 7px; border-radius: 5px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .08); font: 600 12px/1.6 ui-monospace, Consolas, monospace; }

/* hero */
.hero2 { padding: clamp(28px, 6vw, 70px) clamp(16px, 4vw, 48px) 26px; display: grid; gap: 26px; }
.hero2-main { display: flex; align-items: center; gap: clamp(18px, 4vw, 44px); }
.hero2-logo { width: clamp(150px, 20vw, 250px); height: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .7)); flex: none; }
.hero2-text h2 { margin: 4px 0 8px; font-size: clamp(34px, 6vw, 64px); font-weight: 800; line-height: 1; letter-spacing: .02em; text-transform: uppercase; text-shadow: 0 4px 24px rgba(0, 0, 0, .7); }
.hero2-text h2::after { content: ""; display: block; width: 90px; height: 4px; margin-top: 14px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.hero2-text p { margin: 0 0 18px; max-width: 640px; color: #d4d7d9; font-size: clamp(15px, 1.6vw, 17.5px); text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.join-card { display: inline-flex; align-items: center; gap: 16px; padding: 10px 12px 10px 18px; margin-bottom: 16px; border-radius: 14px; background: rgba(0, 0, 0, .55); border: 1px solid rgba(229, 57, 62, .45); backdrop-filter: blur(8px); }
.join-card small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.join-card code { font: 700 clamp(20px, 2.6vw, 26px)/1.1 ui-monospace, Consolas, monospace; color: #fff; letter-spacing: .04em; }
.hero2-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.live-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile2 { padding: 14px 18px; border-radius: 14px; background: rgba(0, 0, 0, .55); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.tile2 small { display: block; color: var(--muted); font-size: 12.5px; letter-spacing: .04em; }
.tile2 b { font-size: clamp(24px, 3vw, 32px); font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.tile2 em { font-style: normal; font-size: 15px; color: var(--muted); margin-left: 2px; }
.tile2 .state.on { color: #4ade80; } .tile2 .state.off { color: #ff8a8d; }

/* sections */
.block { padding: 18px clamp(16px, 4vw, 48px); }
.block-head { margin-bottom: 14px; }
.block-head.inset { padding: 18px clamp(16px, 4vw, 48px) 0; margin: 0; }
.block-head h2 { margin: 2px 0 0; font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.step { position: relative; padding: 18px 18px 16px 70px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.step .n { position: absolute; left: 18px; top: 16px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 18px; color: #fff; background: var(--accent); box-shadow: 0 0 0 4px rgba(229, 57, 62, .2); }
.step b { display: block; font-size: 16px; margin-bottom: 4px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.ip-inline { padding: 1px 6px; border-radius: 6px; background: rgba(229, 57, 62, .18); color: #fff; font-family: ui-monospace, Consolas, monospace; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.feat { padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); transition: border-color .2s, transform .2s; }
.feat:hover { border-color: rgba(229, 57, 62, .5); transform: translateY(-2px); }
.feat i { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 10px; border-radius: 12px; font-style: normal; font-size: 24px; background: rgba(242, 169, 59, .12); border: 1px solid rgba(242, 169, 59, .3); }
.feat b { display: block; font-size: 16px; margin-bottom: 4px; }
.feat p { margin: 0; color: var(--muted); font-size: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.facts span { padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .45); border: 1px solid var(--line); font-size: 13.5px; }
.home .layout { height: min(78vh, 760px); }
.two-up { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.download-card .btn, .promo .btn { margin-top: 6px; }
.download-card { border-color: rgba(242, 169, 59, .3); }
.foot { display: flex; align-items: center; gap: 14px; padding: 20px clamp(16px, 4vw, 48px) 30px; border-top: 1px solid var(--line); margin-top: 10px; background: rgba(0, 0, 0, .5); }
.foot-logo { width: 54px; height: 54px; object-fit: contain; }
@media (max-width: 1000px) {
  .live-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps, .features { grid-template-columns: 1fr 1fr; }
  .two-up { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .hero2-main { flex-direction: column; text-align: center; }
  .hero2-text h2::after { margin-inline: auto; }
  .hero2-cta { justify-content: center; }
  .join-card { width: 100%; justify-content: space-between; }
  .steps, .features { grid-template-columns: 1fr; }
  .home .layout { height: auto; }
  .top .btn.ghost { display: none; }
}

/* Inside the desktop app (/skins?app=1): no page background, so the app's own scene shows through. */
html.in-app, html.in-app body { background: transparent !important; }
/* Inside the desktop app the skin page is the whole view: no site header or links to other pages */
html.in-app header.top { display: none !important; }
@font-face { font-family: "Kanit"; font-weight: 400; font-display: swap; src: url(vendor/fonts/kanit-thai-400.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-weight: 400; font-display: swap; src: url(vendor/fonts/kanit-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Kanit"; font-weight: 600; font-display: swap; src: url(vendor/fonts/kanit-thai-600.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-weight: 600; font-display: swap; src: url(vendor/fonts/kanit-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Kanit"; font-weight: 800; font-display: swap; src: url(vendor/fonts/kanit-thai-800.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-weight: 800; font-display: swap; src: url(vendor/fonts/kanit-latin-800.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
/* Local Thai fonts, independent of Google Fonts availability. */
:root { --muted: #b3bdb8; }
body, button, input, select, textarea { font-family: 'Kanit','Leelawadee UI',Tahoma,sans-serif; line-height: 1.65; }
p, li, label, small, button, .muted { letter-spacing: normal; }
p, li, label, h1, h2, h3, .card { overflow-wrap: anywhere; }
small, .small { font-size: 13px; line-height: 1.7; }
button, .btn { white-space: normal; min-height: 36px; }
.card, aside, main { min-width: 0; }

/* Skin studio: keep Thai controls readable in the embedded desktop pane. */
.skin-grid > *, .skin-grid aside, .studio { min-width: 0; }
.stage-top, .stage-foot, .growth-row, .picker-head { flex-wrap: wrap; }
.stage-top, .stage-foot { line-height: 1.65; }
.stage-foot > span { overflow-wrap: anywhere; }
.growth-row input { flex: 1 1 140px; min-width: 80px; }
html.in-app body { overflow-y: auto; }
html.in-app .skin-page { padding: 16px; }
html.in-app .skin-grid { grid-template-columns: minmax(0,1fr) minmax(300px,340px); }
html.in-app .foot { display: none; }
@media(max-width:1000px) { html.in-app .skin-grid, .skin-grid { grid-template-columns: minmax(0,1fr); } #stage { min-height:300px; } }

/* Opaque embedded studio: never reveal the preceding native page. */
html.in-app, html.in-app body { background: #0d1014 !important; color: #f1f2f0; }
html.in-app .skin-page { min-height: 100vh; background: #0d1014; }

/* ---- Skin Lab inside the desktop app: one screen, no page scroll ----
   3D view on the left fills the height; the colour panel on the right scrolls on its own.
   Only for ?app=1 (html.in-app); the website layout is unchanged. */
html.in-app, html.in-app body { height: 100%; overflow: hidden !important; }
html.in-app .skin-head { display: none; }
html.in-app .skin-page { height: 100vh; min-height: 0; padding: 10px; box-sizing: border-box; display: flex; flex-direction: column; }
html.in-app .skin-grid { flex: 1; min-height: 0; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) clamp(290px, 34vw, 370px); gap: 10px; align-items: stretch; }
html.in-app .viewer { display: flex; flex-direction: column; height: 100%; min-height: 0; margin: 0; }
html.in-app #stage { flex: 1; height: auto; min-height: 0; }
html.in-app .growth-row { padding: 8px 12px; gap: 10px; }
html.in-app .growth-row label { min-width: 120px; font-size: 13px; }
html.in-app .panel { height: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 10px; gap: 9px; margin: 0; scrollbar-width: thin; scrollbar-color: #3a4a3e transparent; }
html.in-app .panel::-webkit-scrollbar { width: 6px; }
html.in-app .panel::-webkit-scrollbar-thumb { background: #3a4a3e; border-radius: 3px; }
html.in-app .species-card { padding: 8px 11px; }
html.in-app .species-card .icon { font-size: 22px; width: 30px; }
html.in-app button, html.in-app .btn { min-height: 32px; }
@media (max-width: 1000px) {
  html.in-app .skin-grid { grid-template-columns: minmax(0, 1fr) clamp(270px, 40vw, 330px); }
  html.in-app #stage { min-height: 0; }
}
/* very narrow app window: stack, 3D on top, panel scrolls below */
@media (max-width: 680px) {
  html.in-app .skin-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46% minmax(0, 1fr); }
}
/* colour swatches: let the 10 columns shrink to the panel (the global button min-height made them 48 px wide) */
.swatches { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.swatches button { min-height: 0; min-width: 0; }
.shades button { min-height: 0; min-width: 0; }
.shades { grid-template-columns: repeat(7, minmax(0, 1fr)); }
