:root {
  --bg: #0b0b0f;
  --panel: #15151c;
  --line: #2a2a35;
  --text: #f4f4f7;
  --muted: #a3a3b2;
  --accent-a: #aa5cc3;
  --accent-b: #00a4dc;
  --danger: #e5484d;
  --ok: #3dd68c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: #8fd3ff; }
img { max-width: 100%; }

.brandbar {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(244,244,247,.78); text-decoration: none;
}
.mark { width: 26px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); }

/* ---------- public share page ---------- */
body.share { overflow-x: hidden; }
.hero { position: fixed; inset: 0; z-index: 0; }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.shade {
  position: fixed; inset: 0; z-index: 1;
  background:
    linear-gradient(90deg, rgba(8,8,12,.96) 0%, rgba(8,8,12,.82) 45%, rgba(8,8,12,.45) 100%),
    linear-gradient(0deg, rgba(8,8,12,.95) 0%, rgba(8,8,12,0) 45%);
}
body.share > header, body.share > main, body.share > footer { position: relative; z-index: 2; }
body.share > header { display: flex; padding: 28px clamp(16px, 5vw, 64px) 0; }
.card {
  display: flex; gap: clamp(20px, 4vw, 48px); align-items: flex-end;
  max-width: 1100px; min-height: calc(100vh - 140px);
  padding: 32px clamp(16px, 5vw, 64px) 24px;
}
.poster {
  flex: none; width: clamp(150px, 24vw, 250px); height: auto; border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}
.info { max-width: 640px; }
.kicker { margin: 0 0 .4rem; font-size: .75rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.info h1 { margin: 0; font-size: clamp(2rem, 5.5vw, 3.6rem); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.info h2 { margin: .5rem 0 0; font-size: clamp(1.1rem, 2.6vw, 1.5rem); font-weight: 600; }
.meta { margin: .75rem 0 0; color: #d0d0da; font-weight: 500; }
.overview { margin: 1rem 0 0; color: #d6d6de; max-width: 60ch; }
.actions { margin: 1.6rem 0 0; }
.button {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.5rem; border-radius: 10px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none;
  box-shadow: 0 10px 30px rgba(120, 90, 255, .35);
}
.button:hover, .button:focus-visible { filter: brightness(1.1); }
.button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.button svg { width: 20px; height: 20px; fill: currentColor; }
.hint { margin: .9rem 0 0; font-size: .85rem; color: var(--muted); max-width: 52ch; }
.foot { padding: 0 clamp(16px, 5vw, 64px) 24px; font-size: .78rem; color: rgba(163,163,178,.7); }

@media (max-width: 640px) {
  .card { flex-direction: column; align-items: flex-start; min-height: 0; padding-top: 24px; }
  .poster { width: 140px; }
  .shade { background: linear-gradient(0deg, rgba(8,8,12,.97) 35%, rgba(8,8,12,.6) 100%); }
  .button { width: 100%; justify-content: center; }
}

/* ---------- plain pages (home, errors) ---------- */
body.plain { display: flex; flex-direction: column; padding: 28px 16px; }
body.plain > header { max-width: 640px; width: 100%; margin: 0 auto; }
.message { max-width: 640px; width: 100%; margin: 18vh auto 0; }
.message h1 { font-size: 2rem; margin: 0 0 .5rem; }
.message p { color: #cfcfda; }

/* ---------- admin ---------- */
body.admin { background: #0f0f14; }
.adminbar { display: flex; justify-content: space-between; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--line); max-width: 1100px; margin: 0 auto; }
.who { color: var(--muted); font-size: .9rem; }
.adminmain { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.adminmain h1 { margin: .2rem 0; font-size: 1.8rem; }
.adminmain h2 { margin: 2rem 0 .8rem; font-size: 1.2rem; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: #ff9a9e; }
.crumbs { margin: 0 0 1rem; font-size: .9rem; }
input, select, button { font: inherit; color: inherit; }
input[type=text], input[type=search], select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; width: 100%;
}
button { cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem; }
button.primary { background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); border: 0; font-weight: 700; color: #fff; }
button.danger { background: transparent; border-color: var(--danger); color: #ff9a9e; }
button.small { padding: .3rem .7rem; font-size: .85rem; }
.search { display: flex; gap: .5rem; }
.grid { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; }
.grid a { display: flex; flex-direction: column; gap: .3rem; color: var(--text); text-decoration: none; }
.grid img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; background: var(--panel); }
.grid .t { font-weight: 600; line-height: 1.25; }
.shares { width: 100%; border-collapse: collapse; font-size: .95rem; }
.shares th, .shares td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.shares th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.shares tr.revoked td, .shares tr.expired td { opacity: .55; }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); }
.pill.active { color: var(--ok); border-color: rgba(61,214,140,.4); }
.pill.revoked { color: #ff9a9e; border-color: rgba(229,72,77,.4); }
.pill.expired { color: var(--muted); }
.item { display: flex; gap: 24px; align-items: flex-start; }
.item .thumb { width: 160px; height: auto; border-radius: 10px; flex: none; }
.item h2 { margin: .2rem 0; font-size: 1.15rem; }
.create { display: grid; gap: .8rem; max-width: 420px; margin-top: 1.2rem; }
.create label { display: grid; gap: .3rem; font-weight: 600; }
.list { padding-left: 1.2rem; }
.list li { margin: .3rem 0; }
.linkbox { display: flex; gap: .5rem; margin: 1.2rem 0; max-width: 760px; }
.linkbox input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.preview { display: block; width: 100%; max-width: 600px; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.revoke { margin-top: 2rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.tools { margin-top: 2.5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.tools summary { cursor: pointer; font-weight: 600; }
.bookmarklet { display: inline-block; padding: .3rem .8rem; border-radius: 8px; background: var(--panel); border: 1px dashed var(--accent-a); text-decoration: none; }

@media (max-width: 640px) {
  .item { flex-direction: column; }
  .shares th:nth-child(5), .shares td:nth-child(5) { display: none; }
  .linkbox { flex-wrap: wrap; }
  .linkbox input { flex-basis: 100%; }
}
