/* Kappa's Tweaks. One dark theme, colours taken from the mod's own art (mod_image.png):
   night purple, kappa green, lettering lime. Tokens, base, layout, components, pages, admin. */

@font-face {
  font-family: "Jakarta";
  src: url("/fonts/jakarta-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jakarta";
  src: url("/fonts/jakarta-latin-ext.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #130E1B;
  --bg-2: #1A1424;
  --surface: #1F1829;
  --surface-2: #271F33;
  --line: #342A44;
  --line-2: #43375A;
  --ink: #F4EFF8;
  --ink-2: #D2C9DD;
  --muted: #9C92AE;
  --faint: #6D6382;
  --green: #8CC152;
  --green-hi: #A8D86A;
  --green-ink: #13200A;
  --lime: #DDE66B;
  --purple: #A77BE0;
  --teal: #55C6C9;
  /* in-game keyword colours */
  --kw-gold: #EFC851;
  --kw-blue: #7FC8F0;
  --kw-purple: #C792F2;
  --kw-red: #FF7A70;
  --ok: #8CC152;
  --ok-soft: #1E2B16;
  --bad: #FF6B6B;
  --bad-soft: #2F1719;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 14px 34px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  --r: 14px;
  --r-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* ---- base ------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 500 15.5px/1.55 "Jakarta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: .88em; }
[hidden] { display: none !important; }
::selection { background: var(--green); color: var(--green-ink); }
:focus-visible { outline: 2.5px solid var(--lime); outline-offset: 2px; border-radius: 8px; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---- header / footer -------------------------------------------------------------------- */

.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .25s;
}
.site-head.scrolled { border-bottom-color: var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--muted); transition: color .2s, background .2s; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a.active { color: var(--ink); }
.head-tools { display: flex; align-items: center; }
@media (max-width: 420px) { .brand span { display: none; } .nav a { padding: 8px 10px; } }

.site-foot { margin-top: 88px; border-top: 1px solid var(--line); padding: 26px 0 34px; color: var(--muted); font-size: 13.5px; }
.site-foot .wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-foot .spacer { flex: 1; }
.site-foot a:hover { color: var(--ink); }

/* ---- buttons & fields ------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 18px; border: 0; border-radius: 12px;
  font-size: 14.5px; font-weight: 700; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, color .2s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #fff; }
.btn-green { background: var(--green); color: var(--green-ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 10px 30px -12px rgba(140, 193, 82, .55); }
.btn-green:hover { background: var(--green-hi); }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--muted); height: 36px; padding: 0 12px; border-radius: 10px; }
.btn-quiet:hover { background: var(--surface); color: var(--ink); }
.btn-danger:hover { color: var(--bad); background: var(--bad-soft); }
.btn-lg { height: 54px; padding: 0 26px; font-size: 16.5px; border-radius: 14px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn .sub { font-weight: 600; opacity: .7; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 11px; background: transparent; color: var(--muted); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font-size: 12.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }
.pill .ic { width: 14px; height: 14px; }
.pill-green { background: var(--ok-soft); color: var(--green); }
.pill-purple { background: #2A1D3D; color: var(--kw-purple); }
.tag-version { font-family: var(--mono); font-weight: 700; letter-spacing: -.01em; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, .textarea { width: 100%; height: 46px; padding: 0 14px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; transition: border-color .2s, box-shadow .2s; }
.textarea { height: auto; min-height: 130px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(140, 193, 82, .18); }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.form-error { display: flex; gap: 8px; align-items: flex-start; color: var(--bad); font-size: 13.5px; font-weight: 600; }
.form-error .ic { width: 18px; height: 18px; margin-top: 1px; }
.hint { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* in-game keyword colours, used by renderGameText() */
.kw-gold { color: var(--kw-gold); font-weight: 700; }
.kw-blue { color: var(--kw-blue); font-weight: 700; }
.kw-purple { color: var(--kw-purple); font-weight: 700; }
.kw-red { color: var(--kw-red); font-weight: 700; }
.kw-green { color: var(--green); font-weight: 700; }

/* ---- hero ------------------------------------------------------------------------------- */

.hero { position: relative; isolation: isolate; overflow: hidden; padding: 72px 0 64px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: url("/img/fuse.jpg") center 30% / cover no-repeat;
  opacity: .5; filter: saturate(1.15);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(19, 14, 27, .55) 0%, rgba(19, 14, 27, .2) 40%, var(--bg) 100%),
    linear-gradient(90deg, rgba(19, 14, 27, .85) 0%, rgba(19, 14, 27, .2) 70%);
}
.hero .wrap { display: grid; grid-template-columns: auto 1fr; gap: 56px; align-items: center; }
.cover {
  width: 300px; aspect-ratio: 1; border-radius: 22px; display: block;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, .08);
  transform: rotate(-3deg); transition: transform .5s var(--ease);
}
.cover:hover { transform: rotate(0) scale(1.02); }
.hero h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1; font-weight: 800; letter-spacing: -.04em; }
.hero .tagline { margin-top: 14px; font-size: 19px; color: var(--ink-2); }
.hero .tagline em { font-style: normal; color: var(--lime); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 22px; font-size: 14px; color: var(--muted); }
.hero-facts b { color: var(--ink-2); font-weight: 650; }
.eyebrow { font-size: 12.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; color: var(--green); }
.hero .eyebrow { display: block; margin-bottom: 12px; }
@media (max-width: 820px) {
  .hero { padding: 36px 0 44px; text-align: center; }
  .hero .wrap { grid-template-columns: 1fr; gap: 30px; justify-items: center; }
  .cover { width: min(240px, 64vw); }
  .hero-actions, .hero-facts { justify-content: center; }
  .hero::after { background: linear-gradient(180deg, rgba(19, 14, 27, .6), var(--bg)); }
}

/* friend-only strip: rendered only for unlocked browsers */
.secret { display: flex; align-items: center; gap: 18px; padding: 16px 18px; margin-top: 8px; border-color: #3E2F57; background: linear-gradient(100deg, #241A33, var(--surface)); }
.secret img { width: 64px; height: 64px; border-radius: 12px; flex: none; }
.secret h3 { font-size: 16px; font-weight: 800; }
.secret .hint { margin-top: 2px; }
.secret .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .secret { flex-wrap: wrap; } .secret .actions { margin-left: 0; width: 100%; } .secret .actions .btn { flex: 1; } }

/* ---- sections --------------------------------------------------------------------------- */

.section { padding-top: 72px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.h2 { font-size: clamp(24px, 3vw, 30px); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }

/* What's inside: three art tiles, then StS-style tooltip boxes */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { position: relative; overflow: hidden; border-radius: var(--r-lg); aspect-ratio: 16 / 10; display: flex; align-items: flex-end; border: 1px solid var(--line); }
.feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.feature:hover img { transform: scale(1.04); }
.feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(12, 8, 18, .92)); }
.feature .body { position: relative; z-index: 1; padding: 16px 18px; }
.feature .kind { font-size: 11.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--lime); }
.feature h3 { font-size: 17px; font-weight: 800; margin-top: 2px; }
.feature p { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
@media (max-width: 820px) { .features { grid-template-columns: 1fr; } .feature { aspect-ratio: 16 / 8; } }

.group { margin-top: 30px; }
.group h3 { font-size: 13px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tip { padding: 13px 15px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.tip b { display: block; color: var(--kw-gold); font-size: 14.5px; font-weight: 800; margin-bottom: 3px; }

/* install: one compact card */
.install { display: grid; grid-template-columns: repeat(3, 1fr); }
.install > div { padding: 22px 24px; }
.install > div + div { border-left: 1px solid var(--line); }
.install .n { font: 800 13px var(--mono); color: var(--green); }
.install h3 { font-size: 15.5px; font-weight: 750; margin: 6px 0 4px; }
.install p { font-size: 14px; color: var(--muted); }
.install code { color: var(--ink-2); }
@media (max-width: 760px) { .install { grid-template-columns: 1fr; } .install > div + div { border-left: 0; border-top: 1px solid var(--line); } }

/* ---- notes & changelog ------------------------------------------------------------------ */

.notes { color: var(--ink-2); font-size: 15px; }
.notes > * + * { margin-top: 10px; }
.notes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.notes li { position: relative; padding-left: 20px; }
.notes li::before { content: ""; position: absolute; left: 3px; top: .6em; width: 7px; height: 7px; border-radius: 2px; background: var(--green); transform: rotate(45deg); }
.notes h4 { font-size: 12.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 16px; }
.notes h4:first-child { margin-top: 0; }
.notes code { padding: 2px 6px; border-radius: 6px; background: var(--surface-2); }
.notes strong { color: var(--ink); }
.notes .empty { color: var(--faint); font-style: italic; }

.page-head { padding: 52px 0 28px; }
.page-head h1 { font-size: clamp(32px, 5vw, 44px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 8px; }
.page-head .lead { color: var(--muted); margin-top: 8px; }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); margin-top: 22px; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--ink); }

.timeline { display: grid; gap: 14px; }
.entry { padding: 22px 24px; }
.entry-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.entry-head .v { font: 800 19px var(--mono); letter-spacing: -.02em; }
.entry-head .when { margin-left: auto; color: var(--muted); font-size: 13.5px; }
.entry-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.entry.is-latest { border-color: #3B4E2A; }
@media (max-width: 600px) { .entry { padding: 18px; } .entry-head .when { margin-left: 0; width: 100%; } }

.empty-state { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty-state .ic { width: 30px; height: 30px; color: var(--faint); margin-bottom: 10px; }
.empty-state h3 { color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: skel 1.3s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }

/* ---- toast ------------------------------------------------------------------------------ */

.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 13px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 650; animation: toast-in .3s var(--ease) both; }
.toast.ok .ic { color: #4E8A1E; }
.toast.bad .ic { color: #C0392B; }
.toast.out { animation: toast-out .25s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---- admin ------------------------------------------------------------------------------ */

.login-card { max-width: 400px; margin: 72px auto 0; padding: 30px; display: grid; gap: 18px; }
.login-card img { width: 52px; height: 52px; border-radius: 13px; }
.login-card h1 { font-size: 22px; font-weight: 800; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.panel { padding: 24px; margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; font-weight: 800; }
.panel-head .ic-box { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ok-soft); color: var(--green); }
.panel-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 600px) { .panel { padding: 18px 16px; } }

.drop { display: grid; place-items: center; text-align: center; gap: 8px; padding: 34px 20px; border-radius: 16px; border: 2px dashed var(--line-2); background: var(--bg-2); transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--green); background: var(--ok-soft); }
.drop .ic-lg { width: 32px; height: 32px; color: var(--green); }
.drop h3 { font-size: 16px; font-weight: 750; }
.drop p { color: var(--muted); font-size: 14px; max-width: 52ch; }
.drop .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.picked { display: grid; gap: 14px; margin-top: 18px; }
.picked-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.picked-head img { width: 44px; height: 44px; border-radius: 10px; }
.picked-head .name { font-weight: 750; }
.picked-head .end { margin-left: auto; }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); font: 600 12px var(--mono); color: var(--ink-2); }
.file-chip .ic { width: 14px; height: 14px; color: var(--muted); }
.file-chip.dim { opacity: .45; text-decoration: line-through; }
.publish-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.publish-row .btn { margin-left: auto; }
.progress { height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }

.table-wrap { overflow-x: auto; margin: 0 -24px -24px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; text-align: right; }
.table tbody tr:hover { background: var(--surface-2); }
.table .code { font: 700 13.5px var(--mono); letter-spacing: .03em; }
.table .row-actions { display: inline-flex; gap: 2px; }
@media (max-width: 600px) { .table-wrap { margin: 0 -16px -18px; } .table th:first-child, .table td:first-child { padding-left: 16px; } .table th:last-child, .table td:last-child { padding-right: 16px; } }

.new-code { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.new-code .input { flex: 1; min-width: 200px; }
.code-reveal { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; background: var(--ok-soft); color: var(--green); }
.code-reveal .link { font: 700 14px var(--mono); color: var(--ink); word-break: break-all; }
.code-reveal .btn { margin-left: auto; }

dialog { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); width: min(620px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
dialog::backdrop { background: rgba(8, 4, 12, .6); backdrop-filter: blur(4px); }
dialog form { padding: 24px; display: grid; gap: 16px; }
dialog h2 { font-size: 18px; font-weight: 800; }
dialog .row { display: flex; justify-content: flex-end; gap: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
