/* Klin OS · TikTok Dashboard
 * Mobile-first · dark mode default · zero framework
 * Design token alignment with caioklin.com (cyan accents · soft dark surface)
 */

:root {
  --bg: #0b0d11;
  --surface: #14171d;
  --surface-2: #1c2029;
  --border: #262b35;
  --text: #f5f7fa;
  --text-dim: #a3acba;
  --text-faint: #6b7382;
  --accent: #4ade80;
  --accent-hover: #22c55e;
  --tt-pink: #fe2c55;
  --tt-blue: #25f4ee;
  --error: #f87171;
  --success: #4ade80;
  --radius: 14px;
  --gap: 1.25rem;
  --max: 960px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   Brand
   ============================================ */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand__mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--tt-blue) 0%, var(--accent) 50%, var(--tt-pink) 100%);
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.5rem; color: #000;
  letter-spacing: -0.04em;
}
.brand--small .brand__mark { width: 32px; height: 32px; font-size: 1rem; border-radius: 8px; }
.brand__text h1 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.brand__text p { margin: 0; color: var(--text-dim); font-size: 0.8rem; }

/* ============================================
   Hero (landing)
   ============================================ */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.25rem 1.5rem;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.hero__copy { margin-top: 3rem; flex: 1; }
.hero__title {
  font-size: 1.95rem; font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.hero__sub {
  color: var(--text-dim);
  margin: 0 0 2rem;
  font-size: 1rem;
}
.hero__sub strong { color: var(--text); font-weight: 600; }

.cta {
  appearance: none; border: 0;
  background: linear-gradient(135deg, var(--tt-blue), var(--tt-pink));
  color: #000;
  font-weight: 700; font-size: 1.05rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  width: 100%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  transition: transform 0.15s ease, filter 0.15s ease;
  font-family: var(--font);
}
.cta:hover { filter: brightness(1.08); }
.cta:active { transform: translateY(1px); }
.cta__icon { width: 22px; height: 22px; }

.hero__error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--error);
  border-radius: 8px;
  font-size: 0.9rem;
}

.hero__scopes {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}
.hero__scopes li { display: flex; align-items: center; gap: 0.6rem; }
.dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.hero__legal {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
}
.hero__legal a { color: var(--text-dim); }
.hero__legal span { margin: 0 0.5rem; }

/* ============================================
   Dashboard
   ============================================ */
.dashboard { padding: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.ghost {
  appearance: none;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
}
.ghost:hover { color: var(--text); border-color: var(--text-faint); }

.grid {
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 720px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .videos { grid-column: 1 / -1; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card__title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
}

/* Profile */
.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.profile__avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--surface-2);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.profile__meta { flex: 1; min-width: 0; }
.profile__name {
  font-size: 1.15rem; font-weight: 700;
  margin: 0;
  display: flex; align-items: center; gap: 0.4rem;
}
.profile__handle {
  font-size: 0.85rem; color: var(--text-dim); margin: 0.15rem 0 0;
}
.profile__bio {
  font-size: 0.85rem; color: var(--text-dim);
  margin: 0.5rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.verified {
  display: inline-flex;
  width: 16px; height: 16px;
  background: var(--tt-blue);
  border-radius: 50%;
  align-items: center; justify-content: center;
  font-size: 10px; color: #000;
}

/* Stats */
.stats__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
@media (min-width: 480px) {
  .stats__grid { grid-template-columns: repeat(4, 1fr); }
}
.stat {
  background: var(--surface-2);
  padding: 0.85rem;
  border-radius: 10px;
}
.stat__num {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
}

/* Videos */
.videos__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.video {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  gap: 0.85rem;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.video:hover { background: #232833; }
.video__cover {
  width: 80px; height: 80px;
  border-radius: 8px;
  background: var(--surface);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.video__body { flex: 1; min-width: 0; }
.video__title {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.video__meta span::before {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  background: var(--text-faint);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.4rem;
  margin-top: -2px;
}

.video.expanded .video__extras {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.video.expanded .video__extras div {
  text-align: center;
}
.video.expanded .video__extras strong {
  display: block;
  font-variant-numeric: tabular-nums;
}
.video.expanded .video__extras span {
  font-size: 0.65rem;
  color: var(--text-faint);
  text-transform: uppercase;
}
.video__extras { display: none; }

/* Meta */
.meta__list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.85rem;
}
.meta__list dt { color: var(--text-faint); }
.meta__list dd { margin: 0; color: var(--text); font-family: ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; font-size: 0.78rem; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, #2a2f3a 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
.skeleton--line { height: 14px; margin-bottom: 8px; }
.skeleton--w60 { width: 60%; }
.skeleton--w40 { width: 40%; }
.skeleton--num { width: 60px; height: 28px; }
.skeleton--video { height: 96px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error banner */
.error-banner {
  position: fixed;
  bottom: 1rem; left: 1rem; right: 1rem;
  max-width: 480px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--error);
  border-radius: 10px;
  font-size: 0.9rem;
  text-align: center;
  z-index: 100;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}
