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

body {
  background: #05070d;
  color-scheme: dark;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#canvas-container {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
}

/* ── Tooltip ── */
#tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 50;
}

#tooltip.visible {
  opacity: 1;
}

/* ── Credits / attribution ── */
#credits {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 94vw;
  text-align: center;
  font-size: 10px;
  line-height: 1.35;
  color: #9aa7c7;
  opacity: 0.85;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  z-index: 10;
  pointer-events: none;
}
#credits a { color: inherit; text-decoration: underline; pointer-events: auto; }
#credits a:hover { color: #cdd6ee; }

/* ── Name plate ── */
#nameplate {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

#nameplate h1 {
  font-size: 22px;
  font-weight: 700;
  color: #f2f5fb;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
  letter-spacing: -0.02em;
}

#nameplate p {
  font-size: 13px;
  color: #9aa7c7;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
  margin-top: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Hint bar ── */
#hint {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #8e9bbb;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
}

/* ── Card overlay ── */
#card-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 40px;
}

#card-overlay.active {
  pointer-events: all;
}

#card-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.35s ease;
}

#card-overlay.active #card-backdrop {
  background: rgba(2, 4, 10, 0.4);
}

.cv-card {
  position: relative;
  background: #111a2e;
  border-radius: 24px;
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(150, 170, 220, 0.14);
  padding: 32px;
  transform: translateX(460px);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: #2a3556 transparent;
}

.cv-card::-webkit-scrollbar { width: 4px; }
.cv-card::-webkit-scrollbar-thumb { background: #2a3556; border-radius: 4px; }

.cv-card.open {
  transform: translateX(0);
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-header-text h2 {
  font-size: 20px;
  font-weight: 700;
  color: #f2f5fb;
  line-height: 1.2;
}

.card-header-text p {
  font-size: 12px;
  color: #6f7c9d;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #1f2a47;
  color: #8391b3;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.card-close:hover {
  background: #2a3556;
  color: #fff;
}

/* ── About card ── */
.about-bio {
  font-size: 15px;
  color: #c3cde3;
  line-height: 1.7;
  margin-bottom: 24px;
}

.about-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #b4bfd8;
}

.about-detail .di { font-size: 16px; }

/* ── Skills card ── */
.skill-category {
  margin-bottom: 22px;
}

.skill-category-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6f7c9d;
  margin-bottom: 12px;
}

.skill-item {
  margin-bottom: 12px;
}

.skill-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #dfe6f5;
  font-weight: 500;
  margin-bottom: 5px;
}

.skill-pct { color: #6f7c9d; font-size: 12px; }

.skill-bar-bg {
  height: 6px;
  background: #232e4a;
  border-radius: 6px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  border-radius: 6px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Experience card ── */
.job {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid #232e4a;
  position: relative;
}

.job:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.job-company {
  font-size: 16px;
  font-weight: 700;
  color: #f2f5fb;
}

.job-role {
  font-size: 13px;
  color: #93a0c0;
  margin-top: 2px;
}

.job-period {
  font-size: 11px;
  color: #6f7c9d;
  margin: 6px 0 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.job-desc {
  font-size: 13.5px;
  color: #b4bfd8;
  line-height: 1.65;
  margin-bottom: 10px;
}

.job-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

/* ── Education card ── */
.degree {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #232e4a;
}

.degree:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.degree-institution {
  font-size: 16px;
  font-weight: 700;
  color: #f2f5fb;
}

.degree-name {
  font-size: 13px;
  color: #93a0c0;
  margin-top: 3px;
}

.degree-period {
  font-size: 11px;
  color: #6f7c9d;
  margin: 6px 0 8px;
  font-weight: 600;
}

.degree-gpa {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.degree-notes {
  font-size: 13px;
  color: #93a0c0;
  line-height: 1.6;
}

/* ── Projects card ── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.project-item {
  background: #18223a;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #232e4a;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.project-item:hover {
  border-color: #3a4770;
  transform: translateY(-2px);
}

.project-emoji { font-size: 24px; margin-bottom: 8px; }

.works-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8391b3;
  margin-bottom: 12px;
}

.project-name {
  font-size: 13px;
  font-weight: 700;
  color: #f2f5fb;
  margin-bottom: 6px;
}

.project-desc {
  font-size: 11.5px;
  color: #93a0c0;
  line-height: 1.5;
  margin-bottom: 10px;
}

.project-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.project-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: #2a3556;
  color: #93a0c0;
}

/* ── Contact card ── */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #18223a;
  border-radius: 14px;
  border: 1px solid #232e4a;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.contact-link:hover {
  background: #1f2a47;
  border-color: #34406a;
}

.contact-link-icon { font-size: 20px; }

.contact-link-label {
  font-size: 11px;
  color: #6f7c9d;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.contact-link-value {
  font-size: 13.5px;
  color: #dfe6f5;
  font-weight: 500;
  margin-top: 1px;
}

/* ── Red-eye scan HUD (head click) ── */
#hud {
  position: fixed; inset: 0; display: none; opacity: 0;
  pointer-events: none; z-index: 20;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(120,0,0,0.55) 100%);
}
#hud .hud-scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255,40,30,0.05) 0 1px, transparent 1px 4px);
}
#hud pre {
  position: absolute; top: 9vh; margin: 0;
  font: 600 13px/1.7 ui-monospace, 'SF Mono', Menlo, monospace;
  color: #ff4a3d; letter-spacing: 0.06em; text-shadow: 0 0 8px rgba(255,40,30,0.8);
  white-space: pre;
}
#hud-l { left: 4vw; }
#hud-r { right: 4vw; text-align: right; }
@media (max-width: 760px) { #hud pre { font-size: 10px; } #hud-r { top: auto; bottom: 14vh; } }

/* ── In-scene data view: close button + hint ── */
#scene-close, #scene-hint { opacity: 0; pointer-events: none; transition: opacity 0.4s ease; position: fixed; z-index: 30; }
#scene-close.show, #scene-hint.show { opacity: 1; }
#scene-close.show { pointer-events: auto; }
#scene-close {
  top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.35); background: rgba(10,10,14,0.7); color: #fff; font-size: 16px;
}
#scene-close:hover { background: rgba(10,10,14,0.9); }
#scene-hint {
  left: 50%; bottom: 22px; transform: translateX(-50%); padding: 6px 14px; border-radius: 20px;
  background: rgba(10,10,14,0.7); color: #fff; font-size: 12px; letter-spacing: 0.06em; white-space: nowrap;
}

/* ── CV additions: bullets, links, certificates ── */
.job-bullets {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 13px;
  color: #b4bfd8;
  line-height: 1.6;
}
.job-bullets li { margin-bottom: 3px; }

.job-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
}
.job-link {
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.job-link:hover { text-decoration: underline; }

.cert {
  padding: 10px 0;
  border-bottom: 1px solid #232e4a;
}
.cert:last-child { border-bottom: none; }
.cert-name { font-size: 13.5px; font-weight: 600; color: #e4e9f5; }
.cert-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #8391b3;
  margin-top: 2px;
}

/* ── App icons from the CV ── */
.app-icon { display: block; object-fit: cover; flex-shrink: 0; }
.app-icon-lg { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.app-icon-sm { width: 18px; height: 18px; border-radius: 5px; }
.project-emoji { margin-bottom: 10px; }
.job-link { display: inline-flex; align-items: center; gap: 6px; }

/* ── Loading screen ── */
#loading {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 42%, #14203a 0%, #0a1020 55%, #04060c 100%);
  opacity: 1; transition: opacity 1.8s ease; color: #dfe6f5;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading .ld-inner { text-align: center; width: min(320px, 78vw); }
#loading .ld-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: #f2f5fb; }
#loading .ld-sub { margin-top: 6px; font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; color: #7f8db0; }
#loading .ld-bar { margin: 34px auto 0; height: 2px; width: 100%; background: rgba(160, 180, 220, 0.16); border-radius: 2px; overflow: hidden; }
#loading .ld-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #6f86b8, #cfe0ff); border-radius: 2px; transition: width 0.35s ease; }
#loading .ld-pct { margin-top: 14px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #6b7899; font-variant-numeric: tabular-nums; }
#loading .ld-note { margin-top: 10px; font-size: 10px; letter-spacing: 0.04em; color: #5a6788; line-height: 1.45; }


/* ── Mobile / narrow screens ── */
html, body { height: 100%; touch-action: manipulation; }
#canvas-container, #canvas-container canvas { touch-action: none; }

@media (max-width: 720px) {
  #hint {
    top: max(12px, env(safe-area-inset-top));
    font-size: 10px;
    letter-spacing: 0.04em;
    max-width: 92vw;
    text-align: center;
    line-height: 1.35;
  }
  #nameplate {
    bottom: calc(52px + env(safe-area-inset-bottom));
  }
  #nameplate h1 { font-size: 18px; }
  #nameplate p { font-size: 11px; }
  #credits {
    bottom: max(4px, env(safe-area-inset-bottom));
    font-size: 8px;
    max-width: 96vw;
    line-height: 1.3;
  }
  #card-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }
  .cv-card {
    width: 100%;
    max-width: 100%;
    max-height: min(82vh, 720px);
    border-radius: 20px 20px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    transform: translateY(110%);
  }
  .cv-card.open { transform: translateY(0); }
  .projects-grid { grid-template-columns: 1fr; }
  #scene-hint {
    bottom: calc(14px + env(safe-area-inset-bottom));
    font-size: 11px;
    max-width: 90vw;
    white-space: normal;
    text-align: center;
  }
  #scene-close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
  #loading .ld-title { font-size: 22px; }
  #loading .ld-note { max-width: 86vw; margin-left: auto; margin-right: auto; }
}
