/* ==========================================================
   ぽこぽこアクアリウム -Poko Aquarium- - style.css
   ========================================================== */

:root {
  --color-bg-top: #072a4a;
  --color-bg-bottom: #03142a;
  --color-box: #0d3358;
  --color-box-border: #4fd6ff;
  --color-primary: #33b6f0;
  --color-primary-2: #7fe3ff;
  --color-heart: #ff6b9d;
  --color-good: #4fe3a8;
  --color-text: #eaf6ff;
  --color-text-muted: #9dc2dd;
  --color-border: #1d5580;
  --header-h: 56px;
  --ad-h: 58px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--color-bg-top), var(--color-bg-bottom));
  color: var(--color-text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* ---------- ヘッダー ---------- */
.game-header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.8rem;
  background: rgba(4, 20, 40, 0.75);
  border-bottom: 2px solid var(--color-box-border);
  z-index: 20;
}

.back-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 1.3rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.back-link:active {
  background: rgba(255, 255, 255, 0.18);
}

.game-title {
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--color-primary-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

.icon-btn.is-muted {
  color: var(--color-text-muted);
}

/* ---------- HUD ---------- */
.stat-row {
  flex: 0 0 auto;
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem 0.3rem;
  z-index: 10;
}

.stat-box {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(13, 51, 88, 0.8);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 0.3rem 0.5rem;
  text-align: center;
  line-height: 1.25;
}

.stat-box__label {
  display: block;
  font-size: 0.6rem;
  font-weight: bold;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.stat-box__value {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
  color: var(--color-heart);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-box:last-child .stat-box__value {
  color: var(--color-good);
}

/* ---------- 水槽ビュー ---------- */
.tank-view {
  position: relative;
  flex: 1 1 46%;
  min-height: 200px;
  overflow: hidden;
  border-bottom: 2px solid var(--color-border);
  touch-action: manipulation;
}

.tank-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  pointer-events: none;
}

.tank-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.fish-sprite {
  position: absolute;
  image-rendering: pixelated;
  pointer-events: none;
  will-change: transform;
  top: 0;
  left: 0;
}

.fish-sprite.is-tapped {
  animation: fish-nom 0.32s ease;
}

@keyframes fish-nom {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.4); }
  100% { filter: brightness(1); }
}

.food-sprite {
  position: absolute;
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
  pointer-events: none;
}

.bubble-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.9), rgba(180, 230, 255, 0.15) 70%);
  pointer-events: none;
  animation: bubble-rise linear forwards;
}

@keyframes bubble-rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0.9; }
  90% { opacity: 0.7; }
  100% { transform: translateY(-260px) scale(1); opacity: 0; }
}

.heart-float {
  position: absolute;
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(255, 107, 157, 0.6));
  animation: heart-bob 2.6s ease-in-out infinite;
  touch-action: manipulation;
}

@keyframes heart-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.heart-float.is-collected {
  animation: heart-collected 0.4s ease-out forwards;
  pointer-events: none;
}

@keyframes heart-collected {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.8) translateY(-30px); opacity: 0; }
}

/* ---------- 飛び出す +N エフェクト ---------- */
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.float-text {
  position: absolute;
  font-size: 1rem;
  font-weight: 900;
  color: var(--color-heart);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 2px 8px rgba(255, 107, 157, 0.5);
  transform: translate(-50%, -50%);
  animation: float-up 0.9s ease-out forwards;
  white-space: nowrap;
  z-index: 5;
}

.float-text.is-levelup {
  color: #ffe066;
  font-size: 1.1rem;
}

@keyframes float-up {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.9); }
  20% { transform: translate(-50%, -70%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

/* ---------- 増築ショップ ---------- */
.shop-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(3, 20, 42, 0.5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.shop-panel__title {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.55rem 0.8rem 0.25rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-text);
}

.shop-list {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.15rem 0.65rem 0.5rem;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-box);
  border: 2px solid var(--color-border);
  border-radius: 14px;
  padding: 0.45rem 0.6rem;
}

.shop-item__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: rgba(79, 214, 255, 0.08);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 78%;
  image-rendering: pixelated;
}

.shop-item__info {
  flex: 1 1 auto;
  min-width: 0;
}

.shop-item__name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.shop-item__badge {
  font-size: 0.62rem;
  font-weight: 800;
  color: #04202f;
  background: var(--color-primary-2);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  white-space: nowrap;
}

.shop-item__desc {
  font-size: 0.66rem;
  color: var(--color-text-muted);
  margin: 0.15rem 0 0;
}

.shop-item__feed-bar {
  margin-top: 0.3rem;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.shop-item__feed-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-good), var(--color-primary-2));
  border-radius: 999px;
  transition: width 0.2s ease;
}

.shop-item__buy {
  flex: 0 0 auto;
  border: none;
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  min-width: 82px;
  background: linear-gradient(135deg, var(--color-heart), #ff9ec4);
  color: #3a0a1e;
  font-weight: 900;
  font-size: 0.74rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}

.shop-item__buy:active {
  filter: brightness(0.92);
}

.shop-item__buy:disabled {
  background: #33465a;
  color: #7d93a8;
  cursor: not-allowed;
}

.shop-item__buy-label {
  font-size: 0.6rem;
  opacity: 0.85;
}

/* ---------- オーバーレイ ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 12, 24, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay__box {
  text-align: center;
  padding: 1.8rem 2rem;
  background: var(--color-box);
  border: 3px solid var(--color-box-border);
  border-radius: 22px;
  max-width: 85%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.overlay__box--wide {
  max-width: min(92%, 460px);
  max-height: 88%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-section {
  text-align: left;
  margin: 1rem 0;
}

.guide-section__title {
  font-size: 0.92rem;
  color: var(--color-primary-2);
  margin: 0 0 0.4rem;
}

.guide-section__text {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

.guide-section__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.guide-section__list li {
  margin-bottom: 0.3rem;
}

.overlay__title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 0 0 0.5rem;
  color: var(--color-primary-2);
}

.overlay__result-emoji {
  font-size: 2.4rem;
  margin: 0 0 0.2rem;
}

.overlay__desc {
  color: var(--color-text-muted);
  margin: 0 0 1.3rem;
  font-size: 0.9rem;
  font-weight: bold;
}

.overlay__btn {
  border: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  color: #04202f;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.overlay__btn:active {
  filter: brightness(0.92);
}

.overlay__btn-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.overlay__btn--ghost {
  background: rgba(79, 214, 255, 0.12);
  color: var(--color-primary-2);
}

/* ---------- 広告スペース ---------- */
.ad-slot {
  flex: 0 0 var(--ad-h);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.3rem 0.65rem 0.6rem;
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-muted);
  font-size: 0.7rem;
  overflow: hidden;
}

@media (max-height: 620px) {
  .tank-view {
    flex-basis: 38%;
    min-height: 150px;
  }
}
