:root {
  --bg-color: #0A0D36; /* Deep dark blue */
  --bg-gradient: linear-gradient(180deg, #2D438A 0%, #0A0D36 40%, #060824 100%);
  --text-color: #FFFFFF;
  --accent-color: #FACC15; /* Vibrant yellow */
  --accent-hover: #EAB308;
  --black-key: #2D3033;
  --black-key-active: #1A1C1F;
  --white-key: #FFFFFF;
  --white-key-active: #E0E0E0;
  --border-color: rgba(255, 255, 255, 0.2);
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-color);
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  line-height: 1.8;
  letter-spacing: 0.05em;
}

.container {
  max-width: 900px;
  width: 100%;
  padding: 60px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

.title-container {
  margin-bottom: 10px;
  position: relative;
}

.main-title-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.title-character {
  width: 80px;
  height: auto;
  animation: float-char 3s ease-in-out infinite;
}

.title-character.left {
  animation-delay: 0s;
  --rot: -10deg;
}

.title-character.right {
  animation-delay: -1.5s;
  --rot: 10deg;
}

@keyframes float-char {
  0% { transform: translateY(0px) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-8px) rotate(var(--rot, 0deg)); }
  100% { transform: translateY(0px) rotate(var(--rot, 0deg)); }
}

h1 {
  font-size: 3rem;
  font-weight: 800;
  margin: 0;
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.concept {
  font-size: 1.05rem;
  font-weight: 500;
  color: #EEEEEE;
  max-width: 600px;
  margin: 0 auto;
}

/* Accompaniment Section */
.accompaniment-section {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 500px;
  justify-content: center;
}

.accomp-btn {
  background-color: #FFFFFF;
  border: 2px solid #FFFFFF;
  border-radius: 12px;
  padding: 12px 10px;
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0A0D36;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.accomp-btn:hover {
  transform: translateY(-2px);
  background-color: #F0F0F0;
  border-color: #F0F0F0;
  color: #0A0D36;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.accomp-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.accomp-btn.playing {
  background-color: var(--accent-color);
  color: #0A0D36;
  border-color: var(--accent-color);
  box-shadow: 0 6px 15px rgba(250, 204, 21, 0.5);
}

.accomp-btn.playing:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.icon {
  margin-right: 8px;
  font-size: 1.1rem;
}

/* Keyboard Section */
.keyboard-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.controls-section {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 20px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 20px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.volume-control input[type="range"] {
  width: 120px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.volume-control .icon {
  margin: 0;
  font-size: 1.2rem;
  color: #FFF;
}

.keyboard-wrapper {
  width: 100%;
  max-width: 900px;
}

.keyboard {
  display: flex;
  position: relative;
  height: 180px;
  width: 100%;
  border-radius: 6px;
  background-color: #111;
  border-top: 10px solid #5D4037; /* Wood-like top edge */
  border-bottom: 2px solid #222;
  padding: 1px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 5px 15px rgba(0,0,0,0.2);
}

.key {
  position: relative;
  box-sizing: border-box;
  border-radius: 0 0 5px 5px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.1s, transform 0.1s;
}

.key.white {
  flex: 1;
  height: 100%;
  background-color: var(--white-key);
  z-index: 0;
  border-right: 1px solid #CCC;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.05);
}

.keyboard-blocker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 65%;
  z-index: 1;
  /* 黒鍵と黒鍵の間の白鍵上部を無効化する */
}

.key.white:last-child {
  border-right: none;
}

.key.white.active {
  background-color: var(--white-key-active);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.08);
}

.key.black {
  height: 65%;
  background-color: var(--black-key);
  background-image: linear-gradient(180deg, #3A3D40 0%, transparent 100%);
  position: absolute;
  top: 0;
  z-index: 2;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 6px 10px rgba(0,0,0,0.2), inset 0 2px 4px rgba(255,255,255,0.1);
}

/* 黒鍵の当たり判定を左右・下方向に広げる（無効化された白鍵上部を有効活用） */
.key.black::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140%; /* 隙間なく隣の黒鍵の当たり判定とくっつくサイズ */
  height: calc(100% + 15px); /* 下方向にも少し余裕を持たせてミスタッチを防ぐ */
  z-index: 3;
}

/* Accent for black keys to emphasize them */
.key.black::after {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 3px;
  background-color: rgba(230, 168, 124, 0.4);
  border-radius: 2px;
  transition: background-color 0.1s;
}

.key.black.active {
  background-color: #555A60; /* 明るいグレーにして光る（ヒットした）エフェクトを再現 */
  background-image: none;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3), inset 0 2px 6px rgba(0,0,0,0.3); /* 外側にほんのり光る影を追加 */
}

.key.black.active::after {
  background-color: rgba(230, 168, 124, 0.9);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px 5px;
  }
  
  header {
    margin-bottom: 10px;
  }

  .main-title-wrapper {
    gap: 10px;
  }

  .title-character {
    width: 40px;
  }

  h1 {
    font-size: 1.6rem;
  }
  
  .concept {
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .accompaniment-section {
    margin-bottom: 10px;
  }
  
  .accomp-btn {
    padding: 10px 8px;
    font-size: 1.05rem;
  }
  
  .keyboard {
    height: 150px;
  }
}

/* Footer Links */
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 30px;
  width: 100%;
}

@media (min-width: 600px) {
  .footer-links {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
  }
}

.footer-link-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 40px;
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  width: 100%;
  max-width: 280px;
  box-sizing: border-box;
}

.footer-link-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.footer-link-btn:active {
  transform: translateY(1px);
}
