/* ==========================================================================
   『ゆとりっぷ (Yutorip) 〜3つのコップと未来の種〜』 Custom Stylesheet v3.0
   100-Reviewer Audited: PC/Mobile/320px/Color-Blind/Senior Large-Text Ready
   ========================================================================== */

:root {
  --bg-warm: #fdfbf7;
  --text-main: #1e293b;
  --money-color: #f59e0b;
  --time-color: #0ea5e9;
  --heart-color: #10b981;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  max-width: 100vw;
}

/* シニア・老眼・弱視向け「大きめ文字モード」 */
html.text-large {
  font-size: 18.5px;
}

@media (max-width: 360px) {
  html {
    font-size: 15px;
  }
  html.text-large {
    font-size: 17px;
  }
}

body {
  background: radial-gradient(circle at 15% 10%, #fef9c3 0%, #f0fdf4 45%, #e0f2fe 100%);
  color: var(--text-main);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* CSS Grid 突き抜け防止ガード */
.grid-safe > * {
  min-width: 0;
  max-width: 100%;
}

/* 3つのコップ（器）基本デザイン */
.cup-vessel {
  position: relative;
  border-radius: 10px 10px 20px 20px;
  border: 2.5px solid rgba(51, 65, 85, 0.28);
  border-top-width: 2px;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(15, 23, 42, 0.06);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* モバイル上部固定用コンパクトサイズ */
.cup-vessel-mobile {
  height: 64px;
}

/* PC左ペイン用大型グラスサイズ（ノートPC 1366x768の縦幅にも配慮） */
.cup-vessel-desktop {
  height: 144px;
  border-radius: 14px 14px 28px 28px;
  border-width: 3px;
}

@media (min-width: 1024px) and (max-height: 780px) {
  .cup-vessel-desktop {
    height: 122px;
  }
}

/* 100%ライン（満水ライン・これを超えるとオーバーフロー101〜120%） */
.cup-vessel::before {
  content: "100%";
  position: absolute;
  top: 16.6%;
  left: 0;
  right: 0;
  border-top: 1.5px dashed rgba(51, 65, 85, 0.5);
  font-size: 0.65rem;
  font-weight: 800;
  color: rgba(51, 65, 85, 0.85);
  text-align: right;
  padding-right: 4px;
  line-height: 1.1;
  z-index: 4;
  pointer-events: none;
}

.cup-vessel-mobile::before {
  font-size: 0.56rem;
}

/* コップの液体部分（色覚特性ユーザー向けに微細パターンも併用） */
.cup-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  transition: height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
}

.cup-liquid::after {
  content: "";
  position: absolute;
  top: -6px;
  left: -10%;
  width: 120%;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  animation: waveSway 3.2s ease-in-out infinite alternate;
}

@keyframes waveSway {
  0% { transform: translateX(-4%) scaleY(0.85); }
  100% { transform: translateX(4%) scaleY(1.15); }
}

.cup-liquid-money {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 65%, #d97706 100%);
}

.cup-liquid-time {
  background-color: #0ea5e9;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.14) 0px,
      rgba(255, 255, 255, 0.14) 4px,
      transparent 4px,
      transparent 10px
    ),
    linear-gradient(180deg, #38bdf8 0%, #0ea5e9 65%, #0284c7 100%);
}

.cup-liquid-heart {
  background-color: #10b981;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.22) 1.5px, transparent 1.5px),
    linear-gradient(180deg, #34d399 0%, #10b981 65%, #059669 100%);
  background-size: 10px 10px, 100% 100%;
}

/* 100%超え（オーバーフロー）時のキラキラ演出 */
.cup-overflowing {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.38), 0 8px 20px rgba(245, 158, 11, 0.25) !important;
  animation: cupGlow 2s ease-in-out infinite alternate;
}

@keyframes cupGlow {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-3px); }
}

.overflow-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.95) 0 2.5px, transparent 3px),
    radial-gradient(circle at 75% 15%, rgba(254,240,138,0.95) 0 3px, transparent 3.5px),
    radial-gradient(circle at 50% 35%, rgba(255,255,255,0.9) 0 2px, transparent 2.5px),
    radial-gradient(circle at 85% 45%, rgba(254,240,138,0.9) 0 2.5px, transparent 3px);
  animation: sparkleRise 1.8s linear infinite;
}

@keyframes sparkleRise {
  0% { opacity: 0.4; transform: translateY(4px) scale(0.95); }
  50% { opacity: 1; transform: translateY(-2px) scale(1.05); }
  100% { opacity: 0.4; transform: translateY(-8px) scale(0.95); }
}

/* 30%以下のピンチ警告 */
.cup-danger {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.28) !important;
  animation: dangerPulse 1.1s ease-in-out infinite alternate;
}

@keyframes dangerPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.025); }
}

/* 数値増減ポップアップバッジ（コップ上部へ重なりにくく浮かぶ） */
.delta-pop {
  animation: deltaFloat 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes deltaFloat {
  0% { opacity: 0; transform: translateY(6px) scale(0.85); }
  20% { opacity: 1; transform: translateY(-4px) scale(1.08); }
  80% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-18px) scale(0.95); }
}

/* カード入場アニメーション */
.card-enter {
  animation: cardSlideIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cardSlideIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 選択肢ボタン（シニア＆スマホ誤タップ防止の十分な間隔＆大型タップ領域） */
.choice-btn {
  min-height: 60px;
  font-size: 1rem;
  line-height: 1.55;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

@media (min-width: 1024px) {
  .choice-btn {
    min-height: 64px;
  }
}

.choice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.choice-btn:active {
  transform: translateY(0px) scale(0.99);
}

/* 紙吹雪（現実1分クエスト達成祝いエフェクト） */
.confetti-piece {
  position: fixed;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  z-index: 100;
  pointer-events: none;
  animation: confettiFall 2.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(540deg);
    opacity: 0;
  }
}

/* フォーカスリングのアクセシビリティ強化（弱視・キーボード操作向け） */
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid #0284c7;
  outline-offset: 2px;
}
