/* ==========================================================
   大富豪のタワーマンション - style.css
   ========================================================== */

:root {
  --color-bg-top: #1a1330;
  --color-bg-bottom: #0c0818;
  --color-box: #241a3d;
  --color-box-border: #ffb03b;
  --color-primary: #ffb03b;
  --color-primary-2: #ffd977;
  --color-good: #4fd68a;
  --color-text: #f4ecff;
  --color-text-muted: #b5a6d6;
  --color-border: #4a3a6e;
  --header-h: 56px;
  --ad-h: 60px;
}

* {
  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(20, 12, 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);
  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(36, 26, 61, 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.95rem;
  font-weight: 900;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ---------- タワービュー（増築したフロアを縦に表示・スクロール） ---------- */
.tower-view {
  position: relative;
  flex: 1 1 46%;
  min-height: 160px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 176, 59, 0.12), transparent 65%);
  border-bottom: 2px solid var(--color-border);
}

.tower-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  min-height: 100%;
  padding: 0.5rem 0 0;
}

.floor {
  position: relative;
  width: min(84vw, 360px);
  height: 64px;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  margin-top: -2px;
  image-rendering: pixelated;
}

.floor--lobby {
  cursor: pointer;
  touch-action: manipulation;
  filter: drop-shadow(0 4px 10px rgba(255, 176, 59, 0.35));
}

.floor--lobby:active .floor__inner {
  transform: scale(0.97);
}

.floor__inner {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  transition: transform 0.06s ease;
  image-rendering: pixelated;
}

.floor.is-tapped .floor__inner {
  animation: floor-pop 0.16s ease;
}

@keyframes floor-pop {
  0% { transform: scale(1); }
  40% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

.floor__badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(12, 8, 24, 0.75);
  border: 1px solid var(--color-primary);
  color: var(--color-primary-2);
  font-size: 0.65rem;
  font-weight: 900;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  pointer-events: none;
}

.floor__tap-hint {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(244, 236, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- 飛び出す +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-primary-2);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 2px 8px rgba(255, 176, 59, 0.4);
  transform: translate(-50%, -50%);
  animation: float-up 0.85s ease-out forwards;
  white-space: nowrap;
  z-index: 5;
}

@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(12, 8, 24, 0.4);
  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;
  overflow: hidden;
  background-color: rgba(255, 176, 59, 0.08);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  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__owned {
  font-size: 0.64rem;
  font-weight: 800;
  color: #241a3d;
  background: var(--color-primary-2);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

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

.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-primary), var(--color-primary-2));
  color: #2a1c05;
  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: #3a3050;
  color: #7d739a;
  cursor: not-allowed;
}

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

/* ---------- オーバーレイ ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 18, 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);
  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);
}

.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: #2a1c05;
  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(255, 176, 59, 0.12);
  color: var(--color-primary);
}

/* ---------- 広告スペース ---------- */
.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) {
  .tower-view {
    flex-basis: 38%;
    min-height: 130px;
  }
  .floor {
    height: 52px;
  }
}
