body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: transparent;
  margin: 0;
  font-family: Arial, sans-serif;
}

canvas {
  border: solid 3px #6091d3; /*線*/
  border-radius: 10px; /*角の丸み*/
  background-color: rgba(10, 25, 47, 0.7);
  box-shadow: 0 0 20px rgba(173, 216, 230, 0.3);
}

h3 {
  margin-bottom: 10px;
}

/* 新しい宇宙テーマの背景のスタイル */
#space-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #0a192f, #20314f);
}

.planet {
  position: absolute;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #1c3a6e 0%, #0a1930 70%);
  box-shadow: inset 0 0 50px rgba(173, 216, 230, 0.2);
  z-index: 0;
  top: 50%;
  left: 70%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.button-container {
  position: absolute;
  top: 10%;
  right: 20%;
}

#control-btn {
  font-size: 1.8rem;
  color: greenyellow;
  cursor: pointer;
}

#control-btn:hover i {
  color: green;
  transition: all 0.4s ease;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: rgba(0, 0, 0, 0.8);
  border-radius: 15px;
  padding: 20px;
  width: 300px;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 80vh; /* ビューポートの高さの80%に制限 */
  overflow-y: auto; /* 内容が多い場合にスクロール可能に */
}

.controls-title {
  text-align: center;
  color: #00ff00;
  font-size: 24px;
  margin-bottom: 20px;
}

.control-item {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 0;
}

.control-icon {
  color: #e0e0ff;
  width: 40px;
  height: 40px;
  background: rgba(0, 255, 0, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 15px;
  min-width: 40px;
}

.control-description {
  flex-grow: 1;
  color: #e0e0ff;
}

.close-btn {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close-btn:hover {
  color: #00ff00;
}

.star {
  z-index: -1;
  position: absolute;
  width: 100%;
  height: 200%;
  background-image: radial-gradient(
      white,
      rgba(255, 255, 255, 0.2) 2px,
      transparent 40px
    ),
    radial-gradient(white, rgba(255, 255, 255, 0.15) 1px, transparent 30px),
    radial-gradient(white, rgba(255, 255, 255, 0.1) 2px, transparent 40px);
  background-size: 550px 550px, 350px 350px, 250px 250px;
  background-repeat: repeat, repeat, repeat; /* starがループ */
  animation: twinkle 55s infinite linear;
}

@keyframes twinkle {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

#start-screen {
  text-align: center;
  padding: 20px;
  color: white;
  z-index: 1;
}

/* スタート画面のタイトルスタイル */
.tetris-title {
  font-size: 6rem;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5rem;
  text-shadow: 3px 3px 0px #00ffff, -3px -3px 0px #ff00ff,
    0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.5),
    0 0 30px rgba(255, 255, 255, 0.3);
  background: linear-gradient(45deg, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  animation: pulse 3s infinite alternate;
}
.tetris-title::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  background: linear-gradient(45deg, #ff00ff, #00ffff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.5;
  filter: blur(1px);
}
.tetris-title::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -2;
  color: #ffffff;
  opacity: 0.1;
  filter: blur(3px);
}
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.05);
  }
}

/* スタート画面のボタンスタイル */

.animated-button {
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 36px;
  border: 4px solid;
  border-color: transparent;
  font-size: 16px;
  background-color: inherit;
  border-radius: 100px;
  font-weight: 600;
  color: greenyellow;
  box-shadow: 0 0 0 2px greenyellow;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button svg {
  position: absolute;
  width: 24px;
  fill: greenyellow;
  z-index: 9;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .arr-1 {
  right: 16px;
}

.animated-button .arr-2 {
  left: -25%;
}

.animated-button .circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background-color: greenyellow;
  border-radius: 50%;
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .text {
  position: relative;
  z-index: 1;
  transform: translateX(-12px);
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button:hover {
  box-shadow: 0 0 0 12px transparent;
  color: #212121;
  border-radius: 12px;
}

.animated-button:hover .arr-1 {
  right: -25%;
}

.animated-button:hover .arr-2 {
  left: 16px;
}

.animated-button:hover .text {
  transform: translateX(12px);
}

.animated-button:hover svg {
  fill: #212121;
}

.animated-button:active {
  scale: 0.95;
  box-shadow: 0 0 0 4px greenyellow;
}

.animated-button:hover .circle {
  width: 220px;
  height: 220px;
  opacity: 1;
}

#game-container {
  position: relative;
  z-index: 1;
  /* 背景色を半透明にして宇宙背景が見えるようにする */
  background-color: rgba(10, 25, 47, 0.7);
  padding: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 80vh;
}

/* tetris-effect */
#tetris-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  font-weight: bold;
  font-family: "Arial Black", sans-serif;
  color: #00ffff;
  text-shadow: 3px 3px 0 #ff00ff, -3px -3px 0 #ffff00, 3px -3px 0 #ff8c00,
    -3px 3px 0 #00ff00;
  letter-spacing: 5px;
  display: none;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

#left-container,
#right-container {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  gap: 20px;
}

#hold-container,
#next-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
}

#score-container div {
  margin-top: 15px;
  padding-right: 8px;
  padding-left: 8px;
  border: solid 3px #6091d3; /*線*/
  border-radius: 10px; /*角の丸み*/
  box-shadow: 0 0 20px rgba(173, 216, 230, 0.3);
}

#score-container #score {
  margin-bottom: 10px;
}

#hold-canvas {
  width: 120px;
  height: 120px;
}

.next-canvas {
  margin-bottom: 10px;
}

.next-canvas.large {
  width: 120px;
  height: 120px;
}

.next-canvas.small {
  width: 80px;
  height: 80px;
}

#home-container {
  color: white;
  margin-top: 50px;
}

#home-button {
  all: unset; /* 全てのデフォルトスタイルをリセット */
}

#home-container i {
  cursor: pointer;
  transition: all 0.4s ease;
}

#home-button i:hover {
  opacity: 0.5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#score-container {
  text-align: center;
}

#score {
  font-size: 24px;
  font-weight: bold;
  margin: 0;
}

#level {
  font-size: 24px;
  font-weight: bold;
}

#line {
  font-size: 24px;
  font-weight: bold;
}

#effect-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* combo */
#combo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  width: 120px;
  margin-top: 25px;
  border: 3px solid #ff00ff;
  border-radius: 10px;
  background: linear-gradient(45deg, #000000, #333333);
  box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #ff00ff;
  position: relative;
  overflow: hidden;
  animation: pulse 0.5s ease-in-out infinite;
}

#combo-container::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    transparent,
    rgba(255, 0, 255, 0.3),
    transparent 30%
  );
  animation: rotate 4s linear infinite;
}

#combo-text {
  font-family: "Arial", sans-serif;
  font-size: 24px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 5px yellow;
  z-index: 1;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* t-spin */
#t-spin-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  width: 120px;
  margin-top: 25px;
  border: 3px solid #39ff14;
  border-radius: 10px;
  background: linear-gradient(45deg, #000000, #333333);
  box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #ff00ff;
  position: relative;
  overflow: hidden;
  animation: pulse 0.5s ease-in-out infinite;
}

#t-spin-container::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    transparent,
    rgba(255, 0, 255, 0.3),
    transparent 30%
  );
  animation: rotate 4s linear infinite;
}

#t-spin-text {
  font-family: "Arial", sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 5px yellow;
  z-index: 1;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* back-to-back */
#back-to-back-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  width: 120px;
  margin-top: 25px;
  border: 3px solid #ff0000;
  border-radius: 10px;
  background: linear-gradient(45deg, #000000, #333333);
  box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #ff00ff;
  position: relative;
  overflow: hidden;
  animation: pulse 0.5s ease-in-out infinite;
}

#back-to-back-container::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    transparent,
    rgba(255, 0, 255, 0.3),
    transparent 30%
  );
  animation: rotate 4s linear infinite;
}

#back-to-back-text {
  font-family: "Arial", sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 5px yellow;
  z-index: 1;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

#effect-container > div {
  transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.5s ease;
}

#effect-container > div.slide-in {
  display: flex !important;
  animation: slideIn 0.5s forwards cubic-bezier(0.25, 0.1, 0.25, 1);
}

#combo-container.slide-in {
  animation-delay: 0.1s;
}

#t-spin-container.slide-in {
  animation-delay: 0.2s;
}

#back-to-back-container.slide-in {
  animation-delay: 0.3s;
}

#game-over {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#game-over-container {
  background-color: rgba(10, 25, 47, 0.9);
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

#game-over h2 {
  font-size: 48px;
  color: #ff0000;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#game-over p {
  font-size: 24px;
  color: #ffffff;
  margin-bottom: 30px;
}

#close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: color 0.3s ease;
}

#close-button:hover {
  color: #ff0000;
}

#game-over-container {
  position: relative;
  /* 他の既存のスタイル */
}

#restart-button {
  font-size: 20px;
  padding: 10px 20px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#restart-button:hover {
  background-color: green;
}
