* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
  color: #ffffff;
  overflow: hidden;
  position: relative;
  min-height: 100vh;
}

/* 星空背景アニメーション */
#stars,
#stars2,
#stars3 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

#stars {
  background: transparent;
  animation: animStar 50s linear infinite;
}

#stars:after {
  content: ' ';
  position: absolute;
  top: 0;
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow:
    779px 1331px #fff,
    324px 42px #fff,
    1253px 1458px #fff,
    1324px 1160px #fff,
    1915px 1412px #fff,
    758px 1530px #fff,
    420px 1342px #fff,
    1530px 1415px #fff,
    1242px 1621px #fff,
    935px 1518px #fff,
    1339px 1215px #fff,
    1412px 1515px #fff;
}

#stars2 {
  background: transparent;
  animation: animStar 100s linear infinite;
}

#stars2:after {
  content: ' ';
  position: absolute;
  top: 0;
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow:
    779px 835px #fff,
    1324px 142px #fff,
    253px 1458px #fff,
    1324px 1160px #fff,
    915px 1412px #fff,
    1758px 530px #fff;
}

#stars3 {
  background: transparent;
  animation: animStar 150s linear infinite;
}

#stars3:after {
  content: ' ';
  position: absolute;
  top: 0;
  width: 3px;
  height: 3px;
  background: transparent;
  box-shadow:
    1779px 335px #fff,
    324px 1142px #fff,
    1253px 958px #fff;
}

@keyframes animStar {
  from {
    transform: translateY(0px);
  }
  to {
    transform: translateY(-2000px);
  }
}

/* メインコンテナ */
.game-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ヘッダー */
.game-header {
  text-align: center;
  margin-bottom: 30px;
}

.game-title {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 2.5em;
  font-weight: 900;
  background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.subtitle {
  font-family: 'Orbitron', monospace;
  font-size: 1.2em;
  color: #a0aec0;
  margin-top: 5px;
}

.game-instructions {
  margin-top: 15px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.game-instructions p {
  font-size: 0.9em;
  color: #68d391;
  margin: 5px 0;
  text-align: center;
  line-height: 1.4;
}

/* リソースパネル */
.resource-panel {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.resource-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 20px 30px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.resource-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.resource-item.main-resource {
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(102, 126, 234, 0.1);
}

.resource-item.quantum {
  border-color: rgba(255, 107, 129, 0.5);
  background: rgba(255, 107, 129, 0.1);
}

.resource-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.9em;
  color: #a0aec0;
  margin-bottom: 5px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  font-size: 11px;
  color: #667eea;
  cursor: help;
  transition: all 0.3s ease;
}

.help-icon.small {
  width: 14px;
  height: 14px;
  font-size: 10px;
}

.help-icon:hover {
  background: rgba(102, 126, 234, 0.5);
  transform: scale(1.1);
}

/* ツールチップ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8em;
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 250px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(0, 0, 0, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

.resource-value {
  font-family: 'Orbitron', monospace;
  font-size: 2em;
  font-weight: 700;
  color: #ffffff;
}

.resource-per-sec {
  font-family: 'Orbitron', monospace;
  font-size: 0.8em;
  color: #68d391;
  margin-top: 5px;
}

/* ねこブラックホール */
.cat-container {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto 40px;
}

.black-hole-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  animation: blackHolePulse 3s ease-in-out infinite;
}

@keyframes blackHolePulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.cat-blackhole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.cat-blackhole:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.cat-blackhole:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.cat-ears {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  height: 70px;
}

.cat-ears::before,
.cat-ears::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 70px;
  background: #2d3748;
  border-radius: 70% 30% 0 0;
  box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.3);
}

.cat-ears::before {
  left: 15px;
  transform: rotate(-15deg);
}

.cat-ears::after {
  right: 15px;
  transform: rotate(15deg);
}

/* 耳の内側 */
.cat-ears::before::after,
.cat-ears::after::after {
  content: '';
  position: absolute;
  width: 35px;
  height: 45px;
  background: #ff6b81;
  border-radius: 50%;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
}

.cat-face {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 150px;
  background: #2d3748;
  border-radius: 50% 50% 45% 45%;
  overflow: visible;
  box-shadow:
    0 0 40px rgba(102, 126, 234, 0.5),
    inset 0 -10px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* 猫の模様 */
.cat-face::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 50px;
  background: #1a202c;
  border-radius: 50%;
  opacity: 0.3;
}

/* ほっぺた */
.cat-cheeks {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  display: flex;
  justify-content: space-between;
}

.cat-cheek {
  width: 30px;
  height: 20px;
  background: rgba(255, 107, 129, 0.3);
  border-radius: 50%;
  filter: blur(5px);
}

.cat-eyes {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  display: flex;
  justify-content: space-between;
}

.cat-eye {
  width: 32px;
  height: 38px;
  background: #ffffff;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 瞳 */
.cat-eye::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 24px;
  background: radial-gradient(circle at 30% 30%, #4a5568, #000);
  border-radius: 50%;
  animation: eyeMove 4s ease-in-out infinite;
}

/* 瞳孔 */
.cat-eye::before {
  content: '';
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 12px;
  background: #000;
  border-radius: 50%;
  z-index: 2;
  animation: pupilDilate 6s ease-in-out infinite;
}

/* 光の反射 */
.eye-shine {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  z-index: 3;
}

@keyframes pupilDilate {
  0%,
  100% {
    transform: translateX(-50%) scaleY(1);
  }
  50% {
    transform: translateX(-50%) scaleY(0.7);
  }
}

@keyframes eyeMove {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  25% {
    transform: translateX(-30%) translateY(-2px);
  }
  75% {
    transform: translateX(-70%) translateY(-2px);
  }
}

.cat-nose {
  position: absolute;
  top: 95px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 10px;
  background: #ff6b81;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

.cat-mouth {
  position: absolute;
  top: 103px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 20px;
}

.cat-mouth::before,
.cat-mouth::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid #ff6b81;
  border-radius: 0 0 50% 0;
  border-top: none;
  border-left: none;
}

.cat-mouth::before {
  left: -2px;
  transform: rotate(-30deg);
}

.cat-mouth::after {
  right: -2px;
  transform: rotate(30deg) scaleX(-1);
}

/* ひげ */
.cat-whiskers {
  position: absolute;
  top: 85px;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 40px;
}

.whisker {
  position: absolute;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  transform-origin: 0 50%;
}

.whisker-left-1 {
  width: 40px;
  top: 5px;
  left: 10px;
  transform: rotate(-10deg);
}

.whisker-left-2 {
  width: 35px;
  top: 15px;
  left: 15px;
  transform: rotate(-5deg);
}

.whisker-right-1 {
  width: 40px;
  top: 5px;
  right: 10px;
  transform: rotate(10deg) scaleX(-1);
}

.whisker-right-2 {
  width: 35px;
  top: 15px;
  right: 15px;
  transform: rotate(5deg) scaleX(-1);
}

.gravity-waves {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(102, 126, 234, 0.3);
  animation: gravityWave 2s ease-out infinite;
}

@keyframes gravityWave {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* ペットボタン */
.pet-button {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50px;
  padding: 15px 40px;
  color: white;
  font-size: 1.2em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  position: relative;
  overflow: hidden;
}

.pet-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.pet-button:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.pet-button:hover::before {
  width: 300px;
  height: 300px;
}

.pet-button:active {
  transform: translateX(-50%) translateY(0) scale(0.98);
}

.pet-button .button-text,
.pet-button .click-value {
  position: relative;
  z-index: 2;
}

.click-value {
  display: block;
  font-family: 'Orbitron', monospace;
  font-size: 0.8em;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.8);
}

/* ゲームレイアウト */
.game-layout {
  display: grid;
  grid-template-columns: 350px 1fr 350px;
  gap: 20px;
  margin-bottom: 30px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  min-height: 70vh;
}

.left-panels,
.right-panels {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.center-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.panel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 15px;
  backdrop-filter: blur(10px);
  min-height: 350px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.panel-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.3em;
  margin-bottom: 15px;
  color: #a0aec0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.passives-info {
  background: rgba(255, 107, 129, 0.1);
  border: 1px solid rgba(255, 107, 129, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
}

.info-text {
  font-size: 0.8em;
  color: #ff6b81;
  margin: 0;
  line-height: 1.5;
  text-align: center;
}

.no-passives-message {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  color: #a0aec0;
}

.no-passives-message h3 {
  margin: 0 0 10px 0;
  color: #ff6b81;
  font-size: 1.1em;
}

.no-passives-message p {
  margin: 5px 0;
  font-size: 0.9em;
  line-height: 1.4;
}

/* アップグレードリスト */
.upgrades-list,
.passives-list,
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 5px;
  flex: 1;
}

.upgrade-item,
.passive-item,
.achievement-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 80px;
}

.upgrade-item:hover,
.passive-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.upgrade-item.disabled,
.passive-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.upgrade-item.disabled:hover,
.passive-item.disabled:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

.item-name {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.95em;
  padding-right: 50px; /* レベル表示のスペース確保 */
}

.item-effect {
  font-size: 0.85em;
  color: #68d391;
  margin-bottom: 4px;
  line-height: 1.3;
}

.item-cost {
  font-family: 'Orbitron', monospace;
  font-size: 0.85em;
  color: #fbbf24;
  margin-top: auto;
}

.item-level {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(102, 126, 234, 0.5);
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75em;
}

/* 実績 */
.achievement-item {
  border-color: rgba(16, 185, 129, 0.3);
}

.achievement-item.unlocked {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.5);
}

.achievement-item.locked {
  opacity: 0.6;
}

/* 次元跳躍セクション */
.prestige-section {
  text-align: center;
  margin-top: 30px;
}

.prestige-button {
  background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
  border: none;
  border-radius: 50px;
  padding: 20px 50px;
  color: white;
  font-size: 1.3em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
  position: relative;
  overflow: hidden;
}

.prestige-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.prestige-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(50%);
}

.prestige-button::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: rotate(45deg);
  transition: all 0.5s;
  opacity: 0;
}

.prestige-button:hover:not(:disabled)::before {
  animation: prestigeShine 0.5s ease-in-out;
}

@keyframes prestigeShine {
  0% {
    transform: rotate(45deg) translateX(-100%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: rotate(45deg) translateX(100%);
    opacity: 0;
  }
}

.prestige-title {
  display: block;
  font-size: 1.2em;
}

.prestige-reward {
  display: block;
  font-family: 'Orbitron', monospace;
  font-size: 0.9em;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.9);
}

/* イベントポップアップ */
.event-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
  border-radius: 20px;
  padding: 30px 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
  max-width: 400px;
}

.event-popup.active {
  transform: translate(-50%, -50%) scale(1);
}

.event-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.5em;
  font-weight: 700;
  margin-bottom: 10px;
}

.event-description {
  font-size: 1.1em;
}

/* フローティング数字 */
.floating-numbers {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.floating-number {
  position: absolute;
  font-family: 'Orbitron', monospace;
  font-size: 1.5em;
  font-weight: 700;
  color: #68d391;
  animation: floatUp 2s ease-out forwards;
  text-shadow: 0 0 10px rgba(104, 211, 145, 0.5);
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(1.5);
    opacity: 0;
  }
}

/* スクロールバー */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.7);
}

/* \u30d1\u30cd\u30eb\u5185\u306e\u30b9\u30af\u30ed\u30fc\u30eb\u30d0\u30fc */
.upgrades-list::-webkit-scrollbar,
.passives-list::-webkit-scrollbar,
.achievements-list::-webkit-scrollbar {
  width: 4px;
}

.upgrades-list::-webkit-scrollbar-thumb,
.passives-list::-webkit-scrollbar-thumb,
.achievements-list::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
}

/* レスポンシブ */
@media (max-width: 768px) {
  .game-title {
    font-size: 1.8em;
  }

  .subtitle {
    font-size: 1em;
  }

  .game-instructions {
    margin-top: 10px;
  }

  .game-instructions p {
    font-size: 0.8em;
  }

  .resource-panel {
    gap: 10px;
    flex-direction: column;
    align-items: center;
  }

  .resource-item {
    padding: 12px 20px;
    min-width: 200px;
  }

  .cat-container {
    width: 220px;
    height: 220px;
    margin-bottom: 30px;
  }

  .cat-blackhole {
    width: 130px;
    height: 130px;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 15px;
    min-height: auto;
  }

  .left-panels,
  .right-panels {
    order: 2;
  }

  .center-area {
    order: 1;
  }

  .panel {
    padding: 12px;
    min-height: 300px;
  }

  .panel-title {
    font-size: 1.1em;
  }

  .pet-button {
    padding: 12px 30px;
    font-size: 1em;
  }

  [data-tooltip]::before {
    max-width: 200px;
    font-size: 0.75em;
    left: 20px;
    transform: none;
  }

  [data-tooltip]::after {
    left: 30px;
    transform: none;
  }
}
