:root {
  --bg: #0b0906; --bg2: #120e09; --panel: #17120c; --panel2: #1e1810; --ink: #f3ead6; --muted: #a8987a; --faint: #75684f; --line: #33291c;
  --accent: #d9b25a; --accent-ink: #f0cf7e; --accent-soft: rgba(217, 178, 90, .13); --on-accent: #1d1503;
  --ok: #53d08f; --ok-soft: rgba(83, 208, 143, .12); --warn: #f2906d; --warn-soft: rgba(242, 144, 109, .12);
  --metal: linear-gradient(135deg, #b8902f 0%, #ecd27e 22%, #fff3c4 42%, #d2aa48 62%, #f5dc8f 82%, #bd9433 100%);
  --font-display: "Saira Semi Condensed", "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --r: 16px; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 15px/1.5 var(--font-body);
  background: radial-gradient(900px 520px at 0% -10%, #2a1f0c, transparent 60%), radial-gradient(700px 500px at 110% 110%, rgba(217, 178, 90, .08), transparent 60%), var(--bg);
  background-attachment: fixed; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.app { max-width: 1040px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { border-radius: 11px; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .9); }
.brand > span { display: grid; min-width: 0; }
.creator { font: 700 .62rem/1.2 var(--font-display); letter-spacing: .32em; color: var(--muted); }
.title { font: 800 1.28rem/1.15 var(--font-display); letter-spacing: .02em; background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { display: flex; align-items: center; gap: 8px; flex: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.gold { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.chip.plain::before { display: none; }

/* tabs: bottom bar on phones, inline on wide screens */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(14, 11, 7, .92); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.tabs button { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: .76rem; font-weight: 600; cursor: pointer; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button[aria-selected="true"] { color: var(--accent-ink); background: var(--accent-soft); }
@media (min-width: 760px) {
  .app { padding-bottom: 48px; }
  .tabs { position: static; justify-content: flex-start; padding: 0 0 18px; background: none; border: 0; border-bottom: 1px solid var(--line); margin-bottom: 22px; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tabs button { flex: none; flex-direction: row; gap: 8px; padding: 9px 16px; font-size: .92rem; }
  .tabs button svg { width: 18px; height: 18px; }
}

h2 { font: 700 1.05rem/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 14px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.head h2 { margin: 6px 0; }
.lede { color: var(--muted); margin: -6px 0 18px; max-width: 60ch; }

.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 12px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.primary { border: 0; background: var(--metal); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset, 0 10px 24px -14px rgba(0, 0, 0, .9); transition: transform .15s, filter .2s; }
.primary:hover { filter: brightness(1.06); }
.primary:active { transform: scale(.98); }
.ghost { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); }
.ghost:hover { border-color: #4a3c28; }
.sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; filter: none; transform: none; }
.danger { color: var(--warn); }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pkg { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 16px; border-radius: var(--r); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); }
.badge { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font: 800 .95rem/1 var(--font-display); letter-spacing: .06em; color: #120d05;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .55), transparent 55%), var(--c, var(--accent)); box-shadow: 0 8px 20px -10px var(--c, var(--accent)); }
.pkg h3 { margin: 0; font: 700 1.04rem/1.25 var(--font-body); }
.meta { margin: 2px 0 0; color: var(--muted); font-size: .84rem; }
.desc { margin: 6px 0 0; color: #cfc2a6; font-size: .9rem; }
.note { margin: 6px 0 0; color: var(--faint); font-size: .8rem; }
.status { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .primary { flex: 1 1 auto; min-width: 120px; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--metal); transition: width .2s; }
.bar.indet i { width: 35%; animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

.empty { text-align: center; padding: 42px 20px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 1.1rem; }
.empty .row { justify-content: center; margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.card { padding: 18px; border-radius: var(--r); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); margin-bottom: 14px; }
.card h3 { margin: 0 0 6px; font-size: 1rem; }
.card p { margin: 0 0 10px; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; margin: 4px 0 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.lic { list-style: none; margin: 0; padding: 0; }
.lic li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.lic li:first-child { border-top: 0; }
.thanks b { color: var(--ink); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: .9rem; margin-bottom: 14px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }

details.more { position: relative; }
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more .menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 170px; display: grid; gap: 4px; padding: 6px; border-radius: 12px; background: #231c12; border: 1px solid #4a3c28; box-shadow: 0 18px 40px -16px #000; }
details.more .menu button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; }
details.more .menu button:hover { background: var(--accent-soft); }

#toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); z-index: 60; max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 14px; background: #2a2116; border: 1px solid #4a3c28; color: var(--ink); box-shadow: 0 20px 40px -18px #000; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#toast.bad { border-color: #6b3424; }
#toast a, #toast button { margin-left: 8px; }
@media (min-width: 760px) { #toast { bottom: 28px; } }

#player { position: fixed; inset: 0; z-index: 100; background: #000; }
#player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
#closePlayer { position: absolute; z-index: 2; top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); display: inline-flex; align-items: center; gap: 2px;
  padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid rgba(217, 178, 90, .35); background: rgba(11, 9, 6, .6); color: #f0cf7e; font-size: .74rem; font-weight: 700; cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: .55; transition: opacity .2s; }
#closePlayer.dragging { cursor: grabbing; opacity: 1; transition: none; }
#closePlayer:hover, #closePlayer:focus-visible { opacity: 1; }
#closePlayer svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.keyin { flex: 1 1 220px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: #0f0c08; color: var(--ink);
  font: 600 1rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.keyin:focus { border-color: var(--accent); outline: none; }
