/* ─── Theme tokens ─────────────────────────────────────────────────────────── */

:root {
  --primary:    #ADD8E6;
  --bg:         #ffffff;
  --text:       #333333;
  --card-bg:    #5C9EFF;
  --shadow:     rgba(0, 0, 0, 0.2);
  --msg-bg:     #ffffff;
  --input-bg:   rgba(255, 255, 255, 0.8);
  --transition: 0.3s ease;
}

[data-theme="dark"] {
  --primary:  #1A2B4C;
  --bg:       #121212;
  --text:     #E0E0E0;
  --card-bg:  #2C5EAB;
  --shadow:   rgba(0, 0, 0, 0.5);
  --msg-bg:   #1E1E1E;
  --input-bg: rgba(255, 255, 255, 0.05);
}

/* ─── Base ─────────────────────────────────────────────────────────────────── */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  font-family: 'Comic Neue', sans-serif;
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

.page {
  max-width: 500px;
  margin: 40px auto;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--shadow);
  background: var(--bg);
  transition: background var(--transition), box-shadow var(--transition);
}

.overlay {
  position: relative;
  padding: 20px;
  z-index: 1;
}

.text-center {
  text-align: center;
}

/* ─── Theme toggle ─────────────────────────────────────────────────────────── */

.theme-toggle {
  position: absolute;
  top: 15px;
  left: 15px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.3s, transform 0.3s;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(128, 128, 128, 0.2);
  transform: scale(1.1);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Profile header ───────────────────────────────────────────────────────── */

.avatar {
  display: block;
  margin: 0 auto;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 8px var(--shadow);
  transition: border var(--transition);
}

.username {
  text-align: center;
  margin-top: 10px;
  font-size: 1.1rem;
  font-weight: 700;
}

.role {
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 4px 0 20px;
}

.copyright {
  margin: 24px 0 0;
}

/* ─── Link buttons ─────────────────────────────────────────────────────────── */

.links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
}

.link-item {
  position: relative;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 3px;
  box-shadow: 0 2px 6px var(--shadow);
  cursor: pointer;
  color: #FFF;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow var(--transition);
}

.link-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  z-index: 1;
  opacity: 0;
  transform: scale(1.05);
  transition: all 0.3s ease;
  pointer-events: none;
}

.link-item:hover::before,
.link-item:focus-visible::before {
  opacity: 1;
  transform: scale(1);
}

.link-item:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.link-item > * {
  position: relative;
  z-index: 2;
}

.link-item .icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-item .icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.link-item .icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #FFF;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-label {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  margin-left: -30px;
}

/* ─── Content card ─────────────────────────────────────────────────────────── */

.card {
  margin: 10px 0 20px;
  padding: 24px 16px;
  background: var(--msg-bg);
  border-radius: 10px;
  text-align: center;
  transition: background var(--transition);
}

.card h3 {
  color: var(--card-bg);
  margin-bottom: 10px;
  font-size: 1.2rem;
  transition: color var(--transition);
}

.card p {
  opacity: 0.8;
  font-size: 0.95rem;
}

.card a {
  color: var(--card-bg);
  font-weight: 700;
}

/* Discord handle */
.handle-display {
  width: 100%;
  background: var(--input-bg);
  border: 2px solid var(--card-bg);
  padding: 12px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  user-select: all;
  transition: border 0.3s, background var(--transition);
}

.action-btn {
  width: 100%;
  background: var(--card-bg);
  border: 0;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  color: #FFF;
  box-shadow: 0 2px 6px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, background var(--transition);
}

.action-btn:hover,
.action-btn:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 4px 10px var(--shadow);
}

/* Error page */
.error-code {
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--card-bg);
  line-height: 1;
  transition: color var(--transition);
}

.card .error-code + p {
  margin-top: 12px;
}

/* Redirect page */
.loader {
  border: 5px solid var(--primary);
  border-top: 5px solid var(--card-bg);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  animation: spin 1.2s linear infinite;
  margin: 0 auto 16px;
}

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

.countdown {
  font-weight: 700;
  color: var(--card-bg);
  font-size: 1.15rem;
}

.card .fallback {
  margin-top: 10px;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ─── Doodles ──────────────────────────────────────────────────────────────── */

.doodle {
  position: absolute;
  width: 50px;
  height: 50px;
  stroke: var(--text);
  fill: none;
  stroke-width: 3px;
  pointer-events: none;
  transition: stroke var(--transition), fill var(--transition);
}

.doodle.star-right {
  top: 60px;
  right: 20px;
  transform: rotate(15deg);
}

.doodle.star-left {
  top: 100px;
  left: 25px;
  transform: rotate(-15deg);
  fill: var(--bg);
}

.doodle.heart {
  bottom: 20px;
  left: 25px;
  transform: rotate(-15deg);
  fill: var(--card-bg);
  stroke: var(--card-bg);
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  padding: 20px 40px;
  color: var(--card-bg);
  margin-top: 40px;
  transition: color var(--transition);
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-links {
  display: flex;
  gap: 15px;
}

.footer-links img {
  width: 18px;
  height: 18px;
  filter: brightness(0) saturate(100%) invert(53%) sepia(72%) saturate(500%) hue-rotate(190deg);
}

@media (min-width: 600px) {
  .footer-container {
    flex-direction: row;
    justify-content: space-between;
    max-width: 500px;
    margin: 0 auto;
  }
}

@media (max-width: 540px) {
  .page {
    margin: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    transition: none !important;
    animation-duration: 3s !important;
  }
}
