* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #010207;
  color: #f4efe6;
  font-family: Georgia, "Palatino Linotype", Palatino, serif;
}
button, input { font-family: inherit; }

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}
#loading[hidden], #welcome[hidden], #view[hidden], #bar[hidden], #hud[hidden], #name-box[hidden], #save-note[hidden] { display: none; }
#loading, #welcome {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 3;
  pointer-events: none;
}
#loading { color: rgba(255, 236, 210, 0.8); letter-spacing: 0.14em; font-size: 14px; }
#welcome { pointer-events: auto; }
#welcome .card {
  width: min(440px, calc(100% - 40px));
  text-align: center;
  padding: 28px 26px 24px;
  border-radius: 22px;
  background: rgba(10, 10, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}
#welcome h1 { font-weight: normal; letter-spacing: 0.08em; margin: 0 0 10px; font-size: 28px; }
#welcome p { margin: 0 0 16px; line-height: 1.45; color: rgba(244, 239, 230, 0.82); }
#welcome .hint { font-size: 14px; color: rgba(244, 239, 230, 0.6); }
#welcome-name {
  width: 100%;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  text-align: center;
  letter-spacing: 0.18em;
}
#choose {
  border: 0;
  background: white;
  color: #120c12;
  border-radius: 999px;
  padding: 12px 22px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

#hud, #bar {
  position: fixed;
  z-index: 4;
  transition: opacity 0.6s ease;
}
#hud.is-hidden, #bar.is-hidden { opacity: 0; }
#bar.is-hidden { pointer-events: none; }
#hud {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(10, 10, 18, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#hud a { color: #f4efe6; text-decoration: none; }
#hud a:hover { color: white; }
#bar {
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(10, 10, 18, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
#bar button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
#bar button:hover { background: rgba(255, 255, 255, 0.2); }
#bar svg { width: 21px; height: 21px; fill: white; display: block; }

#name-box {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
}
#name-box form {
  width: min(420px, calc(100% - 32px));
  padding: 22px 22px 18px;
  border-radius: 18px;
  background: rgba(12, 12, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
}
#name-box p { margin: 0 0 12px; letter-spacing: 0.04em; }
#name-box input {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  text-align: center;
  letter-spacing: 0.06em;
}
#name-box .row { display: flex; gap: 10px; justify-content: center; }
#name-box button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  background: white;
  color: #120c12;
}
#name-box #name-cancel { background: transparent; color: white; border: 1px solid rgba(255, 255, 255, 0.25); }
#save-note {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(10, 10, 18, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.04em;
}

body.gallery {
  min-height: 100%;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(120, 60, 90, 0.35), transparent 60%),
    linear-gradient(#010207, #0a0b1a);
}
.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.gallery header { text-align: center; margin-bottom: 28px; }
.gallery h1 {
  font-weight: normal;
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
body.gallery .wrap { position: relative; z-index: 6; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.card {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  background: #07070e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 220px;
}
.card img { width: 100%; height: 280px; object-fit: cover; display: block; filter: saturate(0.9); }
.card span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 8, 14, 0.78);
  letter-spacing: 0.04em;
  font-size: 13px;
  white-space: nowrap;
}
.card:hover { border-color: rgba(255, 210, 170, 0.7); }
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .card img { height: 220px; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
}
body.gallery .grid .card img {
  filter: blur(12px) saturate(0.88);
  transform: scale(1.08);
  transition: filter 0.28s ease, transform 0.28s ease;
}
body.gallery .grid .card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.78;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncR type='linear' slope='3' intercept='-1.15'/><feFuncG type='linear' slope='3' intercept='-1.15'/><feFuncB type='linear' slope='3' intercept='-1.15'/></feComponentTransfer></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  background-size: 140px 140px;
  mix-blend-mode: overlay;
  transition: opacity 0.28s ease;
}
body.gallery .grid .card span { z-index: 2; }
body.gallery .grid .card:hover img,
body.gallery .grid .card:focus-visible img {
  filter: blur(0) saturate(1);
  transform: none;
}
body.gallery .grid .card:hover::after,
body.gallery .grid .card:focus-visible::after {
  opacity: 0;
}
