:root {
  --bg-start: #1a0000;
  --bg-end: #3d0000;
  --panel: rgba(52, 0, 0, 0.45);
  --panel-strong: rgba(68, 0, 0, 0.56);
  --panel-border: rgba(255, 82, 82, 0.26);
  --panel-border-strong: rgba(255, 74, 74, 0.58);
  --text-main: #ffffff;
  --text-soft: rgba(255, 238, 238, 0.8);
  --text-muted: rgba(255, 215, 215, 0.66);
  --accent: #ff4d5f;
  --accent-bright: #f55e70;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 32px rgba(255, 77, 95, 0.22);
  --card-width: min(92vw, 470px);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-start);
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(255, 85, 85, 0.14), transparent 28%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end), #260000, #430000);
  background-size: 180% 180%;
  animation: gradientShift 8s ease-in-out infinite;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  padding: 32px 16px;
  isolation: isolate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(42px);
  z-index: -2;
}

body::before {
  width: 18rem;
  height: 18rem;
  top: -4rem;
  right: -3rem;
  background: rgba(255, 84, 84, 0.14);
  animation: driftGlow 10s ease-in-out infinite;
}

body::after {
  width: 20rem;
  height: 20rem;
  bottom: -6rem;
  left: -6rem;
  background: rgba(200, 20, 40, 0.18);
  animation: driftGlow 12s ease-in-out infinite reverse;
}

/* Particles */
.particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.particle {
  position: absolute;
  bottom: -12vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 116, 116, 0.95) 0%, rgba(255, 77, 95, 0.55) 48%, rgba(255, 77, 95, 0) 75%);
  animation: floatUp linear infinite;
  will-change: transform, opacity;
}

/* Shell */
.shell {
  width: var(--card-width);
  position: relative;
  padding: 34px 22px 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(35, 0, 0, 0.44), rgba(20, 0, 0, 0.52));
  border: 1px solid rgba(255, 90, 90, 0.14);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

.qr-shell {
  padding-bottom: 28px;
  display: grid;
  gap: 20px;
  animation: revealUp 0.75s var(--ease-out) both;
}

.shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%, transparent 72%, rgba(255, 120, 120, 0.06));
  pointer-events: none;
}

/* Profile Section */
.profile {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
  margin-bottom: 22px;
}

.avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(160deg, rgba(255, 92, 92, 0.28), rgba(55, 0, 0, 0.9));
  border: 2px solid rgba(255, 105, 105, 0.78);
  box-shadow:
    0 0 0 7px rgba(255, 58, 58, 0.1),
    0 0 36px rgba(255, 74, 74, 0.3),
    inset 0 0 28px rgba(255, 145, 145, 0.08);
  animation: revealUp 0.75s var(--ease-out) 0.05s both;
  will-change: transform;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  animation: avatarPulse 3s ease-in-out infinite 0.8s;
  will-change: transform;
}

.avatar span {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 250, 250, 0.92);
  text-shadow: 0 0 12px rgba(255, 82, 82, 0.32);
  animation: avatarPulse 3s ease-in-out infinite 0.8s;
  will-change: transform;
}

.avatar.avatar-fallback span {
  display: grid;
}

.profile-text {
  animation: revealUp 0.75s var(--ease-out) 0.15s both;
}

.profile h1 {
  margin: 0;
  font-size: clamp(1.95rem, 6vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-shadow: 0 0 16px rgba(255, 80, 80, 0.25);
}

.profile p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* About Section */
.about {
  position: relative;
  margin-bottom: 20px;
  padding: 20px 18px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel), rgba(38, 0, 0, 0.52));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 16px 30px rgba(0, 0, 0, 0.18);
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
  animation: revealUp 0.75s var(--ease-out) 0.25s both;
  will-change: transform;
}

.about:hover {
  transform: scale(1.01);
  border-color: var(--panel-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 34px rgba(0, 0, 0, 0.24),
    0 0 26px rgba(255, 77, 95, 0.18);
}

.about h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 212, 212, 0.94);
}

.about p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
  font-size: 0.96rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-pill);
  background: rgba(18, 0, 0, 0.68);
  border: 1px solid rgba(255, 92, 92, 0.18);
  color: rgba(255, 232, 232, 0.92);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.stat-pill strong {
  color: var(--accent-bright);
  font-weight: 600;
}

/* Links Section */
.links {
  display: grid;
  gap: 12px;
}

.link-card {
  --delay: 0.35s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(58, 0, 0, 0.42), rgba(26, 0, 0, 0.58));
  color: var(--text-main);
  text-decoration: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 24px rgba(0, 0, 0, 0.18);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
  overflow: hidden;
  animation: revealUp 0.75s var(--ease-out) var(--delay) both;
  will-change: transform;
}

.link-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  transform: translateX(-120%);
  transition: transform 320ms ease;
}

.link-card:hover,
.link-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255, 95, 95, 0.66);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 32px rgba(0, 0, 0, 0.24),
    0 0 32px rgba(255, 77, 95, 0.22);
  background: linear-gradient(180deg, rgba(72, 0, 0, 0.48), rgba(30, 0, 0, 0.64));
}

.link-card:hover::before,
.link-card:focus-visible::before {
  transform: translateX(120%);
}

.link-card:focus-visible {
  outline: none;
}

.link-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.link-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 78, 78, 0.12);
  border: 1px solid rgba(255, 94, 94, 0.16);
  font-size: 1.18rem;
  flex: 0 0 auto;
}

.link-copy {
  min-width: 0;
}

.link-copy strong,
.link-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-copy strong {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.link-copy span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.link-arrow {
  font-size: 1rem;
  color: rgba(255, 200, 200, 0.78);
  transform: translateX(0);
  transition: transform 220ms ease, color 220ms ease;
  flex: 0 0 auto;
}

.link-card:hover .link-arrow,
.link-card:focus-visible .link-arrow {
  transform: translateX(3px);
  color: rgba(255, 235, 235, 0.96);
}

/* QR Generator Specific Styles */
.qr-title {
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  letter-spacing: 0.03em;
  text-align: center;
  text-shadow: 0 0 16px rgba(255, 80, 80, 0.25);
  margin: 0;
}

.qr-title span {
  color: var(--accent-bright);
}

.input-wrap {
  position: relative;
}

input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  background: rgba(18, 0, 0, 0.68);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 220ms ease, box-shadow 220ms ease;
  backdrop-filter: blur(10px);
}

input[type="text"]::placeholder {
  color: rgba(255, 180, 180, 0.35);
}

input[type="text"]:focus {
  border-color: var(--panel-border-strong);
  box-shadow: 0 0 0 3px rgba(255, 77, 95, 0.12);
}

.qr-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel), rgba(26, 0, 0, 0.55));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 16px 30px rgba(0, 0, 0, 0.18);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.qr-panel:hover {
  border-color: var(--panel-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 34px rgba(0, 0, 0, 0.24),
    0 0 26px rgba(255, 77, 95, 0.18);
}

.qr-frame {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
  position: relative;
}

.qr-frame.empty {
  opacity: 0.15;
}

.qr-frame #qr canvas,
.qr-frame #qr img {
  display: block;
}

.placeholder-icon {
  position: absolute;
  font-size: 3rem;
  opacity: 0.25;
  pointer-events: none;
}

.actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(58, 0, 0, 0.42), rgba(26, 0, 0, 0.58));
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease,
    color 220ms ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 18px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  transform: translateX(-120%);
  transition: transform 320ms ease;
}

.btn:hover:not(:disabled),
.btn:focus-visible:not(:disabled) {
  transform: translateY(-3px);
  border-color: rgba(255, 95, 95, 0.66);
  color: var(--text-main);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 28px rgba(0, 0, 0, 0.24),
    0 0 24px rgba(255, 77, 95, 0.22);
  background: linear-gradient(180deg, rgba(72, 0, 0, 0.48), rgba(30, 0, 0, 0.64));
}

.btn:hover:not(:disabled)::before {
  transform: translateX(120%);
}

.btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn svg {
  flex: 0 0 auto;
}

/* Fullscreen overlay */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-direction: column;
  gap: 20px;
}

#overlay.active {
  display: flex;
}

#overlay .fs-hint {
  color: rgba(255, 200, 200, 0.5);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#overlay .fs-frame {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 0 80px rgba(255, 77, 95, 0.3);
}

#overlay #qr-full canvas,
#overlay #qr-full img {
  display: block;
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(255, 145, 145, 0.48) 0%, rgba(255, 77, 95, 0.18) 45%, rgba(255, 77, 95, 0) 72%);
  animation: ripplePulse 650ms ease-out forwards;
  pointer-events: none;
}

/* Animations */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.7);
  }
  10% {
    opacity: 0.55;
  }
  85% {
    opacity: 0.28;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift-x), -115vh, 0) scale(1.08);
  }
}

@keyframes ripplePulse {
  from {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3.4);
  }
}

@keyframes avatarPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes driftGlow {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(1rem, -0.8rem, 0) scale(1.08);
  }
}

/* Media Queries */
@media (max-width: 560px) {
  body {
    padding: 22px 12px;
  }

  .shell {
    padding: 28px 16px 18px;
    border-radius: 24px;
  }

  .avatar {
    width: 102px;
    height: 102px;
  }

  .link-card {
    padding: 14px 15px;
  }

  .stat-pill {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
  }

  .actions {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
