:root {
  --bg: #0c0c0d;
  --panel: rgba(22, 22, 24, .88);
  --panel-solid: #171719;
  --panel-soft: #1d1d20;
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .24);
  --text: #f4f4f1;
  --muted: rgba(244, 244, 241, .56);
  --faint: rgba(244, 244, 241, .32);
  --accent: #e7ff8a;
  --accent-soft: rgba(231, 255, 138, .11);
  --danger: #ff796f;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(231, 255, 138, .85);
  outline-offset: 3px;
}

.is-hidden {
  display: none !important;
}

.page-texture {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 25%, transparent 75%, rgba(0, 0, 0, .28)),
    linear-gradient(180deg, rgba(5, 5, 6, .25), rgba(5, 5, 6, .62)),
    url("/assets/home-stone-texture.jpg") center / cover;
}

.page-texture::after {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 68% 16%, rgba(255, 255, 255, .05), transparent 34%),
    radial-gradient(circle at 18% 84%, rgba(255, 255, 255, .035), transparent 30%);
  content: "";
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 22px;
  border-radius: 999px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary-button {
  background: var(--text);
  color: #0d0d0e;
  font-weight: 650;
}

.primary-button:hover {
  background: #fff;
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: wait;
  opacity: .48;
  transform: none;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .035);
  color: var(--text);
}

.secondary-button:hover {
  border-color: rgba(255, 255, 255, .48);
  background: rgba(255, 255, 255, .07);
}

.danger-button {
  background: var(--danger);
  color: #1b0b0a;
  font-weight: 650;
}

.danger-button:hover {
  background: #ff948d;
  transform: translateY(-2px);
}

/* Login */
.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 1.08fr) minmax(420px, .92fr);
  align-items: stretch;
}

.login-brand {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 50%;
  content: "";
}

.login-brand::before {
  width: min(44vw, 650px);
  height: min(30vw, 440px);
  transform: rotate(-12deg);
}

.login-brand::after {
  width: min(34vw, 500px);
  height: min(34vw, 500px);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, .018), 0 0 0 120px rgba(255, 255, 255, .012);
  transform: rotate(18deg);
}

.eyebrow {
  position: absolute;
  top: 48px;
  left: 54px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 5px;
}

.login-symbol {
  position: relative;
  z-index: 1;
  width: 188px;
  height: 270px;
  object-fit: contain;
}

.brand-roman {
  position: relative;
  z-index: 1;
  margin-top: -6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  font-weight: 600;
  letter-spacing: 17px;
  text-indent: 17px;
}

.brand-studio {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 7px;
  text-indent: 7px;
}

.login-card {
  align-self: center;
  width: min(470px, calc(100% - 72px));
  margin: auto;
  padding: 52px 48px 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(17, 17, 18, .76);
  box-shadow: 0 42px 120px rgba(0, 0, 0, .46), inset 0 1px rgba(255, 255, 255, .07);
}

.login-index {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 3px;
}

.login-card h1 {
  margin: 22px 0 8px;
  font-size: 38px;
  font-weight: 630;
  letter-spacing: 4px;
}

.login-card > p {
  margin: 0 0 44px;
  color: var(--muted);
  font-size: 14px;
}

.login-card form > label {
  display: block;
  margin-bottom: 11px;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
}

.password-field {
  display: flex;
  height: 56px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, .24);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.password-field:focus-within {
  border-color: rgba(231, 255, 138, .62);
  box-shadow: 0 0 0 4px rgba(231, 255, 138, .06);
}

.password-field input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 17px;
  border: 0;
  outline: 0;
  background: transparent;
}

.password-field input::placeholder {
  color: rgba(255, 255, 255, .24);
}

.icon-button {
  height: 100%;
  padding: 0 17px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.form-error {
  min-height: 20px;
  margin: 9px 2px 5px;
  color: var(--danger);
  font-size: 12px;
}

.login-button {
  width: 100%;
  min-height: 58px;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 15px 0 23px;
  border-radius: var(--radius-md);
}

.button-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, .25);
  border-radius: 50%;
  font-size: 17px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  color: rgba(255, 255, 255, .22);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 2px;
  white-space: nowrap;
}

.login-foot span {
  width: 28px;
  height: 1px;
  flex: 1;
  background: rgba(255, 255, 255, .12);
}

/* Main application */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  width: 264px;
  flex-direction: column;
  padding: 30px 22px 24px;
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 11, .88);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 2px 7px 26px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand img {
  width: 36px;
  height: 51px;
  object-fit: contain;
}

.sidebar-brand div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-brand strong {
  font-size: 16px;
  letter-spacing: 3px;
}

.sidebar-brand span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 2px;
}

.side-nav {
  margin-top: 30px;
}

.nav-item {
  display: grid;
  width: 100%;
  height: 54px;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item.is-active {
  border-color: var(--line);
  background: rgba(255, 255, 255, .055);
  color: var(--text);
}

.side-nav a.nav-item { text-decoration: none; }
.project-nav-icon { font-size: 22px; line-height: 1; text-align: center; }

.nav-item em {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
}

.nav-icon {
  display: grid;
  width: 18px;
  grid-template-columns: repeat(2, 7px);
  gap: 3px;
}

.nav-icon i {
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 17px 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(231, 255, 138, .08), 0 0 18px rgba(231, 255, 138, .34);
}

.sidebar-status div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-status strong {
  font-size: 11px;
  font-weight: 500;
}

.sidebar-status span:last-child {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 1.5px;
}

.logout-button {
  display: flex;
  width: 100%;
  height: 46px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.logout-button:hover {
  color: var(--text);
}

.main-content {
  grid-column: 2;
  min-width: 0;
  padding: 42px clamp(28px, 4vw, 64px) 80px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 3px;
}

.page-kicker span {
  width: 30px;
  height: 1px;
  background: rgba(255, 255, 255, .23);
}

.topbar h1 {
  margin: 16px 0 7px;
  font-size: clamp(29px, 3vw, 42px);
  font-weight: 620;
  letter-spacing: 2px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.add-button {
  min-width: 138px;
}

.plus {
  font-size: 20px;
  font-weight: 300;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 39px;
}

.stat-card {
  position: relative;
  min-height: 140px;
  overflow: hidden;
  padding: 20px 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(20, 20, 22, .64);
  box-shadow: inset 0 1px rgba(255, 255, 255, .045);
}

.stat-card::after {
  position: absolute;
  right: -32px;
  bottom: -52px;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(255, 255, 255, .035);
  border-radius: 50%;
  content: "";
}

.stat-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.stat-label span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1px;
}

.stat-value {
  margin-top: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 43px;
  line-height: 1;
}

.stat-line {
  height: 2px;
  margin-top: 17px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
}

.stat-line i {
  display: block;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, .36);
}

.stat-line i.is-bright {
  width: 76%;
  background: var(--accent);
}

.stat-line i.is-short {
  width: 24%;
  background: rgba(255, 255, 255, .2);
}

.stat-update {
  background: linear-gradient(140deg, rgba(231, 255, 138, .1), rgba(20, 20, 22, .58));
}

.stat-time {
  margin-top: 21px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
}

.stat-date {
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
}

.catalog-panel {
  margin-top: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(14, 14, 15, .64);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .18), inset 0 1px rgba(255, 255, 255, .04);
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--line);
}

.catalog-toolbar h2 {
  margin: 0 0 5px;
  font-size: 19px;
  font-weight: 590;
  letter-spacing: 1px;
}

.catalog-toolbar > div > span {
  color: var(--faint);
  font-size: 11px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.search-box,
.filter-select {
  display: flex;
  height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}

.search-box {
  width: 210px;
  padding: 0 13px;
}

.search-box span {
  position: relative;
  width: 14px;
  height: 14px;
  flex: none;
  border: 1px solid var(--faint);
  border-radius: 50%;
}

.search-box span::after {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 6px;
  height: 1px;
  background: var(--faint);
  content: "";
  transform: rotate(45deg);
}

.search-box input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 0 0 11px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.search-box input::placeholder {
  color: var(--faint);
}

.filter-select {
  padding: 0 8px 0 13px;
}

.filter-select select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.filter-select option {
  background: #171719;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-top: 24px;
}

.category-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgba(26, 26, 28, .8);
  box-shadow: 0 24px 56px rgba(0, 0, 0, .22), inset 0 1px rgba(255, 255, 255, .04);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.category-card:hover {
  border-color: rgba(255, 255, 255, .26);
  box-shadow: 0 30px 72px rgba(0, 0, 0, .34), inset 0 1px rgba(255, 255, 255, .07);
  transform: translateY(-3px);
}

.category-card.is-hidden-category {
  opacity: .66;
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 8.6;
  overflow: hidden;
  background: #111;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.55) brightness(.74) contrast(1.1);
  transition: transform 500ms ease, filter 300ms ease;
}

.category-card:hover .card-cover img {
  filter: saturate(.75) brightness(.82) contrast(1.08);
  transform: scale(1.035);
}

.card-cover::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .12), transparent 45%, rgba(0, 0, 0, .86));
  content: "";
}

.cover-empty {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .08), transparent 28%),
    #151517;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 3px;
}

.card-number,
.card-visibility {
  position: absolute;
  top: 16px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 2px;
}

.card-number {
  left: 17px;
  color: rgba(255, 255, 255, .58);
}

.card-visibility {
  right: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 999px;
  background: rgba(0, 0, 0, .34);
  color: rgba(255, 255, 255, .72);
  letter-spacing: 1px;
}

.card-visibility i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.card-visibility.is-off i {
  background: rgba(255, 255, 255, .32);
}

.card-cover-copy {
  position: absolute;
  right: 19px;
  bottom: 18px;
  left: 19px;
  z-index: 2;
}

.card-cover-copy span {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, .54);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 2px;
}

.card-cover-copy h3 {
  margin: 0;
  font-family: STKaiti, KaiTi, serif;
  font-size: clamp(24px, 2.5vw, 34px);
  font-weight: 400;
  letter-spacing: 4px;
}

.card-body {
  padding: 19px 19px 16px;
}

.card-en-name {
  overflow: hidden;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-intro {
  display: -webkit-box;
  min-height: 42px;
  margin: 11px 0 15px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.card-action {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  font-size: 10px;
}

.card-action:hover {
  border-color: rgba(255, 255, 255, .3);
  color: var(--text);
}

.card-action.is-danger:hover {
  border-color: rgba(255, 121, 111, .4);
  color: var(--danger);
}

.card-action.is-icon {
  width: 32px;
  padding: 0;
  font-size: 13px;
}

.card-action:disabled {
  cursor: default;
  opacity: .2;
}

.card-action.edit-action {
  margin-left: auto;
}

.empty-state {
  display: flex;
  min-height: 380px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-mark {
  color: rgba(255, 255, 255, .08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(56px, 8vw, 104px);
  letter-spacing: 12px;
}

.empty-state h3 {
  margin: -18px 0 9px;
  font-size: 20px;
}

.empty-state p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 12px;
}

/* Editor drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, .68);
  animation: fadeIn 180ms ease both;
}

.editor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: min(620px, 92vw);
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  background: #111113;
  box-shadow: -30px 0 100px rgba(0, 0, 0, .5);
  transform: translateX(102%);
  transition: transform 280ms cubic-bezier(.22, .74, .22, 1);
}

.editor-drawer.is-open {
  transform: translateX(0);
}

.editor-drawer form {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 30px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-header span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 3px;
}

.drawer-header h2 {
  margin: 8px 0 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
}

.drawer-close {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  font-weight: 200;
}

.drawer-close:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.drawer-body {
  overflow-y: auto;
  padding: 4px 30px 40px;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
  scrollbar-width: thin;
}

.form-section {
  padding: 28px 0 30px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.section-heading > span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
}

.section-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 580;
  letter-spacing: 1px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 17px;
}

.field-grid .form-field {
  margin-top: 0;
}

.form-field > span {
  color: rgba(255, 255, 255, .67);
  font-size: 11px;
}

.form-field em {
  color: var(--accent);
  font-style: normal;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-field input {
  height: 46px;
  padding: 0 14px;
}

.form-field textarea {
  min-height: 110px;
  padding: 13px 14px;
  line-height: 1.65;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: rgba(231, 255, 138, .52);
  box-shadow: 0 0 0 4px rgba(231, 255, 138, .05);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: rgba(255, 255, 255, .2);
}

.form-field small {
  align-self: flex-end;
  color: var(--faint);
  font-size: 9px;
}

.form-field small b {
  font-weight: 400;
}

.cover-dropzone {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  overflow: hidden;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, .24);
  border-radius: 16px;
  background: rgba(255, 255, 255, .022);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.cover-dropzone:hover,
.cover-dropzone.is-dragging {
  border-color: rgba(231, 255, 138, .55);
  background: rgba(231, 255, 138, .035);
}

.cover-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--muted);
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 19px;
}

.cover-placeholder strong {
  font-size: 12px;
  font-weight: 550;
}

.cover-placeholder span {
  margin-top: 8px;
  color: var(--faint);
  font-size: 9px;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .58);
  opacity: 0;
  transition: opacity 160ms ease;
}

.cover-overlay span {
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 999px;
  font-size: 10px;
}

.cover-dropzone:hover .cover-overlay {
  opacity: 1;
}

.text-button {
  margin-top: 12px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-button:hover {
  color: var(--danger);
}

.video-hint,
.video-new small {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.video-list {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.video-item,
.video-new {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .025);
}

.video-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.video-item-head span:first-child {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
}

.video-item-head span:last-child {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-item video,
.video-item-cover {
  display: block;
  width: 100%;
  max-height: 220px;
  border-radius: 10px;
  background: #09090a;
  object-fit: cover;
}

.video-item .form-field,
.video-new .form-field {
  margin-top: 12px;
}

.video-item input[type="file"],
.video-new input[type="file"] {
  height: auto;
  padding: 10px;
  font-size: 11px;
}

.video-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.video-item-actions button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 10px;
}

.video-item-actions button:disabled { opacity: .35; cursor: default; }
.video-item-actions .video-delete { color: var(--danger); }
.video-new > strong { font-size: 12px; }
.video-new small { display: block; margin: 12px 0; }
.video-new .secondary-button { width: 100%; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
}

.setting-row > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-row strong {
  font-size: 12px;
  font-weight: 550;
}

.setting-row > div > span {
  color: var(--faint);
  font-size: 9px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 27px;
  flex: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  content: "";
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + span {
  border-color: rgba(231, 255, 138, .5);
  background: var(--accent-soft);
}

.switch input:checked + span::after {
  background: var(--accent);
  transform: translateX(21px);
}

.sort-field {
  max-width: 190px;
}

.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 30px;
  border-top: 1px solid var(--line);
  background: rgba(17, 17, 19, .96);
}

.save-button {
  min-width: 150px;
  justify-content: space-between;
}

/* Confirmation and feedback */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(0, 0, 0, .82);
  animation: fadeIn 160ms ease both;
}

.confirm-card {
  width: min(430px, 100%);
  padding: 35px 34px 30px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #171719;
  box-shadow: 0 42px 120px rgba(0, 0, 0, .65), inset 0 1px rgba(255, 255, 255, .07);
  text-align: center;
  animation: modalIn 220ms cubic-bezier(.2, .75, .25, 1) both;
}

.confirm-kicker {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 3px;
}

.confirm-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 23px auto 18px;
  place-items: center;
  border: 1px solid rgba(255, 121, 111, .38);
  border-radius: 50%;
  color: var(--danger);
  font-size: 28px;
  font-weight: 200;
}

.confirm-card h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 1px;
}

.confirm-card p {
  margin: 12px 0 26px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.toast {
  position: fixed;
  right: 30px;
  bottom: 28px;
  z-index: 160;
  display: flex;
  min-width: 220px;
  align-items: center;
  gap: 11px;
  padding: 15px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgba(24, 24, 26, .96);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  font-size: 12px;
  animation: toastIn 220ms ease both;
}

.toast.is-error .toast-dot {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 121, 111, .42);
}

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(231, 255, 138, .42);
}

.loading-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0d0d0e;
  transition: opacity 240ms ease, visibility 240ms ease;
}

.loading-layer.is-done {
  visibility: hidden;
  opacity: 0;
}

.loading-mark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 25px;
}

.loading-mark span {
  display: block;
  width: 3px;
  height: 8px;
  background: var(--text);
  animation: loadingBars 900ms ease-in-out infinite;
}

.loading-mark span:nth-child(2) {
  height: 20px;
  animation-delay: 120ms;
}

.loading-mark span:nth-child(3) {
  height: 13px;
  animation-delay: 240ms;
}

.loading-layer p {
  margin: 16px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 3px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes loadingBars {
  0%, 100% { opacity: .28; transform: scaleY(.5); }
  50% { opacity: 1; transform: scaleY(1); }
}

@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-card {
    width: min(470px, calc(100% - 34px));
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 15px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-brand {
    padding: 0;
    border: 0;
  }

  .sidebar-brand img {
    width: 27px;
    height: 38px;
  }

  .side-nav,
  .sidebar-status {
    display: none;
  }

  .logout-button {
    width: auto;
    margin: 0 0 0 auto;
  }

  .logout-button span:first-child {
    display: none;
  }

  .main-content {
    padding: 28px 18px 60px;
  }

  .topbar {
    align-items: center;
  }

  .topbar p {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar h1 {
    font-size: 26px;
  }

  .add-button {
    min-width: 48px;
    width: 48px;
    padding: 0;
  }

  .add-button span:last-child {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stat-card {
    min-height: 125px;
    padding: 17px;
  }

  .catalog-panel {
    padding: 17px;
    border-radius: 20px;
  }

  .catalog-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions,
  .search-box,
  .filter-select {
    width: 100%;
  }

  .filter-select select {
    width: 100%;
  }

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

  .editor-drawer {
    width: 100vw;
  }

  .drawer-header,
  .drawer-footer {
    padding-right: 20px;
    padding-left: 20px;
  }

  .drawer-body {
    padding-right: 20px;
    padding-left: 20px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }
}

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