@font-face { font-family: "Chakra Petch"; font-weight: 600; src: url(fonts/chakra-petch-latin-600.ttf); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; src: url(fonts/chakra-petch-latin-700.ttf); }
@font-face { font-family: Manrope; font-weight: 500; src: url(fonts/manrope-latin-500.ttf); }
@font-face { font-family: Manrope; font-weight: 600; src: url(fonts/manrope-latin-600.ttf); }
@font-face { font-family: Manrope; font-weight: 700; src: url(fonts/manrope-latin-700.ttf); }

:root {
  --bg: #090c19; --rail: #0d1124; --panel: #12162b; --card: #181d36; --card-hi: #1f2545; --field: #0b0f22;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12); --text: #e9ecff; --muted: #8d95bd; --faint: #5d6488;
  --accent: #5ef2c6; --a10: rgba(94,242,198,.10); --a20: rgba(94,242,198,.2); --violet: #8b7bff; --rose: #ff8aa3; --gold: #ffd36e;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 500 14px/1.45 Manrope, system-ui, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: "Chakra Petch", sans-serif; font-weight: 700; margin: 0; letter-spacing: .2px; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 15px; }
a { color: var(--accent); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 15px; height: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ring { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(from 200deg, #5ef2c6, #8b7bff, #5ef2c6); flex: none; }
.ring .hole { width: 15px; height: 15px; border-radius: 50%; background: var(--bg); }
.ring.big { width: 56px; height: 56px; } .ring.big .hole { width: 32px; height: 32px; background: var(--panel); }

/* buttons and fields */
button, .btn { font: 700 13px Manrope, sans-serif; color: var(--text); background: var(--card-hi); border: 1px solid var(--line2);
  border-radius: 9px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
button:hover, .btn:hover { border-color: rgba(255,255,255,.22); }
button.primary, .btn.primary { background: var(--accent); color: #07121a; border-color: transparent; }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--rose); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--card); }
button:disabled { opacity: .45; cursor: default; }
.icon-btn { padding: 7px; background: transparent; border-color: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--card); }
input, select, textarea { font: 600 13px Manrope, sans-serif; color: var(--text); background: var(--field); border: 1px solid var(--line2);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; min-height: 60px; }
input[type=checkbox], input[type=range] { accent-color: var(--accent); }
input[type=checkbox] { width: auto; }
input[type=range] { padding: 0; border: 0; background: transparent; }
input[type=color] { padding: 2px; height: 36px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; }
.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; color: var(--muted); border-radius: 7px; }
.seg button.on { background: var(--card-hi); color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.chip.on { color: var(--accent); border-color: var(--a20); background: var(--a10); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--card-hi); color: var(--muted); }
.pill.mint { background: var(--a10); color: var(--accent); } .pill.gold { background: rgba(255,211,110,.12); color: var(--gold); }
.pill.rose { background: rgba(255,138,163,.12); color: var(--rose); }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(900px 500px at 30% 20%, rgba(94,242,198,.07), transparent), radial-gradient(900px 600px at 80% 90%, rgba(139,123,255,.09), transparent); }
.login-card { width: 420px; max-width: 100%; padding: 34px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.code { font: 700 34px "Chakra Petch", sans-serif; letter-spacing: 6px; color: var(--accent); padding: 10px 16px;
  border-radius: 12px; background: var(--field); border: 1px solid var(--line2); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* frame */
.app { display: flex; min-height: 100%; }
.side { width: 228px; flex: none; background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 4px 8px 18px;
  font: 700 17px "Chakra Petch", sans-serif; letter-spacing: 1.5px; }
.brand small { display: block; font: 700 10.5px Manrope, sans-serif; letter-spacing: .4px; color: var(--faint); }
#nav { display: flex; flex-direction: column; gap: 3px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 700; }
#nav a:hover { color: var(--text); background: var(--card); }
#nav a.on { color: var(--accent); background: var(--a10); }
.who { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.who-name { flex: 1; display: flex; flex-direction: column; font-weight: 700; }
.who-name small { color: var(--faint); font-size: 11px; }
main { flex: 1; min-width: 0; }
.testmode { padding: 8px 24px; background: rgba(255,211,110,.08); border-bottom: 1px solid rgba(255,211,110,.18); color: var(--gold); font-weight: 700; font-size: 12.5px; }
#view { padding: 24px 28px 60px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.head p { margin: 4px 0 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px;
  background: var(--card-hi); border: 1px solid var(--line2); font-weight: 700; box-shadow: 0 16px 30px rgba(0,0,0,.4); z-index: 50; }
.toast.err { color: var(--rose); }

/* overview */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat b { display: block; font: 700 28px "Chakra Petch", sans-serif; }
.stat span { color: var(--muted); font-weight: 700; font-size: 12px; }

/* builder */
.builder { display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.pane-h { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.pane-b { padding: 12px; overflow: auto; }
.palette { display: flex; flex-direction: column; gap: 6px; }
.pal { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); cursor: grab; }
.pal b { display: block; font-size: 13px; } .pal small { color: var(--faint); font-size: 11.5px; font-weight: 600; }
.pal svg { color: var(--accent); }
.lib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lib-it { padding: 6px; border-radius: 9px; background: var(--card); border: 1px solid var(--line); cursor: grab; text-align: center; }
.lib-it img { width: 100%; aspect-ratio: 1; image-rendering: pixelated; object-fit: contain; }
.lib-it span { display: block; font-size: 10.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.lib-it.off { opacity: .45; }
.frame { background: #0d1124; border: 1px solid var(--line); border-radius: 18px; padding: 18px; min-height: 400px; }
.frame-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.frame-h h2 { font-size: 21px; }
.coins { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font: 700 13px "Chakra Petch", sans-serif; }
.bw { position: relative; border-radius: 16px; outline: 2px solid transparent; outline-offset: 3px; cursor: pointer; }
.bw:hover { outline-color: rgba(255,255,255,.12); }
.bw.sel { outline-color: var(--accent); }
.bw-tools { position: absolute; top: -12px; right: 8px; display: none; gap: 4px; z-index: 2; }
.bw:hover .bw-tools, .bw.sel .bw-tools { display: flex; }
.bw-tools button { padding: 4px 6px; background: var(--card-hi); }
.bw.dragging { opacity: .35; }
.drop-line { height: 3px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); margin: -8px 0 5px; }
.sb-card.drop-before { box-shadow: -6px 0 0 -2px var(--accent); }
.sb-card .x { position: absolute; top: 4px; right: 4px; display: none; padding: 2px 4px; }
.sb-card:hover .x { display: inline-flex; }
.sb-grid.drop-end { outline: 2px dashed var(--a20); outline-offset: 4px; border-radius: 10px; }
.sb-feat.drop-hot, .sb-banner.drop-hot { outline: 2px dashed var(--accent); }
.insp { display: flex; flex-direction: column; gap: 12px; }
.tones { display: flex; gap: 6px; flex-wrap: wrap; }
.tones button { width: 34px; height: 24px; padding: 0; border-radius: 7px; border: 2px solid transparent; }
.tones button.on { border-color: var(--accent); }
.media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media button { padding: 0; height: 46px; border-radius: 7px; background-size: cover; background-position: center; border: 2px solid transparent; }
.media button.on { border-color: var(--accent); }
.publish { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; color: var(--faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.015); }
td img.th { width: 44px; height: 44px; border-radius: 8px; background: var(--card); image-rendering: pixelated; object-fit: contain; display: block; }
td input.num { width: 92px; }
.bulk { position: sticky; top: 0; z-index: 3; display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 10px;
  border-radius: 12px; background: var(--card-hi); border: 1px solid var(--a20); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; background: var(--panel); border-left: 1px solid var(--line2);
  box-shadow: -20px 0 40px rgba(0,0,0,.4); padding: 20px; display: flex; flex-direction: column; gap: 12px; z-index: 20; overflow: auto; }

/* upload */
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type { text-align: left; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; background: var(--card); }
.type small { color: var(--faint); font-weight: 600; font-size: 11.5px; line-height: 1.3; }
.type.on { border-color: var(--accent); background: var(--a10); }
.type svg { color: var(--accent); margin-bottom: 4px; }
.up { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; margin-top: 16px; align-items: start; }
.dz { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; background: var(--field); }
.dz.hot { border-color: var(--accent); background: var(--a10); }
.dz b { display: block; } .dz small { color: var(--faint); font-weight: 600; }
.dz.ok { border-style: solid; border-color: var(--a20); }
.preview { aspect-ratio: 1; border-radius: 12px; background: radial-gradient(circle at 50% 42%, rgba(94,242,198,.14), rgba(13,17,36,.95) 70%);
  display: flex; align-items: center; justify-content: center; }
.preview img { width: 84%; image-rendering: pixelated; }
.err { color: var(--rose); font-weight: 700; }
.form { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 1200px) { .builder { grid-template-columns: 250px minmax(0,1fr); } .builder .insp-pane { grid-column: 1 / -1; position: static; } }
@media (max-width: 800px) { .side { display: none; } .stats { grid-template-columns: 1fr 1fr; } .up { grid-template-columns: 1fr; } }

/* tiers */
.tiers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tier .tier-pv { margin: 12px 0; }
.tier-pick { gap: 10px; } .tier-pick input[type=color] { width: 46px; height: 32px; padding: 2px; border-radius: 8px; cursor: pointer; }
.tiersel { color: var(--tier); font-weight: 800; max-width: 130px; }
@media (max-width: 1100px) { .tiers { grid-template-columns: 1fr 1fr; } }
.lib-it.pick { outline: 2px solid var(--mint, #5ff2c4); opacity: 1; }

/* moderation */
.modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.modcard { display: grid; grid-template-columns: 60px 1fr; gap: 12px; padding: 14px; border-radius: 12px;
  background: var(--panel, rgba(255,255,255,.04)); border: 1px solid var(--line, rgba(255,255,255,.08)); }
/* the cape's front (10x16 at 1,1 of the 64x32 texture), 6x */
.modimg { width: 60px; height: 96px; border-radius: 6px; background: #0d0f16 no-repeat; image-rendering: pixelated;
  background-size: 384px 192px; background-position: -6px -6px; }
.modinfo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.modinfo p { margin: 2px 0 0; font-size: 12px; }
.modbtns { grid-column: 1 / -1; display: flex; gap: 8px; }
.modbtns button { flex: 1; }

/* crash reports + feedback */
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.crtable { width: 100%; border-collapse: collapse; }
.crtable th, .crtable td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.crtable th { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .4px; }
.crtable tr[data-open] { cursor: pointer; } .crtable tr[data-open]:hover td { background: var(--card); }
.crtable td.sig { word-break: break-word; max-width: 640px; }
.crpre { margin: 12px 0 0; padding: 12px 14px; background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.crfacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 18px; }
.crfacts small { display: block; color: var(--faint); font-size: 11px; font-weight: 700; }
.crfacts b { word-break: break-word; }
svg.i.flip { transform: rotate(180deg); }
.fblist { display: flex; flex-direction: column; gap: 10px; }
.fb.done { opacity: .55; }
.fbtext { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; }
.shotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shot { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.shot img { width: 100%; border-radius: 8px; display: block; background: #000; }
.shot span { font-size: 12px; }
