/* ============================================================
 * 飲みゲーハブ — TOPページ スタイル
 * getdesign.md「Spotify」DESIGN.md を土台に、より華やかに仕上げた版。
 *   - 近黒の没入ダーク（#121212 / #181818 / #1f1f1f）
 *   - Spotify Green(#1ed760) を機能的アクセントに
 *   - 各ゲームの絵文字タイル＝アルバムアートとして色を担う
 *   - オーロラ状の背景 / カードの登場演出 / アクセント色のグロー
 * ============================================================ */
:root {
  --bg: #0d0d0f;          /* page（やや締めた近黒） */
  --surface: #181818;     /* card */
  --surface-2: #1f1f1f;   /* interactive surface */
  --surface-hover: #232323;

  --green: #1ed760;
  --green-press: #1db954;
  --text: #ffffff;
  --muted: #a7a7ad;
  --border: rgba(255, 255, 255, 0.08);

  --shadow-card: rgba(0, 0, 0, 0.45) 0px 10px 30px;
  --shadow-dialog: rgba(0, 0, 0, 0.55) 0px 8px 24px;

  --header-h: 56px;
  --maxw: 1040px;

  --font: SpotifyMixUI, "Helvetica Neue", Helvetica, Arial, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, "MS Gothic", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  overflow-x: hidden;
}

/* オーロラ状の背景（3ゲームのアクセント色をほのかに反映） */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 38% at 18% 16%, rgba(30, 215, 96, 0.20), transparent 62%),
    radial-gradient(34% 34% at 84% 12%, rgba(108, 140, 255, 0.16), transparent 62%),
    radial-gradient(42% 42% at 72% 88%, rgba(255, 122, 182, 0.14), transparent 62%);
  filter: blur(36px);
  animation: aurora 26s ease-in-out infinite alternate;
}
@keyframes aurora {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, -4%, 0) scale(1.1) rotate(2deg); }
}

/* ---------- 画面切り替え ---------- */
.view {
  display: none;
}
.view.active {
  display: block;
}

/* ============================================================
 * TOP（ゲーム選択）
 * ============================================================ */
#home {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 44px) 22px calc(env(safe-area-inset-bottom) + 56px);
}

.hero {
  text-align: center;
  margin-bottom: 40px;
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.hero .logo {
  font-size: clamp(52px, 15vw, 76px);
  line-height: 1;
  filter: drop-shadow(0 8px 22px rgba(30, 215, 96, 0.35));
  animation: float 4.5s ease-in-out infinite;
}
.hero h1 {
  font-size: clamp(30px, 8vw, 46px);
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 12px 0 8px;
  background: linear-gradient(96deg, #ffffff 0%, #c9ffdd 45%, var(--green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .sub {
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* アルバムグリッド */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 18px;
}
@media (min-width: 540px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 22px;
  }
}

/* カード */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 15px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  overflow: hidden;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease,
    border-color 0.25s ease;
  animation: cardIn 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
.card:hover,
.card:focus-visible {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--accent, #1ed760) 45%, transparent);
  transform: translateY(-6px);
  box-shadow: rgba(0, 0, 0, 0.5) 0px 16px 34px,
    0 14px 46px -10px color-mix(in srgb, var(--accent, #1ed760) 55%, transparent);
  outline: none;
}
.card:active {
  transform: translateY(-2px) scale(0.99);
}

/* 絵文字タイル＝アルバムアート */
.card .art {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background:
    radial-gradient(125% 120% at 28% 18%, rgba(255, 255, 255, 0.28), transparent 46%),
    linear-gradient(155deg, var(--accent, #1ed760) 0%, #101014 94%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.card .art .emoji {
  font-size: clamp(52px, 15vw, 78px);
  line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card:hover .art .emoji {
  transform: scale(1.08) rotate(-3deg);
}

/* Spotify緑の円形プレイボタン */
.card .play-fab {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  padding-left: 3px; /* 三角形の視覚中心を補正 */
  box-shadow: rgba(0, 0, 0, 0.4) 0 8px 18px, rgba(30, 215, 96, 0.5) 0 4px 16px;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1), background 0.12s ease;
}
.card:hover .play-fab {
  transform: translateY(-6px) scale(1.06);
}
.card:active .play-fab {
  background: var(--green-press);
  transform: scale(0.94);
}

.card .meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 3px 3px;
}
.card .title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.card .tagline {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  margin: 0;
  line-height: 1.45;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 48px;
  line-height: 1.8;
  opacity: 0.85;
}

/* 登場アニメーション */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

/* 動きを抑える設定を尊重 */
@media (prefers-reduced-motion: reduce) {
  *,
  body::before {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
 * ゲーム再生ビュー（iframe + ヘッダー）
 * ============================================================ */
#play {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #000;
  z-index: 5;
}
#play.active {
  display: flex;
}

.playbar {
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: rgba(13, 13, 15, 0.9);
  box-shadow: var(--shadow-dialog);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex: 0 0 auto;
  z-index: 2;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  border-radius: 9999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.back-btn:hover {
  background: var(--surface-hover);
}
.back-btn:active {
  transform: scale(0.96);
}

.playbar .game-name {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#gameFrame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  display: block;
  background: #000;
}
