/* Unified Slide Styles for 投機信託ダービー (scene01-04)
   Keep scene-specific selectors so individual HTML files stay simple.
   Palette & design tokens */

:root {
  --color-primary: #4a69bd;
  --color-bg-gradient-start: #f5f7fa;
  --color-bg-gradient-end: #c3cfe2;
  --color-panel-bg: #f8f9fa;
  --color-border-soft: #e9ecef;
  --color-text-dark: #333;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-elev-1: 0 2px 5px rgba(0,0,0,0.1);
  --shadow-elev-2: 0 6px 12px rgba(0,0,0,0.15);
  --shadow-card: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);

  /* Fund / category colors */
  --color-ikeike: #ff6b6b;
  --color-sox: #5f27cd;
  --color-leverage: #e84393;
  --color-standard-acwi: #3498db;
  --color-standard-sp500: #2ecc71;
  --color-standard-vti: #1abc9c;
  font-size: 1.6em;
  font-weight: bold;
  color: var(--color-primary);
  --color-dividend-spyd: #e67e22;

/* Runner / lap styling (used in race slide) */
.lap-number {
  font-size: 3.4em;
  font-weight: bold;
  color: var(--color-primary);
  line-height: 1;
}

.lap-label {
  font-size: 1.05em;
  color: #666;
  margin-top: 4px;
}

.progress-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 0.95em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.runner-name { font-size: 1.5em; font-weight: 700; }
.runner-icon { font-size: 3em; }
.track-labels span { font-size: 1em; }
}

/* Base Layout */
body {
  font-family: 'Noto Sans JP', sans-serif;
  /* Increased base font-size for better readability */
  font-size: 18px;
  background: linear-gradient(135deg, var(--color-bg-gradient-start) 0%, var(--color-bg-gradient-end) 100%);
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-text-dark);
}

.slide {
  width: 1920px;
  height: 1080px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.header {
  background: var(--color-primary);
  color: #fff;
  padding: 15px 20px;
  text-align: center;
  font-size: 32px;
  flex-shrink: 0;
}

.footer {
  background: var(--color-primary);
  color: #fff;
  padding: 8px 12px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
}

.content {
  flex: 1;
  display: flex;
  padding: 10px 15px;
  gap: 10px;
  overflow: hidden;
}

/* Allow scenes that need scrolling to add .scrollable to .content */
.content.scrollable { overflow: auto; }

.character-area {
  width: 30%;
  position: relative;
  padding: 0 10px 10px 10px;
  z-index: 2;
  overflow: hidden;
}

.character-container {
  width: 100%;
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#yuki-container {
  top: 10px;
}

#zunda-container {
  top: 285px;
}

.character-slot {
  width: 350px;
  height: 350px;
  flex-shrink: 0;
}

.data-area {
  width: 70%;
  padding: 10px 15px;
  overflow: hidden;
}

/* Character & Speech */
.character-img {
  width: 350px;
  height: 350px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
  display: block;
}
.character-img.compact { /* scene03 variant */
  width: 160px;
  height: 160px;
  margin-bottom: 5px;
}

.speech-bubble {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 8px;
  width: 100%;
  max-width: 280px;
  height: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  font-family: 'Noto Sans JP', 'M PLUS Rounded 1c', sans-serif;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
/* Use visibility approach for initial hidden speech bubbles (follow 4_gathered behavior) */
/* Note: specific slides set inline style="visibility:hidden;" on speech bubbles */
.speech-bubble:after {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  width: 0; height: 0;
  border: 12px solid transparent;
  border-right-color: #ffffff;
  border-left: 0;
  margin-top: -12px;
  filter: drop-shadow(-2px 2px 2px rgba(0,0,0,0.1));
}
.speech-bubble.active {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid var(--color-primary);
  box-shadow: 0 6px 16px rgba(74, 105, 189, 0.3), 0 3px 6px rgba(0,0,0,0.12);
  transform: scale(1.02);
}

/* キャラクターごとのデフォルトカラー */
#yuki-speech {
  color: #1e90ff; /* DodgerBlue */
  border-color: #63b3ff; /* Lighter blue for border accent */
}

#zunda-speech {
  color: #6ab04c;
  border-color: #badc58;
}

@keyframes bubbleHighlight { 0%{transform:scale(1);}50%{transform:scale(1.05);}100%{transform:scale(1);} }

/* Rule / info boxes (scene01) */
.rule-box {
  background: #f1f2f6;
  border-left: 4px solid var(--color-primary);
  padding: 10px 12px;
  margin: 10px 0 15px;
  font-size: 15px;
}

/* Category grid (scene01, scene03 fragments) */
.categories-container { /* 2x2 grid */
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: auto;
  gap: 15px;
  margin-top: 15px;
}
.fund-category {
  background: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-elev-1);
  text-align: center;
}
.fund-category h3 {
  margin: 0 0 8px;
  padding-bottom: 5px;
  border-bottom: 2px solid currentColor;
  font-size: 16px;
}
.fund-list { text-align: left; font-size: 14px; line-height: 1.4; }
.fund-item { margin-bottom: 6px; }

/* Category color helpers */
.ikeike { color: var(--color-ikeike); }
.standard { color: var(--color-standard-acwi); }
.active { color: var(--color-active); }
.dividend { color: var(--color-dividend); }

/* Tabs (scene02) */
.tabs { display: flex; background: #e9ecef; border-radius: 5px 5px 0 0; overflow: hidden; }
.tab { padding: 12px 24px; cursor: pointer; transition: background .3s; font-size: 15px; }
.tab.active { background: var(--color-primary); color: #fff; font-weight: 600; }
.tab:hover:not(.active) { background: #ced4da; }
.tab-content { display: none; padding: 15px; background: var(--color-panel-bg); border-radius: 0 0 5px 5px; margin-bottom: 15px; }
.tab-content.active { display: block; animation: fadeIn .5s; }
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }

/* Fund cards (scene02) */
.fund-card { background:#fff; border-radius:5px; padding:15px; margin-bottom:15px; box-shadow:var(--shadow-elev-1); display:flex; align-items:center; }
.fund-icon { width:60px; height:60px; background:var(--color-primary); border-radius:50%; display:flex; justify-content:center; align-items:center; color:#fff; font-weight:bold; margin-right:15px; flex-shrink:0; font-size:12px; letter-spacing:.5px; }
.fund-details { flex:1; }
.fund-name { font-weight:700; font-size:20px; margin:0 0 6px; }
.fund-desc { font-size:15px; color:#495057; line-height:1.4; }
.characteristic { display:inline-block; background:#e9ecef; padding:3px 8px; border-radius:12px; font-size:12px; margin:5px 5px 0 0; }


/* Scene04: next preview */
.coming-soon { text-align:center; margin-bottom:20px; }
.coming-soon h2 { font-size:36px; color:var(--color-primary); margin:0 0 5px; }
.coming-soon p { font-size:16px; color:#495057; margin:0; }
.mystery-box { background:rgba(255,255,255,.8); border-radius:10px; padding:15px; margin-bottom:15px; box-shadow:0 4px 8px rgba(0,0,0,.1); }
.mystery-title { font-size:22px; font-weight:700; margin:0 0 12px; color:var(--color-primary); display:flex; align-items:center; }
.mystery-title i { margin-right:10px; font-size:26px; }
.mystery-item { background:rgba(255,255,255,.6); border-radius:8px; padding:12px; margin-bottom:12px; display:flex; align-items:center; box-shadow:0 2px 4px rgba(0,0,0,.05); }
.mystery-icon { width:44px; height:44px; background:var(--color-primary); color:#fff; border-radius:50%; display:flex; justify-content:center; align-items:center; font-weight:700; font-size:20px; margin-right:18px; flex-shrink:0; }
.mystery-text { flex:1; font-size:16px; line-height:1.5; }
.mystery-text span { color:var(--color-primary); font-weight:700; }
@keyframes pulse { 0%{transform:scale(1);}50%{transform:scale(1.05);}100%{transform:scale(1);} }
.pulse { animation:pulse 2s infinite; }

/* Utility */
.hidden { display:none !important; }
.sr-only { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; }

/* Responsive fallback (optional)
   Note: Do NOT scale at exactly 1280×720 to keep a perfect fit.
*/
@media (max-width: 1279px) {
  .slide { transform: scale(.9); transform-origin: top left; }
}
@media (max-width: 1100px) {
  .slide { transform: scale(.8); }
}

/* Scene specific wrappers can add classes to tweak (example: add class="compact" to slide for scene03) */
.slide.compact .character-img { width:160px; height:160px; margin-bottom:5px; }

/* Additional overrides: enlarge main body text (non-dialogue) */
.content, .data-area, .rule-box, .tab-content, .fund-desc, .mystery-text, .coming-soon p {
  font-size: 20px;
}

/* Stats and badges — larger for readability */
.stat-box { padding: 14px; }
.stat-label { font-size: 16px; color: #666; margin-bottom: 6px; }
.stat-value { font-size: 2.0em; font-weight: 800; color: var(--color-primary); }

/* Ensure speech bubbles remain the original size */
.speech-bubble { font-size: 15px; }
