/* ═══════════════════════════════════════════════════════════════
   Cinnamoroll Linktree — All Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --bg-start: #c7e8f7;
  --bg-end: #e8f4fb;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-hover: rgba(255, 255, 255, 0.92);
  --border: rgba(180, 220, 240, 0.7);
  --shadow: 0 4px 24px rgba(100, 170, 220, 0.15);
  --shadow-h: 0 8px 32px rgba(80, 150, 210, 0.25);
  --accent: #5baad9;
  --accent-d: #3a87be;
  --text-main: #2a4a6b;
  --text-sub: #5b80a0;
  --radius-card: 18px;
  --radius-btn: 14px;
  --font: 'Nunito', system-ui, sans-serif;
}

/* ── Body ───────────────────────────────────────────────────── */
html,
body {
  min-height: 100%;
  font-family: var(--font);
  color: var(--text-main);
  background: linear-gradient(160deg, var(--bg-start) 0%, var(--bg-end) 100%);
}

body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 420px;
  height: 300px;
  top: -80px;
  left: -80px;
}

body::after {
  width: 360px;
  height: 260px;
  bottom: -60px;
  right: -60px;
}

/* ═══════════════════════════════════════════════════════════════
   PUBLIC PAGE
   ═══════════════════════════════════════════════════════════════ */
.container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  margin-bottom: 2.2rem;
}

.avatar-wrap {
  position: relative;
  width: 110px;
  height: 110px;
}

.avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 0 0 4px rgba(91, 170, 217, .35), var(--shadow);
  transition: transform .3s ease, box-shadow .3s ease;
}

.avatar:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 5px rgba(91, 170, 217, .55), var(--shadow-h);
}

.avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(91, 170, 217, .5);
  animation: spin 12s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Username row */
.username-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .15rem;
}

.username {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -.3px;
}

.username::before {
  content: '@';
  font-weight: 400;
  color: var(--accent);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

/* Bio / description */
.bio {
  font-size: .9rem;
  color: var(--text-sub);
  text-align: center;
  max-width: 320px;
}

/* Typewriter cursor */
.tw-cursor {
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  animation: blink .75s step-end infinite;
  margin-left: 1px;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0
  }
}

/* Links */
.links {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  width: 100%;
  padding: .85rem 1.2rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .2s ease, transform .18s ease, box-shadow .2s ease;
  animation: slideUp .45s ease both;
}

.link-btn:hover {
  background: var(--card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-h);
}

.link-btn:active {
  transform: translateY(0);
}

.link-btn:nth-child(1) {
  animation-delay: .05s;
}

.link-btn:nth-child(2) {
  animation-delay: .10s;
}

.link-btn:nth-child(3) {
  animation-delay: .15s;
}

.link-btn:nth-child(4) {
  animation-delay: .20s;
}

.link-btn:nth-child(5) {
  animation-delay: .25s;
}

.link-btn:nth-child(6) {
  animation-delay: .30s;
}

.link-btn:nth-child(7) {
  animation-delay: .35s;
}

.link-btn:nth-child(8) {
  animation-delay: .40s;
}

.link-btn:nth-child(9) {
  animation-delay: .45s;
}

.link-btn:nth-child(10) {
  animation-delay: .50s;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(18px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.icon[src*="simple-icons"] {
  filter: invert(40%) sepia(60%) saturate(600%) hue-rotate(185deg);
}

.label {
  line-height: 1;
}

/* ── Layout variants ────────────────────────────────────────── */
/* Card layout */
.layout-card .container {
  padding-top: 4rem;
}

.layout-card .profile {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 3.5rem 1.5rem 1.5rem;
  position: relative;
  margin-bottom: 1.25rem;
}

.layout-card .avatar-wrap {
  position: absolute;
  top: -55px;
  left: 50%;
  transform: translateX(-50%);
}

/* Side layout */
@media (min-width: 600px) {
  .layout-side .container {
    max-width: 720px;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    align-items: start;
  }

  .layout-side .profile {
    position: sticky;
    top: 2rem;
    margin-bottom: 0;
    text-align: left;
  }

  .layout-side .avatar-wrap {
    margin: 0 0 .75rem 0;
  }

  .layout-side .links {
    grid-column: 2;
  }

  .layout-side .username-row {
    justify-content: flex-start;
  }
}

/* Minimal layout */
.layout-minimal body::before,
.layout-minimal body::after {
  display: none !important;
}

.layout-minimal .avatar-wrap::after {
  display: none !important;
}

.layout-minimal .link-btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08) !important;
}

/* ═══════════════════════════════════════════════════════════════
   ADMIN DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

.admin-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

.admin-wrap h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
}

.admin-wrap h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-d);
  margin-bottom: .9rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.5rem;
}

/* ── Theme sections ─────────────────────────────────────────── */
.theme-section {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.theme-section:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.theme-sub {
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: .65rem;
}

.theme-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
  margin-bottom: .75rem;
}

.theme-label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-sub);
}

/* ── Color picker pairs ─────────────────────────────────────── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
}

.color-row {
  display: flex;
  gap: .4rem;
  align-items: center;
}

.cpick {
  width: 38px;
  height: 34px;
  padding: 2px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

.ctext {
  flex: 1;
}

/* ── Stats & analytics ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .85rem;
}

.stat-box {
  background: rgba(91, 170, 217, .1);
  border: 1.5px solid rgba(91, 170, 217, .25);
  border-radius: 12px;
  padding: .9rem;
  text-align: center;
}

.stat-box .num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-d);
  line-height: 1.1;
}

.stat-box .lbl {
  font-size: .74rem;
  color: var(--text-sub);
  margin-top: 3px;
}

.charts-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
}

.chart-wrap {
  background: rgba(255, 255, 255, .55);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.chart-line-wrap {
  flex: 2;
  min-width: 0;
}

.chart-donut-wrap {
  flex: 1;
  min-width: 200px;
}

.chart-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: .5rem;
}

.chart-box {
  position: relative;
  height: 220px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.chart-box canvas {
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Date controls */
.date-controls {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  align-items: flex-end;
}

.preset-btns {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preset-btn {
  padding: .28rem .7rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, .7);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all .18s;
}

.preset-btn:hover,
.preset-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.custom-date-row {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.custom-date-row input[type=date] {
  padding: .28rem .55rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, .7);
  font-size: .82rem;
  color: var(--text-main);
}

/* ── Table ──────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}

th,
td {
  padding: .4rem .65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: rgba(91, 170, 217, .1);
  color: var(--accent-d);
  font-weight: 700;
  font-size: .8rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(91, 170, 217, .04);
}

.sortable {
  user-select: none;
}

.sortable:hover {
  color: var(--accent);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.05rem;
  border-radius: 10px;
  border: none;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .18s, transform .15s;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: .88;
}

.btn-success {
  background: #4caf88;
  color: #fff;
}

.btn-success:hover {
  opacity: .88;
}

.btn-danger {
  background: #e05c6a;
  color: #fff;
}

.btn-danger:hover {
  opacity: .88;
}

.btn-sm {
  padding: .3rem .7rem;
  font-size: .78rem;
  border-radius: 8px;
}

/* ── Inputs ─────────────────────────────────────────────────── */
input[type="text"],
input[type="url"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: .45rem .7rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: .87rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, .75);
  outline: none;
  transition: border-color .2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

/* ── Upload area ────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: .55rem .75rem;
  font-size: .81rem;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.upload-area:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.upload-area input[type="file"] {
  display: none;
}

/* ── Toggle ─────────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.toggle-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.toggle-wrap label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

/* ── Toast ──────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #2a4a6b;
  color: #fff;
  padding: .65rem 1.1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: .88rem;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
}

/* ── Profile editor ─────────────────────────────────────────── */
.profile-edit-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.profile-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-width: 200px;
}

.profile-fields label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

/* ── Link cards (editor) ────────────────────────────────────── */
.link-card {
  background: rgba(255, 255, 255, .8);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1rem;
  margin-bottom: .75rem;
  display: grid;
  grid-template-columns: 28px 48px 1fr;
  gap: .65rem;
  align-items: start;
  transition: box-shadow .2s;
}

.link-card:hover {
  box-shadow: var(--shadow-h);
}

.link-card.dragging {
  opacity: .5;
  transform: scale(.98);
}

.link-card.drag-over {
  border-color: var(--accent);
  background: rgba(91, 170, 217, .08);
}

.drag-handle {
  cursor: grab;
  font-size: 1.1rem;
  color: var(--text-sub);
  padding-top: .15rem;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.link-card-preview {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.link-card-fields {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.link-card-fields label {
  font-size: .77rem;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

/* ── Layout picker ──────────────────────────────────────────── */
.layout-picker {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
}

.layout-opt {
  cursor: pointer;
}

.layout-opt input[type=radio] {
  display: none;
}

.layout-card-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .6rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .6);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-sub);
  transition: all .18s;
  cursor: pointer;
}

.lo-icon {
  font-size: 1.4rem;
}

.layout-opt input[type=radio]:checked+.layout-card-opt {
  border-color: var(--accent);
  background: rgba(91, 170, 217, .1);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 170, 217, .15);
}

.layout-card-opt:hover {
  border-color: var(--accent);
}

/* ── Font selectors ─────────────────────────────────────────── */
.font-select {
  width: 100%;
  padding: .42rem .65rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, .75);
  font-size: .86rem;
  margin-bottom: .35rem;
}

.font-preview {
  padding: .5rem .7rem;
  background: rgba(255, 255, 255, .5);
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  font-size: 1.05rem;
  color: var(--text-sub);
  min-height: 2.2rem;
  transition: font-family .3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Font upload row ────────────────────────────────────────── */
.font-upload-row {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.font-upload-row .theme-label {
  flex: 1;
  min-width: 160px;
}

/* ── Typewriter text list ───────────────────────────────────── */
.tw-item {
  display: flex;
  gap: .4rem;
  align-items: center;
  margin-bottom: .35rem;
}

/* ── Color pairs ────────────────────────────────────────────── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
}

.color-row {
  display: flex;
  gap: .4rem;
  align-items: center;
}

.cpick {
  width: 38px;
  height: 32px;
  padding: 2px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

.ctext {
  flex: 1;
}

/* ── Custom fonts list ──────────────────────────────────────── */
#customFontsList .tw-item {
  background: rgba(255, 255, 255, .6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem .6rem;
}

/* ── Audio Floating Speaker Toggle (Top Right) ──────────────── */
.audio-toggle-btn {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(100, 170, 220, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease;
  color: var(--text-main);
}

.audio-toggle-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
}

.audio-toggle-btn:active {
  transform: scale(0.96);
}

.audio-toggle-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ── Enter Overlay (click to enter / play) ──── */
.enter-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 30, 50, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity .45s ease, visibility .45s ease;
  color: #fff;
  user-select: none;
  pointer-events: auto !important;
}

.enter-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.enter-content {
  text-align: center;
  animation: pulseEnter 2s infinite ease-in-out;
}

.enter-icon {
  font-size: 2.8rem;
  margin-bottom: .4rem;
}

.enter-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

@keyframes pulseEnter {

  0%,
  100% {
    transform: scale(1);
    opacity: .9;
  }

  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 680px) {
  .admin-wrap {
    padding: 1rem .6rem 3rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .card {
    padding: 1.1rem .9rem;
    max-width: 100%;
    overflow: hidden;
  }

  .link-card {
    grid-template-columns: 24px 40px 1fr;
    gap: .45rem;
  }

  .charts-row {
    flex-direction: column;
    width: 100%;
  }

  .chart-wrap,
  .chart-line-wrap,
  .chart-donut-wrap {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .chart-box {
    width: 100%;
    max-width: 100%;
    position: relative;
    height: 200px;
  }

  .date-controls {
    align-items: flex-start;
    width: 100%;
  }

  .preset-btns {
    justify-content: flex-start;
  }

  .custom-date-row {
    width: 100%;
    justify-content: flex-start;
    gap: .35rem;
  }

  .custom-date-row input[type=date] {
    flex: 1 1 110px;
    min-width: 0;
  }

  .custom-date-row .btn {
    flex-shrink: 0;
    margin-top: .2rem;
  }

  .theme-row {
    grid-template-columns: 1fr;
  }

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