/* Import Fonts */
@import url('fonts.css');

/* Global Styles */
* {
  box-sizing: border-box;
  font-family: 'Press Start 2P', cursive;
}

body {
  margin: 0;
  padding: 20px;
  background-color: #222;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

/* ===== START SCREEN ===== */
#start-screen {
  position: fixed;
  inset: 0;
  background: url("../img/start-bg.png") center/cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* โลโก้พอดีทุกจอ */
.start-logo {
  width: min(80%, 420px);
  height: auto;
  margin-bottom: 40px;
  object-fit: contain;
  animation: fadeInDown 1.2s ease-out;
}

/* ปุ่ม START */
.start-button {
  padding: 18px 40px;
  font-size: 24px;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  transition: 0.25s;
  backdrop-filter: blur(4px);
  font-family: 'Press Start 2P', cursive;
}

.start-button:hover {
  transform: scale(1.06);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Controls Info */
.controls-info {
  background: rgba(0, 0, 0, 0.7);
  padding: 20px;
  border-radius: 10px;
  margin-top: 30px;
  border: 2px solid white;
  color: white;
  text-align: center;
  max-width: 500px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 15px;
}

.player-controls h4 {
  color: #ff6b6b;
  margin-bottom: 10px;
  font-size: 0.9em;
}

.player-controls p {
  margin: 5px 0;
  font-size: 0.7em;
  color: #ccc;
}

.reset-hint {
  margin-top: 15px;
  font-size: 0.7em;
  color: #ffcc00;
}

/* Animation */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== GAME CONTAINER ===== */
.game-container {
  position: relative;
  display: inline-block;
}

/* Score Container */
#scoreContainer {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  width: 100%;
}

.scoreBox {
  color: white;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border: 2px solid white;
  border-radius: 5px;
}

/* Health and Timer Container */
.health-timer-container {
  position: absolute;
  display: flex;
  width: 100%;
  align-items: center;
  padding: 20px;
  top: 0;
  left: 0;
  z-index: 10;
}

/* Health Bars */
.health-container {
  position: relative;
  width: 100%;
  border: 4px solid white;
  height: 30px;
}

.player-health-container {
  display: flex;
  justify-content: flex-end;
  border-right: none;
}

.enemy-health-container {
  border-left: none;
}

.health-background {
  background-color: red;
  height: 100%;
  width: 100%;
}

.health-bar {
  position: absolute;
  background: #818cf8;
  top: 0;
  bottom: 0;
  width: 100%;
  transition: width 0.3s ease;
}

.player-health {
  right: 0;
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.enemy-health {
  left: 0;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

/* Timer */
.timer {
  background-color: black;
  width: 100px;
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  border: 4px solid white;
  font-size: 1.2em;
}

/* Display Text */
.display-text {
  position: absolute;
  color: white;
  align-items: center;
  justify-content: center;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  font-size: 4em;
  background: rgba(0, 0, 0, 0.8);
  z-index: 20;
  text-shadow: 0 0 20px #ff0000;
  font-family: 'Press Start 2P', cursive;
}

.display-text.tie {
  color: #ffcc00;
}

.display-text.win {
  color: #00ff00;
}

/* Canvas */
canvas {
  display: block;
  border: 4px solid white;
  background: black;
}
.control-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    z-index: 9999;
}

.ctrl-btn {
    padding: 12px 22px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(180deg, #ff3636, #c40000);
    border: 2px solid #ffb3b3;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255, 50, 50, 0.8), inset 0 0 8px rgba(0,0,0,0.5);
    transition: 0.2s ease-in-out;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Arial Black', sans-serif;
}

.ctrl-btn:hover {
    background: linear-gradient(180deg, #ff5c5c, #ff0000);
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(255, 80, 80, 1);
}

.ctrl-btn:active {
    transform: scale(0.95);
    background: linear-gradient(180deg, #c40000, #8b0000);
}
/* ===== HOW TO PLAY WINDOW ===== */
.howto-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.howto-box {
    background: #1e1e1e;
    padding: 30px 40px;
    border-radius: 15px;
    width: 480px;
    text-align: center;
    color: #fff;
    border: 2px solid #ff5555;
    box-shadow: 0 0 25px rgba(255, 60, 60, 0.8);
}

.howto-box h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.howto-box h3 {
    margin-top: 18px;
    margin-bottom: 8px;
    color: #ff6666;
    font-size: 20px;
}

.howto-note {
    font-size: 15px;
    margin-top: 15px;
    opacity: 0.9;
}

/* ปุ่มเดียวกับ Ctrl-Button */
.howto-btn {
    margin-top: 20px;
}
