/* ゲーム詳細画面・プレイ画面の切り替え（/js/game-screen.js と対で使う） */

/* ——— 詳細画面：開始ボタン ——— */
.gs-launch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.gs-launch__thumb {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: 0 14px 34px rgba(28, 52, 96, .2);
}

.gs-launch__btn {
  min-width: 13rem;
  min-height: 48px;
  font-size: 1rem;
}

/* ——— プレイ画面 ——— */
/* 詳細画面はレイアウトを保ったまま隠し、戻ったときにスクロール位置と広告の描画状態を変えない */
html.gs-playing,
html.gs-playing body {
  overflow: hidden;
  overscroll-behavior: none;
}

html.gs-playing body {
  visibility: hidden;
}

html.gs-playing .gs-screen {
  visibility: visible;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding:
    max(10px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 12% 0%, rgba(73, 195, 255, .1), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(161, 114, 255, .09), transparent 26rem),
    linear-gradient(180deg, #f7fbff 0%, #eef5ff 48%, #f8f9ff 100%);
}

.gs-screen:focus {
  outline: none;
}

.gs-bar {
  display: flex;
  flex: none;
  align-items: center;
  margin-bottom: 10px;
}

/* アイコンのみの操作ボタン（戻るボタンと各ゲームの操作ボタンで共通）。名前は aria-label で付ける */
.gs-icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
}

.gs-icon-btn .material-symbols-outlined {
  font-size: 24px;
  line-height: 1;
}

.gs-icon-btn:focus-visible,
.gs-notice__btn:focus-visible {
  outline: 3px solid rgba(31, 142, 230, .55);
  outline-offset: 2px;
}

/* ——— 画面向きの案内（閉じて続行できる） ——— */
.gs-notice {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background: rgba(247, 251, 255, .97);
  text-align: center;
}

.gs-notice__icon {
  color: var(--ns-blue);
  font-size: 48px;
  line-height: 1;
}

.gs-notice__text {
  max-width: 22rem;
  margin: 0;
  color: var(--ns-text);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.7;
}

.gs-notice__btn {
  min-width: 10rem;
  min-height: 44px;
}

/* ——— ダークテーマ（プレイ画面の要素に gs-theme-dark を付けたゲームだけに適用） ——— */
/* 外側の背景・戻るボタン・案内だけを扱い、盤面などゲーム固有の色は各ゲーム側で決める */
.gs-theme-dark {
  --play-bg: #080f1f;
  --play-bg-top: #142440;
  --play-hud-bg: #101f35;
  --play-btn-hover: #17304f;
  --play-text: #f1f7ff;
  --play-text-muted: #afc4dc;
  --play-border: #2c4764;
  --play-accent: #46d9f3;
}

/* 画面端の引っ張りやアドレスバーの伸縮で明るい背景が見えないようにする */
html.gs-playing:has(.gs-theme-dark) {
  background: #080f1f;
}

html.gs-playing .gs-screen.gs-theme-dark {
  color: var(--play-text);
  color-scheme: dark;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(70, 217, 243, .06), transparent 70%),
    linear-gradient(180deg, var(--play-bg-top) 0%, var(--play-bg) 62%);
}

.gs-theme-dark .gs-icon-btn,
.gs-theme-dark .gs-notice__btn {
  border: 1px solid var(--play-border);
  background: var(--play-hud-bg);
  color: var(--play-text);
  box-shadow: none;
}

@media (hover: hover) {
  .gs-theme-dark .gs-icon-btn:hover,
  .gs-theme-dark .gs-notice__btn:hover {
    border-color: color-mix(in srgb, var(--play-accent) 55%, var(--play-border));
    background: var(--play-btn-hover);
    color: var(--play-accent);
  }
}

.gs-theme-dark .gs-icon-btn:active,
.gs-theme-dark .gs-notice__btn:active {
  background: var(--play-bg);
}

.gs-theme-dark .gs-icon-btn:focus-visible,
.gs-theme-dark .gs-notice__btn:focus-visible {
  outline: 2px solid var(--play-accent);
  outline-offset: 2px;
}

.gs-theme-dark .gs-notice {
  background: rgba(8, 15, 31, .97);
}

.gs-theme-dark .gs-notice__icon {
  color: var(--play-accent);
}

.gs-theme-dark .gs-notice__text {
  color: var(--play-text);
}

/* 15パズル・パイプパズルと同じ区切り線付きステータスバー。
   このクラスを付けたゲームだけに適用する。 */
.gs-theme-dark .gs-hud {
  display: flex;
  flex: none;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: min(100%, 560px);
  margin: 0 auto 10px;
  padding: 6px 4px;
  border: 1px solid var(--play-border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: color-mix(in srgb, var(--play-hud-bg) 88%, transparent);
}

.gs-hud__item {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px 8px;
}

.gs-hud__item + .gs-hud__item { border-left: 1px solid var(--play-border); }

.gs-hud__label {
  color: var(--play-text-muted);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.gs-hud__value {
  color: var(--play-text);
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
