* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0a0a0a;
  --bg-card: #121212;
  --bg-card-hover: #1a1a1a;
  --yellow: #f5c518;
  --yellow-bright: #ffd700;
  --yellow-dark: #c9a000;
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --border: rgba(245, 197, 24, 0.25);
  --green-verified: #22c55e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== LOADING ========== */
#loading {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a1500 0%, #0a0a0a 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), filter 0.6s;
}

#loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.05);
  filter: blur(8px);
}

.loading-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
  border: 3px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(245, 197, 24, 0.4), inset 0 0 20px rgba(245, 197, 24, 0.1);
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 24px;
}

.loading-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(245, 197, 24, 0.35), 0 0 60px rgba(245, 197, 24, 0.15);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 50px rgba(245, 197, 24, 0.55), 0 0 90px rgba(245, 197, 24, 0.25);
  }
}

.loading-text {
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--yellow);
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.8;
}

.loading-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.loading-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--yellow-dark), var(--yellow-bright));
  border-radius: 4px;
  animation: loadProgress 1.8s ease-out forwards;
}

@keyframes loadProgress {
  to { width: 100%; }
}

.dots {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: bounce 1.2s ease-in-out infinite;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ========== MAIN APP ========== */
#app {
  display: none;
  min-height: 100vh;
  padding-bottom: 80px;
}

#app.show {
  display: block;
  animation: appEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes appEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.header {
  text-align: center;
  padding: 32px 20px 20px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1f1a00, #0d0d0d);
  border: 3px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 0 auto 16px;
  box-shadow: 0 0 30px rgba(245, 197, 24, 0.35);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand {
  font-size: 26px;
  font-weight: 800;
  color: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.4);
  animation: brandGlow 2.5s ease-in-out infinite;
}

@keyframes brandGlow {
  0%, 100% { text-shadow: 0 0 16px rgba(245, 197, 24, 0.35); }
  50% { text-shadow: 0 0 28px rgba(245, 197, 24, 0.65), 0 0 48px rgba(245, 197, 24, 0.25); }
}

.verified {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
}

.verified img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.tagline span {
  color: var(--yellow);
  font-weight: 600;
}

.desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 340px;
  margin: 12px auto 0;
  line-height: 1.5;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin: 24px 0 8px;
  justify-content: center;
}

.tab-btn {
  flex: 1;
  max-width: 100px;
  padding: 10px 4px;
  border: none;
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
}

.tab-btn .icon {
  font-size: 18px;
  line-height: 1;
}

.tab-btn.active .icon {
  color: #000;
}

.tab-btn .count {
  font-size: 10px;
  opacity: 0.7;
}

.tab-btn.active {
  background: var(--yellow);
  color: #000;
  box-shadow: 0 4px 20px rgba(245, 197, 24, 0.4);
  border-color: var(--yellow-bright);
}

.tab-btn:not(.active):hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

/* ========== SECTIONS ========== */
.section {
  display: none;
  padding: 8px 16px 24px;
  max-width: 480px;
  margin: 0 auto;
}

.section.active {
  display: block;
  animation: fadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.section-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title i {
  color: var(--yellow);
}

.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.link-card:nth-child(1) { animation-delay: 0.05s; }
.link-card:nth-child(2) { animation-delay: 0.1s; }
.link-card:nth-child(3) { animation-delay: 0.15s; }
.link-card:nth-child(4) { animation-delay: 0.2s; }
.link-card:nth-child(5) { animation-delay: 0.25s; }
.link-card:nth-child(6) { animation-delay: 0.3s; }
.link-card:nth-child(7) { animation-delay: 0.35s; }
.link-card:nth-child(8) { animation-delay: 0.4s; }

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.link-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--yellow);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 197, 24, 0.15);
}

.link-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1f1a00, #121200);
  border: 2px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--yellow);
}

.link-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--yellow);
  color: #000;
  text-transform: uppercase;
}

.badge.cs { background: #3b82f6; color: #fff; }
.badge.fs { background: #8b5cf6; color: #fff; }
.badge.jb { background: #22c55e; color: #000; }
.badge.sl { background: #f59e0b; color: #000; }
.badge.custom { background: #ec4899; color: #fff; }

.link-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  color: var(--yellow);
  font-size: 18px;
  opacity: 0.7;
}

.link-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  border: none;
  color: #ef4444;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.link-card:hover .link-delete,
.edit-mode .link-delete {
  display: flex;
  opacity: 1;
}

/* ========== FOOTER ========== */
.footer {
  text-align: center;
  padding: 24px 16px 16px;
  max-width: 480px;
  margin: 0 auto;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: var(--green-verified);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.copyright {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

.copyright a {
  color: var(--yellow);
  text-decoration: none;
}

/* ========== FLOATING ADD BUTTON ========== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), var(--yellow-dark));
  border: none;
  color: #000;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(245, 197, 24, 0.5);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(245, 197, 24, 0.6);
}

.fab:active {
  transform: scale(0.95);
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 380px;
  padding: 24px;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
  font-size: 18px;
  color: var(--yellow);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d0d0d;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--yellow);
}

.form-group select {
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel {
  background: #222;
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: #2a2a2a;
}

.btn-save {
  background: var(--yellow);
  color: #000;
}

.btn-save:hover {
  background: var(--yellow-bright);
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  border: 1px solid var(--yellow);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 480px) {
  .tabs {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }
}
