body {
    background-color: #f0f8ff;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 上寄せに変更 */
    padding-top: 10px;       /* 上に余白を追加 */
    min-height: 100vh;       /* 小さい画面でも高さ確保 */
    margin: 5px;
    text-align: center;
    overflow-y: auto;        /* 画面が小さい場合にスクロール */
}

.screen {
    width: 800px;
    min-height: 600px;
    background-color: #fff;
    border: 5px solid #ff69b4;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    padding: 60px 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}


h1, h2 {
    color: #ff1493;
    text-shadow: 1px 1px 2px #ffc0cb;
}

.player-character {
    display: block;
    margin: 0 auto 8px auto; /* 中央寄せ & 下に少し余白 */
    width: 120px;            /* キャラ画像の大きさ調整 */
    height: auto;
}

#player-name-input {
    padding: 10px;
    border: 2px solid #ff69b4;
    border-radius: 10px;
    font-size: 1.2em;
    text-align: center;
    margin-bottom: 20px;
}


.character-select img {
    width: 120px;
    height: 120px;
    margin: 10px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}


.character-select img:hover {
    transform: scale(1.1);
    border-color: #ffd700;
}


.character-select img.selected {
    border-color: #ffd700;
}


button {
    padding: 15px 30px;
    font-size: 1.5em;
    color: #fff;
    background-color: #ff69b4;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}


button:hover {
    background-color: #ff1493;
    transform: translateY(-2px);
}


button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}


.game-info {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #4b0082;
}


.enemy-info, .player-info {
    width: 45%;
}


.enemy-info img {
    max-width: 150px;
    margin-bottom: 10px;
}


#game-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 3px;
    width: 360px;
    height: 360px;
    background-color: #ffc0cb;
    border: 3px solid #ff69b4;
    margin: 0 auto;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}


.cell {
    width: 60px;
    height: 60px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}


.cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}


.cell.selected {
    border: 3px solid gold !important;
    box-shadow: 0 0 10px gold;
}


.falling {
    animation: fall 0.5s ease-in;
}


@keyframes fall {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}


.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}


@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.5); }
}


.damage-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    color: red;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
    animation: floatUp 1s ease-out forwards;
}


@keyframes floatUp {
    from { top: 50%; opacity: 1; }
    to { top: 20%; opacity: 0; }
}


.hp-bar-container {
    width: 80%;
    height: 20px;
    background-color: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid #333;
}


.hp-bar-fill {
    height: 100%;
    background-color: #ff1493;
    transition: width 0.5s ease-out;
}


.hp-bar-fill.player {
    background-color: #00bfff;
}

.skill-animation {
  position: fixed;
  top: 50%;
  left: -200px; /* 初期は画面外 */
  transform: translateY(-50%);
  width: 200px;
  height: 200px;
  z-index: 9999;
  pointer-events: none;
}

.skill-animation img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 左から中央へ */
@keyframes slide-in {
  from { left: -250px; }
  to { left: calc(50% - 100px); }
}

/* 円を描く（transformで回転しつつ translate） */
@keyframes circle-motion {
  0% { transform: translate(-50%, -50%) rotate(0deg) translateX(50px) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg) translateX(50px) rotate(-360deg); }
}

/* 右へ退場 */
@keyframes slide-out {
  from { left: calc(50% - 100px); }
  to { left: 120%; }
}

.ending-character {
    width: 120px;
    height: auto;
    display: block;
    margin: 10px auto;
}

.player-info p,
.enemy-info p,
.ui-panel p {
    background-color: rgba(255,255,255,0.3); /* 半透明 */
    backdrop-filter: blur(4px); /* 背景をぼかす */
    border-radius: 10px;
    padding: 5px 10px;
    text-shadow: 1px 1px 2px #000; /* 黒影でコントラスト強化 */
    color: #ffffff; /* 白文字 */
}

.hp-bar-container {
    border: 2px solid #fff;
    border-radius: 10px;
}

/* スキル演出用 */
#skill-animation {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  padding: 12px 20px;
  border-radius: 16px;
  font-weight: bold;
  font-size: 28px;
  color: #fff;
  background: rgba(255, 200, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s ease;
  text-shadow: 2px 2px 6px #000;
}

/* 表示アニメーション */
#skill-animation.show {
  opacity: 1;
  transform: translateX(-50%) scale(1.3);
}

/* 吹き出しの見た目 */
#character-speech {
  position: absolute;
  top: -60px; /* キャラの頭上に表示 */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 16px;
  border-radius: 20px;
  border: 2px solid #ffcc00;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

/* アニメーション（ふわっと表示→消える） */
.speech-show {
  animation: speechAnim 2s ease forwards;
}

@keyframes speechAnim {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.character-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 16px;
  margin: 20px auto;
  max-width: 600px;
  text-align: left;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.character-card h2 {
  margin-top: 0;
}

.menu-link {
  margin-top: 20px;
  text-align: center;
}

.menu-link a {
  color: #007acc;
  font-weight: bold;
  text-decoration: none;
}
