/* === Undertale-style font ===
   TODO: remplace par la vraie police Undertale ("Determination Mono" / DTM-Mono).
   1. Dépose le fichier .ttf/.otf dans public/assets/fonts/
   2. Mets à jour le src ci-dessous
   En attendant, fallback en monospace pixelisé via font-stack. */
@font-face {
  font-family: "Determination";
  src: url("../assets/fonts/determination.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #000000;
  --fg: #ffffff;
  --ut-red: #ff0000;
  --ut-yellow: #ffe648;
  --box-border: #ffffff;
  --font-ut: "Determination", "Courier New", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ut);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#stars-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: var(--bg);
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.scene.scene-active {
  opacity: 1;
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

/* --- top sound button --- */
.top-sound-btn {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #000;
  color: var(--fg);
  border: 2px solid var(--fg);
  font-family: var(--font-ut);
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  letter-spacing: 1px;
}

.top-sound-btn.is-playing {
  color: var(--ut-yellow);
  border-color: var(--ut-yellow);
}

.top-sound-btn:active {
  transform: translateX(-50%) scale(0.97);
}

/* --- heart --- */
.heart-slot {
  position: relative;
  width: 64px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jirachi-slot {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jirachi-slot.jirachi-normal {
  background-image: url("../assets/images/jirachi.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.jirachi-slot.jirachi-kiss {
  background-image: url("../assets/images/jirachi-kiss.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* --- message / dialogue boxes --- */
.message-box,
.dialogue-box {
  max-width: 640px;
  width: 90%;
  border: 3px solid var(--box-border);
  background: #000;
  padding: 18px 22px;
  font-size: 16px;
  line-height: 1.6;
  min-height: 1.6em;
}

.message-box p,
.dialogue-box p {
  margin: 0;
  white-space: pre-wrap;
}

/* --- buttons --- */
.battle-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.ut-button {
  background: #000;
  color: var(--fg);
  border: 2px solid var(--fg);
  font-family: var(--font-ut);
  font-size: 16px;
  letter-spacing: 1px;
  padding: 10px 22px;
  cursor: pointer;
  position: relative;
}

.ut-button:hover {
  color: var(--ut-yellow);
  border-color: var(--ut-yellow);
}

.ut-button:active {
  transform: scale(0.96);
}

.ut-button:focus-visible {
  outline: 2px dashed var(--ut-yellow);
  outline-offset: 3px;
}

/* --- wish form --- */
.wish-form {
  display: flex;
  gap: 12px;
  width: 90%;
  max-width: 640px;
  flex-wrap: wrap;
  justify-content: center;
}

#wish-input {
  flex: 1;
  min-width: 200px;
  background: #000;
  border: 2px solid var(--fg);
  color: var(--fg);
  font-family: var(--font-ut);
  font-size: 15px;
  padding: 10px 12px;
}

#wish-input:focus {
  outline: none;
  border-color: var(--ut-yellow);
}

/* --- ending --- */
.ending-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.ending-line {
  font-size: 20px;
  letter-spacing: 1px;
}

#ending-line-2 {
  color: var(--ut-yellow);
}

/* --- final --- */
.final-text {
  font-size: 22px;
  color: var(--ut-yellow);
  letter-spacing: 2px;
  text-align: center;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.final-line {
  margin: 4px 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.final-line:not(.hidden) {
  opacity: 1;
}

/* === responsive === */
@media (max-width: 600px) {
  .message-box,
  .dialogue-box {
    font-size: 14px;
    padding: 14px 16px;
  }

  .jirachi-slot {
    width: 110px;
    height: 110px;
  }

  .ut-button {
    font-size: 14px;
    padding: 9px 16px;
  }

  .ending-line {
    font-size: 16px;
  }

  .top-sound-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
}

@media (max-height: 480px) {
  .scene {
    gap: 12px;
  }

  .jirachi-slot {
    width: 90px;
    height: 90px;
  }
}
