@font-face {
  font-family: "Outfit";
  src: url("fonts/Outfit-Variable.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* Light — clean Apple style (default) */
:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --sidebar: rgba(245, 245, 247, 0.86);
  --panel: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #8e8e93;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-text: #ffffff;
  --ok: #248a3d;
  --ok-soft: rgba(36, 138, 61, 0.12);
  --warn: #b25000;
  --warn-soft: rgba(178, 80, 0, 0.12);
  --danger: #d70015;
  --danger-soft: rgba(215, 0, 21, 0.1);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --thumb-overlay: rgba(0, 0, 0, 0.55);
  --modal-scrim: rgba(0, 0, 0, 0.32);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --sidebar-w: 240px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --sidebar: rgba(28, 28, 30, 0.92);
  --panel: #1c1c1e;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --faint: #8e8e93;
  --accent: #30d158;
  --accent-hover: #4ade80;
  --accent-soft: rgba(48, 209, 88, 0.18);
  --accent-text: #ffffff;
  --ok: #30d158;
  --ok-soft: rgba(48, 209, 88, 0.16);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.16);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.16);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 2px 14px rgba(0, 0, 0, 0.35);
  --thumb-overlay: rgba(0, 0, 0, 0.6);
  --modal-scrim: rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* —— Sidebar —— */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 1.35rem 0.85rem 1rem;
  padding-top: max(1.35rem, env(safe-area-inset-top, 0px));
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(0.85rem, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow: hidden;
  box-sizing: border-box;
}

.brand {
  flex-shrink: 0;
  padding: 0.45rem 0.7rem 0.5rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-logo {
  width: 1.65rem;
  height: auto;
  flex-shrink: 0;
  color: var(--accent);
}

.brand-mark {
  display: block;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.brand-mark em {
  font-style: normal;
  color: var(--accent);
  font-weight: 650;
}

.brand-sub {
  margin-top: 0.28rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item[hidden],
.nav-item-admin[hidden] {
  display: none !important;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

html[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
}

.nav-ico {
  width: 1.1rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.nav-item span:last-child {
  font-size: 0.92rem;
}

.sidebar-user,
.sidebar-tools {
  flex-shrink: 0;
}

.sidebar-tools {
  padding: 0.25rem 0.35rem 0.35rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--muted);
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

html[data-theme="light"] .theme-ico-sun,
html[data-theme="dark"] .theme-ico-moon {
  display: none;
}

/* —— Main —— */
.main {
  min-width: 0;
  padding: 1.4rem 1.75rem 2.5rem;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: clamp(1.65rem, 2.6vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 36rem;
  line-height: 1.45;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.55rem 0.95rem;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 520;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.btn:hover {
  background: var(--bg);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.btn-danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.05);
  border-color: transparent;
}

.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 560;
}

.badge-mock {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-progress.done {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge-progress.almost {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-progress.started {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
}
html[data-theme="dark"] .badge-progress.started {
  background: rgba(255, 255, 255, 0.08);
}
.badge-progress.new {
  background: transparent;
  color: var(--faint);
  border: 1px solid var(--line);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.35rem;
}

.stat {
  padding: 0.95rem 1.05rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.stat-val {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-label {
  margin-top: 0.35rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.toolbar-primary {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 540;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-toggle:hover {
  border-color: var(--line-strong);
}

.filter-toggle.is-open,
.filter-toggle.has-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 980px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 1;
}

.filter-chevron {
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

.filter-toggle.is-open .filter-chevron {
  transform: rotate(180deg);
}

.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-card);
}

.filter-panel[hidden] {
  display: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.filter-group + .filter-group {
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.filter-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.search {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 980px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
}

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

.chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--muted);
  padding: 0.34rem 0.68rem;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-weight: 550;
}

.chip-toggle {
  border-style: dashed;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.sort-label {
  white-space: nowrap;
}

.sort-select {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0.42rem 0.65rem;
  border-radius: 980px;
  font-size: 0.8rem;
  cursor: pointer;
  max-width: 220px;
}

.card-pub {
  color: var(--faint);
  font-size: 0.88em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  text-align: left;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  color: inherit;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--c, #5b8def), #1d1d1f 85%);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0.7rem;
  overflow: hidden;
}

.thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-mark {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 650;
  color: #fff;
  opacity: 0.92;
}

.thumb-dur {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 1;
  background: var(--thumb-overlay);
  color: #fff;
  padding: 0.12rem 0.38rem;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 560;
}

.thumb-done {
  position: absolute;
  left: 0.4rem;
  top: 0.4rem;
  z-index: 1;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.thumb-sm {
  width: 5.6rem;
  flex-shrink: 0;
  padding: 0.35rem;
  border-radius: 8px;
  align-self: center;
}

.thumb-sm .thumb-mark {
  font-size: 1rem;
}

.thumb-sm .thumb-done {
  width: 1.2rem;
  height: 1.2rem;
  left: 0.28rem;
  top: 0.28rem;
  font-size: 0.65rem;
}

.row-card-done {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.8rem 0.9rem 0.95rem;
}

.card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 560;
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  min-height: calc(0.92rem * 1.3 * 3);
}

.card-meta {
  margin-top: auto;
  padding-top: 0.35rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.card-hidden {
  opacity: 0.82;
}

.card-hidden-tag {
  color: var(--muted);
  font-style: italic;
}

.card-lists {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.42rem;
  min-height: 1.35rem;
}

.list-tag {
  display: inline-flex;
  align-items: center;
  max-width: 7.5rem;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 520;
  line-height: 1.25;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .list-tag {
  background: rgba(255, 255, 255, 0.06);
}

.list-tag-more {
  max-width: none;
  color: var(--faint);
  background: transparent;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.fav,
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.3rem;
  line-height: 1;
  border-radius: 6px;
}

.fav:hover,
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

html[data-theme="dark"] .fav:hover,
html[data-theme="dark"] .icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.fav.is-on {
  color: var(--accent);
}

.icon-btn.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.row-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.95rem;
  align-items: center;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.row-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.creator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem 0.65rem 0.65rem;
  cursor: default;
}

.creator-row .creator-open {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.95rem;
  align-items: center;
  flex: 1;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 10px;
}

.creator-row .creator-open:hover {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="dark"] .creator-row .creator-open:hover {
  background: rgba(255, 255, 255, 0.05);
}

.creator-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 650;
  color: #fff;
}

.row-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 560;
  letter-spacing: -0.015em;
}

.row-meta {
  margin: 0.18rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.row-aside {
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.panel + .panel {
  margin-top: 0.9rem;
}

.panel h2 {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.panel p.lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 540;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field textarea {
  min-height: 170px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  resize: vertical;
}

.hint {
  font-size: 0.76rem;
  color: var(--faint);
}

.field-heading {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 540;
}

.check-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.schedule-block {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
}

.schedule-toggle {
  font-weight: 550;
  margin-bottom: 0.65rem;
}

.schedule-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.schedule-fields.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 120px;
}

.field-inline label {
  font-size: 0.76rem;
  color: var(--muted);
}

.field-inline input,
.field-inline select {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

.row-meta-sub {
  margin-top: 0.15rem;
  font-size: 0.76rem !important;
  color: var(--faint) !important;
}

.import-preview {
  margin-top: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  font-size: 0.85rem;
  color: var(--muted);
}

.import-preview strong {
  color: var(--accent);
}

.tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.95rem;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.84rem;
}

.tab.is-active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 560;
}

.player-shell {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.1rem;
  align-items: start;
}

.player-stage {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #000;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.yt-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.play-btn {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.play-btn:hover {
  transform: scale(1.05);
}

.player-note {
  position: absolute;
  left: 0.9rem;
  bottom: 0.9rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
}

.player-meta h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.player-meta .meta-line {
  margin: 0.45rem 0 0.95rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.done-block {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
}

.done-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.done-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.done-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.84rem;
}

.btn-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 550;
  padding: 0.15rem 0.25rem;
  border-radius: 6px;
  white-space: nowrap;
}

.btn-link.danger {
  color: var(--danger);
}

.btn-link:hover {
  background: var(--accent-soft);
}

.btn-link.danger:hover {
  background: var(--danger-soft);
}

.hint-inline {
  font-size: 0.72rem;
  color: var(--faint);
  font-weight: 550;
}

.toast {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 60;
  max-width: min(360px, calc(100vw - 2rem));
}

.toast.is-on {
  opacity: 1;
  transform: translateY(0);
}

.mock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.84rem;
  color: var(--muted);
  box-shadow: var(--shadow-card);
}

.mock-banner strong {
  color: var(--accent);
  font-weight: 560;
}

.empty {
  padding: 2.4rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-scrim);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 80;
  backdrop-filter: blur(6px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(400px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.3rem 1.15rem;
  box-shadow: var(--shadow);
  animation: rise 0.22s ease both;
}

.modal h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.modal p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--muted);
}

.list-pick-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(220px, 40vh);
  overflow-y: auto;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.list-pick-empty {
  margin: 0;
  font-size: 0.88rem;
}

.list-pick-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.2rem;
  border-radius: 8px;
}

.list-pick-item:hover:not(.is-in-list) {
  background: var(--panel);
}

.list-pick-item.is-in-list {
  opacity: 0.72;
  cursor: default;
}

.list-modal-create {
  margin-bottom: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.list-modal-create .field-label {
  display: block;
  margin-bottom: 0.45rem;
}

.list-modal-create-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.list-modal-create-row input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

.list-modal-create-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.list-modal-create-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 1.2rem;
}

.modal-prompt {
  width: min(640px, 100%);
}

.modal-prompt textarea {
  min-height: 220px;
  width: 100%;
  cursor: text;
}

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

#view > * {
  animation: rise 0.28s ease both;
}

#view .video-results .grid,
#view .video-results .empty {
  animation: none;
}

.settings-panel {
  max-width: 640px;
}

.settings-status-row {
  margin: 0 0 1rem;
}

.settings-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 560;
  border: 1px solid var(--line);
}

.settings-status-loading {
  color: var(--muted);
}

.settings-status-on {
  color: #1a7f37;
  background: rgba(52, 199, 89, 0.12);
  border-color: rgba(52, 199, 89, 0.28);
}

.settings-status-off {
  color: var(--muted);
  background: var(--bg);
}

html[data-theme="dark"] .settings-status-on {
  color: #6ee787;
  background: rgba(52, 199, 89, 0.14);
}

.settings-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.settings-feedback {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  line-height: 1.45;
}

.settings-feedback-ok {
  color: #1a7f37;
  background: rgba(52, 199, 89, 0.1);
  border: 1px solid rgba(52, 199, 89, 0.25);
}

.settings-feedback-error {
  color: #c41e3a;
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.22);
}

html[data-theme="dark"] .settings-feedback-ok {
  color: #6ee787;
}

html[data-theme="dark"] .settings-feedback-error {
  color: #ff6b6b;
}

.settings-form[disabled] {
  opacity: 0.7;
  pointer-events: none;
}

.mobile-topbar,
.sidebar-overlay {
  display: none;
}

.sidebar-overlay[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--sidebar);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }

  .menu-toggle {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 0;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
  }

  .menu-toggle svg {
    width: 1.15rem;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.02rem;
    font-weight: 650;
    letter-spacing: -0.03em;
  }

  .mobile-brand .brand-logo {
    width: 1.35rem;
  }

  .mobile-brand em {
    font-style: normal;
    color: var(--accent);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  body.nav-open .sidebar-overlay:not([hidden]) {
    display: block;
  }

  html[data-theme="dark"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.55);
  }

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(86vw, var(--sidebar-w));
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav {
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    min-height: 0;
    overflow-y: auto;
  }

  .nav-item {
    flex: 0 0 auto;
  }

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

  .player-shell {
    grid-template-columns: 1fr;
  }

  .toolbar-primary {
    gap: 0.45rem;
  }

  .search {
    min-width: 0;
    flex: 1 1 calc(100% - 6.5rem);
  }

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

  .sort-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  .sort-select {
    width: 100%;
    max-width: none;
  }

  .filter-toggle {
    flex: 0 0 auto;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 1rem 1rem 2rem;
  }
}

/* —— Contextual help tips —— */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.3rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}

.help-tip:hover,
.help-tip[aria-expanded="true"] {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.help-tip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter-group-label .help-tip,
.sort-label .help-tip,
.field-heading .help-tip,
.field-label .help-tip,
.help-heading .help-tip {
  margin-top: -0.1rem;
}

.help-heading {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.help-popover {
  position: fixed;
  z-index: 1200;
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0;
}

.help-popover[hidden] {
  display: none;
}

.help-popover-inner {
  position: relative;
  padding: 0.85rem 2rem 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.help-popover-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text);
}

.help-popover-close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.help-popover-close:hover {
  background: var(--accent-soft);
  color: var(--text);
}

@media (max-width: 560px) {
  .help-popover {
    left: 0.75rem !important;
    right: 0.75rem;
    max-width: none;
    width: auto;
  }
}

/* —— Help page —— */
.help-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 42rem;
}

.help-section {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-card);
}

.help-section h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 620;
  letter-spacing: -0.02em;
  color: var(--text);
}

.help-section h2::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: 0.1em;
}

.help-section p {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.help-section p:last-child {
  margin-bottom: 0;
}

.help-section ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.help-section li + li {
  margin-top: 0.35rem;
}

.help-section code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--text);
}

.help-page-intro {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Language switcher */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lang-switcher-sep {
  opacity: 0.45;
  user-select: none;
}
.lang-switcher-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  font: inherit;
}
.lang-switcher-btn:hover {
  color: var(--text);
}
.lang-switcher-btn.is-active {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.sidebar-tools .lang-switcher {
  margin-bottom: 0.65rem;
  justify-content: center;
  width: 100%;
}
