:root {
  --ink: #0b2530;
  --deep: #0f3440;
  --teal: #1f6f78;
  --sea: #2a9d8f;
  --sea-soft: #d7efec;
  --sand: #e9dcc4;
  --bg: #f3f6f6;
  --card: #ffffff;
  --line: #dde5e6;
  --muted: #5d7279;
  --danger: #b3261e;
  --ok: #1e7d4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 37, 48, .06), 0 4px 16px rgba(11, 37, 48, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--teal); }
[hidden] { display: none !important; }

/* header */
.top {
  background: linear-gradient(135deg, var(--ink), var(--deep) 60%, var(--teal));
  color: #fff;
  padding: 18px 20px 22px;
}
.top-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { width: 38px; height: 38px; }
.brand b { letter-spacing: .18em; font-size: 14px; font-weight: 700; }
.top h1 { font-size: 22px; margin: 4px 0 0; font-weight: 650; width: 100%; }
.top .who { margin-left: auto; font-size: 14px; opacity: .9; display: flex; gap: 10px; align-items: center; }
.top .who button { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 80px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.narrow { max-width: 440px; margin: 30px auto; }
h2 { font-size: 19px; margin: 0 0 6px; }
p.lead { color: var(--muted); margin: 0 0 18px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

label.f { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--sea); outline-offset: 1px; border-color: transparent; }

button, .btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 16px; border-radius: 10px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover, .btn:hover { border-color: var(--teal); }
button.primary, .btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
button.primary:hover, .btn.primary:hover { background: var(--deep); }
button.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 20px; }
button.danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
button.link { border: 0; background: none; padding: 4px; color: var(--teal); font-weight: 600; }
.err { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 1em; }

/* tabs */
.tabs { display: flex; gap: 6px; margin: -8px 0 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 12px 14px; color: var(--muted); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--sea); }
.badge { background: var(--sea-soft); color: var(--deep); border-radius: 99px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }

/* upload */
.drop {
  display: block; border: 2px dashed #a9c6c8; border-radius: var(--radius); background: #f8fbfb;
  padding: 34px 18px; text-align: center; cursor: pointer; transition: .15s;
}
.drop:hover, .drop.over { background: var(--sea-soft); border-color: var(--sea); }
.drop svg { width: 46px; height: 46px; color: var(--teal); }
.drop strong { display: block; font-size: 18px; margin: 8px 0 4px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tips { font-size: 13px; color: var(--muted); margin: 14px 2px 0; line-height: 1.5; }
.tips li { margin: 2px 0; }

.summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 22px 0 8px; flex-wrap: wrap; }
.summary .bar { flex-basis: 100%; }
.bar { height: 8px; background: #e6eeee; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sea), var(--teal)); transition: width .3s; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.queue .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.queue .state { color: var(--muted); white-space: nowrap; }
.queue .bar { grid-column: 1 / -1; height: 5px; }
.queue li.done .state { color: var(--ok); }
.queue li.failed .state { color: var(--danger); }
.notice { background: #fff7e3; border: 1px solid #f0dca8; color: #6b5414; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-top: 14px; }

/* gallery */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar select { width: auto; min-width: 180px; padding: 9px 12px; font-size: 15px; }
.toolbar .grow { flex: 1; }
.group h3 { font-size: 16px; margin: 26px 0 10px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.group h3 .muted { font-weight: 400; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #dfe8e9;
  border: 0; padding: 0; cursor: pointer; display: block; width: 100%;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--teal); font-size: 12px; padding: 8px; text-align: center; word-break: break-all; }
.tile .play {
  position: absolute; right: 8px; bottom: 8px; background: rgba(11, 37, 48, .75); color: #fff;
  border-radius: 99px; font-size: 12px; padding: 3px 9px;
}
.tile .del { position: absolute; top: 6px; right: 6px; padding: 4px 8px; font-size: 12px; background: rgba(255,255,255,.92); color: var(--danger); }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(5, 17, 22, .94); z-index: 50; display: flex; flex-direction: column; }
.lb-bar { display: flex; align-items: center; gap: 10px; color: #fff; padding: 10px 14px; font-size: 14px; }
.lb-bar .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar button, .lb-bar a { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); padding: 8px 12px; font-size: 14px; }
.lb-stage { flex: 1; display: grid; place-items: center; min-height: 0; position: relative; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; font-size: 26px; width: 46px; height: 64px; }
.lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }
.lb-note { color: #c9d6d8; font-size: 13px; text-align: center; padding: 8px 16px 14px; }

/* admin */
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 180px; }
.exp-list { display: grid; gap: 14px; margin-top: 18px; }
.exp { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.exp h3 { margin: 0 0 4px; font-size: 17px; }
.exp .meta { font-size: 13px; color: var(--muted); }
.exp .link { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--bg); padding: 6px 8px; border-radius: 8px; word-break: break-all; margin: 10px 0 6px; }
.exp .code { font-family: ui-monospace, Menlo, monospace; font-weight: 700; letter-spacing: .06em; }
.exp .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.exp .actions button, .exp .actions .btn { padding: 7px 12px; font-size: 14px; }
.exp img.qr { width: 120px; height: 120px; border-radius: 8px; border: 1px solid var(--line); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-right: 14px; cursor: pointer; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--sea-soft); color: var(--deep); margin-left: 6px; }
.pill.off { background: #f3dcda; color: var(--danger); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; }

@media (max-width: 600px) {
  .card { padding: 18px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .tile { border-radius: 6px; }
  .exp { grid-template-columns: 1fr; }
  .exp img.qr { display: none; }
  .top h1 { font-size: 19px; }
}
.row > .row-btn { flex: 0 0 auto; min-width: 0; }
.create-btn { margin-bottom: 1px; padding: 12px 18px; }
.tile .del.dl { right: auto; left: 6px; color: var(--ink); }
.toggles { margin-top: 12px; }
.gcard { margin-bottom: 16px; }
.gactions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
