/* ============================================
   CHAMBRE VIRTUELLE — style.css
   palette: rose pâle, lilas, turquoise, old web
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&family=Noto+Sans+JP:wght@300;400;700&family=Caveat:wght@400;600&display=swap');

/* === CSS VARIABLES === */
:root {
  --rose:        #ffd6e0;
  --rose-deep:   #ffaac4;
  --lilas:       #e8d5f5;
  --lilas-deep:  #c89fe8;
  --turquoise:   #a8f0e8;
  --turq-deep:   #5ce0d0;
  --cream:       #fef9f0;
  --grey-soft:   #d8d0e8;
  --grey-mouse:  #9890a8;
  --flash-pink:  #ff69b4;
  --flash-blue:  #00bfff;
  --flash-yellow:#ffff00;
  --flash-green: #39ff14;
  --black:       #1a1520;
  --window-bg:   rgba(255,240,250,0.92);
  --font-pixel:  "pf-pixelscript", sans-serif,"Silkscreen", monospace;
  --font-body:   'Noto Sans JP', 'MS PGothic', 'ＭＳ Ｐゴシック', Verdana, sans-serif;
  --font-hand:   'Caveat', cursive;
}
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--cream);
  color: var(--turquoise);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="5" cy="5" r="4" fill="%23ff69b4" stroke="%23fff" stroke-width="1.5"/></svg>') 5 5, auto;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--flash-pink);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}
a:hover {
  color: var(--flash-blue);
  text-shadow: 0 0 8px var(--flash-blue);
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--rose); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--lilas-deep), var(--turq-deep));
  border-radius: 5px;
  border: 1px solid var(--rose-deep);
}
::-webkit-scrollbar-thumb:hover { background: var(--flash-pink); }

/* === BACKGROUND TEXTURE === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,182,193,0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(168,240,232,0.10) 0%, transparent 50%),
    radial-gradient(circle at 60% 10%, rgba(200,159,232,0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* === PIXEL RAIN CANVAS === */
#pixel-rain {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
}

/* === LOADING SCREEN === */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.8s ease;
}
#loading-screen.fade-out { opacity: 0; pointer-events: none; }

.loading-text {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--flash-pink);
  animation: blink 0.8s infinite;
  letter-spacing: 2px;
}
.loading-bar-wrap {
  width: 220px;
  height: 14px;
  border: 2px solid var(--lilas-deep);
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--flash-pink), var(--lilas-deep), var(--turq-deep));
  animation: load-progress 2s ease forwards;
}
@keyframes load-progress { from { width: 0; } to { width: 100%; } }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.loading-hearts {
  display: flex; gap: 8px; font-size: 18px;
  animation: float-up 1s ease infinite;
}
@keyframes float-up {
  0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)}
}

/* === NAVIGATION === */
.nav-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 36px;
  background: rgba(232,213,245,0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--lilas-deep);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 4px;
  z-index: 500;
  font-family: var(--font-pixel);
  font-size: 10px;
}
.nav-logo {
  color: var(--flash-pink);
  font-size: 11px;
  margin-right: 12px;
  text-shadow: 0 0 6px var(--flash-pink);
}
.nav-btn {
  padding: 3px 10px;
  background: var(--window-bg);
  border: 1px solid var(--lilas-deep);
  color: var(--black);
  font-family: var(--font-pixel);
  font-size: 9px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
  text-decoration: none;
  display: inline-block;
}
.nav-btn:hover {
  background: var(--flash-pink);
  color: #fff;
  border-color: var(--flash-pink);
  box-shadow: 0 0 8px var(--flash-pink);
  transform: translateY(-1px);
}
.nav-spacer { flex: 1; }
.nav-time {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--grey-mouse);
}

/* === WINDOW WIDGET (draggable popup style) === */
.win-window {
  position: absolute;
  background: var(--window-bg);
  border: var(--window-border);
  box-shadow: 4px 4px 0 rgba(200,159,232,0.4), 8px 8px 0 rgba(255,182,193,0.2);
  min-width: 180px;
  z-index: 100;
  border-radius: 2px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.win-window:hover {
  box-shadow: 6px 6px 0 var(--lilas-deep), 12px 12px 0 rgba(255,182,193,0.3);
}
.win-window.active { z-index: 200; }

.win-titlebar {
  background: linear-gradient(90deg, var(--lilas-deep), var(--rose-deep));
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: grab;
  user-select: none;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: white;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
.win-titlebar:active { cursor: grabbing; }
.win-dots {
  display: flex; gap: 3px; margin-left: auto;
}
.win-dot {
  width: 8px; height: 8px; border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.15s;
}
.win-dot:hover { opacity: 0.7; }
.win-dot.close { background: #ff5f57; }
.win-dot.min   { background: #febc2e; }
.win-dot.max   { background: #28c840; }

.win-body {
  padding: 8px;
  font-size: 11px;
  line-height: 1.6;
  font-family: var(--font-body);
}

/* === FLOAT ANIMATIONS === */
@keyframes float {
  0%,100% { transform: translateY(0px) rotate(0deg); }
  33%      { transform: translateY(-8px) rotate(1deg); }
  66%      { transform: translateY(-4px) rotate(-1deg); }
}
@keyframes float-slow {
  0%,100% { transform: translateY(0px); }
  50%     { transform: translateY(-12px); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%,100% { opacity:0.6; filter: brightness(1); }
  50%     { opacity:1;   filter: brightness(1.3) drop-shadow(0 0 6px var(--flash-pink)); }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 5px var(--rose-deep); }
  50%     { box-shadow: 0 0 20px var(--flash-pink), 0 0 40px var(--lilas-deep); }
}
@keyframes drift {
  0%   { transform: translate(0,0) rotate(0deg); }
  25%  { transform: translate(5px,-5px) rotate(2deg); }
  50%  { transform: translate(-3px,8px) rotate(-1deg); }
  75%  { transform: translate(8px,3px) rotate(1.5deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}
@keyframes scanline {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100%; }
}
@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

/* === CRT EFFECT === */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* === GLITTER BADGE === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-pixel);
  font-size: 8px;
  background: linear-gradient(90deg, var(--flash-pink), var(--lilas-deep));
  color: white;
  letter-spacing: 1px;
  animation: shimmer 2s infinite;
}

/* === TOOLTIP === */
.tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--rose);
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 3px 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 999;
  letter-spacing: 1px;
}
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--black);
}
*:hover > .tooltip { opacity: 1; }

/* === PAGE WRAPPER === */
.page-wrap {
  position: relative;
  padding-top: 36px;
  min-height: 100vh;
  z-index: 2;
}

/* === HOVER TRAIL DOTS === */
.trail-dot {
  position: fixed;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9990;
  transform: translate(-50%,-50%);
  animation: trail-fade 0.6s ease forwards;
}
@keyframes trail-fade {
  0%   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(0.2); }
}

/* === MUSIC PLAYER === */
#music-player {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 600;
  background: var(--window-bg);
  border: var(--window-border);
  padding: 6px 10px;
  font-family: var(--font-pixel);
  font-size: 8px;
  box-shadow: 3px 3px 0 var(--lilas-deep);
  min-width: 160px;
}
.player-title { color: var(--flash-pink); margin-bottom: 4px; }
.player-track { color: var(--grey-mouse); margin-bottom: 5px; overflow: hidden; white-space: nowrap; }
.player-controls { display: flex; gap: 5px; align-items: center; }
.player-btn {
  background: var(--lilas);
  border: 1px solid var(--lilas-deep);
  padding: 2px 6px;
  cursor: pointer;
  font-size: 9px;
  transition: background 0.15s;
}
.player-btn:hover { background: var(--flash-pink); color: white; }
.player-progress {
  flex: 1;
  height: 4px;
  background: var(--grey-soft);
  cursor: pointer;
  overflow: hidden;
}
.player-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--flash-pink), var(--turq-deep));
  width: 0%;
  transition: width 0.3s;
}

/* === MISC UTILITIES === */
.text-pixel { font-family: var(--font-pixel); }
.text-hand  { font-family: var(--font-hand); font-size: 16px; }
.glow-pink  { text-shadow: 0 0 8px var(--flash-pink), 0 0 16px var(--flash-pink); }
.glow-blue  { text-shadow: 0 0 8px var(--flash-blue), 0 0 16px var(--flash-blue); }

.float { animation: float 4s ease-in-out infinite; }
.float-slow { animation: float-slow 6s ease-in-out infinite; }
.drift { animation: drift 8s ease-in-out infinite; }

.pixel-border {
  border: 2px solid var(--lilas-deep);
  box-shadow: 2px 2px 0 var(--rose-deep), 4px 4px 0 var(--lilas);
}

/* STICKER */
.sticker {
  display: inline-block;
  font-size: 18px;
  animation: drift 5s ease-in-out infinite;
  cursor: default;
  user-select: none;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.2));
}

/* === BACK/HOME BUTTONS === */
.room-nav {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.room-nav-btn {
  background: var(--window-bg);
  border: var(--window-border);
  padding: 4px 10px;
  font-family: var(--font-pixel);
  font-size: 9px;
  cursor: pointer;
  text-decoration: none;
  color: var(--black);
  display: block;
  transition: all 0.15s;
  box-shadow: 2px 2px 0 var(--lilas-deep);
}
.room-nav-btn:hover {
  background: var(--lilas-deep);
  color: white;
  transform: translate(-1px,-1px);
  box-shadow: 3px 3px 0 var(--flash-pink);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .nav-bar { overflow-x: auto; }
  .win-window { min-width: 140px; }
}