:root {
  --bg: #0a0a0b;
  --panel: #16161a;
  --panel2: #1e1e24;
  --border: #2a2a32;
  --text: #f3f3f5;
  --muted: #9a9aa5;
  --red: #ff2d55;
  --purple: #7c5cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Bricolage Grotesque', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.cr-app { position: relative; min-height: 100vh; }

/* atmospheric glow */
.cr-glow {
  position: fixed;
  top: -30%; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 700px;
  background: radial-gradient(ellipse at center, rgba(255,45,85,0.18), rgba(124,92,255,0.12) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(20px);
  animation: glowPulse 8s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

/* Header */
.cr-header {
  position: relative;
  z-index: 2;
  padding: 22px 18px 8px;
}
.cr-header-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.cr-title {
  margin: 0;
  font-size: clamp(28px, 7vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background: linear-gradient(100deg, var(--red), #ff7ab8 40%, var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cr-dice { -webkit-text-fill-color: initial; display: inline-block; animation: wob 3s ease-in-out infinite; }
@keyframes wob { 0%,100%{transform:rotate(-8deg);} 50%{transform:rotate(12deg);} }
.cr-tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.01em;
}
.cr-fav-btn {
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: transform .15s, border-color .15s;
}
.cr-fav-btn:hover { transform: translateY(-2px); border-color: var(--red); }
.cr-fav-count {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Main */
.cr-main {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 18px 60px;
}

/* Chips */
.cr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 18px 0 24px;
}
.cr-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.cr-chip:hover { color: var(--text); border-color: var(--purple); transform: translateY(-1px); }
.cr-chip-active { font-weight: 700; box-shadow: 0 4px 20px -6px currentColor; }

/* Spin zone */
.cr-spin-zone { text-align: center; margin-bottom: 28px; }
.cr-spin-btn {
  background: linear-gradient(120deg, var(--red), var(--purple));
  border: none;
  color: #fff;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 5vw, 26px);
  letter-spacing: 0.02em;
  padding: 18px 40px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 10px 40px -8px rgba(255,45,85,0.6);
  transition: transform .12s, box-shadow .2s;
  position: relative;
}
.cr-spin-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 50px -8px rgba(255,45,85,0.75);
}
.cr-spin-btn:active:not(:disabled) { transform: scale(0.96); }
.cr-spin-btn:disabled { cursor: wait; opacity: 0.9; }
.cr-spinning { animation: shake 0.4s ease-in-out infinite; }
@keyframes shake {
  0%,100%{ transform: translateX(0) rotate(0); }
  25%{ transform: translateX(-3px) rotate(-1deg); }
  75%{ transform: translateX(3px) rotate(1deg); }
}
.cr-spin-load { display: inline-block; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.6;} }
.cr-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  min-height: 18px;
}

/* Empty state */
.cr-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.cr-empty-emoji { font-size: 52px; margin-bottom: 10px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-8px);} }

/* Card */
.cr-card {
  background: linear-gradient(160deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  animation: cardIn 0.5s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.cr-card-gem {
  border-color: #ffd23f;
  box-shadow: 0 0 40px -6px rgba(255,210,63,0.5), inset 0 0 60px -30px rgba(255,210,63,0.4);
  animation: cardIn 0.5s cubic-bezier(.2,.9,.3,1.3), gemGlow 2s ease-in-out infinite;
}
@keyframes gemGlow {
  0%,100% { box-shadow: 0 0 40px -6px rgba(255,210,63,0.5), inset 0 0 60px -30px rgba(255,210,63,0.4); }
  50% { box-shadow: 0 0 60px -4px rgba(255,210,63,0.8), inset 0 0 70px -25px rgba(255,210,63,0.6); }
}
.cr-gem-badge {
  position: absolute;
  top: 14px; right: -34px;
  background: linear-gradient(90deg, #ffd23f, #ff8c42);
  color: #0a0a0b;
  font-weight: 800;
  font-size: 11px;
  padding: 5px 40px;
  transform: rotate(38deg);
  letter-spacing: 0.03em;
}
.cr-avatar {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px -4px rgba(0,0,0,0.6);
}
.cr-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.cr-handle { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px; margin-top: 2px; }
.cr-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid;
}
.cr-subs { font-size: 13px; color: var(--muted); font-weight: 600; }
.cr-desc { margin: 14px 0 4px; font-size: 15px; line-height: 1.5; color: #dcdce2; }

.cr-videos { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.cr-video-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  transition: background .15s;
}
.cr-video-row:hover { background: rgba(255,255,255,0.05); }
.cr-thumb {
  width: 72px; height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.cr-play {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  background: rgba(0,0,0,0.35);
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 2px;
}
.cr-video-meta { min-width: 0; }
.cr-video-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cr-video-views { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

.cr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.cr-btn {
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  padding: 10px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  flex: 1 1 auto;
}
.cr-btn:hover { transform: translateY(-2px); }
.cr-btn-save { background: rgba(255,210,63,0.12); border-color: rgba(255,210,63,0.4); color: #ffd23f; }
.cr-btn-saved { background: #ffd23f; color: #0a0a0b; }
.cr-btn-yt { background: rgba(255,45,85,0.14); border-color: rgba(255,45,85,0.45); color: #ff6b8a; }
.cr-btn-again { background: rgba(124,92,255,0.14); border-color: rgba(124,92,255,0.45); color: #b3a1ff; }

.cr-counter {
  text-align: center;
  margin-top: 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--muted);
}

/* Footer */
.cr-footer {
  margin-top: 40px;
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.cr-disclaimer { color: #5f5f6a; font-size: 11px; line-height: 1.5; max-width: 420px; margin: 0 auto 12px; }
.cr-remix {
  color: var(--purple);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed rgba(124,92,255,0.5);
}
.cr-remix:hover { color: #b3a1ff; }

/* Drawer */
.cr-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 20;
  animation: fade .2s;
}
@keyframes fade { from{opacity:0;} to{opacity:1;} }
.cr-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(380px, 88vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 21;
  transform: translateX(105%);
  transition: transform .3s cubic-bezier(.3,.8,.3,1);
  display: flex;
  flex-direction: column;
}
.cr-drawer-open { transform: translateX(0); box-shadow: -20px 0 60px -10px rgba(0,0,0,0.7); }
.cr-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.cr-drawer-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.cr-close {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}
.cr-close:hover { border-color: var(--red); }
.cr-drawer-empty { padding: 30px 20px; color: var(--muted); font-size: 14px; text-align: center; }
.cr-drawer-list { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cr-drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
}
.cr-di-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-di-cat { font-size: 12px; font-weight: 600; margin-top: 2px; }
.cr-di-yt, .cr-di-rm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.cr-di-yt:hover { border-color: var(--red); color: #ff6b8a; }
.cr-di-rm:hover { border-color: var(--red); color: var(--red); }

/* Particles */
.cr-particle {
  position: fixed;
  width: 9px; height: 9px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 50;
  animation: fly 1s ease-out forwards;
}
@keyframes fly {
  0% { transform: translate(0,0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

@media (max-width: 480px) {
  .cr-header-inner { flex-direction: column; }
  .cr-fav-btn { align-self: flex-start; }
  .cr-btn { flex: 1 1 100%; }
}