:root {
  --bg: #f3efe6;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-accent: linear-gradient(180deg, rgba(255, 248, 231, 0.95), rgba(255, 255, 255, 0.96));
  --text: #1d232f;
  --muted: #667085;
  --line: rgba(29, 35, 47, 0.08);
  --line-strong: rgba(29, 35, 47, 0.12);
  --shadow: 0 22px 44px rgba(51, 65, 85, 0.12);
  --shadow-soft: 0 14px 28px rgba(51, 65, 85, 0.08);
  --brand: #0f766e;
  --brand-strong: #115e59;
  --brand-soft: rgba(15, 118, 110, 0.12);
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.1);
  --gold: #d97706;
  --gold-soft: rgba(217, 119, 6, 0.14);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.14), transparent 24%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
}

body.modal-open {
  overflow: hidden;
}

html.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  position: relative;
  overflow: clip;
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.ambient {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.ambient--one,
.ambient--two {
  width: 340px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.6;
  animation: float-orb 14s ease-in-out infinite;
}

.ambient--one {
  top: 36px;
  left: -120px;
  background: radial-gradient(circle, rgba(14, 116, 144, 0.24), transparent 68%);
}

.ambient--two {
  top: 520px;
  right: -140px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22), transparent 68%);
  animation-delay: -6s;
}

.ambient--grid {
  inset: 120px 0 auto auto;
  width: 420px;
  height: 420px;
  background-image:
    linear-gradient(rgba(29, 35, 47, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 35, 47, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 75%);
  opacity: 0.55;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(29, 35, 47, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
  color: var(--text);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.06), transparent 18%, transparent 82%, rgba(245, 158, 11, 0.08));
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar__brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(14, 116, 144, 0.24));
  color: var(--brand-strong);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}

.topbar__brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar__summary {
  flex: 1;
  margin: 0;
  max-width: 420px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.topbar__actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.topbar__install-button {
  min-width: 148px;
  white-space: nowrap;
}

.eyebrow,
.panel__eyebrow,
.stat-card__label,
.field__label,
.group-list-header,
.video-card__group,
.video-card__badge,
.activity-item__time {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
}

.topbar h1,
.panel h2,
.empty-state h3,
.video-card__title,
.modal h2 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.25rem, 2.1vw, 1.8rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.topbar__stats {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 320px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 2px;
  align-content: center;
  min-height: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 250, 252, 0.92));
  border: 1px solid rgba(29, 35, 47, 0.08);
  animation: rise-in 500ms ease both;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.05), transparent 48%);
  pointer-events: none;
}

.stat-card__value {
  display: block;
  margin-top: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.stat-card__label {
  color: var(--muted);
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 24px;
}

.content,
.sidebar {
  min-width: 0;
}

.sidebar {
  display: grid;
  gap: 24px;
  align-self: start;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 30%);
  pointer-events: none;
}

.panel--accent {
  background: var(--surface-accent);
}

.panel--activity {
  background: linear-gradient(180deg, rgba(250, 251, 255, 0.8), rgba(255, 255, 255, 0.95));
}

.panel--form {
  overflow: visible;
  z-index: 15;
}

.panel--library {
  overflow: visible;
  z-index: 10;
}

.panel + .panel {
  margin-top: 24px;
}

.panel__header {
  margin-bottom: 20px;
}

.panel__tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel__header--split {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.library-heading {
  flex: 1;
  min-width: 0;
}

.library-toolbar {
  display: grid;
  grid-template-columns: 220px minmax(280px, 360px);
  gap: 14px;
  align-items: end;
  flex: 0 0 auto;
  min-width: 0;
}

.panel__eyebrow,
.eyebrow {
  margin: 0 0 8px;
  opacity: 0.82;
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 48px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand-strong) 50%),
    linear-gradient(135deg, var(--brand-strong) 50%, transparent 50%),
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(14, 116, 144, 0.04));
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px),
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.field select:hover {
  border-color: rgba(15, 118, 110, 0.2);
}

.field select option {
  color: var(--text);
  background: #ffffff;
}

.custom-select {
  position: relative;
}

.custom-select__trigger {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 14px 46px 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(14, 116, 144, 0.04)),
    var(--surface-strong);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.custom-select__trigger::before,
.custom-select__trigger::after {
  content: "";
  position: absolute;
  right: 20px;
  width: 8px;
  height: 8px;
  border-bottom: 2px solid var(--brand-strong);
  transition: transform 180ms ease, opacity 180ms ease;
}

.custom-select__trigger::before {
  top: calc(50% - 6px);
  border-right: 2px solid var(--brand-strong);
  transform: rotate(45deg);
}

.custom-select__trigger::after {
  top: calc(50% - 1px);
  border-left: 2px solid var(--brand-strong);
  transform: rotate(-45deg);
}

.custom-select.is-open .custom-select__trigger {
  border-color: rgba(15, 118, 110, 0.48);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.custom-select.is-open .custom-select__trigger::before {
  transform: rotate(-135deg);
}

.custom-select.is-open .custom-select__trigger::after {
  transform: rotate(135deg);
}

.custom-select__value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  width: max-content;
  max-width: min(320px, 90vw);
  padding: 8px;
  border: 1px solid rgba(29, 35, 47, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(16px);
  animation: modal-in 180ms ease both;
}

.custom-select__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
}

.custom-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.custom-select__option:hover {
  background: rgba(15, 118, 110, 0.08);
}

.custom-select__option.is-selected {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(14, 116, 144, 0.08));
  color: var(--brand-strong);
}

.custom-select__option-label {
  flex: 1;
  min-width: 0;
}

.custom-select__option-count {
  color: var(--muted);
  font-size: 0.86rem;
}

.field input:focus,
.field select:focus {
  border-color: rgba(15, 118, 110, 0.48);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.video-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(170px, 0.9fr) minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.field--wide {
  min-width: 0;
}

.field--search {
  min-width: 0;
  width: 100%;
}

.field--sort {
  min-width: 0;
  width: 100%;
}

.field--sort .custom-select,
.field--search,
.field--search input {
  width: 100%;
}

.button,
.ghost-button,
.icon-button,
.video-card__thumb-link,
.favorite-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.button,
.ghost-button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.button:hover,
.ghost-button:hover,
.icon-button:hover,
.favorite-toggle:hover,
.video-card__thumb-link:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.button--primary {
  background: linear-gradient(135deg, var(--brand), #0e7490);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.24);
}

.button--secondary {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.button--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button--tall {
  min-width: 132px;
}

.ghost-button {
  min-height: auto;
  padding: 6px 0;
  background: transparent;
  color: var(--brand-strong);
}

.ghost-button--compact {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(29, 35, 47, 0.08);
}

.ghost-button.is-active {
  color: var(--text);
}

.quick-filters {
  display: flex;
  gap: 12px;
}

.group-list-wrap {
  margin-top: 20px;
}

.group-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  margin-bottom: 12px;
}

.group-list,
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.panel--activity .activity-list {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 118, 110, 0.35) transparent;
}

.panel--activity .activity-list::-webkit-scrollbar {
  width: 10px;
}

.panel--activity .activity-list::-webkit-scrollbar-track {
  background: transparent;
}

.panel--activity .activity-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.48), rgba(14, 116, 144, 0.28));
  border: 2px solid transparent;
  background-clip: padding-box;
}

.group-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-list__button {
  position: relative;
  overflow: hidden;
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.group-list__button.is-active {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.12);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.group-list__button::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0), rgba(15, 118, 110, 0.7), rgba(15, 118, 110, 0));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 220ms ease;
}

.group-list__button:hover::after,
.group-list__button.is-active::after {
  transform: scaleX(1);
}

.group-list__count {
  color: var(--muted);
  font-size: 0.92rem;
}

.group-list__delete,
.icon-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  cursor: pointer;
}

.group-list__edit {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-strong);
}

.form-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--brand-strong);
}

.empty-state,
.mini-empty-state {
  padding: 28px;
  border: 1px dashed rgba(15, 118, 110, 0.24);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
  color: var(--muted);
}

.mini-empty-state {
  padding: 18px;
}

.empty-state p,
.mini-empty-state p,
.modal__message {
  margin-bottom: 0;
}

.activity-list {
  margin-top: 8px;
}

.activity-item {
  animation: rise-in 320ms ease both;
  animation-delay: calc(var(--stagger-index, 0) * 70ms);
  min-width: 0;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.activity-item__text {
  margin: 0 0 6px;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.activity-item__time {
  color: var(--muted);
}

.video-grid-wrap {
  position: relative;
}

.video-grid-wrap::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 18%, transparent 82%, rgba(15, 118, 110, 0.06));
  pointer-events: none;
}

.video-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 280px));
  gap: 18px;
  justify-content: start;
  align-items: start;
}

.video-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(29, 35, 47, 0.06);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(0);
  transition: transform 220ms ease, box-shadow 220ms ease;
  animation: card-in 420ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: calc(var(--stagger-index, 0) * 70ms);
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 34px rgba(51, 65, 85, 0.14);
}

.video-card::before {
  content: "";
  position: absolute;
  inset: -120% auto auto -40%;
  width: 70%;
  height: 240%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: rotate(18deg) translateX(-220%);
  transition: transform 700ms ease;
  pointer-events: none;
}

.video-card:hover::before {
  transform: rotate(18deg) translateX(320%);
}

.video-card__thumb-shell {
  position: relative;
}

.video-card__thumb-link {
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #d7dee7;
}

.video-card__thumb-link.is-fallback {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 28%),
    linear-gradient(180deg, #dce6ea, #c9d7dc);
}

.video-card__thumb-link.is-fallback::before {
  content: "No Preview";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: #31545b;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.video-card__thumb-link::after {
  content: "Preview";
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.74);
  color: #f8fafc;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.video-card:hover .video-card__thumb-link::after {
  opacity: 1;
  transform: translateY(0);
}

.video-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 240ms ease;
}

.video-card__thumb.is-hidden {
  opacity: 0;
}

.video-card:hover .video-card__thumb {
  transform: scale(1.03);
}

.favorite-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: rgba(29, 35, 47, 0.42);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.14);
}

.favorite-toggle.is-favorite {
  background: rgba(255, 244, 214, 0.95);
  color: var(--gold);
}

.video-card__body {
  padding: 18px;
}

.video-card__meta {
  margin-bottom: 16px;
}

.video-card__meta-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.video-card__group {
  display: inline-block;
  color: var(--brand-strong);
}

.video-card__badge {
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 999px;
  padding: 6px 10px;
}

.video-card__title {
  font-size: 1rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.video-card__channel,
.video-card__url {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.video-card__channel {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.video-card__url {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.video-card__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.video-card__actions > * {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: none;
}

.video-card__open {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.14), rgba(14, 116, 144, 0.2));
  color: var(--brand-strong);
}

.video-card__menu-trigger {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(29, 35, 47, 0.06), rgba(29, 35, 47, 0.1));
  color: #1f4f59;
  border: 1px solid rgba(29, 35, 47, 0.08);
  box-shadow: none;
  text-decoration: none;
  background-color: rgba(29, 35, 47, 0.08);
}


.video-card__actions > *:active {
  transform: translateY(0);
}

.video-card__menu {
  position: relative;
  padding-top: 10px;
  margin-top: -10px;
}

.video-card__menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: 0;
}

.video-card__menu-dropdown {
  position: absolute;
  right: 0;
  bottom: calc(100% + 2px);
  z-index: 5;
  min-width: 180px;
  padding: 8px;
  border: 1px solid rgba(29, 35, 47, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
  display: grid;
  gap: 4px;
}

.video-card__menu-dropdown[hidden] {
  display: none;
}

.video-card__menu:hover .video-card__menu-dropdown,
.video-card__menu:focus-within .video-card__menu-dropdown,
.video-card__menu.is-open .video-card__menu-dropdown {
  display: grid;
}

.video-card__menu.is-open .video-card__menu-trigger {
  border-color: rgba(29, 35, 47, 0.12);
  background: linear-gradient(180deg, rgba(29, 35, 47, 0.09), rgba(29, 35, 47, 0.14));
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.08);
}

.video-card__menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 18px;
  max-width: 18px;
}

.video-card__menu-icon span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.video-card__menu-trigger:hover {
  background: linear-gradient(180deg, rgba(29, 35, 47, 0.1), rgba(29, 35, 47, 0.16));
  color: #123d45;
  border-color: rgba(29, 35, 47, 0.12);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.08);
}

.video-card__menu-trigger:focus-visible,
.video-card__menu-trigger:active {
  background: linear-gradient(180deg, rgba(29, 35, 47, 0.1), rgba(29, 35, 47, 0.16));
  color: #123d45;
  border-color: rgba(29, 35, 47, 0.12);
  outline: none;
}

.video-card__open:hover {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.18), rgba(14, 116, 144, 0.24));
}

.video-card__actions .button--secondary.video-card__menu-trigger,
.video-card__actions .button--secondary.video-card__menu-trigger:hover,
.video-card__actions .button--secondary.video-card__menu-trigger:focus-visible,
.video-card__actions .button--secondary.video-card__menu-trigger:active,
.video-card__actions .button--secondary.video-card__menu-trigger:visited {
  background-clip: padding-box;
  -webkit-tap-highlight-color: transparent;
  background-image: linear-gradient(180deg, rgba(29, 35, 47, 0.06), rgba(29, 35, 47, 0.1));
}

.video-card__actions .button--secondary.video-card__menu-trigger:hover,
.video-card__actions .button--secondary.video-card__menu-trigger:focus-visible,
.video-card__actions .button--secondary.video-card__menu-trigger:active {
  background-image: linear-gradient(180deg, rgba(29, 35, 47, 0.1), rgba(29, 35, 47, 0.16));
}

.video-card__menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.video-card__menu-item-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  min-width: 20px;
  color: currentColor;
  font-size: 0.95rem;
  line-height: 1;
}

.video-card__menu-item:hover {
  background: rgba(15, 118, 110, 0.08);
}

.video-card__menu-item.video-card__delete {
  color: var(--danger);
}

.video-card__menu-item.video-card__delete:hover {
  background: rgba(180, 35, 24, 0.08);
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 24px));
}

.toast {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(29, 35, 47, 0.94);
  color: #f8fafc;
  box-shadow: var(--shadow);
  animation: toast-in 280ms ease both;
  animation-delay: calc(var(--stagger-index, 0) * 60ms);
}

.toast--error {
  background: rgba(180, 35, 24, 0.96);
}

.toast--success {
  background: rgba(17, 94, 89, 0.96);
}

.toast__copy {
  flex: 1;
}

.toast__title {
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}

.toast__close {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}

#transferModal {
  overflow: hidden;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(6px);
  animation: fade-in 220ms ease both;
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 52px rgba(15, 23, 42, 0.24);
  animation: modal-in 260ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
  overflow: auto;
}

.modal__dialog--video {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.modal__dialog--transfer {
  width: min(560px, 100%);
  padding: 0;
  overflow: hidden;
  max-height: none;
}

.modal__dialog--edit {
  width: min(460px, 100%);
}

.modal__header,
.modal__footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.modal__header {
  margin-bottom: 18px;
  flex: 0 0 auto;
}

.modal__footer {
  margin-top: 22px;
  flex: 0 0 auto;
}

.preview-frame-wrap {
  overflow: hidden;
  border-radius: 22px;
  background: #0f172a;
  width: 100%;
  flex: 0 0 auto;
  max-height: calc(100vh - 250px);
}

.preview-frame {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 250px);
  border: 0;
}

#previewModalTitle {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.3;
}

#previewModal .modal__header,
#previewModal .modal__footer {
  margin: 0;
}

.transfer-modal__body {
  display: grid;
  gap: 18px;
  padding: 0 24px 24px;
  overflow: visible;
}

.edit-form {
  display: grid;
  gap: 16px;
}

.edit-form__hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.transfer-modal__heading {
  display: grid;
  gap: 8px;
}

.transfer-modal__subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 48ch;
}

.transfer-modal__summary {
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(14, 116, 144, 0.04)),
    #f8fbfb;
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.transfer-modal__summary-block {
  display: grid;
  gap: 8px;
}

.transfer-modal__summary-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.transfer-modal__summary-value {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}

.transfer-modal__footer {
  justify-content: flex-end;
  padding: 18px 24px 24px;
  border-top: 1px solid rgba(29, 35, 47, 0.08);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.5), rgba(255, 255, 255, 0.92));
}

.transfer-modal__action {
  min-width: 144px;
}

#transferModal .modal__header {
  margin-bottom: 0;
  padding: 24px 24px 18px;
  border-bottom: 1px solid rgba(29, 35, 47, 0.06);
  background:
    radial-gradient(circle at top right, rgba(14, 116, 144, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 252, 0.94));
}

#transferModal .icon-button {
  background: rgba(180, 35, 24, 0.08);
}

#transferModal .field {
  gap: 10px;
}

#transferModal .custom-select__dropdown {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  width: 100%;
  min-width: 100%;
  max-width: none;
  margin-top: 10px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

#transferModal .custom-select__list {
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
}

#transferModal .custom-select__option {
  white-space: normal;
  align-items: flex-start;
}

#transferModal .custom-select__option-label {
  white-space: normal;
  word-break: break-word;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes float-orb {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -18px, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1180px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .topbar__summary {
    max-width: none;
  }

  .topbar__actions {
    justify-content: flex-start;
  }

  .topbar__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 300px;
  }

  .video-form {
    grid-template-columns: 1fr 1fr;
  }

  .field--wide {
    grid-column: 1 / -1;
  }

  .button--tall {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
  }

  .topbar,
  .panel,
  .modal__dialog {
    border-radius: 22px;
  }

  .topbar {
    padding: 14px 14px;
    gap: 14px;
  }

  .panel__tools {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar__brand {
    align-items: flex-start; 
  }

  .topbar__brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 0.82rem;
  }

  .topbar h1 {
    font-size: clamp(1.15rem, 6vw, 1.5rem);
  }

  .topbar__summary {
    font-size: 0.84rem;
  }

  .topbar__actions {
    width: 100%;
  }

  .topbar__install-button {
    width: 100%;
  }

  .topbar__stats {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .app-layout {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    display: contents;
  }

  .sidebar .panel--accent {
    order: 1;
  }

  .content {
    order: 2;
  }

  .sidebar .panel--activity {
    order: 3;
  }

  .panel__header--split,
  .video-form,
  .modal__header,
  .modal__footer,
  .group-list-header {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .video-card__actions {
    grid-template-columns: 1fr 1fr;
  }

  .field--search {
    min-width: 0;
  }

  .library-toolbar {
    width: 100%;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .field--sort {
    min-width: 0;
  }

  .quick-filters {
    justify-content: space-between;
  }

  .panel__header {
    gap: 12px;
  }

  .toast-stack {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }

  .modal {
    padding: 12px;
  }

  .modal__dialog {
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  .modal__dialog--transfer {
    padding: 0;
  }

  .preview-frame-wrap,
  .preview-frame {
    max-height: calc(100vh - 220px);
  }

  .modal__dialog--video {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    gap: 12px;
  }

  .preview-frame-wrap {
    max-height: calc(100vh - 280px);
  }

  .preview-frame {
    max-height: calc(100vh - 280px);
  }

  #previewModal .modal__footer {
    gap: 10px;
  }

  #previewModalTitle {
    -webkit-line-clamp: 2;
    font-size: 1.5rem;
  }

  #transferModal .modal__header,
  .transfer-modal__body,
  .transfer-modal__footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .transfer-modal__footer {
    padding-bottom: 18px;
  }
}
