:root {
  --bg: #120f17;
  --panel: #1b1722;
  --panel-2: #231e2c;
  --line: #342d40;
  --text: #ece8f2;
  --muted: #9a92a8;
  --accent: #e8c26b;
  --accent-ink: #1a1408;
  --danger: #ff7a7a;
  --ok: #7ed6a0;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; white-space: nowrap;
  text-decoration: none; line-height: 1.2;
}
.btn:hover { border-color: #4a4158; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: #5a3036; background: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 13px; border-radius: 6px; }
.icon-btn {
  width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; padding: 0; font-size: 14px;
}
.icon-btn:hover { border-color: #4a4158; }
.icon-btn.danger:hover { color: var(--danger); border-color: #5a3036; }
.icon-btn:disabled { opacity: .35; cursor: default; }

label.field { display: grid; gap: 5px; }
label.field > span { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
label.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=url], input[type=tel], textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0f0c13;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .row-3 { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.lang { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: #2e2739; color: var(--accent); margin-right: 4px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(360px, 100%); display: grid; gap: 14px; background: var(--panel); padding: 28px; border-radius: 14px; border: 1px solid var(--line); }
.login h1 { margin: 0; font-size: 18px; letter-spacing: .08em; }
.login .error { color: var(--danger); margin: 0; min-height: 1.5em; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 20px; background: rgba(18, 15, 23, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .12em; margin-right: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 7px 12px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.tab[aria-selected=true] { background: var(--panel-2); color: var(--text); }
.spacer { flex: 1; }
.status { font-size: 13px; color: var(--muted); }
.status.dirty { color: var(--accent); }
.who { font-size: 13px; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; max-width: min(640px, calc(100% - 32px));
  padding: 10px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.error { border-color: #5a3036; color: #ffb3b3; }
.toast.ok { border-color: #2f5a41; color: var(--ok); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: .03em; }
.card h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stack { display: grid; gap: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2, .section-head h3 { margin: 0; }

/* ---------- projects ---------- */
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.plist { display: grid; gap: 6px; position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; padding-right: 2px; }
@media (max-width: 900px) { .plist { position: static; max-height: none; } }
.pitem {
  display: grid; grid-template-columns: 18px 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px;
  border-radius: 10px; border: 1px solid transparent; background: var(--panel); cursor: pointer;
}
.pitem:hover { border-color: var(--line); }
.pitem.active { border-color: var(--accent); }
.pitem img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: #0f0c13; }
.pitem .t { overflow: hidden; }
.pitem .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pitem .t span { color: var(--muted); font-size: 12px; }
.pitem .moves { display: flex; flex-direction: column; gap: 2px; }
.pitem .moves .icon-btn { width: 24px; height: 20px; font-size: 11px; }
.handle { color: var(--muted); cursor: grab; user-select: none; text-align: center; }
.dragging { opacity: .4; }
.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }

.media-pick { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.media-pick .preview { width: 240px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #0f0c13; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.media-pick .preview.square { width: 160px; aspect-ratio: 1; }
.media-pick .preview img, .media-pick .preview video { width: 100%; height: 100%; object-fit: cover; }
.media-pick .actions { display: grid; gap: 8px; align-content: start; }

/* credits rows */
.credit-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 8px; align-items: end; padding: 10px; border-radius: 10px; background: var(--panel-2); }
.credit-row .ctl { display: flex; gap: 4px; }
@media (max-width: 760px) { .credit-row { grid-template-columns: 1fr 1fr; } }

/* ---------- photo grid ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo {
  position: relative; border-radius: 10px; overflow: hidden; background: #0f0c13; border: 1px solid var(--line);
  aspect-ratio: 1; cursor: grab;
}
.photo img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.photo .n { position: absolute; left: 6px; top: 6px; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.6); }
.photo .ctl { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.photo:hover .ctl, .photo:focus-within .ctl { opacity: 1; }
@media (hover: none) { .photo .ctl { opacity: 1; } }
.photo .ctl .icon-btn { background: rgba(18,15,23,.85); }
.photo.drop-before { box-shadow: inset 4px 0 0 var(--accent); }
.photo.drop-after { box-shadow: inset -4px 0 0 var(--accent); }
.dropzone {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted);
  display: grid; gap: 8px; place-items: center;
}
.dropzone.over { border-color: var(--accent); color: var(--text); background: rgba(232,194,107,.05); }
.uploading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- team ---------- */
.member { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; }
@media (max-width: 760px) { .member { grid-template-columns: 1fr; } }
.member-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 12px; }
.member-head h2 { margin: 0; }
.member-head .ctl { display: flex; gap: 4px; }

/* ---------- publish ---------- */
.log { background: #0b090e; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 420px; overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: #2f5a41; }
.pill.err { color: var(--danger); border-color: #5a3036; }
.pill.run { color: var(--accent); border-color: #5a4a2a; }
