:root {
  --bg: #f6f7fb;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --line: #e7e9f2;
  --text: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --accent: #ec4899;
  --soft: #eef2ff;
  --soft-text: #4338ca;
  --danger: #e11d48;
  --success: #059669;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 12px 40px -12px rgba(79, 70, 229, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.dot { margin: 0 6px; opacity: .5; }

/* ---------- фон ---------- */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55;
}
.bg-blobs span:nth-child(1) { width: 520px; height: 520px; background: #c7d2fe; top: -160px; left: -120px; }
.bg-blobs span:nth-child(2) { width: 460px; height: 460px; background: #fbcfe8; top: 10%; right: -160px; }
.bg-blobs span:nth-child(3) { width: 420px; height: 420px; background: #bae6fd; bottom: -180px; left: 30%; opacity: .45; }

/* ---------- жоғарғы жолақ ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 18px 16px;
  padding-top: max(18px, env(safe-area-inset-top));
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 20px -6px rgba(124, 58, 237, .55);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.logout { margin: 0; }

/* ---------- макет ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 8px 16px 40px; }
.wrap.narrow { max-width: 560px; }
.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }

.hero { text-align: center; padding: 18px 0 30px; }
.hero h1 { font-size: clamp(28px, 5vw, 46px); font-weight: 800; line-height: 1.12; margin: 14px 0 12px; }
.hero p { max-width: 560px; margin: 0 auto; font-size: 16.5px; }
.grad {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--soft-text); background: rgba(255, 255, 255, .8); border: 1px solid var(--line);
}

.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.card-head h2 { font-size: 19px; font-weight: 700; }
.card-head p { margin: 2px 0 0; }
.card-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  color: var(--primary); background: var(--soft);
}

/* ---------- dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 210px; padding: 24px; text-align: center; cursor: pointer;
  border: 2px dashed #c7cdea; border-radius: 18px;
  background: linear-gradient(180deg, rgba(238, 242, 255, .6), rgba(255, 255, 255, .6));
  transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: rgba(238, 242, 255, .95); }
.dropzone.over { transform: scale(1.01); }
.dz-icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; margin-bottom: 8px;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 24px -8px rgba(79, 70, 229, .5);
}
.dz-title { font-weight: 700; font-size: 17px; }
.dz-sub { color: var(--muted); font-size: 14.5px; }
.dz-sub u { color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 3px; }

.file-chip {
  display: flex; align-items: center; gap: 14px; padding: 12px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card-solid);
}
.file-chip video {
  width: 88px; height: 64px; border-radius: 10px; object-fit: cover; background: #e5e7eb; flex-shrink: 0;
}
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }

/* ---------- өрістер ---------- */
.field { display: block; margin-top: 18px; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-solid);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .14); }

/* ---------- батырмалар ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none;
  padding: 12px 18px; border-radius: 14px; border: 1px solid transparent; cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, .7);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 14px 28px -10px rgba(79, 70, 229, .8); }
.btn-soft { color: var(--soft-text); background: var(--soft); }
.btn-soft:hover { background: #e0e7ff; }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, .7); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 20px; font-size: 16px; margin-top: 20px; }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite;
}
.btn.loading .ic { opacity: 0; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card-solid);
  color: var(--muted); cursor: pointer; text-decoration: none; transition: all .15s;
}
.icon-btn:hover { color: var(--primary); border-color: #c7d2fe; background: var(--soft); }
.icon-btn.danger:hover { color: var(--danger); border-color: #fecdd3; background: #fff1f2; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1 1 auto; }

/* ---------- прогресс ---------- */
.progress { margin-top: 20px; }
.progress-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.progress-top strong { color: var(--primary); }
.bar { height: 10px; border-radius: 99px; background: #e5e7f5; overflow: hidden; }
.bar span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .25s ease;
}
.progress .small { display: block; margin-top: 8px; }

.error-text {
  display: flex; align-items: center; gap: 8px; margin: 16px 0 0;
  padding: 10px 12px; border-radius: 12px; font-size: 14px; color: var(--danger); background: #fff1f2;
}

/* ---------- нәтиже ---------- */
.result-card { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.result-card.pop { animation: pop .45s ease; }
.result-empty { text-align: center; padding: 30px 10px; }
.qr-placeholder {
  display: grid; place-items: center; width: 150px; height: 150px; margin: 0 auto 18px;
  border-radius: 26px; color: #c7cdea; border: 2px dashed #d7dbef; background: rgba(255, 255, 255, .6);
}
.result-empty h3 { font-size: 18px; margin-bottom: 6px; }
.result-body { text-align: center; }
.success-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; color: var(--success); background: #ecfdf5;
}
.qr-frame {
  display: inline-block; margin: 18px auto 14px; padding: 14px; border-radius: 22px; background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -18px rgba(79, 70, 229, .4);
}
.qr-frame canvas { display: block; width: 260px; height: 260px; max-width: 100%; image-rendering: pixelated; }
.result-title { font-size: 18px; word-break: break-word; }
.link-box {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 6px 6px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card-solid);
}
.link-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--muted);
}
.result-body > .btn-ghost { margin-top: 10px; }

/* ---------- тізім ---------- */
.list-card { margin-top: 20px; }
.video-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.video-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card-solid);
  transition: border-color .15s;
}
.video-row:hover { border-color: #c7d2fe; }
.row-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  color: var(--accent); background: #fdf2f8;
}
.row-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; }
.list-empty {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px;
  color: var(--muted); border: 1px dashed var(--line); border-radius: 16px;
}

/* ---------- кіру ---------- */
.login-card { text-align: center; margin-top: 30px; padding: 34px 26px; }
.login-icon {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent));
}
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-form { text-align: left; margin-top: 8px; }
.login-form .btn { margin-top: 18px; }

/* ---------- видео беті ---------- */
.page-video .wrap { padding-top: 0; }
.player-card { padding: 12px; }
.player {
  position: relative; border-radius: 16px; overflow: hidden; background: #0b0b12;
}
.player video { display: block; width: 100%; max-height: 78vh; background: #0b0b12; }
.player-info { padding: 16px 10px 0; }
.video-title { font-size: 21px; font-weight: 800; word-break: break-word; }
.player-info p { display: flex; align-items: center; gap: 4px; margin: 6px 0 0; }
.player-card .actions { padding: 0 10px 10px; }
.hint {
  display: flex; gap: 8px; align-items: flex-start; margin: 4px 10px 10px; padding: 10px 12px;
  border-radius: 12px; font-size: 14px; color: #92400e; background: #fffbeb;
}
.hint .ic { margin-top: 2px; }
.empty-state { text-align: center; padding: 50px 24px; margin-top: 30px; }
.empty-icon {
  display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 18px;
  border-radius: 24px; color: var(--primary); background: var(--soft);
}
.empty-state h1 { font-size: 24px; margin-bottom: 6px; }

/* ---------- төменгі ---------- */
.footer {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px 30px; padding-bottom: max(30px, env(safe-area-inset-bottom));
  font-size: 13px; color: var(--muted); text-align: center;
}

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 14px; font-size: 14.5px; font-weight: 600;
  color: #fff; background: #111827; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4);
  transition: opacity .25s, transform .25s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.97); } 60% { transform: scale(1.01); } 100% { transform: scale(1); } }

/* ---------- мобильді ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .card { padding: 18px; border-radius: 20px; }
  .hero { padding: 6px 0 22px; }
  .hero p { font-size: 15px; }
  .brand-name { font-size: 16px; }
  .hide-sm { display: none; }
  .dropzone { min-height: 180px; }
  .video-row { flex-wrap: wrap; }
  .row-meta { flex-basis: calc(100% - 60px); }
  .row-actions { width: 100%; justify-content: flex-end; }
  .actions .btn { flex: 1 1 100%; }
  .player-card { padding: 8px; }
  .qr-frame canvas { width: 230px; height: 230px; }
}

.brand-tld {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
