@font-face {
  font-family: "Bilbo";
  src: url("assets/fonts/Bilbo.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SunandMoon";
  src: url("assets/fonts/SunandMoon.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --main: #fff;
  --ink: #000;
  --glass: rgba(20, 20, 25, 0.8);
  --glass-strong: rgba(0, 0, 0, 0.85);
  --line: rgba(255, 255, 255, 0.4);
  --line-soft: rgba(255, 255, 255, 0.2);
  --muted: rgba(255, 255, 255, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

body.intro-active .brand-title,
body.intro-active .site-logo,
body.intro-active .scene,
body.intro-active .player {
  opacity: 0;
  pointer-events: none;
}

.brand-title,
.site-logo,
.scene,
.player {
  transition: opacity 0.9s ease;
}

/* —— Fixed corner mark —— */
.site-logo {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 7;
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.55));
}

@media (max-width: 640px) {
  .site-logo {
    top: 0.75rem;
    left: 0.75rem;
    width: 40px;
    height: 40px;
  }
}

/* —— Kodex-style splash —— */
.intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.intro.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-content {
  text-align: center;
  padding: 2rem;
}

.intro-brand {
  display: block;
  font-family: "Bilbo", serif;
  font-size: clamp(3.5rem, 14vw, 7.5rem);
  font-weight: normal;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1;
  animation: splash-sway 4s ease-in-out infinite;
}

.intro-sub {
  margin-top: 1.5rem;
  font: italic 400 0.85rem/1 system-ui, sans-serif;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.38);
  animation: intro-pulse 2.2s ease-in-out infinite;
}

@keyframes splash-sway {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.9;
  }

  50% {
    transform: translateY(15px) scale(1.02);
    opacity: 1;
  }
}

@keyframes intro-pulse {
  0%,
  100% {
    opacity: 0.32;
  }

  50% {
    opacity: 0.65;
  }
}

/* —— Atmosphere layers (kodex-inspired; solid black bg for now) —— */

/* Kodex matrix stack 1:1 — .matrix / .matrix2 / .matrix3 / .matrix4 */
.fx-matrix {
  z-index: 2;
  pointer-events: none;
  position: fixed;
  height: 1000%;
  width: 1000%;
  bottom: 0;
  top: 0;
  right: 0;
  opacity: 0.7;
  left: 0;
  background-image: url("assets/bayer.png");
  background-size: 0.5em;
  -webkit-filter: contrast(0.45);
  filter: contrast(0.45);
  background-attachment: fixed;
  text-align: center;
  mix-blend-mode: color-dodge;
  -ms-interpolation-mode: nearest-neighbor;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-pixelated;
  image-rendering: pixelated;
}

.fx-grain {
  z-index: 2;
  pointer-events: none;
  position: fixed;
  height: 1000%;
  width: 1000%;
  bottom: 0;
  top: 0;
  right: 0;
  left: 0;
  background: url("assets/grain.gif");
  background-attachment: fixed;
  text-align: center;
  opacity: 0.025;
  mix-blend-mode: overlay;
  -ms-interpolation-mode: nearest-neighbor !important;
  image-rendering: -webkit-optimize-contrast !important;
  image-rendering: -moz-crisp-edges !important;
  image-rendering: -o-pixelated !important;
  image-rendering: pixelated !important;
}

.fx-matrix3 {
  z-index: 5;
  pointer-events: none;
  position: fixed;
  height: 1000%;
  width: 1000%;
  bottom: 0;
  top: 0;
  right: 0;
  opacity: 1;
  left: 0;
  -webkit-filter: grayscale();
  filter: grayscale();
  background-image: url("assets/bayer.png");
  -ms-interpolation-mode: nearest-neighbor;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-pixelated;
  image-rendering: pixelated;
  background-attachment: fixed;
  mix-blend-mode: color-dodge;
  text-align: center;
}

.fx-matrix4 {
  z-index: 99;
  pointer-events: none;
  position: fixed;
  height: 1000%;
  width: 1000%;
  bottom: 0;
  top: 0;
  right: 0;
  left: 0;
  background-image: url("assets/pixelscreen.jpg");
  -ms-interpolation-mode: nearest-neighbor;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-pixelated;
  image-rendering: pixelated;
  mix-blend-mode: color-dodge;
  text-align: center;
  mix-blend-mode: hue;
  display: none;
}

/* Kodex has empty .matrix5 in DOM; unused */
.fx-matrix5 {
  display: none;
  pointer-events: none;
}

#trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.brand-title {
  position: fixed;
  top: calc(50% - min(38vh, 320px));
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  margin: 0;
  font-family: "Bilbo", serif;
  font-size: clamp(2.4rem, 7vw, 3.5rem);
  font-weight: normal;
  font-style: italic;
  letter-spacing: 0.06em;
  color: #fff;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 0 36px rgba(255, 255, 255, 0.32), 0 2px 18px rgba(0, 0, 0, 0.75);
}

body.profile-active .brand-title {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.scene {
  position: relative;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* —— Kodex vortex cards —— */
.vortex-container {
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 500px;
  perspective: 1000px;
  z-index: 5;
  pointer-events: none;
  cursor: grab;
  transition: opacity 0.4s ease;
}

.vortex-container.is-dragging {
  cursor: grabbing;
}

.vortex-scene {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  pointer-events: auto;
}

.vortex-group {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.vortex-card {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -90px;
  margin-top: -140px;
  width: 180px;
  height: 280px;
  transform-style: preserve-3d;
  cursor: pointer;
  will-change: transform, opacity;
}

.card-face {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(18, 18, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 0;
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 22px rgba(255, 255, 255, 0.06),
    0 12px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
}

.card-face::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/bayer.png") repeat;
  background-size: 48px 48px;
  mix-blend-mode: color-dodge;
  opacity: 0.28;
  pointer-events: none;
  z-index: 2;
}

.vortex-card:hover .card-face {
  background: rgba(36, 36, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18) inset,
    0 0 42px rgba(255, 255, 255, 0.28),
    0 14px 48px rgba(255, 255, 255, 0.14);
}

.card-image {
  -webkit-user-drag: none;
  user-select: none;
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  filter: grayscale(0.45) contrast(1.2);
  transition: filter 0.3s ease, opacity 0.35s ease, transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.vortex-card:hover .card-image {
  filter: grayscale(0) contrast(1.08) brightness(1.05);
}

.card-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font: 700 16px/1 system-ui, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: visible;
}

.vortex-card:hover .card-label {
  background: rgba(255, 255, 255, 0.98);
  color: #000;
}

.vortex-card::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.18) 0%, transparent 68%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.vortex-card:hover::after {
  opacity: 1;
}

.vortex-card.is-selected .card-face {
  opacity: 0;
  transform: scale(1.05) translateY(-80px);
  transition:
    opacity 0.35s ease 0.1s,
    transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}

body.profile-active .vortex-container {
  pointer-events: none;
}

body.profile-active .vortex-card:not(.is-selected) {
  opacity: 0.2 !important;
  filter: blur(2px);
}

.lyrics-display {
  position: fixed;
  top: calc(55% + 220px);
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  text-align: center;
  padding: 0 clamp(1rem, 4vw, 2rem);
  width: min(92vw, 560px);
}

.lyrics-display.is-empty {
  opacity: 0;
}

.lyrics-line {
  max-width: min(52vw, 520px);
  margin: 0;
  padding: 0;
  font: italic 500 1.85rem/1.38 Georgia, "Times New Roman", serif;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.88);
  text-shadow:
    0 0 18px rgba(255, 255, 255, 0.28),
    0 0 36px rgba(255, 255, 255, 0.12),
    0 2px 14px rgba(0, 0, 0, 0.85);
  opacity: 1;
}

.lyrics-line.is-typing::after {
  content: "|";
  display: inline-block;
  margin-left: 0.04em;
  font-weight: 300;
  font-style: normal;
  color: rgba(255, 255, 255, 0.55);
  animation: lyrics-cursor 0.75s step-end infinite;
}

@keyframes lyrics-cursor {
  50% {
    opacity: 0;
  }
}

body.profile-active .lyrics-display {
  opacity: 0.35;
  transition: opacity 0.35s ease;
}

.player {
  --p-bg: rgba(0, 0, 0, 0.88);
  --p-border: rgba(255, 255, 255, 0.28);
  --p-shadow-inset: rgba(255, 255, 255, 0.03);
  --p-shadow-glow: rgba(255, 255, 255, 0.04);
  --p-title: rgba(255, 255, 255, 0.95);
  --p-artist: rgba(255, 255, 255, 0.55);
  --p-muted: #555;
  --p-time: rgba(255, 255, 255, 0.38);
  --p-btn-color: rgba(255, 255, 255, 0.88);
  --p-btn-border: rgba(255, 255, 255, 0.28);
  --p-btn-bg: rgba(0, 0, 0, 0.9);
  --p-btn-inset: rgba(255, 255, 255, 0.02);
  --p-btn-border-hover: #fff;
  --p-btn-bg-hover: rgba(255, 255, 255, 0.95);
  --p-btn-color-hover: #000;
  --p-btn-glow: rgba(255, 255, 255, 0.08);
  --p-btn-inset-hover: rgba(255, 255, 255, 0.04);
  --p-main-bg: rgba(0, 0, 0, 0.9);
  --p-main-border: rgba(255, 255, 255, 0.35);
  --p-main-bg-hover: rgba(255, 255, 255, 0.95);
  --p-main-border-hover: #fff;
  --p-main-glow: rgba(255, 255, 255, 0.1);
  --p-main-inset-hover: rgba(255, 255, 255, 0.04);
  --p-track-bg: #000;
  --p-track-inset: #222;
  --p-fill-start: #fff;
  --p-fill-end: #fff;
  --p-fill-glow: rgba(255, 255, 255, 0.2);
  --p-fill-seek: #fff;
  --p-fill-seek-glow: rgba(255, 255, 255, 0.3);
  --p-focus: rgba(255, 255, 255, 0.35);
  --p-cover-border: rgba(255, 255, 255, 0.28);
  --p-cover-glow: rgba(255, 255, 255, 0.06);

  position: fixed;
  top: 1rem;
  right: 1rem;
  left: auto;
  bottom: auto;
  z-index: 6;
  width: min(42vw, 360px);
  padding: 0.85rem 0.95rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  background: var(--p-bg);
  border: 1px dotted var(--p-border);
  border-radius: 0;
  outline: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 0 0 1px var(--p-shadow-inset) inset,
    0 10px 40px rgba(0, 0, 0, 0.55),
    0 0 40px var(--p-shadow-glow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  touch-action: manipulation;
  transition: opacity 0.35s ease;
}

.player::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/bayer.png") repeat;
  background-size: 48px 48px;
  mix-blend-mode: color-dodge;
  opacity: 0.18;
  pointer-events: none;
}

.player-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.625rem 1.25rem;
}

.track-info {
  grid-column: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.track-cover {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0;
  object-fit: cover;
  border: 1px solid var(--p-cover-border);
  box-shadow: 0 0 12px var(--p-cover-glow);
  filter: none;
  transition:
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

.track-cover[hidden] {
  display: none;
}

.track-meta {
  min-width: 0;
  flex: 1;
}

.track-title {
  font: italic 600 0.8125rem/1.35 system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: var(--p-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.45s ease;
}

.track-artist {
  margin-top: 0.125rem;
  font: italic 400 0.6875rem/1.35 system-ui, sans-serif;
  color: var(--p-artist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.45s ease;
}

.track-index {
  margin-top: 0.375rem;
  font: italic 700 0.6rem/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--p-muted);
  transition: color 0.45s ease;
}

.player-controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 0.625rem;
}

.volume-controls {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0.375rem;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  border: 1px dotted var(--p-btn-border);
  border-radius: 0;
  background: var(--p-btn-bg);
  box-shadow: 0 0 0 1px var(--p-btn-inset) inset;
  color: var(--p-btn-color);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    border-style 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.control-btn:hover:not(:disabled) {
  background: var(--p-btn-bg-hover);
  border-style: solid;
  border-color: var(--p-btn-border-hover);
  color: var(--p-btn-color-hover);
  box-shadow:
    0 0 0 1px var(--p-btn-inset-hover) inset,
    0 0 16px var(--p-btn-glow);
}

.control-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.control-btn-main {
  width: 2.625rem;
  height: 2.625rem;
  font-size: 0.8125rem;
  background: var(--p-main-bg);
  border-color: var(--p-main-border);
  color: var(--p-btn-color-hover);
}

.control-btn-main:hover:not(:disabled) {
  background: var(--p-main-bg-hover);
  border-color: var(--p-main-border-hover);
  box-shadow:
    0 0 0 1px var(--p-main-inset-hover) inset,
    0 0 20px var(--p-main-glow);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding-top: 0.125rem;
}

.time-label {
  flex-shrink: 0;
  width: 2.25rem;
  font: 500 0.625rem/1 ui-monospace, "Cascadia Code", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--p-time);
  text-align: center;
  transition: color 0.45s ease;
}

.time-label:last-child {
  text-align: center;
}

.progress-elastic-host {
  flex: 1;
  min-width: 0;
}

.progress-elastic-host .elastic-slider__fill {
  transition:
    width 0.05s linear,
    background 0.45s ease,
    box-shadow 0.45s ease;
}

.progress-elastic-host .elastic-slider__track-area.is-dragging .elastic-slider__fill {
  background: var(--p-fill-seek);
  box-shadow: 0 0 12px var(--p-fill-seek-glow);
  transition:
    background 0.45s ease,
    box-shadow 0.45s ease;
}

.volume-elastic-host {
  flex-shrink: 0;
  width: 7.5rem;
}

.elastic-slider {
  width: 100%;
}

.elastic-slider__row {
  display: flex;
  align-items: center;
  width: 100%;
  touch-action: none;
  user-select: none;
  transform-origin: center center;
  will-change: transform, opacity;
}

.elastic-slider__track-area {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0;
  cursor: grab;
  touch-action: none;
}

.elastic-slider__track-area.is-dragging {
  cursor: grabbing;
}

.elastic-slider__track-area:focus-visible {
  outline: 1px solid var(--p-focus);
  outline-offset: 3px;
  border-radius: 0;
}

.elastic-slider__track-wrap {
  flex: 1;
  display: flex;
  will-change: transform;
}

.elastic-slider__track {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 0;
  background: var(--p-track-bg);
  outline: 1px solid var(--p-track-inset);
  box-shadow: none;
  overflow: hidden;
  transition:
    background 0.45s ease,
    outline-color 0.45s ease;
}

.elastic-slider__fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  border-radius: 0;
  background: linear-gradient(
    90deg,
    var(--p-fill-start) 0%,
    var(--p-fill-end) 100%
  );
  box-shadow: 0 0 6px var(--p-fill-glow);
  pointer-events: none;
  transition:
    background 0.45s ease,
    box-shadow 0.45s ease;
}

@media (max-width: 900px) {
  .vortex-container {
    height: 400px;
  }

  .vortex-card {
    width: 140px;
    height: 220px;
    margin-left: -70px;
    margin-top: -110px;
  }

  .card-image {
    height: 155px;
  }

  .card-label {
    font-size: 12px;
    letter-spacing: 2px;
  }

  .lyrics-display {
    top: calc(50% + 190px);
  }
}

@media (max-width: 600px) {
  .brand-title {
    top: calc(50% - min(34vh, 240px));
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }

  .player {
    top: 0.75rem;
    right: 0.75rem;
    width: min(78vw, 280px);
    padding: 0.65rem 0.7rem 0.55rem;
    gap: 0.45rem;
  }

  .player .track-cover {
    width: 2.25rem;
    height: 2.25rem;
  }

  .player .control-btn {
    width: 1.875rem;
    height: 1.875rem;
    font-size: 0.65rem;
  }

  .player .control-btn-main {
    width: 2.25rem;
    height: 2.25rem;
  }

  .player .track-title {
    font-size: 0.7rem;
  }

  .player .track-artist,
  .player .track-index,
  .player .time-label {
    font-size: 0.6rem;
  }

  .vortex-container {
    height: 350px;
  }

  .vortex-card {
    width: 140px;
    height: 190px;
    margin-left: -70px;
    margin-top: -95px;
  }

  .card-image {
    height: 130px;
  }

  .card-label {
    font-size: 11px;
    letter-spacing: 0;
  }

  .lyrics-display {
    top: calc(50% + 170px);
    width: min(88vw, 340px);
    padding: 0 0.5rem;
  }

  .lyrics-line {
    max-width: min(88vw, 340px);
    font-size: 1.35rem;
    line-height: 1.42;
  }

  .player-top {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.625rem;
  }

  .track-info {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .player-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .volume-controls {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: center;
  }

  .volume-elastic-host {
    width: 5.5rem;
  }
}

/* Profile overlay — dark monochrome horizontal layout */
.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  pointer-events: none;
}

.profile-overlay.is-visible {
  pointer-events: auto;
}

.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.profile-overlay.is-visible .profile-backdrop {
  opacity: 1;
}

.profile-stage {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  width: min(94vw, 780px);
  max-width: min(94vw, 780px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.profile-overlay.is-visible .profile-stage {
  opacity: 1;
}

.profile-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  z-index: 2;
  width: auto;
  min-width: 2rem;
  height: auto;
  padding: 4px 10px;
  border: 1px dotted rgba(255, 255, 255, 0.3);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  font: italic 400 0.85rem/1 system-ui, sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, border-style 0.3s ease;
}

.profile-close:hover {
  background: rgba(255, 255, 255, 0.95);
  border-style: solid;
  border-color: #fff;
  color: #000;
}

.profile-avatar-slot {
  flex-shrink: 0;
  z-index: 1;
  padding-right: 1rem;
  display: flex;
  align-items: center;
}

.profile-avatar {
  -webkit-user-drag: none;
  user-select: none;
  width: 190px;
  height: 190px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  outline: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
  background: rgba(0, 0, 0, 0.85);
  filter: grayscale(0.2) contrast(1.08);
  box-shadow:
    0 0 28px rgba(255, 255, 255, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.7);
  transform:
    translate(
      calc(var(--fly-dx, 0px)),
      calc(var(--fly-dy, 80px))
    )
    scale(var(--fly-scale, 0.55));
  opacity: 0;
  transition:
    transform 0.55s cubic-bezier(0.34, 1.2, 0.64, 1),
    opacity 0.35s ease;
}

.profile-overlay.is-visible .profile-avatar {
  transform: translate(0, 0) scale(1);
  opacity: 1;
}

.profile-panel {
  position: relative;
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 360px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  overflow: visible;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: translateX(24px);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1) 0.12s,
    opacity 0.4s ease 0.12s;
}

.profile-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/bayer.png") repeat;
  background-size: 48px 48px;
  mix-blend-mode: color-dodge;
  opacity: 0.26;
  pointer-events: none;
  z-index: 2;
}

.profile-panel.border-glow {
  position: relative;
  display: grid;
  isolation: isolate;
}

.border-glow__content {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
}

.border-glow__mesh-border,
.border-glow__mesh-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
  z-index: 0;
}

.border-glow__mesh-fill {
  mix-blend-mode: soft-light;
  mask-composite: subtract, add, add, add, add, add;
  -webkit-mask-composite: source-out, source-over, source-over, source-over, source-over, source-over;
}

.border-glow__glow-outer {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
  mix-blend-mode: plus-lighter;
}

.border-glow__glow-inner {
  position: absolute;
  border-radius: inherit;
}

.profile-overlay.is-visible .profile-panel {
  transform: translateX(0);
  opacity: 1;
}

.profile-banner {
  width: 100%;
  height: 280px;
  min-height: 280px;
  flex-shrink: 0;
  background-color: #050505;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  filter: grayscale(0.15) contrast(1.05);
}

.profile-banner--image {
  background-color: #050505;
}

.profile-info {
  position: relative;
  z-index: 1;
  padding: 1.125rem 1.375rem 1.375rem;
  background: rgba(0, 0, 0, 0.72);
}

.profile-name {
  font-family: "Bilbo", serif;
  font-size: clamp(1.6rem, 3.5vw, 2rem);
  font-weight: normal;
  line-height: 1.2;
  color: #fff;
  letter-spacing: 0.04em;
}

.profile-divider {
  height: 1px;
  margin: 0.75rem 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.1) 55%,
    transparent 100%
  );
}

.profile-bio {
  font: italic 400 0.875rem/1.65 system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.72);
  white-space: pre-line;
}

@media (max-width: 520px) {
  .profile-stage {
    flex-direction: column;
    align-items: center;
    width: min(92vw, 380px);
    max-width: min(92vw, 380px);
    gap: 0.75rem;
  }

  .profile-avatar-slot {
    padding-right: 0;
  }

  .profile-avatar {
    width: 120px;
    height: 120px;
  }

  .profile-panel {
    width: 100%;
    min-height: auto;
    transform: translateY(16px);
  }

  .profile-banner {
    height: 200px;
    min-height: 200px;
  }

  .profile-overlay.is-visible .profile-panel {
    transform: translateY(0);
  }

  .profile-close {
    top: -0.75rem;
    right: 0;
  }
}
