:root {
  --primary-color: #ff6b6b;
  --secondary-color: #4ecdc4;
  --accent-color: #ffb86c;
  --bg-color: #f0f8ff;
  --text-color: #333;
}

body {
  font-family: 'Hiragino Maru Gothic ProN', 'Meiryo', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0; padding: 20px;
}
body.is-fullscreen { padding: 0; background-color: white; }

.app-container {
  max-width: 1000px; margin: 0 auto; background: white;
  padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
body.is-fullscreen .app-container { max-width: 100%; height: 100vh; border-radius: 0; display: flex; flex-direction: column; overflow-y: auto;}

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 10px; border-bottom: 2px solid #eee; }
h1 { color: var(--primary-color); margin: 0; font-size: 26px; }
.header-right { display: flex; align-items: center; gap: 15px; }

.icon-btn { background: none; border: 1px solid #ddd; font-size: 18px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.sound-control { display: flex; align-items: center; gap: 8px; font-weight: bold; color: #555; font-size: 14px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--secondary-color); }
input:checked + .slider:before { transform: translateX(20px); }

.view-section { display: none; flex-direction: column; align-items: center; width: 100%; }
.view-section.active { display: flex; }

/* モード選択 */
.mode-buttons { display: flex; gap: 20px; margin-top: 30px; flex-wrap: wrap; justify-content: center; }
.mode-btn { padding: 30px; font-size: 24px; font-weight: bold; border: none; border-radius: 15px; cursor: pointer; transition: transform 0.2s; color: white; box-shadow: 0 6px 0 rgba(0,0,0,0.2); }
.mode-btn:hover { transform: translateY(-4px); }
.mode-btn small { font-size: 14px; font-weight: normal; display: block; margin-top: 10px; }
.teacher-btn { background-color: var(--primary-color); }
.student-btn { background-color: var(--secondary-color); }

/* 先生モード */
.teacher-layout { display: flex; width: 100%; gap: 30px; flex-wrap: wrap; justify-content: center;}
.draw-area { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 300px; }
.drawn-number-box { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 20px; }
.current-number { font-size: 120px; font-weight: 900; color: var(--primary-color); text-shadow: 3px 3px 0px #fff, 6px 6px 0px rgba(255,107,107,0.3); width: 180px; text-align: center; line-height: 1;}
.sparkle { font-size: 50px; animation: blink 1s infinite alternate; color: #ffd700; }
@keyframes blink { from { opacity: 0.5; transform: scale(0.8); } to { opacity: 1; transform: scale(1.1); } }

.spin-btn { background-color: var(--primary-color); color: white; border: none; padding: 20px 50px; font-size: 24px; font-weight: bold; border-radius: 50px; cursor: pointer; transition: transform 0.2s; box-shadow: 0 6px 0 #d9534f; }
.spin-btn:active { transform: translateY(6px); box-shadow: 0 0 0 transparent; }
.spin-btn:disabled { background-color: #ccc; box-shadow: 0 6px 0 #999; cursor: not-allowed; }
.result { margin-top: 20px; font-size: 24px; font-weight: bold; color: #555; }

.board-area { flex: 1.5; background: #f8f9fa; padding: 20px; border-radius: 15px; border: 2px solid #eee; min-width: 320px; width: 100%; box-sizing: border-box;}
.board-area h3 { margin-top: 0; color: var(--secondary-color); text-align: center; }
.number-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.board-cell { aspect-ratio: 1; display: flex; justify-content: center; align-items: center; background: white; border: 1px solid #ddd; border-radius: 4px; font-size: clamp(12px, 3vw, 16px); font-weight: bold; color: #ccc; transition: all 0.3s; }
.board-cell.drawn { background-color: var(--accent-color); color: white; border-color: var(--accent-color); transform: scale(1.1); box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 2; }

/* ✅ 子どもモード（完璧なビンゴカード） */
.student-controls { display: flex; gap: 15px; margin-bottom: 20px; width: 100%; justify-content: center; flex-wrap: wrap;}
.update-btn { background-color: var(--secondary-color); color: white; border: none; padding: 12px 25px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
.bingo-btn { background-color: #ffd700; color: #d35400; border: none; padding: 12px 30px; font-size: 20px; font-weight: 900; border-radius: 30px; cursor: pointer; box-shadow: 0 4px 0 #e67e22; transition: transform 0.2s; }
.bingo-btn:not(:disabled):hover { transform: scale(1.05); }
.bingo-btn:disabled { background-color: #eee; color: #aaa; box-shadow: none; cursor: not-allowed; }

.bingo-card-wrapper { width: 100%; max-width: 500px; margin: 0 auto; }
.bingo-card { border: 3px solid var(--primary-color); border-radius: 10px; overflow: hidden; background-color: #fff; box-shadow: 0 6px 15px rgba(0,0,0,0.15); }

/* BINGOの文字部分 */
.bingo-header { display: grid; grid-template-columns: repeat(5, 1fr); background-color: var(--primary-color); color: white; font-size: clamp(20px, 6vw, 32px); font-weight: bold; text-align: center; }
.bingo-header div { padding: 10px 0; }

/* 5x5のマス目部分（Gridレイアウト） */
.bingo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; background-color: #eee; }
.bingo-cell { 
  aspect-ratio: 1 / 1; /* 絶対に正方形を維持 */
  background-color: white; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  font-size: clamp(20px, 6vw, 36px); 
  font-weight: bold; 
  color: #444; 
  cursor: pointer; 
  position: relative; 
  user-select: none; 
  transition: background-color 0.2s; 
}

/* FREEマスの文字サイズ調整 */
.bingo-cell.free-cell { font-size: clamp(14px, 4vw, 24px); color: var(--primary-color); }

.bingo-cell:hover { background-color: #f9f9f9; }

/* ⭕マークのスタイル */
.bingo-cell.marked { background-color: #ffeaa7; color: #d63031; }
.bingo-cell.marked::after {
  content: "⭕"; 
  position: absolute; 
  font-size: clamp(40px, 12vw, 70px); 
  color: rgba(214, 48, 49, 0.6); 
  pointer-events: none; 
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.back-btn { background: none; border: none; color: #666; text-decoration: underline; cursor: pointer; margin-top: 20px; font-size: 16px; }
.danger-btn { background: none; border: 1px solid #ccc; padding: 8px 15px; border-radius: 5px; color: #999; cursor: pointer; }
.danger-btn:hover { background: #ffebee; color: #d32f2f; border-color: #d32f2f; }

/* 🎉 演出用Canvas */
#effect-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1999; }