/* =============================================
   CSS Reset & Base Styles
   ============================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

/* LINEミニアプリでのみ固定位置を適用 */
.liff-in-client html {
  position: fixed;
  width: 100%;
}

/* ビューポート高さのCSS変数（JavaScriptで動的に設定） */
html {
  --vh: 1vh; /* デフォルト値 */
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* LINE内ブラウザ対応: 実際の表示領域の高さを使用 */
.liff-external-browser body {
  height: calc(var(--vh, 1vh) * 100);
  height: 100vh; /* フォールバック */
}

/* LINEミニアプリ: 実際の表示領域の高さを使用 */
.liff-in-client body {
  height: calc(var(--vh, 1vh) * 100);
  max-height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  touch-action: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
}

/* =============================================
   Loading Screen
   ============================================= */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fff8e1 0%, #fffde7 100%);
  z-index: 1000;
}

.loading-screen__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 20px;
}

.loading-screen__logo {
  width: 200px;
  max-width: 80%;
  height: auto;
  animation: pulse 2s ease-in-out infinite;
}

.loading-screen__progress {
  width: 240px;
  max-width: 80%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.loading-screen__progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff6b35 0%, #f7c948 100%);
  border-radius: 4px;
  transition: width 0.3s ease-out;
  position: relative;
  box-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

/* ローディングバー発光アニメーション */
.loading-screen__progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

.loading-screen__status {
  font-size: 0.875rem;
  color: #666;
  text-align: center;
}

/* =============================================
   TOP Screen
   ============================================= */
.top-screen {
  position: relative;
  height: 100vh;
  height: 100dvh; /* 動的ビューポート高さ（LINEミニアプリ対応） */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* スクロールを無効化 */
  box-sizing: border-box; /* paddingを含めた高さ計算 */
  /* デフォルト: iOSのセーフエリア対応（LINE内ブラウザ用） */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* LINE内ブラウザ対応: 実際の表示領域の高さを使用 */
.liff-external-browser .top-screen {
  height: calc(var(--vh, 1vh) * 100);
  height: 100vh; /* フォールバック */
  /* LINE内ブラウザではセーフエリアは不要（通常のブラウザとして動作） */
  padding-bottom: 0;
}

/* LINEミニアプリ: 実際の表示領域の高さを使用 + セーフエリア対応 */
.liff-in-client .top-screen {
  height: calc(var(--vh, 1vh) * 100);
  max-height: calc(var(--vh, 1vh) * 100);
  box-sizing: border-box; /* paddingを含めた高さ計算 */
  padding-bottom: env(safe-area-inset-bottom, 0); /* 実端末のセーフエリアに追従 */
  overflow: hidden;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  touch-action: none;
}

/* ランドスケープモード対応（LINEミニアプリのみ） */
@media (orientation: landscape) {
  .liff-in-client .top-screen {
    /* ランドスケープモード: 公式ドキュメント推奨の値 */
    box-sizing: border-box; /* paddingを含めた高さ計算 */
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
  }
}

.top-screen__background {
  position: fixed;
  inset: 0;
  background-image: url('/static/images/bg_top.b5b0d21d.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
}

/* ヘッダー（アイコンボタン） */
.top-screen__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  position: relative;
  z-index: 10;
}

.top-screen__header-left,
.top-screen__header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.top-screen__header-left {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.top-screen__header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.top-screen__icon-button {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.top-screen__icon-button:active {
  transform: scale(0.95);
  opacity: 0.8;
}

.top-screen__icon-button img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

/* 称号バッジ */
.top-screen__title-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: #0f1b3d;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid #0b132b;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  letter-spacing: 0.02em;
}

.top-screen__title-pill-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* 未読バッジ */
.top-screen__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  background: #ff3b30;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* メインコンテンツ */
.top-screen__main {
  flex: 1 1 0; /* flex-grow: 1, flex-shrink: 1, flex-basis: 0 で高さを制限 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 20px;
  min-height: 0; /* flexboxのオーバーフローを防ぐ */
  max-height: 100%; /* 親要素の高さを超えないようにする */
  overflow: hidden; /* スクロールを無効化（LINEミニアプリ対応） */
}

/* ロゴ下のコンテンツを少し縮小して高さを確保 */
.top-screen__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  transform: scale(0.95);
  transform-origin: top center;
}

/* LINEミニアプリ内ではタッチスクロールを無効化 */
.liff-in-client .top-screen__main {
  touch-action: none;
  overflow: hidden;
}

/* LINE内ブラウザのみ内部スクロールを許可 */
.liff-external-browser .top-screen__main {
  overflow-y: hidden; /* スクロールを無効化 */
  -webkit-overflow-scrolling: touch; /* iOSのスムーズスクロール */
}

.top-screen__logo {
  max-width: 105%;
  height: auto;
  margin-bottom: 16px;
}

/* 自己ベスト表示 */
.top-screen__best-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 320px;
  max-width: 90%;
  padding: 6px 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: -15px;
  flex-shrink: 0;
}

.top-screen__best-score-label {
  font-size: 0.75rem;
  color: #888;
  letter-spacing: 0.05em;
}

.top-screen__best-score-content {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.top-screen__best-score-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.top-screen__best-score-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ff6b35;
}

.top-screen__best-score-unit {
  font-size: 0.9rem;
  color: #ff6b35;
  font-weight: 500;
}

.top-screen__title-badge {
  font-size: 0.75rem;
  color: #fff;
  background: #ff6b35;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 0;
}

.top-screen__my-records-link {
  font-size: 0.8rem;
  color: #666;
  background: none;
  border: none;
  padding: 4px 0;
  margin-top: 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.top-screen__my-records-link:hover,
.top-screen__my-records-link:active {
  color: #ff6b35;
}

/* ニックネームフォーム */
.top-screen__nickname-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.top-screen__nickname-input-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.top-screen__nickname-label {
  font-size: 0.875rem;
  color: #666;
}

.top-screen__nickname-input {
  width: 100%;
  max-width: 100%;
  padding: 12px 20px;
  font-size: 1.05rem;
  border: 2px solid #2d2d2d;
  border-radius: 16px;
  box-shadow: 0 3px 0 #2d2d2d;
  text-align: center;
  transition: border-color 0.2s ease;
  background: rgba(255, 255, 255, 0.98);
}

.top-screen__nickname-edit-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #aaa;
  pointer-events: none;
  transition: all 0.2s ease;
  background: transparent;
  border-radius: 50%;
}

.top-screen__nickname-input:focus + .top-screen__nickname-edit-icon {
  color: #ff6b35;
  background: rgba(255, 107, 53, 0.1);
  transform: translateY(-50%) scale(1.05);
}

.top-screen__nickname-input:focus {
  outline: none;
  border-color: #ff6b35;
}

.top-screen__nickname-input::placeholder {
  color: #aaa;
}

.top-screen__nickname-count {
  display: none;
}

/* 開始ボタン */
.top-screen__start-button {
  width: 320px;
  max-width: 90%;
  margin-top: 16px;
  padding: 0;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
}

.top-screen__start-button:active {
  transform: translateY(2px);
  opacity: 0.9;
}

.top-screen__start-button-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  margin: -12px;
}

/* 遊び方ボタン */
.top-screen__howto-button {
  width: 320px;
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 14px;
  background: #fff;
  color: #2d2d2d;
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid #b6b6b6;
  box-shadow: 0 4px 0 #b6b6b6;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.top-screen__howto-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b6b6b6;
}

/* ホーム画面に追加ボタン */
.top-screen__shortcut-button {
  width: 320px;
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 14px;
  background: #f2fff6;
  color: #0b8f45;
  font-size: 1.02rem;
  font-weight: 700;
  border: 2px solid #7fe0a9;
  box-shadow: 0 4px 0 #7fe0a9;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.top-screen__shortcut-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7fe0a9;
}

/* =============================================
   Error Screen
   ============================================= */
.error-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  z-index: 1000;
  padding: 20px;
}

.error-screen__content {
  max-width: 400px;
  text-align: center;
}

.error-screen__title {
  font-size: 1.25rem;
  color: #e53935;
  margin-bottom: 16px;
}

.error-screen__message {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 12px;
}

.error-screen__details {
  font-size: 0.75rem;
  color: #999;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 24px;
  word-break: break-all;
  text-align: left;
  max-height: 200px;
  overflow-y: auto;
}

.error-screen__retry-button {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #ff6b35;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.error-screen__retry-button:active {
  background: #e55a28;
}

/* =============================================
   Countdown Screen
   ============================================= */
.countdown-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 27, 61, 0.6); /* 半透明のダークブルー */
  backdrop-filter: blur(8px); /* すりガラス効果 */
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.countdown-screen__content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.countdown-screen__number {
  font-size: 10rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 
    0 0 20px rgba(255, 255, 255, 0.5),
    0 4px 30px rgba(0, 0, 0, 0.3);
  font-family: 'Arial Black', sans-serif;
  letter-spacing: -0.05em;
  transform-origin: center;
  will-change: transform, opacity;
}

.countdown-screen__number.pop {
  animation: countdown-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes countdown-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
    filter: blur(10px);
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* =============================================
   Play Screen
   ============================================= */
.play-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.play-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/static/images/bg_play.2999434a.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  transition: filter 0.3s ease;
}

.play-screen > * {
  position: relative;
  z-index: 1;
}

.play-screen--fever::before {
  filter: grayscale(1);
}

/* プレイ画面ヘッダー */
.play-screen__header {
  padding: 16px;
}

.play-screen__header-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 16px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  position: relative;
  margin-top: 8px;
}

.play-screen__header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.play-screen__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.play-screen__stat--time {
  flex: 0 0 auto;
  border-right: 2px solid #e0e0e0;
  padding-right: 16px;
  margin-right: 16px;
}

.play-screen__stat--docs {
  flex: 1;
}

.play-screen__stat--score {
  flex: 0 0 auto;
  align-items: flex-end;
}

.play-screen__stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #1976d2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.play-screen__time-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1a237e;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 0.3s ease;
}

.play-screen__time-value-wrap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  line-height: 1;
}

.play-screen__time-value.warning {
  color: #d32f2f;
  animation: blink 0.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.play-screen__time-unit {
  font-size: 1rem;
  font-weight: 700;
  color: #1a237e;
}

.play-screen__stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a237e;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.play-screen__score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 4px 16px;
  background: #1976d2;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

.play-screen__time-bar-container {
  height: 8px;
  background: #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}

.play-screen__time-bar {
  height: 100%;
  width: 33.3%; /* 初期60秒/180秒 */
  background: #1976d2;
  border-radius: 4px;
  transition: width 0.1s linear, background-color 0.3s ease;
}

.play-screen__freeze-timer {
  position: absolute;
  top: -10px;
  left: 10px;
  transform: rotate(-5deg);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  /* 氷結・クリスタル風のデザイン */
  background: radial-gradient(circle at 30% 30%, rgba(225, 245, 254, 0.95), rgba(179, 229, 252, 0.9));
  border: 4px solid #fff;
  box-shadow: 
    0 0 0 4px rgba(0, 176, 255, 0.3),
    0 0 30px rgba(0, 176, 255, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  z-index: 100;
  pointer-events: none;
  overflow: visible;
  animation: freeze-pulse 1s ease-in-out infinite alternate;
}

@keyframes freeze-pulse {
  from { 
    transform: rotate(-5deg) scale(1); 
    box-shadow: 0 0 0 4px rgba(0, 176, 255, 0.3), 0 0 30px rgba(0, 176, 255, 0.6); 
  }
  to { 
    transform: rotate(-5deg) scale(1.05); 
    box-shadow: 0 0 0 8px rgba(0, 176, 255, 0.1), 0 0 50px rgba(0, 176, 255, 0.8); 
  }
}

/* 氷の結晶のような回転リング */
.play-screen__freeze-timer::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px dashed rgba(0, 176, 255, 0.5);
  animation: freeze-rotate 10s linear infinite;
  pointer-events: none;
}

@keyframes freeze-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.play-screen__freeze-label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: #0277bd;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.play-screen__freeze-value {
  font-family: 'Arial Black', sans-serif;
  font-size: 3rem;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #00b0ff 0%, #01579b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.8));
  letter-spacing: -0.05em;
}

.play-screen__freeze-unit {
  font-size: 0.9rem;
  color: #0277bd;
  font-weight: 800;
  line-height: 1;
  margin-top: 2px;
}

.play-screen__time-bar.normal {
  background: #1976d2;
}

.play-screen__time-bar.warning {
  background: linear-gradient(90deg, #ff9800 0%, #ffc107 100%);
}

.play-screen__time-bar.danger {
  background: linear-gradient(90deg, #f44336 0%, #ff5722 100%);
}

.play-screen__time-bar.bonus-glow {
  box-shadow: 0 0 15px #ffc107, 0 0 30px #ffc107;
  background: linear-gradient(90deg, #ffc107 0%, #ffeb3b 100%);
}

.play-screen__time-bar.penalty-shake {
  animation: meter-shake 0.4s ease;
  background: #f44336;
}

@keyframes meter-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* 問題エリア */
.play-screen__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

/* コンボ表示 */
.play-screen__combo {
  position: absolute;
  top: 10px;
  right: 20px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 20px;
  background: linear-gradient(135deg, #ff6d00 0%, #ff3d00 100%);
  border: 3px solid #fff;
  border-radius: 30px;
  color: #fff;
  box-shadow: 
    0 4px 15px rgba(255, 61, 0, 0.4),
    inset 0 2px 5px rgba(255, 255, 255, 0.3);
  z-index: 6;
  transform-origin: right center;
}

.play-screen__combo.bounce {
  animation: combo-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes combo-bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.play-screen__combo-count {
  font-family: 'Arial Black', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

.play-screen__combo-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  opacity: 0.9;
}

.play-screen--fever .play-screen__stat--time,
.play-screen--fever .play-screen__stat--docs,
.play-screen--fever .play-screen__time-bar,
.play-screen--fever .play-screen__combo {
  filter: grayscale(1);
  opacity: 0.6;
}

.play-screen--fever .play-screen__combo {
  filter: none;
  opacity: 1;
}

.play-screen--fever .play-screen__score-badge {
  box-shadow: 0 0 16px rgba(255, 235, 59, 0.9);
  animation: fever-score-pulse 0.6s ease-in-out infinite;
}

@keyframes fever-score-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* FEVER表示 */
.play-screen__fever {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  pointer-events: none;
}

.play-screen__fever.animate {
  animation: fever-pop 0.5s ease-out;
}

@keyframes fever-pop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.play-screen__fever-image {
  width: 300px;
  max-width: 80vw;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(255, 234, 0, 0.6));
  animation: fever-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes fever-pulse {
  from { transform: scale(1); filter: drop-shadow(0 0 20px rgba(255, 234, 0, 0.6)); }
  to { transform: scale(1.05); filter: drop-shadow(0 0 30px rgba(255, 234, 0, 0.9)); }
}


/* 問題カード */
.play-screen__card {
  width: calc(100% - 32px);
  max-width: 400px;
  margin: 0 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: visible;
  transition: transform 0.3s ease;
}

.play-screen__card.slide-right {
  animation: slide-right 0.3s ease forwards;
}

.play-screen__card.slide-left {
  animation: slide-left 0.3s ease forwards;
}

.play-screen__card.shake {
  animation: shake-card 0.2s ease;
}

@keyframes slide-right {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

@keyframes slide-left {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-100%); opacity: 0; }
}

@keyframes shake-card {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.play-screen__card-inner {
  padding: 40px 24px 24px;
  /* ノート罫線風の背景 */
  background-image: repeating-linear-gradient(
    transparent,
    transparent 31px,
    #f0f0f0 31px,
    #f0f0f0 32px
  );
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.play-screen__card-page {
  position: absolute;
  bottom: 16px;
  left: 20px;
  font-size: 0.875rem;
  color: #e67e22;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.play-screen__card-expression {
  font-size: 2.5rem;
  font-weight: 900;
  color: #1a237e;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* スタンプ */
.play-screen__stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

.play-screen__stamp--correct {
  width: 160px;
  height: 160px;
  filter: drop-shadow(0 0 15px rgba(220, 38, 38, 0.4));
}

.play-screen__stamp--correct::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  z-index: -1;
  border-radius: 50%;
}

.play-screen__stamp--correct.animate::before {
  animation: correct-flash 0.4s ease-out forwards;
}

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

.play-screen__stamp-hanamaru {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.play-screen__stamp--correct.animate .play-screen__stamp-hanamaru {
  animation: hanamaru-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes hanamaru-pop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.hanamaru-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.3));
}

.play-screen__stamp--correct.animate .hanamaru-path {
  animation: draw-stroke 0.6s ease-out forwards;
}

@keyframes draw-stroke {
  to { stroke-dashoffset: 0; }
}

.play-screen__stamp--miss {
  padding: 12px 40px;
  background: rgba(13, 71, 161, 0.8);
  color: #fff;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 
    0 8px 20px rgba(13, 71, 161, 0.3),
    inset 0 0 20px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -50%) rotate(-15deg);
  backdrop-filter: blur(4px);
}

.play-screen__stamp--miss.animate {
  animation: miss-slam 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes miss-slam {
  0% { transform: translate(-50%, -50%) rotate(-15deg) scale(3); opacity: 0; }
  60% { transform: translate(-50%, -50%) rotate(-15deg) scale(0.9); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-15deg) scale(1); opacity: 1; }
}

.play-screen__stamp-text {
  font-family: 'Arial Black', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.1em;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  display: block;
}

/* タイムエフェクト */
.play-screen__time-effect {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  --effect-dx: 0px;
  --effect-dy: -60px;
  font-family: 'Arial Black', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 20;
  will-change: transform, opacity;
  white-space: nowrap;
  -webkit-text-stroke: 1.5px #fff;
  paint-order: stroke fill;
}

.play-screen__time-effect--bonus {
  color: #00c853;
  text-shadow: 0 4px 12px rgba(0, 200, 83, 0.4);
}

.play-screen__time-effect--bonus.animate {
  animation: bonus-fly-dynamic 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes bonus-fly-dynamic {
  0% {
    transform: translateX(-50%) translateY(20px) scale(0.5) rotate(-10deg);
    opacity: 0;
  }
  20% {
    transform: translateX(-50%) translateY(0) scale(1.2) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(calc(-50% + var(--effect-dx))) translateY(var(--effect-dy)) scale(0.4);
    opacity: 0;
  }
}

.play-screen__time-effect--penalty {
  color: #ff1744;
  text-shadow: 0 4px 12px rgba(255, 23, 68, 0.4);
}

.play-screen__time-effect--penalty.animate {
  animation: penalty-fly 0.6s ease-in forwards;
}

@keyframes penalty-fly {
  0% {
    transform: translateX(-50%) translateY(0) scale(0.5);
    opacity: 0;
  }
  30% {
    transform: translateX(-50%) translateY(0) scale(1.5);
    opacity: 1;
  }
  100% {
    transform: translateX(calc(-50% + var(--effect-dx))) translateY(var(--effect-dy)) scale(0.2);
    opacity: 0;
  }
}

/* 得点エフェクト */
.play-screen__score-effect {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  --effect-dx: 0px;
  --effect-dy: -40px;
  font-family: 'Arial Black', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  color: #2979ff;
  -webkit-text-stroke: 2px #fff;
  paint-order: stroke fill;
  text-shadow: 0 4px 15px rgba(41, 121, 255, 0.5);
  pointer-events: none;
  z-index: 25;
  will-change: transform, opacity;
}

.play-screen__score-effect.fever {
  color: #ffea00;
  -webkit-text-stroke: 2px #ff6d00;
  text-shadow: 0 0 20px rgba(255, 234, 0, 0.8);
  font-size: 4rem;
}

.play-screen__score-effect.animate {
  animation: score-fly-dynamic 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes score-fly-dynamic {
  0% {
    transform: translateX(-50%) translateY(20px) scale(0.5);
    opacity: 0;
  }
  30% {
    transform: translateX(-50%) translateY(0) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translateX(calc(-50% + var(--effect-dx))) translateY(var(--effect-dy)) scale(0.2);
    opacity: 0;
  }
}

/* 終了エフェクト */
.play-screen__finish-effect {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 27, 61, 0.4);
  backdrop-filter: blur(2px);
  z-index: 2000;
  font-family: inherit;
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 
    0 0 20px rgba(255, 107, 53, 0.8),
    0 4px 15px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.1em;
  pointer-events: none;
  opacity: 0;
}

.play-screen__finish-effect.animate {
  animation: finish-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes finish-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 判定ボタンエリア */
.play-screen__footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  background: transparent;
}

.play-screen__btn {
  width: 160px;
  height: 180px;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, opacity 0.1s ease;
  position: relative;
  cursor: pointer;
}

.play-screen__btn:active {
  transform: translateY(4px);
  opacity: 0.9;
}

.play-screen__btn-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 画面フラッシュエフェクト */
body.flash-red::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(244, 67, 54, 0.3);
  pointer-events: none;
  animation: flash 0.15s ease-out;
  z-index: 9999;
}

@keyframes flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* LINEミニアプリ対応 */
.liff-in-client .play-screen__footer {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
}

/* =============================================
   Result Screen
   ============================================= */
.result-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 0; /* スタッキングコンテキストを確立（子要素の z-index: -1 が body の後ろに回らないようにする） */
}

.result-screen__background {
  position: fixed;
  inset: 0;
  background-image: url('/static/images/bg_result.5bcbf10b.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  filter: blur(4px);
}

/* メインコンテンツ */
.result-screen__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* スコアカード */
.result-screen__score-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  text-align: center;
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* カードヘッダー */
.result-screen__card-header {
  margin-bottom: 24px;
}

.result-screen__card-subtitle {
  font-size: 0.75rem;
  font-weight: 400;
  color: #999;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.result-screen__card-title {
  font-size: 2rem;
  font-weight: 900;
  color: #0f1b3d;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #0f1b3d;
  line-height: 1.2;
}

/* メトリクス */
.result-screen__metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.result-screen__metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.result-screen__metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-screen__metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f1b3d;
  font-variant-numeric: tabular-nums;
}

.result-screen__metric-value--score {
  color: #1976d2;
}

.result-screen__metric-value--streak {
  color: #ff6b35;
}

/* 称号スタンプ（赤い枠） */
.result-screen__title-stamp {
  display: inline-block;
  padding: 16px 70px;
  border: 4px solid #e53935;
  border-radius: 8px;
  margin: 16px 0;
  position: relative;
  background: transparent;
}

.result-screen__title-name {
  font-size: 1.5rem;
  font-weight: 900;
  color: #e53935;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

/* 称号スタンプ演出（スケールイン + ランダム位置・回転） */
.result-screen__title-stamp {
  /* CSS変数のデフォルト値（JSで上書きされる） */
  --stamp-rotate: 0deg;
  --stamp-translate-x: 0px;
  --stamp-translate-y: 0px;
}

.result-screen__title-stamp.animate {
  animation: stamp-scale-in-random 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes stamp-scale-in-random {
  0% {
    transform:
      translate(var(--stamp-translate-x), var(--stamp-translate-y))
      rotate(var(--stamp-rotate))
      scale(0);
    opacity: 0;
  }
  60% {
    transform:
      translate(var(--stamp-translate-x), var(--stamp-translate-y))
      rotate(var(--stamp-rotate))
      scale(1.1);
    opacity: 1;
  }
  100% {
    transform:
      translate(var(--stamp-translate-x), var(--stamp-translate-y))
      rotate(var(--stamp-rotate))
      scale(1);
    opacity: 1;
  }
}

/* フッター（ボタン） */
.result-screen__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.result-screen__btn {
  width: 100%;
  max-width: 320px;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.result-screen__btn:active {
  transform: translateY(2px);
  opacity: 0.9;
}

.result-screen__btn--retry {
  background: #1976d2;
  color: #fff;
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.result-screen__btn--retry:active {
  box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
}

.result-screen__btn--share {
  background: #06c755;
  color: #fff;
  box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

.result-screen__btn--share:active {
  box-shadow: 0 2px 6px rgba(6, 199, 85, 0.3);
}

.result-screen__btn--top {
  background: #fff;
  border: 2px solid #e0e0e0;
  color: #666;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-screen__btn--top:active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.result-screen__btn-label {
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.result-screen__btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
}

/* エラー画面の追加スタイル */
.error-screen__buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.error-screen__top-button {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  color: #666;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.error-screen__top-button:active {
  background: #f5f5f5;
}

/* LINEミニアプリ対応 */
.liff-in-client .result-screen__footer {
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
}

/* 高さが低い端末向け */
@media (max-height: 700px) {
  .result-screen__main {
    padding: 12px 16px;
  }

  .result-screen__score-card {
    padding: 24px 20px;
  }

  .result-screen__card-title {
    font-size: 1.5rem;
  }

  .result-screen__metrics {
    gap: 12px;
    margin-bottom: 16px;
  }

  .result-screen__title-stamp {
    padding: 12px 24px;
    margin: 12px 0;
  }

  .result-screen__title-name {
    font-size: 1.25rem;
  }

  .result-screen__footer {
    gap: 8px;
    padding: 12px 16px;
  }

  .result-screen__btn {
    padding: 12px 20px;
    font-size: 1rem;
  }
}

/* =============================================
   Animations
   ============================================= */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.9;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================
   Responsive Design
   ============================================= */
/* 高さが低い端末向け（LINEミニアプリ対応） */
@media (max-height: 700px) {
  .top-screen__main {
    gap: 12px;
    padding: 8px 12px;
    justify-content: flex-start;
    padding-top: 4px;
  }

  .top-screen__best-score {
    width: 320px;
    max-width: 90%;
    padding: 8px 16px;
    gap: 2px;
  }

  .top-screen__best-score-value {
    font-size: 1.5rem;
  }

  .top-screen__start-button {
    width: 320px;
    max-width: 90%;
    margin-top: 8px;
  }

  .top-screen__howto-button {
    width: 320px;
    max-width: 90%;
    font-size: 1rem;
  }

  .top-screen__shortcut-button {
    width: 320px;
    max-width: 90%;
    font-size: 0.95rem;
  }

  .top-screen__nickname-form {
    max-width: 320px;
  }

  .top-screen__nickname-input {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
}

/* LINEミニアプリ内での高さが低い端末向け（さらに縮小） */
@media (max-height: 700px) {
  .liff-in-client .top-screen__main {
    gap: 10px;
    padding: 6px 10px;
    padding-top: 2px;
  }

  .liff-in-client .top-screen__logo {
    width: 180px;
    margin-bottom: 0;
  }

  .liff-in-client .top-screen__best-score {
    width: 320px;
    max-width: 90%;
    padding: 6px 14px;
    gap: 2px;
  }

  .liff-in-client .top-screen__best-score-value {
    font-size: 1.4rem;
  }

  .liff-in-client .top-screen__start-button {
    width: 320px;
    max-width: 90%;
    margin-top: 6px;
  }

  .liff-in-client .top-screen__howto-button {
    width: 320px;
    max-width: 90%;
    font-size: 0.95rem;
  }

  .liff-in-client .top-screen__shortcut-button {
    width: 320px;
    max-width: 90%;
    font-size: 0.9rem;
  }

  .liff-in-client .top-screen__nickname-form {
    max-width: 320px;
  }
}

/* 高さが低い端末向け（プレイ画面） */
@media (max-height: 700px) {
  .play-screen__header {
    padding: 14px 12px 8px;
  }

  .play-screen__header-card {
    padding: 18px 12px 10px;
  }

  .play-screen__header-top {
    margin-bottom: 6px;
  }

  .play-screen__stat-label {
    font-size: 0.6rem;
  }

  .play-screen__time-value {
    font-size: 1.6rem;
  }

  .play-screen__time-unit {
    font-size: 0.85rem;
  }

  .play-screen__stat-value {
    font-size: 1.4rem;
  }

  .play-screen__score-badge {
    font-size: 1rem;
    padding: 2px 10px;
  }

  .play-screen__time-bar-container {
    height: 6px;
  }

  .play-screen__freeze-timer {
    width: 70px;
    height: 70px;
    top: -5px;
    left: 5px;
  }

  .play-screen__freeze-label {
    font-size: 0.6rem;
  }

  .play-screen__freeze-value {
    font-size: 1.8rem;
  }

  .play-screen__freeze-unit {
    font-size: 0.7rem;
  }

  .play-screen__main {
    padding: 12px;
  }

  .play-screen__card {
    max-width: 340px;
  }

  .play-screen__card-inner {
    padding: 32px 20px 18px;
    min-height: 170px;
  }

  .play-screen__card-expression {
    font-size: 2.1rem;
  }

  .play-screen__footer {
    gap: 12px;
    padding: 12px;
    padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
  }

  .play-screen__btn {
    width: 130px;
    height: 150px;
  }

  .liff-in-client .play-screen__footer {
    padding-bottom: calc(50px + 34px);
  }
}

/* セーフエリア対応（iOSのセーフエリア用、LINEミニアプリでは固定値を使用） */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  /* LINE内ブラウザでiOSのセーフエリアがある場合のみ適用 */
  .liff-external-browser .top-screen {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* =============================================
   Toast Notification
   設計書7.3節「シェア機能」準拠
   ============================================= */
.toast-notification {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
  word-break: break-word;
}

.toast-notification--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* リザルト画面のフッター上に表示されるよう調整 */
.result-screen .toast-notification {
  bottom: 140px;
}

/* 小さい画面での調整 */
@media (max-height: 600px) {
  .toast-notification {
    bottom: 80px;
    padding: 10px 20px;
    font-size: 13px;
  }
}

/* =============================================
   Modal Base
   画面設計書 3.5〜3.8節 モーダル仕様準拠
   - fade-in: 0.25秒
   - modal-in: 0.25秒
   ============================================= */

/* モーダルコンテナ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

/* モーダル表示状態 */
.modal.modal--visible {
  display: flex;
}

/* モーダル背景（オーバーレイ） */
.modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  animation: modal-fade-in 0.25s ease-out;
}

/* モーダルコンテンツ */
.modal__content {
  position: relative;
  width: calc(100% - 32px);
  max-width: 400px;
  max-height: calc(100% - 80px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.25s ease-out;
}

/* モーダルヘッダー */
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* モーダルタイトル */
.modal__title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.modal__subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* 閉じるボタン */
.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #6b7280;
  font-size: 24px;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal__close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal__close:active {
  background: #e5e7eb;
}

/* モーダルボディ */
.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* モーダルフッター */
.modal__footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* ホーム画面追加ガイド */
.shortcut-guide__lead {
  margin: 0 0 14px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #374151;
}

.shortcut-guide__section {
  margin-bottom: 16px;
}

.shortcut-guide__heading {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #111827;
}

.shortcut-guide__steps {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
  color: #374151;
}

.shortcut-guide__steps li {
  margin-bottom: 6px;
}

.shortcut-guide__note {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #6b7280;
}

/* モーダルアニメーション */
@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* LINEミニアプリ セーフエリア対応 */
.liff-in-client .modal__content {
  max-height: calc(100% - 80px - 34px);
  margin-bottom: 34px;
}

/* レスポンシブ対応（高さ700px未満） */
@media (max-height: 700px) {
  .modal__content {
    max-height: calc(100% - 48px);
  }

  .modal__header {
    padding: 12px 16px;
  }

  .modal__body {
    padding: 16px;
  }

  .modal__title {
    font-size: 16px;
  }
}

/* =============================================
   お知らせモーダル
   ============================================= */

/* お知らせリスト */
.announcement__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* お知らせアイテム */
.announcement__item {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease;
}

.announcement__item:hover {
  background: #f3f4f6;
}

/* 未読アイテム */
.announcement__item--unread {
  background: #eff6ff;
  border-left-color: #3b82f6;
}

.announcement__item--unread:hover {
  background: #dbeafe;
}

/* お知らせヘッダー */
.announcement__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

/* カテゴリバッジ */
.announcement__category {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.announcement__category--important {
  background: #ef4444;
}

.announcement__category--update {
  background: #3b82f6;
}

.announcement__category--event {
  background: #10b981;
}

.announcement__category--default {
  background: #6b7280;
}

/* 日付 */
.announcement__date {
  font-size: 12px;
  color: #9ca3af;
}

/* タイトル */
.announcement__title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}

/* 本文 */
.announcement__body {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.5;
  margin-top: 6px;
  white-space: pre-wrap;
}

/* 空状態 */
.announcement__empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* ローディング状態 */
.announcement__loading {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* 未読バッジ（ヘッダーアイコン上） */
.top-screen__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================================
   ランキングモーダル
   画面設計書 3.6節「ランキングモーダル」準拠
   - 日次ランキング表示（上位10名）
   - メダルバッジ（1位:金、2位:銀、3位:銅）
   - 自己ハイライト（ログインユーザーの順位を強調）
   - 同率同順位対応
   ============================================= */

/* ランキングリスト */
.ranking__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ランキングアイテム */
.ranking__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.ranking__item:hover {
  background: #f3f4f6;
}

/* 自己ハイライト */
.ranking__item--current-user {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #3b82f6;
}

.ranking__item--current-user:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

/* メダル付きアイテム */
.ranking__item--medal {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.ranking__item--medal:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

/* 順位表示エリア */
.ranking__rank {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 順位番号 */
.ranking__rank-number {
  font-size: 18px;
  font-weight: 700;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

/* メダル絵文字 */
.ranking__medal {
  font-size: 24px;
  line-height: 1;
}

/* ユーザー情報エリア */
.ranking__info {
  flex: 1;
  min-width: 0;
}

/* ニックネーム */
.ranking__nickname {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 称号 */
.ranking__title {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* スコア表示（正解数 + スコアポイント） */
.ranking__stats {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ranking__correct {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

.ranking__score {
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 700;
  color: #1976d2;
  font-variant-numeric: tabular-nums;
}

.ranking__score-unit {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-left: 2px;
}

/* 区切り線（自己ランキングがトップ10外の場合） */
.ranking__separator {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #e5e7eb 50%, transparent 100%);
  margin: 8px 0;
}

/* 空状態 */
.ranking__empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* ローディング状態 */
.ranking__loading {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* 日付表示 */
.ranking__date {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  margin-bottom: 12px;
}

/* レスポンシブ対応（高さ700px未満） */
@media (max-height: 700px) {
  .ranking__item {
    padding: 10px;
    gap: 10px;
  }

  .ranking__rank-number {
    font-size: 16px;
  }

  .ranking__medal {
    font-size: 20px;
  }

  .ranking__nickname {
    font-size: 13px;
  }

  .ranking__correct {
    font-size: 10px;
  }

  .ranking__score {
    font-size: 18px;
  }
}

/* =============================================
   ハイスコアモーダル
   画面設計書4.2節「ハイスコアモーダル」準拠
   - 自分のプレイ履歴（スコアポイント上位10件）表示
   - ランキングモーダルと同じデザイン
   ============================================= */

/* ハイスコアリスト */
.my-records__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ハイスコアイテム */
.my-records__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.my-records__item:hover {
  background: #f3f4f6;
}

/* 上位3位のハイライト */
.my-records__item--top3 {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.my-records__item--top3:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

/* 順位表示エリア */
.my-records__rank {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 順位番号 */
.my-records__rank-number {
  font-size: 18px;
  font-weight: 700;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

/* メダル絵文字 */
.my-records__medal {
  font-size: 24px;
  line-height: 1;
}

/* 情報エリア */
.my-records__info {
  flex: 1;
  min-width: 0;
}

/* 称号 */
.my-records__title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 日付 */
.my-records__date {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* スコア表示（正解数 + スコアポイント） */
.my-records__stats {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.my-records__correct {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

.my-records__score {
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 700;
  color: #1976d2;
  font-variant-numeric: tabular-nums;
}

/* 空状態 */
.my-records__empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* ローディング状態 */
.my-records__loading {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* レスポンシブ対応（高さ700px未満） */
@media (max-height: 700px) {
  .my-records__item {
    padding: 10px;
    gap: 10px;
  }

  .my-records__rank-number {
    font-size: 16px;
  }

  .my-records__medal {
    font-size: 20px;
  }

  .my-records__title {
    font-size: 13px;
  }

  .my-records__correct {
    font-size: 10px;
  }

  .my-records__score {
    font-size: 18px;
  }
}

/* =============================================
   遊び方モーダル
   画面設計書 3.7節「遊び方モーダル」準拠
   - ルール説明
   - 操作ガイド（○/×ボタンの説明）
   ============================================= */

/* セクション */
.howto__section {
  margin-bottom: 20px;
}

.howto__section:last-child {
  margin-bottom: 0;
}

/* 見出し */
.howto__heading {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

/* ルール説明リスト */
.howto__rules {
  list-style: none;
  margin: 0;
  padding: 0;
}

.howto__rules li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
}

.howto__rules li::before {
  content: "・";
  position: absolute;
  left: 8px;
  color: #3b82f6;
  font-weight: 700;
}

/* 操作方法 */
.howto__operations {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.howto__operation {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background: #f9fafb;
}

.howto__operation--correct {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 2px solid #fca5a5;
}

.howto__operation--incorrect {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #93c5fd;
}

/* ボタンアイコン */
.howto__button-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 900;
  flex-shrink: 0;
}

.howto__operation--correct .howto__button-icon {
  background: #ef4444;
  color: #fff;
}

.howto__operation--incorrect .howto__button-icon {
  background: #3b82f6;
  color: #fff;
}

/* 説明テキスト */
.howto__description {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

/* コンボボーナスリスト */
.howto__bonuses {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.howto__bonuses li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border-radius: 8px;
  font-size: 14px;
  color: #1f2937;
}

.howto__bonuses li strong {
  color: #d97706;
}

/* レスポンシブ対応（高さ700px未満） */
@media (max-height: 700px) {
  .howto__section {
    margin-bottom: 16px;
  }

  .howto__heading {
    font-size: 13px;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  .howto__rules li {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .howto__operation {
    padding: 12px;
    gap: 12px;
  }

  .howto__button-icon {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .howto__description {
    font-size: 13px;
  }

  .howto__bonuses li {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* =============================================
   設定モーダル
   画面設計書 3.8節「設定モーダル」準拠
   - SE切替トグル
   - ユーザー情報表示
   - 外部リンク
   ============================================= */

/* セクション */
.settings__section {
  margin-bottom: 24px;
}

.settings__section:last-child {
  margin-bottom: 0;
}

/* 見出し */
.settings__heading {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* トグルスイッチ */
.settings__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 12px;
  cursor: pointer;
}

.settings__toggle-label {
  font-size: 15px;
  font-weight: 500;
  color: #1f2937;
}

.settings__toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings__toggle-slider {
  position: relative;
  width: 52px;
  height: 28px;
  background: #d1d5db;
  border-radius: 14px;
  transition: background-color 0.2s ease;
}

.settings__toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.settings__toggle-input:checked + .settings__toggle-slider {
  background: #3b82f6;
}

.settings__toggle-input:checked + .settings__toggle-slider::after {
  transform: translateX(24px);
}

/* ユーザー情報 */
.settings__info {
  background: #f9fafb;
  border-radius: 12px;
  overflow: hidden;
}

.settings__info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.settings__info-row + .settings__info-row {
  border-top: 1px solid #e5e7eb;
}

.settings__info-label {
  font-size: 14px;
  color: #6b7280;
}

.settings__info-value {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
}

/* 外部リンク */
.settings__links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f9fafb;
  border-radius: 12px;
  overflow: hidden;
}

.settings__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  color: #1f2937;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.settings__link:hover {
  background: #f3f4f6;
}

.settings__link:active {
  background: #e5e7eb;
}

.settings__link + .settings__link {
  border-top: 1px solid #e5e7eb;
}

.settings__link-icon {
  color: #9ca3af;
  font-size: 16px;
}

/* レスポンシブ対応（高さ700px未満） */
@media (max-height: 700px) {
  .settings__section {
    margin-bottom: 20px;
  }

  .settings__heading {
    font-size: 11px;
    margin-bottom: 10px;
  }

  .settings__toggle {
    padding: 10px 14px;
  }

  .settings__toggle-label {
    font-size: 14px;
  }

  .settings__toggle-slider {
    width: 48px;
    height: 26px;
  }

  .settings__toggle-slider::after {
    width: 22px;
    height: 22px;
  }

  .settings__toggle-input:checked + .settings__toggle-slider::after {
    transform: translateX(22px);
  }

  .settings__info-row {
    padding: 10px 14px;
  }

  .settings__info-label,
  .settings__info-value {
    font-size: 13px;
  }

  .settings__link {
    padding: 12px 14px;
    font-size: 13px;
  }
}
