/* ---------- Fonty (self-hosted, OFL) ---------- */
@font-face {
  font-family: 'Pixelify Sans';
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/pixelify-sans-latin-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/pixelify-sans-latin-ext-400.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/pixelify-sans-latin-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/pixelify-sans-latin-ext-600.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/pixelify-sans-latin-700.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/pixelify-sans-latin-ext-700.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DotGothic16';
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/dotgothic16-kana.woff2) format('woff2');
}

/* ---------- Tokeny ---------- */
:root {
  color-scheme: dark;
  --bg: #0b0820;
  --ink: #fdf0fb;
  --muted: #cdb8e4;
  --dim: #9c86b8;
  --pink: #ff8fc0;
  --pink-2: #ffc4dc;
  --peach: #ffb58c;
  --gold: #ffd27a;
  --card: rgba(22, 13, 42, 0.6);
  --card-2: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 176, 214, 0.42);
  --px: 3px;
  --font: 'Pixelify Sans', ui-monospace, 'Segoe UI', system-ui, sans-serif;
  --z: 1;
  --jp: 'DotGothic16', 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg) linear-gradient(180deg, #0d0a26 0%, #2c1a52 45%, #9c4078 78%, #1b2a28 78.2%, #0f1817 100%) fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: url('../assets/cursor.png') 1 1, auto;
  /* ochrana proti označování textu při hraní s míčkem / klikání do scény */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

img,
svg,
canvas,
a {
  -webkit-user-drag: none;
}
canvas {
  -webkit-touch-callout: none;
}

body.over-panda {
  cursor: url('../assets/cursor-hand.png') 11 1, pointer;
}

a,
button {
  cursor: url('../assets/cursor-hand.png') 11 1, pointer;
}

/* ---------- Scéna ---------- */
#scene,
#bloom {
  position: fixed;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
}
#scene {
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#bloom {
  z-index: 0;
  mix-blend-mode: screen;
  opacity: 0.9;
}
body.fx-off #bloom {
  display: none;
}

.shade {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 5, 22, 0.62) 0%, rgba(8, 5, 22, 0.32) 28%, rgba(8, 5, 22, 0) 48%),
    radial-gradient(120% 90% at 62% 42%, rgba(0, 0, 0, 0) 55%, rgba(6, 3, 16, 0.55) 100%);
}

/* ---------- Bublina pandy ---------- */
.bubble {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1;
  width: 0;
  height: 0;
  pointer-events: none;
  will-change: transform;
}
.bubble-in {
  position: absolute;
  left: 0;
  bottom: 12px;
  transform: translate(-50%, 8px) scale(0.7);
  transform-origin: 50% 100%;
  opacity: 0;
  white-space: nowrap;
  padding: 8px 13px 9px;
  background: #fff5f9;
  color: #3b1531;
  font-weight: 600;
  font-size: 16px;
  box-shadow:
    0 -3px 0 0 #3b1531,
    0 3px 0 0 #3b1531,
    -3px 0 0 0 #3b1531,
    3px 0 0 0 #3b1531,
    0 10px 24px rgba(0, 0, 0, 0.35);
  transition:
    opacity 0.18s,
    transform 0.24s steps(4);
}
.bubble-in::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 12px;
  height: 9px;
  margin: 3px 0 0 -6px;
  background: #3b1531;
  clip-path: polygon(0 0, 100% 0, 100% 33%, 75% 33%, 75% 66%, 50% 66%, 50% 100%, 25% 100%, 25% 66%, 0 66%);
}
.bubble-in::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 6px;
  height: 3px;
  margin-left: -3px;
  background: #fff5f9;
  z-index: 1;
}
.bubble.show .bubble-in {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- Rozvržení ---------- */
.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, calc(470px * var(--z))) 1fr;
  align-items: center;
  padding: clamp(20px, 4vw, 64px) clamp(16px, 4.5vw, 80px);
  pointer-events: none;
}
.panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  perspective: 900px;
  zoom: var(--z);
}

/* ---------- Karty (pixel rámeček se zkosenými rohy) ---------- */
.card {
  position: relative;
  margin: var(--px);
  background: var(--card);
  -webkit-backdrop-filter: blur(9px) saturate(1.35);
  backdrop-filter: blur(9px) saturate(1.35);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(var(--px) * -1) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line),
    0 24px 60px -18px rgba(3, 0, 12, 0.8);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.25s ease-out;
  animation: rise 0.7s steps(7) both;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 150, 205, 0.16), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover::before {
  opacity: 1;
}
/* rohové pixely */
.card::after {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  --k: var(--pink-2);
  background:
    linear-gradient(var(--k), var(--k)) top left / 3px 3px,
    linear-gradient(var(--k), var(--k)) top right / 3px 3px,
    linear-gradient(var(--k), var(--k)) bottom left / 3px 3px,
    linear-gradient(var(--k), var(--k)) bottom right / 3px 3px;
  background-repeat: no-repeat;
  opacity: 0.55;
}
.links.card {
  animation-delay: 0.12s;
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 18px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* ---------- Profil ---------- */
.profile {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 24px;
}
.avatar-wrap {
  flex: none;
  filter: drop-shadow(0 0 16px rgba(255, 110, 175, 0.55));
}
.avatar {
  --s: 120px;
  position: relative;
  width: var(--s);
  height: var(--s);
  overflow: hidden;
  clip-path: var(--pixel-circle);
  --pixel-circle: polygon(35% 0%, 65% 0%, 65% 5%, 75% 5%, 75% 10%, 85% 10%, 85% 15%, 90% 15%, 90% 25%, 95% 25%, 95% 35%, 100% 35%, 100% 65%, 95% 65%, 95% 75%, 90% 75%, 90% 85%, 85% 85%, 85% 90%, 75% 90%, 75% 95%, 65% 95%, 65% 100%, 35% 100%, 35% 95%, 25% 95%, 25% 90%, 15% 90%, 15% 85%, 10% 85%, 10% 75%, 5% 75%, 5% 65%, 0% 65%, 0% 35%, 5% 35%, 5% 25%, 10% 25%, 10% 15%, 15% 15%, 15% 10%, 25% 10%, 25% 5%, 35% 5%);
}
.avatar::before {
  content: '';
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, #ff8fc0, #ffb58c, #ffe08a, #c79bff, #ff6fae, #ff8fc0);
  animation: spin 6s linear infinite;
}
.avatar img,
.avatar .fallback {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: cover;
  clip-path: var(--pixel-circle);
  background: #2a1840;
}
.avatar .fallback {
  display: none;
  place-items: center;
  font-size: 44px;
  font-weight: 700;
  color: var(--pink-2);
}
.avatar.noimg img {
  display: none;
}
.avatar.noimg .fallback {
  display: grid;
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.who {
  min-width: 0;
}
.hello {
  margin: 0 0 2px;
  color: var(--pink-2);
  font-size: 14px;
  letter-spacing: 0.08em;
}
.hello .jp,
.kana,
.links h2 small {
  font-family: var(--jp);
}
.name {
  margin: 0;
  font-size: clamp(38px, 4.2vw, 50px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #ffffff 0%, #ffd9e8 45%, #ff9cc7 72%, #ffb58c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(3px 3px 0 #5a1d4f) drop-shadow(0 0 14px rgba(255, 120, 180, 0.35));
}
.kana {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.35em;
}

/* ---------- Odkazy ---------- */
.links {
  padding: 20px 20px 22px;
}
.links h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 4px 14px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.links h2 svg {
  width: 22px;
  height: 22px;
  flex: none;
}
.links h2 small {
  margin-left: auto;
  color: var(--dim);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.3em;
}
.links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.link {
  --c: var(--pink);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 10px;
  margin: 2px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card-2);
  box-shadow:
    0 -2px 0 0 rgba(255, 255, 255, 0.07),
    0 2px 0 0 rgba(255, 255, 255, 0.07),
    -2px 0 0 0 rgba(255, 255, 255, 0.07),
    2px 0 0 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
  transition:
    transform 0.2s steps(3),
    background-color 0.2s,
    box-shadow 0.2s;
  animation: rise 0.6s steps(6) both;
  animation-delay: calc(0.2s + var(--i, 0) * 0.07s);
}
.link::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.2) 48%, rgba(255, 255, 255, 0.05) 52%, transparent 60%);
  background-size: 260% 100%;
  background-position: 130% 0;
  transition: background-position 0s;
}
.link:hover,
.link:focus-visible {
  transform: translateX(6px);
  background-color: color-mix(in srgb, var(--c) 18%, transparent);
  box-shadow:
    0 -2px 0 0 var(--c),
    0 2px 0 0 var(--c),
    -2px 0 0 0 var(--c),
    2px 0 0 0 var(--c),
    0 0 26px -4px color-mix(in srgb, var(--c) 70%, transparent);
}
.link:hover::after,
.link:focus-visible::after {
  background-position: -30% 0;
  transition: background-position 0.7s ease-out;
}
.link:focus-visible {
  outline: 3px dashed var(--pink-2);
  outline-offset: 5px;
}
.link:active {
  transform: translateX(6px) translateY(2px);
}

.ico {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--c);
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), inset 0 4px 0 rgba(255, 255, 255, 0.18);
}
.ico svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  shape-rendering: geometricPrecision;
}
.ico.pixel svg {
  width: 32px;
  height: 32px;
  shape-rendering: crispEdges;
}
.link:hover .ico {
  animation: hop 0.5s steps(2) 1;
}
@keyframes hop {
  50% {
    transform: translateY(-4px);
  }
}

.txt {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.txt strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.1;
}
.txt .url {
  color: var(--pink-2);
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link:hover .url {
  color: #fff;
}
.go {
  margin-left: auto;
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--dim);
  transition:
    transform 0.2s steps(3),
    color 0.2s;
}
.go svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  shape-rendering: crispEdges;
}
.link:hover .go {
  transform: translateX(4px);
  color: #fff;
}

/* ---------- Tlačítko s míčkem ---------- */
.toys {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  zoom: var(--z);
}
.toy-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 3px;
  padding: 9px 16px 9px 11px;
  border: 0;
  font: 600 16px var(--font);
  color: var(--ink);
  background: rgba(22, 13, 42, 0.74);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow:
    0 -3px 0 0 var(--line),
    0 3px 0 0 var(--line),
    -3px 0 0 0 var(--line),
    3px 0 0 0 var(--line),
    0 12px 30px -10px rgba(3, 0, 12, 0.8);
  transition:
    transform 0.15s steps(2),
    background-color 0.2s,
    box-shadow 0.2s;
}
.toy-btn[hidden] {
  display: none;
}
.toy-btn svg {
  width: 30px;
  height: 30px;
  flex: none;
}
.toy-btn:hover {
  background-color: rgba(255, 143, 192, 0.24);
  box-shadow:
    0 -3px 0 0 var(--pink),
    0 3px 0 0 var(--pink),
    -3px 0 0 0 var(--pink),
    3px 0 0 0 var(--pink),
    0 0 26px -2px rgba(255, 120, 180, 0.55);
}
.toy-btn:hover svg {
  animation: hop 0.5s steps(2) 1;
}
.toy-btn:active {
  transform: translateY(2px);
}
.toy-btn:focus-visible {
  outline: 3px dashed var(--pink-2);
  outline-offset: 6px;
}
.toy-clear {
  padding: 9px 14px;
  font-size: 18px;
  line-height: 30px;
}
body.grabbing,
body.grabbing * {
  cursor: url('../assets/cursor-hand.png') 11 1, grabbing !important;
}

/* ---------- Patička ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 6px;
  color: var(--muted);
  font-size: 14px;
  text-shadow: 0 2px 0 rgba(6, 3, 16, 0.85);
  animation: rise 0.6s steps(6) 0.6s both;
}
.foot .jp {
  font-family: var(--jp);
}
.fx-btn {
  font: inherit;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 0;
  padding: 5px 10px;
  box-shadow:
    0 -2px 0 0 rgba(255, 255, 255, 0.12),
    0 2px 0 0 rgba(255, 255, 255, 0.12),
    -2px 0 0 0 rgba(255, 255, 255, 0.12),
    2px 0 0 0 rgba(255, 255, 255, 0.12);
}
.fx-btn:hover {
  color: #fff;
  background: rgba(255, 143, 192, 0.18);
}
.fx-btn:focus-visible {
  outline: 3px dashed var(--pink-2);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Velké obrazovky: zvětšit panel ---------- */
@media (min-width: 1700px) and (min-height: 940px) {
  :root {
    --z: 1.12;
  }
}
@media (min-width: 2200px) and (min-height: 1250px) {
  :root {
    --z: 1.4;
  }
}
@media (min-width: 3000px) and (min-height: 1700px) {
  :root {
    --z: 1.8;
  }
}

/* ---------- Nižší obrazovky (notebooky): zhustit panel ---------- */
@media (min-width: 761px) and (max-height: 960px) {
  .page {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .panel {
    gap: 14px;
  }
  .profile {
    padding: 16px 20px;
    gap: 18px;
  }
  .avatar {
    --s: 100px;
  }
  .name {
    font-size: 40px;
  }
  .links {
    padding: 14px 16px 16px;
  }
  .links h2 {
    margin-bottom: 10px;
    font-size: 22px;
  }
  .links ul {
    gap: 7px;
  }
  .link {
    padding: 7px 12px 7px 8px;
  }
  .ico {
    width: 40px;
    height: 40px;
  }
  .ico svg {
    width: 22px;
    height: 22px;
  }
  .ico.pixel svg {
    width: 28px;
    height: 28px;
  }
}
@media (min-width: 761px) and (max-height: 800px) {
  .avatar {
    --s: 86px;
  }
  .name {
    font-size: 34px;
  }
  .hello,
  .kana {
    font-size: 13px;
  }
  .kana {
    margin-top: 3px;
  }
  .link {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .ico {
    width: 36px;
    height: 36px;
  }
  .txt strong {
    font-size: 16px;
  }
  .txt .url {
    font-size: 14px;
  }
}

/* ---------- Mobil / úzké obrazovky ---------- */
@media (max-width: 760px) {
  .page {
    display: block;
    padding: 18px 16px 0;
  }
  .panel {
    max-width: 480px;
    margin: 0 auto;
    gap: 16px;
  }
  .stage {
    height: 48vh;
    height: 48svh;
  }
  .shade {
    background: linear-gradient(180deg, rgba(8, 5, 22, 0.45) 0%, rgba(8, 5, 22, 0.2) 55%, rgba(8, 5, 22, 0) 70%);
  }
  .profile {
    gap: 16px;
    padding: 18px;
  }
  .avatar {
    --s: 96px;
  }
  .links {
    padding: 16px 14px 18px;
  }
  .foot {
    padding: 8px 12px;
    background: rgba(16, 10, 32, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  .link {
    gap: 12px;
  }
  .toy-btn {
    padding: 8px;
  }
  .toy-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .toy-clear {
    padding: 8px 12px;
  }
}
@media (max-width: 380px) {
  .profile {
    flex-direction: column;
    text-align: center;
  }
  .txt .url {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
