.page-skills {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.skills-app {
  position: fixed;
  inset: 0;
}

.canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0b0b0d;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.canvas.is-grabbing,
.canvas.is-grabbing .tile { cursor: grabbing; }

.canvas:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: -2px;
}

.canvas__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, rgba(255, 255, 255, .14) 1px, transparent 1.5px);
  pointer-events: none;
}

.canvas__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 95% at 50% 50%, transparent 55%, rgba(0, 0, 0, .55));
  pointer-events: none;
}

.world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* ---------- Tiles ---------- */

.tile {
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  contain: layout style;
}

.tile__label {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  color: var(--subtle);
  pointer-events: none;
  transition: color .25s;
}

.tile__frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .9);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}

.tile__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.tile .ph__title {
  position: absolute;
  inset: auto 14px 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
}

.tile:hover .tile__label { color: var(--text); }
.tile:hover .tile__frame { transform: translateY(-4px); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .95); }

.tile__handles { display: none; }

.tile.is-selected .tile__label { color: var(--neon); }

.tile.is-selected .tile__frame {
  outline: 1px solid var(--neon);
  outline-offset: 5px;
  transform: none;
}

.tile.is-selected .tile__handles {
  display: block;
  position: absolute;
  inset: -9px;
  pointer-events: none;
}

.tile__handles i {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #0b0b0d;
  border: 1px solid var(--neon);
}

.tile__handles i:nth-child(1) { top: 0; left: 0; }
.tile__handles i:nth-child(2) { top: 0; right: 0; }
.tile__handles i:nth-child(3) { bottom: 0; left: 0; }
.tile__handles i:nth-child(4) { bottom: 0; right: 0; }

/* ---------- Annotation ---------- */

.annotation {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.annotation[hidden] { display: none; }

.annotation__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  overflow: visible;
}

.annotation__line {
  fill: none;
  stroke: var(--neon);
  stroke-width: 1.25;
}

.annotation__dot,
.annotation__end { fill: var(--neon); }

.annotation__ring {
  fill: none;
  stroke: var(--neon);
  stroke-opacity: .45;
  transform-box: fill-box;
  transform-origin: center;
  animation: ring-pulse 1.8s ease-out infinite;
}

@keyframes ring-pulse {
  from { transform: scale(.5); opacity: 1; }
  to { transform: scale(1.6); opacity: 0; }
}

.annotation.is-drawing .annotation__line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: line-draw .45s var(--ease) forwards;
}

.annotation.is-drawing .annotation__end { animation: fade-in .2s .4s both; }

@keyframes line-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } }

.anno-card {
  position: absolute;
  top: 0;
  left: 0;
  width: min(330px, calc(100vw - 32px));
  pointer-events: auto;
  background: #141418;
  border: 1px solid var(--line-strong);
  box-shadow: 0 32px 64px -24px rgba(0, 0, 0, .9);
}

.anno-card:focus { outline: none; }
.anno-card:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; }

.annotation.is-drawing .anno-card { animation: card-in .35s .28s var(--ease) both; }

@keyframes card-in {
  from { opacity: 0; translate: 0 8px; }
}

.anno-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 6px 6px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.anno-card__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.anno-card__close:hover { color: var(--neon); border-color: var(--line-strong); }

.anno-card__body { padding: 18px 16px 20px; }

.anno-card__body h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.anno-card__body p {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.anno-card__meta {
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--subtle);
}

/* ---------- Software UI ---------- */

.ui {
  position: absolute;
  z-index: 10;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.ui-panel {
  background: rgba(17, 17, 21, .88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .8);
}

.toolbar {
  left: 50%;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  transform: translateX(-50%);
}

.toolbar:focus { outline: none; }

.tool-ico,
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 7px;
}

.tool-ico {
  background: rgba(255, 255, 255, .08);
  color: var(--text);
}

.tool-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}

.tool-btn:hover { color: var(--neon); background: rgba(255, 255, 255, .05); }
.tool-btn[aria-expanded="true"] { color: var(--text); background: rgba(255, 255, 255, .08); }

.toolbar__sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--line-strong);
}

.zoom-value {
  min-width: 54px;
  text-align: center;
  color: var(--text);
}

.coords {
  left: 20px;
  bottom: 20px;
  display: flex;
  gap: 16px;
  padding: 10px 14px;
}

.coords b {
  display: inline-block;
  min-width: 5ch;
  font-weight: 500;
  color: var(--text);
}

.hint {
  top: calc(var(--nav-h) + 16px);
  right: 20px;
  padding: 10px 14px;
  transition: opacity .6s var(--ease);
}

.hint.is-hidden { opacity: 0; }
.hint__key { color: var(--text); }
.hint__sep { margin: 0 4px; }

.layers {
  top: calc(var(--nav-h) + 16px);
  left: 20px;
  width: 248px;
  max-height: calc(100% - var(--nav-h) - 110px);
  display: flex;
  flex-direction: column;
}

.layers__head { border-bottom: 1px solid var(--line); }
.layers.is-collapsed .layers__head { border-bottom-color: transparent; }

.layers__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px 11px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.layers__toggle:hover .layers__title,
.layers__toggle:hover .layers__chevron { color: var(--neon); }

.layers__toggle:focus-visible { outline: 2px solid var(--neon); outline-offset: -2px; border-radius: inherit; }

.layers__chevron {
  flex: none;
  color: var(--subtle);
  transition: transform .25s var(--ease), color .2s;
}

.layers.is-collapsed .layers__chevron { transform: rotate(-90deg); }

.layers__title {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
  transition: color .2s;
}

.layers__list[hidden] { display: none; }

.layers__list {
  overflow: auto;
  padding: 6px;
  scrollbar-width: thin;
}

.layer-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.layer-btn svg { flex: none; opacity: .7; }
.layer-btn:hover { background: rgba(255, 255, 255, .05); color: var(--neon); }
.layer-btn[aria-current="true"] { background: rgba(255, 255, 255, .08); color: var(--text); }
.layer-btn[aria-current="true"] svg { color: var(--neon); opacity: 1; }

.layer-btn__num {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--subtle);
}

@media (max-width: 760px) {
  .hint, .coords { display: none; }
  .toolbar { bottom: 12px; }
  .tool-btn__text { display: none; }
  .layers {
    top: calc(var(--nav-h) + 12px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 45vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .annotation__ring { animation: none; opacity: .5; }
}
