/* HentaiAPK Visual Novel — Late Night at the APK Café */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0a12;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #f0e6ff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#vn-root { width: 100%; height: 100%; }

.vn-overlay {
  position: fixed;
  inset: 0;
  background: #0a0a12;
  z-index: 99999;
}

/* Preloader */
.vn-preloader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #0a0a12 0%, #1a1030 50%, #0a0a12 100%);
}
.vn-preloader-bar {
  width: min(320px, 80vw);
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.vn-preloader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e85d8a, #9b6dff);
  border-radius: 3px;
  transition: width 0.2s;
}
.vn-preloader-text { font-size: 0.9rem; opacity: 0.7; }

/* Age gate */
.vn-age-gate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
  z-index: 100;
}
.vn-age-panel {
  max-width: 420px;
  padding: 2rem;
  text-align: center;
  background: linear-gradient(160deg, #1a1030, #2a1545);
  border: 1px solid rgba(232,93,138,0.4);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(155,109,255,0.2);
}
.vn-age-panel h2 { color: #e85d8a; margin-bottom: 1rem; font-size: 1.5rem; }
.vn-age-panel p { margin-bottom: 1.5rem; line-height: 1.6; opacity: 0.9; }
.vn-age-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Main menu */
.vn-main-menu {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(232,93,138,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(155,109,255,0.15) 0%, transparent 50%),
    linear-gradient(180deg, #0a0a12 0%, #1a1030 100%);
}
.vn-menu-panel {
  text-align: center;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
}
.vn-title {
  font-size: clamp(1.4rem, 5vw, 2rem);
  background: linear-gradient(90deg, #e85d8a, #9b6dff, #7ec8e3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}
.vn-subtitle { opacity: 0.6; margin-bottom: 1.5rem; font-size: 0.9rem; }
.vn-menu-badges { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.vn-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.8rem;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
}
.vn-menu-btn { width: 100%; margin-bottom: 0.6rem; }
.vn-menu-link { display: block; text-align: center; text-decoration: none; box-sizing: border-box; }

/* Buttons */
.vn-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #e85d8a, #9b6dff);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 48px;
}
.vn-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(232,93,138,0.4); }
.vn-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.vn-btn-secondary {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
}
.vn-icon-btn {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

/* Game UI */
.vn-game-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.vn-top-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  z-index: 50;
  flex-shrink: 0;
}
.vn-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  cursor: pointer;
}

/* Scene layers */
.vn-scene {
  position: absolute;
  inset: 0;
  transition: opacity 0.4s;
}
.vn-scene.vn-fade-out { opacity: 0; }
.vn-scene.vn-fade-in { animation: vnFadeIn 0.6s ease; }
@keyframes vnFadeIn { from { opacity: 0; } to { opacity: 1; } }

.vn-bg-wrap {
  position: absolute;
  inset: -5%;
  transition: transform 0.1s ease-out;
  transform: scale(1.05);
}
.vn-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.5s ease;
}
.vn-bg.vn-bg-fade { opacity: 0.3; }
.vn-bg-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background 0.6s ease;
}
.vn-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.vn-chars {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: visible;
}
.vn-char {
  position: absolute;
  bottom: 12%;
  height: 80%;
  width: 32%;
  min-width: 180px;
  max-width: 400px;
  transition: opacity 0.35s, filter 0.35s;
  overflow: visible;
}
.vn-char-center { left: 50%; transform: translateX(-50%); }
.vn-char-left { left: 3%; }
.vn-char-right { right: 3%; }
.vn-char-dim { filter: brightness(0.55) saturate(0.8); opacity: 0.88; }
.vn-char-highlight { filter: brightness(1.08); z-index: 15 !important; }

.vn-char-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.25s ease;
  /* Removes black AI-art background on dark scenes */
  mix-blend-mode: screen;
}
.vn-char-img.vn-char-swap { opacity: 0.5; }

/* Pose variants — subtle only, no crop/scale */
.vn-pose-leaning.vn-char-center { transform: translateX(-50%) rotate(-2deg); }
.vn-pose-leaning.vn-char-left { transform: rotate(-2deg); }
.vn-pose-leaning.vn-char-right { transform: rotate(2deg); }
.vn-pose-sitting { bottom: 16%; height: 72%; }
.vn-pose-surprised.vn-char-center { transform: translateX(-50%) translateY(-4px); }
.vn-char-blush {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,100,120,0.45) 0%, transparent 55%);
  transition: opacity 0.4s;
  pointer-events: none;
}

/* Animations */
.vn-char-center.vn-anim-breathe { animation: vnBreatheCenter 3.5s ease-in-out infinite; }
.vn-char-left.vn-anim-breathe,
.vn-char-right.vn-anim-breathe { animation: vnBreatheSide 3.5s ease-in-out infinite; }
@keyframes vnBreatheCenter {
  0%, 100% { transform: translateX(-50%) scaleY(1); }
  50% { transform: translateX(-50%) scaleY(1.015); }
}
@keyframes vnBreatheSide {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.015); }
}

.vn-blink .vn-char-img { opacity: 0.85; filter: brightness(0.95); }

.vn-enter-left { animation: vnEnterLeft 0.6s ease; }
.vn-enter-right { animation: vnEnterRight 0.6s ease; }
@keyframes vnEnterLeft {
  from { transform: translateX(-80px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes vnEnterRight {
  from { transform: translateX(80px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.vn-shake { animation: vnShake 0.5s ease; }
@keyframes vnShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(calc(var(--shake-intensity, 6px) * -1)); }
  40% { transform: translateX(var(--shake-intensity, 6px)); }
  60% { transform: translateX(calc(var(--shake-intensity, 6px) * -0.5)); }
  80% { transform: translateX(calc(var(--shake-intensity, 6px) * 0.5)); }
}

/* CG overlay */
.vn-cg {
  position: absolute;
  inset: 0;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s;
  background: rgba(0,0,0,0.3);
}
.vn-cg-active { opacity: 1; pointer-events: none; }
.vn-cg-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.vn-cg-kenburns { animation: vnKenBurns 12s ease-in-out forwards; }
@keyframes vnKenBurns {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Dialogue */
.vn-dialogue {
  position: relative;
  z-index: 40;
  margin: 0 0.5rem 0.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, rgba(10,10,18,0.85) 0%, rgba(26,16,48,0.95) 100%);
  border: 1px solid rgba(155,109,255,0.3);
  border-radius: 12px;
  min-height: 120px;
  cursor: pointer;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.vn-speaker {
  color: #e85d8a;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}
.vn-text {
  font-size: 1rem;
  line-height: 1.65;
  min-height: 3.3em;
}
.vn-continue-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 0.7rem;
  opacity: 0.4;
  animation: vnPulse 1.5s infinite;
}
@keyframes vnPulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }

/* Choices */
.vn-choices {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(500px, 92vw);
}
.vn-choice-btn {
  padding: 0.9rem 1.2rem;
  background: rgba(26,16,48,0.95);
  border: 1px solid rgba(232,93,138,0.5);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  min-height: 48px;
  transition: background 0.2s, border-color 0.2s;
}
.vn-choice-btn:hover {
  background: rgba(232,93,138,0.2);
  border-color: #e85d8a;
}

/* Modal */
.vn-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.vn-modal-panel {
  background: #1a1030;
  border: 1px solid rgba(155,109,255,0.3);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.vn-modal-panel h3 { margin-bottom: 1rem; color: #e85d8a; }
.vn-modal-panel label { display: block; margin-bottom: 1rem; font-size: 0.9rem; }
.vn-modal-panel input[type=range] { width: 100%; margin-top: 0.3rem; }
.vn-slot-btn { width: 100%; margin-bottom: 0.5rem; text-align: left; }
.vn-backlog-list { max-height: 300px; overflow-y: auto; margin-bottom: 1rem; }
.vn-backlog-item { padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 0.85rem; line-height: 1.4; }

/* Ending screen */
.vn-ending {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.9);
  z-index: 60;
  overflow-y: auto;
  padding: 1rem;
}
.vn-ending-panel {
  max-width: 600px;
  width: 100%;
  text-align: center;
}
.vn-ending-panel h2 { color: #e85d8a; margin-bottom: 1rem; font-size: 1.6rem; }
.vn-ending-desc { margin-bottom: 1.5rem; line-height: 1.6; opacity: 0.9; }
.vn-ending-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* Recommendations */
.vn-recs { text-align: left; }
.vn-recs-title { color: #9b6dff; margin-bottom: 0.8rem; font-size: 1rem; }
.vn-recs-loading { opacity: 0.6; font-size: 0.9rem; }
.vn-recs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.8rem; }
.vn-rec-card {
  display: block;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
  transition: border-color 0.2s;
}
.vn-rec-card:hover { border-color: #e85d8a; }
.vn-rec-thumb {
  height: 100px;
  background-size: cover;
  background-position: center;
  background-color: #2a1545;
}
.vn-rec-title {
  display: block;
  padding: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Gallery */
.vn-gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 300;
  overflow-y: auto;
  padding: 1.5rem;
}
.vn-gallery-header { text-align: center; margin-bottom: 1.5rem; }
.vn-gallery-header h2 { color: #e85d8a; }
.vn-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto 1.5rem;
}
.vn-gallery-item {
  aspect-ratio: 16/10;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
}
.vn-gallery-item.unlocked { border-color: rgba(232,93,138,0.4); }
.vn-gallery-item.locked {
  background: #1a1030 !important;
  cursor: default;
  filter: brightness(0.3);
}
.vn-gallery-item.locked::after {
  content: '🔒';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.vn-gallery-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem;
  background: rgba(0,0,0,0.7);
  font-size: 0.7rem;
  text-align: center;
}
.vn-gallery-fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.vn-gallery-full-img {
  width: 90vw;
  height: 70vh;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.vn-gallery-full-title { margin: 1rem; color: #e85d8a; }
.vn-gallery-close { margin-top: 0.5rem; }

/* Landscape mobile */
@media (orientation: landscape) and (max-height: 500px) {
  .vn-chars { padding-bottom: 35%; }
  .vn-char { height: 75%; }
  .vn-dialogue { min-height: 90px; margin: 0 0.3rem 0.3rem; padding: 0.6rem 1rem; }
  .vn-choices { bottom: 100px; }
}

@media (min-width: 768px) {
  .vn-dialogue { margin: 0 2rem 1rem; }
  .vn-char { max-width: 35%; }
}
