@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0b0d14;
  --bg-gradient: radial-gradient(circle at 20% 0%, rgba(138, 92, 252, 0.18), transparent 38rem),
                 radial-gradient(circle at 85% 20%, rgba(56, 189, 248, 0.12), transparent 34rem),
                 #0b0d14;
  --panel: rgba(23, 27, 40, 0.7);
  --panel-hover: rgba(30, 35, 52, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(167, 139, 250, 0.6);
  --text: #f8fafc;
  --text-dim: #cbd5e1;
  --muted: #64748b;
  --accent: #a855f7;
  --accent-light: #c084fc;
  --accent-glow: rgba(168, 85, 247, 0.35);
  --cyan: #38bdf8;
  --good: #34d399;
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(880px, calc(100% - 36px));
  margin: 0 auto;
  padding: 50px 0 80px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 34px;
}
.hero.compact { margin-bottom: 28px; }

.eyebrow {
  display: inline-block;
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 8px;
  background: rgba(168, 85, 247, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

h1 {
  font-size: clamp(34px, 5.5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.actions-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
}

.btn, .edit-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
}

.btn:hover, .edit-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 18px var(--accent-glow);
}
.btn.primary:hover {
  box-shadow: 0 6px 26px rgba(168, 85, 247, 0.5);
  background: linear-gradient(135deg, #b86bfc 0%, #8b5cf6 100%);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.04);
}

.btn.danger {
  background: var(--danger-bg);
  border-color: rgba(244, 63, 94, 0.3);
  color: #ff8597;
}
.btn.danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.panel {
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px -10px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
}

.login-panel {
  max-width: 420px;
  margin: 50px auto 0;
  text-align: center;
}
.login-panel h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
.login-panel p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 22px;
}
.code-input-group {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.code-input {
  width: 170px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3em;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(11, 13, 20, 0.9);
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}
.code-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.anime-list {
  display: grid;
  gap: 12px;
}

.anime-card {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
}
.anime-card:hover {
  background: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.anime-card:nth-child(1) .rank { color: #ffd700; }
.anime-card:nth-child(2) .rank { color: #e2e8f0; }
.anime-card:nth-child(3) .rank { color: #f97316; }

.title-wrap {
  min-width: 0;
}
.title-wrap .title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  word-break: break-word;
}
.title-wrap .details {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.title-wrap .likes-badge {
  color: var(--good);
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-light);
}
.score-display small {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
}

.add-box {
  margin-bottom: 24px;
}
.add-box h3 {
  font-size: 18px;
  margin-bottom: 14px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(11, 13, 20, 0.8);
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}
.field-input:focus {
  border-color: var(--border-focus);
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
}
.slider-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent-light);
  min-width: 44px;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
  border: 2px solid #ffffff;
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.edit-card {
  display: grid;
  grid-template-columns: 1fr 240px auto;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
  margin-bottom: 10px;
}
.edit-card:hover {
  background: var(--panel-hover);
}
.edit-card .title {
  font-size: 16px;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

@media(max-width: 720px) {
  .page { width: calc(100% - 24px); padding: 30px 0 60px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .edit-card { grid-template-columns: 1fr; gap: 12px; }
  .anime-card { grid-template-columns: 36px 1fr auto; gap: 12px; padding: 12px 14px; }
  .score-display { font-size: 22px; }
}