:root {
  --bg: #0a0f1a;
  --bg1: #0d1220;
  --bg2: #121828;
  --bg3: #1a2035;
  --cyan: #00f5d4;
  --purple: #8b5cf6;
  --pink: #f472b6;
  --amber: #fbbf24;
  --white: #f0f4ff;
  --muted: #6b7aa8;
  --dimmer: #1e2840;
  --card: rgba(16, 20, 38, 0.95);
  --border: rgba(0, 245, 212, 0.2);
  --glow-c: rgba(0, 245, 212, 0.15);
  --glow-p: rgba(139, 92, 246, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
img { max-width: 100%; height: auto; display: block; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Syne', sans-serif;
  background: var(--bg);
  color: var(--white);
  overflow-x: hidden;
  cursor: default;
}
body:active { cursor: default; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

#cur, #cur-r { display: none; }

#c3d { position: fixed; inset: 0; z-index: 0; display: block; }

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: .3; pointer-events: none; z-index: 1;
}

#loader { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem; transition: opacity .7s, visibility .7s; }
#loader.out { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-ring { width: 60px; height: 60px; border: 2px solid var(--border); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; }
.loader-text { font-family: 'JetBrains Mono', monospace; font-size: .7rem; letter-spacing: 4px; color: var(--cyan); text-transform: uppercase; }
.loader-pct { font-family: 'JetBrains Mono', monospace; font-size: 2rem; font-weight: 700; color: var(--white); }

#hint { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 100; text-align: center; opacity: 0; pointer-events: none; transition: opacity .5s; }
#hint.visible { opacity: 1; }
#hint span { display: inline-block; background: var(--card); border: 1px solid var(--border); padding: .8rem 1.5rem; border-radius: 8px; font-family: 'JetBrains Mono', monospace; font-size: .65rem; letter-spacing: 2px; color: var(--muted); backdrop-filter: blur(20px); }
.hint-fade { position: absolute; inset: 0; background: linear-gradient(to right, var(--bg), transparent 30%, transparent 70%, var(--bg)); pointer-events: none; }

#ui-container { position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 50; }
#ui-container > * { pointer-events: auto; }

#panel-content {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 700px);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 200;
  transition: opacity .4s, visibility .4s, transform .4s;
}
#panel-content.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
#panel-content.ui-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.95);
  pointer-events: none;
}

.glass-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 40px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.05);
  transition: opacity .4s, transform .4s;
}
.ui-hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }
.ui-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

#name-badge {
  position: fixed;
  z-index: 100;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .4s;
}
.badge-dot-pulse { display: inline-block; width: 8px; height: 8px; background: #22c55e; border-radius: 50%; margin-right: .6rem; animation: pulse 2s infinite; box-shadow: 0 0 10px #22c55e; }
.badge-sub { display: block; font-size: .7rem; color: var(--muted); font-weight: 400; margin-top: .2rem; font-family: 'JetBrains Mono', monospace; letter-spacing: 2px; }

.panel-label { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--cyan); letter-spacing: 4px; text-transform: uppercase; margin-bottom: .8rem; display: flex; align-items: center; gap: .6rem; }
.panel-label::before { content: ''; display: block; width: 20px; height: 1px; background: var(--cyan); }
.glass-panel h2 { font-family: 'Clash Display', sans-serif; font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-bottom: 1rem; }
.panel-divider { width: 40px; height: 2px; background: linear-gradient(90deg, var(--cyan), var(--purple)); border-radius: 1px; margin-bottom: 1.5rem; }
.glass-panel p { color: var(--muted); line-height: 1.8; font-size: .95rem; }
.glass-panel strong { color: var(--white); font-weight: 500; }
.panel-stats { display: flex; gap: 2rem; margin-top: 1.5rem; }
.pstat { text-align: center; }
.pstat-n { font-family: 'Clash Display', sans-serif; font-size: 1.8rem; font-weight: 700; background: linear-gradient(135deg, var(--cyan), var(--purple)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; display: block; }
.pstat-l { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

.skills-tabs-g { display: flex; gap: .4rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stab-btn { font-family: 'JetBrains Mono', monospace; font-size: .6rem; padding: .5rem 1rem; border-radius: 4px; border: 1px solid var(--dimmer); background: transparent; color: var(--muted); cursor: pointer; letter-spacing: 2px; text-transform: uppercase; transition: all .25s; }
.stab-btn.active, .stab-btn:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(0, 245, 212, .08); }
.skills-detail-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.tech-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.2rem; display: flex; align-items: center; gap: .8rem; transition: all .3s; }
.tech-card:hover { border-color: rgba(0, 245, 212, .4); transform: translateX(4px); }
.tech-icon { font-size: 1.5rem; }
.tech-info .tech-name { font-size: .85rem; font-weight: 500; margin-bottom: .2rem; }
.tech-info .tech-level { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--muted); letter-spacing: 1px; }
.tech-bar-mini { height: 2px; background: var(--dimmer); border-radius: 1px; margin-top: .5rem; overflow: hidden; }
.tech-bar-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--purple)); border-radius: 1px; width: 0; transition: width 1s cubic-bezier(.4,0,.2,1); }

.proj-scroll { max-height: 400px; overflow-y: auto; padding-right: .5rem; }
.proj-card-3d { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; cursor: pointer; transition: all .3s; }
.proj-card-3d:hover { border-color: rgba(139, 92, 246, .4); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.proj-img-3d { height: 140px; position: relative; overflow: hidden; }
.proj-img-bg-3d { position: absolute; inset: 0; transition: transform .5s; }
.proj-card-3d:hover .proj-img-bg-3d { transform: scale(1.05); }
.proj-img-thumb-3d { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.proj-emoji-3d { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 3rem; z-index: 1; }
.proj-body-3d { padding: 1.2rem; }
.proj-tags-3d { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.ptag-3d { font-family: 'JetBrains Mono', monospace; font-size: .55rem; padding: .2rem .5rem; border-radius: 3px; background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .25); color: #a78bfa; letter-spacing: 1px; }
.proj-name-3d { font-family: 'Clash Display', sans-serif; font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.proj-desc-3d { color: var(--muted); font-size: .8rem; line-height: 1.6; }

.contact-tagline { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.contact-links-3d { display: flex; flex-direction: column; gap: .8rem; }
.clink-3d { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .9rem; transition: all .3s; backdrop-filter: blur(10px); }
.clink-3d:hover { border-color: rgba(0, 245, 212, .3); color: var(--cyan); background: rgba(0, 245, 212, .03); }
.clink-icon-3d { font-size: 1.2rem; flex-shrink: 0; }
.clink-text-3d { font-weight: 500; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 26, .85); backdrop-filter: blur(8px); z-index: 1000; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.modal-backdrop.active { opacity: 1; visibility: visible; }
.modal-glass { background: var(--card); border: 1px solid var(--border); border-radius: 16px; max-width: 700px; width: 100%; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 80px rgba(0,0,0,.4); animation: modalSlideUp .3s ease; }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: transparent; border: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; padding: .5rem; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all .2s; z-index: 1; }
.modal-close:hover { background: rgba(139, 92, 246, .15); color: var(--cyan); }
.modal-body { padding: 2rem; overflow-y: auto; }
.modal-header-3d { margin-bottom: 2rem; }
.modal-header-3d h2 { font-family: 'Clash Display', sans-serif; font-size: 1.6rem; font-weight: 700; margin-bottom: .8rem; background: linear-gradient(135deg, var(--cyan), var(--purple)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.modal-header-3d p { color: var(--muted); line-height: 1.8; }
.modal-features-3d h3, .modal-tech-3d h3 { font-family: 'Clash Display', sans-serif; font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--white); }
.modal-features-3d ul { list-style: none; display: flex; flex-direction: column; gap: .8rem; margin-bottom: 2rem; }
.modal-features-3d li { display: flex; gap: .8rem; align-items: flex-start; color: var(--muted); line-height: 1.6; font-size: .9rem; }
.modal-features-3d li::before { content: '✓'; color: var(--cyan); font-weight: bold; flex-shrink: 0; }
.tech-list-3d { display: flex; flex-wrap: wrap; gap: .5rem; }
.tech-chip-3d { font-family: 'JetBrains Mono', monospace; font-size: .65rem; padding: .4rem .8rem; border-radius: 4px; background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .25); color: #a78bfa; letter-spacing: .5px; }

#nav-dots { position: fixed; right: 2rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 1rem; z-index: 100; }
.nav-dot { width: 12px; height: 12px; border: 2px solid var(--border); border-radius: 50%; background: transparent; cursor: pointer; transition: all .3s; position: relative; }
.nav-dot:hover { border-color: var(--cyan); box-shadow: 0 0 15px var(--glow-c); }
.nav-dot.active { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 20px var(--glow-c); }
.nav-dot .dot-label { position: absolute; right: 1.5rem; top: 50%; transform: translateY(-50%); font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--muted); white-space: nowrap; opacity: 0; visibility: hidden; transition: all .3s; pointer-events: none; }
.nav-dot:hover .dot-label { opacity: 1; visibility: visible; right: 2rem; color: var(--white); }

.speech-bubble-3d { position: absolute; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1.2rem; max-width: 280px; box-shadow: 0 8px 40px rgba(0,0,0,.3); backdrop-filter: blur(20px); animation: bubblePop .3s ease; }
.speech-bubble-3d .bubble-content { font-size: .85rem; line-height: 1.6; color: var(--white); }
.speech-bubble-3d .bubble-tail { position: absolute; bottom: -8px; left: 2rem; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid var(--border); }
.speech-bubble-3d .bubble-tail::after { content: ''; position: absolute; bottom: 1px; left: -8px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid var(--card); }

.subtitle-bar-3d { position: fixed; bottom: 3rem; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1.5rem; max-width: 80vw; box-shadow: 0 8px 40px rgba(0,0,0,.3); backdrop-filter: blur(20px); z-index: 200; opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(20px); transition: all .3s; pointer-events: none; }
.subtitle-bar-3d.visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.subtitle-text { font-size: .9rem; color: var(--white); text-align: center; }

.panel-label-3d { pointer-events: none; }
.panel-label-text { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .8rem; font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--cyan); letter-spacing: 3px; text-transform: uppercase; backdrop-filter: blur(10px); }
.panel-hint { display: block; margin-top: .4rem; font-family: 'JetBrains Mono', monospace; font-size: .55rem; color: var(--muted); opacity: 0.7; }

@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 50% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } }
@keyframes bubblePop { from { opacity: 0; transform: scale(0.8) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(30px); filter: blur(8px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }

@media (max-width: 1024px) {
  #nav-dots { right: 1rem; }
  .nav-dot .dot-label { display: none; }
}

@media (max-width: 768px) {
  :root { --bg: #0a0f1a; --bg1: #0d1220; }
  html { scroll-behavior: auto; }
  body { cursor: auto; }
  #cur, #cur-r { display: none; }
  #name-badge { font-size: .85rem; top: 1rem; }
  .glass-panel { padding: 1.2rem 1.5rem; border-radius: 10px; }
  .skills-detail-g { grid-template-columns: 1fr; }
  .proj-scroll { max-height: 300px; }
  #nav-dots { bottom: 1.5rem; top: auto; right: 50%; transform: translateX(50%); flex-direction: row; gap: .8rem; }
  .speech-bubble-3d { max-width: 85vw; font-size: .8rem; }
  .subtitle-bar-3d { max-width: 90vw; padding: .6rem 1rem; font-size: .8rem; bottom: 2rem; }
  .hint-fade { display: none; }
}

@media (max-width: 480px) {
  #name-badge { font-size: .75rem; }
  .badge-sub { font-size: .6rem; }
  .glass-panel { padding: 1rem; }
  .glass-panel h2 { font-size: 1.1rem; }
  .panel-stats { gap: 1.2rem; }
  .pstat-n { font-size: 1.4rem; }
  .stab-btn { font-size: .55rem; padding: .4rem .8rem; }
  .tech-card { padding: .8rem 1rem; }
  .proj-img-3d { height: 120px; }
  .modal-glass { border-radius: 12px; }
  .modal-body { padding: 1.5rem; }
}