/* カラー変数 */
:root {
  --primary-color: #6e8efb;
  --text-color: #555;
  --light-text: #a1a1a1;
  --header-text: #333333;
  --bg-color: #ffffff;
  --modal-bg: rgba(0, 0, 0, 0.7);
}

/* リセット & ベーススタイル */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--light-text);
  line-height: 1.2;
  padding: 20px;
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* アニメーション */
@keyframes fadeIn {
  to { opacity: 1; }
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes itemAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    backdrop-filter: blur(0);
    opacity: 0;
  }
  to {
    backdrop-filter: blur(5px);
    opacity: 1;
  }
}

@keyframes modalContentSlide {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* メインコンテナ */
.folder-container {
  max-width: 600px;
  width: 90%;
  height: auto;
  min-height: auto;
  max-height: 90vh;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin: auto;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.8s ease-out 0.3s forwards;
}

/* ヘッダー */
.folder-header {
  text-align: center;
  color: var(--header-text);
  margin: 0 auto;
  letter-spacing: -0.5px;
  padding-bottom: 15px;
  max-width: 500px;
  width: 100%;
}

.folder-header h2 {
  font-size: 130px;
  font-weight: 900;
  line-height: 1;
}

.folder-header p {
  font-size: 20px;
  margin-top: -15px;
  color: var(--light-text);
}

/* グリッドレイアウト */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 400px;
  margin: 3% auto;
}

.app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: itemAppear 0.6s cubic-bezier(0.16, 0.77, 0.3, 0.96) forwards;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              box-shadow 0.5s ease;
  will-change: transform;
}

.app-item:nth-child(1) { animation-delay: 0.4s; }
.app-item:nth-child(2) { animation-delay: 0.5s; }
.app-item:nth-child(3) { animation-delay: 0.6s; }
.app-item:nth-child(4) { animation-delay: 0.7s; }
.app-item:nth-child(5) { animation-delay: 0.8s; }
.app-item:nth-child(6) { animation-delay: 0.9s; }

/* ホバーエフェクト */
.app-item:hover {
  transform: translateY(-5px) scale(1.02) !important;
  transition-duration: 0.3s;
}

.app-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.app-item:hover .app-icon {
  transform: scale(1.03);
}

.app-name {
  font-size: 10px;
  color: var(--light-text);
  text-align: center;
  font-weight: 500;
}

/* ボタン */
.btn {
  display: block;
  border: 1px solid #333333;
  background-color: var(--header-text);
  padding: 3px;
  width: 100%;
  margin: 0 auto 5px auto;
  max-width: 500px;
  font-size: 12px;
  text-align: center;
  transition: all 0.3s ease 0.2s;
  color: #ffffff;
}

.btn:hover {
  border: 1px solid #333333;
  color: var(--header-text);
  background-color: #ffffff;
  opacity: 0.4;
}

/* アバウトセクション */
.about {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  font-size: 10px;
  font-weight: 300;
  color: var(--header-text);
}

/* モーダルスタイル */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-bg);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 0;
  animation: modalFadeIn 0.3s ease-out;
}

.modal-content {
  background-color: var(--bg-color);
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  border-radius: 20px;
  padding: 40px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  margin: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: modalContentSlide 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.close {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 30px;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover {
  color: var(--text-color);
}

/* モーダルスライダー */
.modal-slider {
  position: relative;
  width: 100%;
  height: auto;
  max-height: 400px;
  margin: 15px 0;
}

.modal-image {
  display: none;
  width: 100%;
  height: 100%;
  border: 1px solid #e4e4e4;
}

.modal-image.active {
  display: block;
}

.modal-image img {
  object-fit: contain;
}

.modal-description {
  color: var(--light-text);
  font-size: 14px;
  overflow-y: auto;
  padding: 10px 0;
  line-height: 1.2;
}

/* スライダーナビゲーション */
.slider-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
  padding-bottom: 10px;
}

.slider-prev, .slider-next {
  width: 30px;
  height: 30px;
  background-color: #ffffff;
  color: var(--light-text);
  border: 1px solid #aaa;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.slider-prev:hover, .slider-next:hover {
  background: rgba(0,0,0,0.8);
  background-color: var(--light-text);
  color: #ffffff;
}

/* ページネーション */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px auto;
  max-width: 500px;
  gap: 10px;
}

.page-btn, .page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 10px;
  text-decoration: none;
  transition: all 0.3s ease;
  background: none;
  border: none;
}

.page-number {
  border: 1px solid transparent;
}

.page-number.active {
  border: 1px solid #ccc;
  color: var(--light-text);
}

/* ローディング */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #acacac;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

/* サンプルページ追加スタイル */
.samples-page .folder-header h2 {
  font-size: 110px;
  line-height: 0.8;
}

.samples-page .folder-header p {
  margin-top: 0;
  margin-bottom: -20px;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  .modal-content {
    padding: 30px;
    max-height: 85vh;
  }
  
  .modal-image {
    max-height: 300px;
  }
}

@media (max-width: 480px) {
  .folder-header h2 {
    font-size: 60px;
    font-weight: 900;
  }

  .folder-header {
    max-width: 250px;
  }

  .folder-header p {
    margin-top: -10px;
  }

  .apps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 200px;
  }
  
  .app-icon {
    width: 65px;
    height: 65px;
  }

  .app-name {
    line-height: 1;
  }

  .btn {
    font-size: 10px;
  }

  .modal-content {
    padding: 25px 20px;
    max-height: 80vh;
  }
  
  .modal-image {
    max-height: 200px;
    margin: 10px 0;
  }
  
  .modal-description {
    font-size: 14px;
  }

  /* サンプルページのモバイルスタイル */
  .samples-page .folder-header h2 {
    font-size: 60px;
    font-weight: 900;
    line-height: 0.6;
  }

  .samples-page .folder-header p {
    padding-bottom: 5px;
  }
}