html {
  scroll-behavior: smooth;
}

body {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem 0;
  transition: all 0.3s ease;
}

header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.header-content a {
  text-decoration: none;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

nav a {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 500;
  position: relative;
  transition: color 0.3s ease;
}

nav a::before {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary-pink);
  transition: width 0.3s ease;
}

nav a:hover::before {
  width: 100%;
}

nav a:hover {
  color: var(--primary-pink);
}

.back-link {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--primary-pink);
}

main {
  margin-top: 80px;
  padding: 30px;
}

@media (max-width: 768px) {
  main {
    margin-top: 140px;
  }
}

section {
  padding: 5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

h2 {
  font-family: 'Kiwi Maru', serif;
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-dark);
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-pink), var(--accent-purple));
  border-radius: 2px;
}

/* じゃんけんカード */
.janken-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-radius: 30px;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
  text-align: center;
}

.janken-card:hover {
  box-shadow: var(--hover-shadow);
}

.janken-description {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* 画像コンテナ */
.janken-image-container {
  margin: 1.5rem auto;
  width: 300px;
  height: 300px;
  min-width: 300px;
  min-height: 300px;
  max-width: 300px;
  max-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.janken-main-image {
  width: 100%;
  height: 100%;
  min-width: 300px;
  min-height: 300px;
  max-width: 300px;
  max-height: 300px;
  object-fit: contain;
  object-position: center;
  margin: 0;
  padding: 0;
  display: block;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transition: opacity 0.2s ease;
  box-sizing: border-box;
  vertical-align: middle;
}

.janken-main-image:hover {
  transform: scale(1.05);
}

/* 結果表示エリア */
.janken-result-area {
  margin: 1.5rem 0;
  height: 120px;
  min-height: 120px;
  max-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
}

.janken-status-text {
  font-size: 1.5rem;
  color: var(--primary-pink);
  font-weight: 500;
  margin: 0 0 1rem 0;
  height: 1.5em;
  min-height: 1.5em;
  max-height: 1.5em;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

.janken-status-text:empty::before {
  content: "\u00A0"; /* 空のときもスペースを確保 */
  visibility: hidden;
}

.janken-result-text {
  font-size: 1.3rem;
  color: var(--text-dark);
  font-weight: 500;
  margin: 0 0 0.5rem 0;
  height: 1.3em;
  min-height: 1.3em;
  max-height: 1.3em;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

.janken-result-text:empty::before {
  content: "\u00A0"; /* 空のときもスペースを確保 */
  visibility: hidden;
}

.janken-cpu-hand-text {
  font-size: 1.1rem;
  color: var(--text-light);
  margin: 0;
  height: 1.1em;
  min-height: 1.1em;
  max-height: 1.1em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

.janken-cpu-hand-text:empty::before {
  content: "\u00A0"; /* 空のときもスペースを確保 */
  visibility: hidden;
}

/* ボタンエリア */
.janken-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.hand-button {
  padding: 0.8rem 1.8rem;
  font-size: 1.1rem;
  font-weight: 500;
  font-family: 'Kiwi Maru', serif;
  color: white;
  background: linear-gradient(135deg, var(--primary-pink), var(--accent-purple));
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 20px rgba(255, 138, 160, 0.3);
  min-width: 100px;
}

.hand-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(255, 138, 160, 0.4);
}

.hand-button:active:not(:disabled) {
  transform: translateY(-1px);
}

.hand-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* リセットボタンエリア */
.janken-reset-area {
  margin-top: 1rem;
}

.janken-reset-button {
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  font-family: 'Kiwi Maru', serif;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid var(--primary-pink);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.janken-reset-button:hover {
  background: var(--primary-pink);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 138, 160, 0.3);
}

.janken-reset-button:active {
  transform: translateY(0);
}

.janken-reset-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-light);
  border-color: var(--text-light);
}

.janken-reset-button:disabled:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-light);
  transform: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* トップへ戻るボタン */
#page-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-pink), var(--accent-purple));
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 138, 160, 0.4);
  transition: all 0.3s ease;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
}

#page-top.show {
  opacity: 1;
  transform: translateY(0);
}

#page-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(255, 138, 160, 0.5);
}

/* フェードインアニメーション */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* フッターリンク */
.footer-link {
  color: var(--text-light);
  text-decoration: underline;
  margin-left: 0.5rem;
  font-size: 0.95rem;
}

.footer-link:hover {
  color: var(--primary-pink);
  text-decoration: none;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  main {
    padding: 0;
  }

  section {
    max-width: 100%;
    padding: 3rem 0;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  nav ul {
    gap: 1rem;
  }

  h2 {
    font-size: 2rem;
  }

  .janken-card {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    padding: 1.5rem 1rem;
    box-shadow: none;
  }

  .janken-image-container {
    width: 200px;
    height: 200px;
    min-width: 200px;
    min-height: 200px;
    max-width: 200px;
    max-height: 200px;
    margin: 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .janken-main-image {
    width: 100%;
    height: 100%;
    min-width: 200px;
    min-height: 200px;
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    object-position: center;
  }

  .janken-result-area {
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    margin: 1rem 0;
  }

  .janken-description {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .janken-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin: 1rem 0;
  }

  .hand-button {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    min-width: 90px;
    flex: 0 0 calc(33.333% - 0.6rem);
    max-width: calc(33.333% - 0.6rem);
  }

  .janken-reset-area {
    margin-top: 0.5rem;
  }

  .janken-status-text {
    font-size: 1.2rem;
  }

  .janken-result-text {
    font-size: 1.1rem;
  }
}

