:root {
  --bg: radial-gradient(circle at 50% 50%, #141722 0%, #07080a 100%);
  --stone: #14161a;
  --charcoal: #e1e4ea;
  --black: #ffffff;
  --muted: #888e99;
  --white-glass: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --card-bg: transparent;
  --card-border: transparent;
  --card-shadow: none;
  --widget-bg: rgba(20, 22, 26, 0.75);
  --btn-bg: rgba(20, 22, 26, 0.6);
  --music-bg: rgba(16, 18, 21, 0.5);

  --hover-bg: #ffffff;
  --hover-text: #07080a;
  --hover-border: #ffffff;
  --hover-shadow: 0 12px 32px rgba(255, 255, 255, 0.18);
  --hover-icon-bg: rgba(0, 0, 0, 0.08);
  --hover-icon-color: #07080a;
  --hover-muted: rgba(7, 8, 10, 0.6);

  --record-hole: #07080a;
  --preloader-bg: rgba(7, 8, 10, 0.45);
}

/* LIGHT THEME */
body.theme-light {
  --bg: radial-gradient(circle at 50% 50%, #faf8f5 0%, #eae6df 100%);
  --stone: #eae6de;
  --charcoal: #3e3a37;
  --black: #1f1c1a;
  --muted: #8a837c;
  --white-glass: rgba(255, 255, 255, 0.55);
  --line: rgba(62, 58, 55, 0.06);

  --widget-bg: rgba(244, 240, 234, 0.75);
  --btn-bg: rgba(244, 240, 234, 0.55);
  --music-bg: rgba(244, 240, 234, 0.4);

  --hover-bg: #3e3a37;
  --hover-text: #faf8f5;
  --hover-border: #3e3a37;
  --hover-shadow: 0 12px 30px rgba(62, 58, 55, 0.12);
  --hover-icon-bg: rgba(255, 255, 255, 0.15);
  --hover-icon-color: #faf8f5;
  --hover-muted: rgba(255, 255, 255, 0.6);

  --record-hole: #faf8f5;
  --preloader-bg: rgba(244, 240, 234, 0.45);
}

/* DARK THEME */
body.theme-dark {
  --bg: radial-gradient(circle at 50% 50%, #141722 0%, #07080a 100%);
  --stone: #14161a;
  --charcoal: #e1e4ea;
  --black: #ffffff;
  --muted: #888e99;
  --white-glass: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);

  --widget-bg: rgba(20, 22, 26, 0.75);
  --btn-bg: rgba(20, 22, 26, 0.6);
  --music-bg: rgba(16, 18, 21, 0.5);

  --hover-bg: #ffffff;
  --hover-text: #07080a;
  --hover-border: #ffffff;
  --hover-shadow: 0 12px 32px rgba(255, 255, 255, 0.18);
  --hover-icon-bg: rgba(0, 0, 0, 0.08);
  --hover-icon-color: #07080a;
  --hover-muted: rgba(7, 8, 10, 0.6);

  --record-hole: #07080a;
  --preloader-bg: rgba(7, 8, 10, 0.45);
}

/* CHOCOLATE THEME */
body.theme-chocolate {
  --bg: radial-gradient(circle at 50% 50%, #462f25 0%, #20130e 100%);
  --stone: #38241c;
  --charcoal: #f0ded5;
  --black: #fff3ed;
  --muted: #be9d8d;
  --white-glass: rgba(255, 255, 255, 0.07);
  --line: rgba(242, 231, 226, 0.09);

  --widget-bg: rgba(87, 59, 47, 0.65);
  --btn-bg: rgba(87, 59, 47, 0.45);
  --music-bg: rgba(87, 59, 47, 0.35);

  --hover-bg: #fff5f0;
  --hover-text: #321e16;
  --hover-border: #fff5f0;
  --hover-shadow: 0 12px 30px rgba(255, 245, 240, 0.15);
  --hover-icon-bg: rgba(50, 30, 22, 0.08);
  --hover-icon-color: #321e16;
  --hover-muted: rgba(50, 30, 22, 0.6);

  --record-hole: #20130e;
  --preloader-bg: rgba(32, 19, 14, 0.45);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg) no-repeat fixed; transition: background .4s var(--ease); }
body {
  min-height: 100vh; margin: 0; overflow-x: hidden;
  font-family: 'Plus Jakarta Sans', Inter, system-ui, sans-serif;
  background: var(--bg) no-repeat fixed; color: var(--charcoal);
  transition: background .4s var(--ease), color .4s var(--ease);
}

/* Ambient Dot Grid background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  z-index: 1;
  pointer-events: none;
  transition: background-image 0.4s var(--ease);
}
body.theme-light::before {
  background-image: radial-gradient(rgba(18, 18, 17, 0.09) 1.5px, transparent 1.5px);
}
body.theme-chocolate::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 1.5px);
}

button, a, input { font: inherit; }
a { color: inherit; text-decoration: none; }
#network-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.page-shell { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 34px 16px; }
.app-card {
  width: min(100%, 720px); padding: 22px; border-radius: 24px;
  background: transparent !important;
  border: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: none;
  transform-style: preserve-3d;
  position: relative;
}
.profile-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 16px; margin-top: 8px; }
.avatar-wrap { position: relative; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(18,18,17,.1); padding: 3px; background: rgba(255,255,255,.45); transition: filter .45s var(--ease), transform .45s var(--ease); }
.avatar-wrap.is-playing { animation: avatarPulse 1.45s var(--ease) infinite; }
.avatar { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.online-dot { position: absolute; right: 3px; bottom: 6px; width: 12px; height: 12px; border-radius: 50%; background: #5ac878; border: 2px solid var(--bg); box-shadow: 0 0 0 5px rgba(90,200,120,.16); animation: onlinePulse 1.9s var(--ease) infinite; }
.eyebrow { margin: 0 0 4px; color: var(--muted); text-transform: uppercase; font-size: 9px; letter-spacing: .18em; }
h1 { margin: 0; font-size: 22px; line-height: 1; letter-spacing: -.02em; color: var(--black); }
.meta { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.clock-widget { display: inline-flex; align-items: center; gap: 7px; padding: 10px 11px; border-radius: 999px; background: var(--widget-bg); border: 1px solid var(--line); font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--black); white-space: nowrap; transition: background .4s var(--ease), border-color .4s var(--ease), color .4s var(--ease); }
.middle-split { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; gap: 16px; }
.link-column { display: grid; gap: 10px; }
.link-button { position: relative; min-height: 58px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--btn-bg); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); transition: transform .42s var(--ease), border-color .42s var(--ease), background .42s var(--ease), box-shadow .42s var(--ease); overflow: hidden; }
.link-button:hover { transform: translateY(-3px); border-color: var(--hover-border); background: var(--hover-bg); color: var(--hover-text); box-shadow: var(--hover-shadow); }
.link-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; background: var(--white-glass); color: var(--black); transition: transform .42s var(--ease), background .42s var(--ease), color .42s var(--ease); }
.link-button:hover .link-icon { transform: rotate(-6deg); background: var(--hover-icon-bg); color: var(--hover-icon-color); }
.link-button strong, .link-button small { display: block; }
.link-button strong { font-size: 12px; letter-spacing: -.01em; }
.link-button small { margin-top: 2px; color: var(--muted); font-size: 9.5px; line-height: 1.25; transition: color .42s var(--ease); }
.link-button:hover small { color: var(--hover-muted); }
.arrow { font-size: 11px; color: var(--muted); transition: transform .42s var(--ease), color .42s var(--ease); }
.link-button:hover .arrow { transform: translate(5px, -5px); color: var(--hover-text); }
.code-card { min-height: 100%; display: flex; flex-direction: column; border-radius: 14px; background: rgba(18,18,17,.94); border: 1px solid rgba(255,255,255,.08); overflow: hidden; box-shadow: 0 14px 32px rgba(18,18,17,.12); }
.code-topbar { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-bottom: 1px solid rgba(255,255,255,.07); color: rgba(255,255,255,.58); font-family: 'JetBrains Mono', monospace; font-size: 9px; }
.code-topbar .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.25); }
.code-topbar strong { margin-left: auto; font-weight: 500; }
.code-body { flex: 1; margin: 0; padding: 10px 12px; color: rgba(255,255,255,.82); font: 10px/1.65 'JetBrains Mono', monospace; white-space: pre-wrap; }
.py-comment { color: #89a883; } .py-import { color: #d88a7e; } .py-func { color: #86a8d9; } .py-string { color: #c9a76a; } .py-key { color: #b59fd6; }
.caret { display: inline-block; width: 6px; height: 14px; margin-left: 2px; transform: translateY(2px); background: rgba(255,255,255,.55); animation: blink 1s steps(2) infinite; }
.music-card { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: var(--music-bg); border: 1px solid var(--line); transition: background .4s var(--ease), border-color .4s var(--ease); }
.track-row { display: flex; align-items: center; gap: 12px; }
.vinyl-container { position: relative; border: 0; background: transparent; width: 46px; height: 46px; padding: 0; cursor: pointer; flex: 0 0 auto; overflow: visible; }
.vinyl-disk { display: block; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at center, var(--record-hole) 0 5%, #ba8d65 5% 18%, #3a251c 18% 24%, #2d1b14 24% 31%, #42291e 31% 38%, #1f110c 38% 45%, #2b1811 45% 52%, #351f16 52% 59%, #1f110c 59% 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 10px 22px rgba(18,18,17,.18); transition: background .4s var(--ease); }
.is-playing .vinyl-disk { animation: spinDisc 2.6s linear infinite; }

/* Vinyl Tone Arm Styles */
.vinyl-arm {
  position: absolute;
  top: -2px;
  right: -5px;
  z-index: 10;
  transform-origin: 9px 3px;
  transform: rotate(-35deg);
  transition: transform 0.4s var(--ease);
  pointer-events: none;
}
.is-playing .vinyl-arm {
  transform: rotate(3deg);
}
.vinyl-arm-pivot {
  fill: var(--muted);
  transition: fill .4s var(--ease);
}
.vinyl-arm-rod {
  stroke: var(--charcoal);
  transition: stroke .4s var(--ease);
}
.vinyl-arm-head {
  fill: var(--black);
  transition: fill .4s var(--ease);
}
.play-symbol { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.82); font-size: 10px; pointer-events: none; }
.track-info { min-width: 0; flex: 1; }
.track-label { margin: 0 0 3px; text-transform: uppercase; letter-spacing: .16em; font-size: 8.5px; color: var(--muted); }
.track-info h2 { margin: 0; font-size: 13px; line-height: 1.2; letter-spacing: -.02em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.equalizer { width: 18px; height: 14px; display: inline-flex; align-items: end; gap: 2px; opacity: .35; }
.equalizer span { width: 3px; height: 5px; border-radius: 99px; background: var(--black); transform-origin: bottom; }
.equalizer.active { opacity: 1; } .equalizer.active span { animation: eq 800ms var(--ease) infinite; } .equalizer.active span:nth-child(2){animation-delay:.12s}.equalizer.active span:nth-child(3){animation-delay:.24s}.equalizer.active span:nth-child(4){animation-delay:.36s}
.playlist-toggle, .controls-row button { border: 0; background: transparent; color: var(--black); cursor: pointer; width: 32px; height: 32px; border-radius: 12px; transition: background .35s var(--ease), transform .35s var(--ease); }
.playlist-toggle:hover, .controls-row button:hover { background: rgba(18,18,17,.07); transform: translateY(-1px); }
.progress-area { display: grid; grid-template-columns: 34px 1fr 34px; gap: 10px; align-items: center; margin: 14px 0 10px; color: var(--muted); font: 10px 'JetBrains Mono', monospace; }
.progress-bar { height: 12px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; }
.progress-bar::before { content: ''; width: 100%; height: 3px; border-radius: 999px; background: var(--line); position: absolute; }
.progress-bar { position: relative; }
.progress-bar:hover::before { height: 5px; }
#progressFill { position: relative; z-index: 1; display: block; height: 3px; width: 0%; border-radius: 999px; background: var(--black); transition: width .18s linear, height .3s var(--ease); }
.progress-bar:hover #progressFill { height: 5px; }
.controls-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.controls-row .main-control { background: var(--black); color: #fff; width: 38px; height: 38px; border-radius: 50%; }
.volume-zone { margin-left: auto; display: flex; align-items: center; width: 34px; overflow: hidden; transition: width .45s var(--ease); }
.volume-zone:hover, .volume-zone:focus-within { width: 126px; }
#volumeSlider { width: 78px; accent-color: var(--black); opacity: 0; transform: translateX(-8px); transition: opacity .35s var(--ease), transform .35s var(--ease); }
.volume-zone:hover #volumeSlider, .volume-zone:focus-within #volumeSlider { opacity: 1; transform: translateX(0); }
.playlist-drawer { max-height: 0; overflow: hidden; transition: max-height .5s var(--ease); }
.playlist-drawer.open { max-height: 210px; }
.playlist { max-height: 194px; overflow-y: auto; padding-top: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.playlist::-webkit-scrollbar { width: 3px; } .playlist::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.playlist-item { width: 100%; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 9px; background: transparent; text-align: left; color: var(--charcoal); cursor: pointer; transition: background .3s var(--ease); }
.playlist-item:hover, .playlist-item.active { background: var(--white-glass); }
.playlist-item small { color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.tg-meta { display: flex; justify-content: flex-end; gap: 5px; align-items: center; margin-top: 12px; color: var(--muted); opacity: .6; font-size: 10.5px; font-weight: 400; }
@keyframes spinDisc { to { transform: rotate(360deg); } }
@keyframes eq { 0%,100% { height: 4px; } 45% { height: 14px; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes onlinePulse { 50% { box-shadow: 0 0 0 8px rgba(90,200,120,.06); } }
@keyframes avatarPulse { 50% { filter: drop-shadow(0 0 16px rgba(90,200,120,.35)); transform: scale(1.025); } }
@media (max-width: 720px) { .app-card { padding: 18px; } .profile-header { grid-template-columns: auto 1fr; } .clock-widget { grid-column: 1 / -1; justify-self: start; } .middle-split { grid-template-columns: 1fr; } .code-card { min-height: 214px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Preloader Styles */
.preloader {
  position: fixed;
  inset: 0;
  background: var(--preloader-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}
.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loader-ring {
  width: 42px;
  height: 42px;
  border: 3.5px solid var(--line);
  border-radius: 50%;
  border-top-color: var(--charcoal);
  animation: loaderSpin 0.85s cubic-bezier(0.5, 0.1, 0.15, 1) infinite;
}
.preloader-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
@keyframes loaderSpin {
  100% { transform: rotate(360deg); }
}

/* Theme Switcher Styles */
.theme-switcher {
  position: absolute;
  top: 10px;
  left: 22px;
  display: flex;
  gap: 8px;
  z-index: 100;
  transform: translateZ(20px);
}
.theme-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(18, 18, 17, 0.2);
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.theme-btn:hover {
  transform: scale(1.25);
}
.theme-btn.active {
  border: 2px solid var(--charcoal);
  box-shadow: 0 0 6px rgba(0,0,0,0.15);
}
.theme-btn.theme-light {
  background-color: #faf8f5;
  border-color: rgba(62, 58, 55, 0.25);
}
.theme-btn.theme-dark {
  background-color: #141722;
  border-color: rgba(255, 255, 255, 0.2);
}
.theme-btn.theme-chocolate {
  background-color: #462f25;
  border-color: rgba(240, 222, 213, 0.2);
}
