/* ============================================
   リセット & ベーススタイル
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  transition: background-image 1.5s ease-in-out;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* 朝焼けの海（1-7問目） */
body.sea-morning {
  background-image: url('images/morning-sea.jpg');
}

/* グラデーションオーバーレイで文字を読みやすく */
body.sea-morning::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.2) 100%);
  pointer-events: none;
  z-index: 0;
}

/* 昼の海（8-14問目） */
body.sea-noon {
  background-image: url('images/noon-sea.jpg');
}

body.sea-noon::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.15) 100%);
  pointer-events: none;
  z-index: 0;
}

/* 夕焼けの海（15-22問目） */
body.sea-sunset {
  background-image: url('images/sunset-sea.jpg');
}

body.sea-sunset::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.2) 100%);
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* ============================================
   見出し
   ============================================ */
h1 {
  font-size: 32px;
  color: white;
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

h2 {
  font-size: 24px;
  color: #333;
  margin-bottom: 20px;
}

h3 {
  font-size: 20px;
  color: #667eea;
  margin-bottom: 15px;
}

/* ============================================
   カード
   ============================================ */
.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 30px;
  margin-bottom: 20px;
  animation: fadeIn 0.5s ease-in-out;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

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

/* ============================================
   フォーム要素
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
  color: #555;
  font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ============================================
   ボタン
   ============================================ */
button {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-family: inherit;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: white;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
  margin: 2px;
}

/* ============================================
   タイマー
   ============================================ */
.timer-container {
  text-align: center;
  margin-bottom: 30px;
}

.timer {
  font-size: 48px;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 1s linear;
}

/* ============================================
   問題表示
   ============================================ */
.question-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: #666;
}

.category-badge {
  background: #667eea;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  display: inline-block;
}

.question-text {
  font-size: 20px;
  line-height: 1.6;
  color: #333;
  margin: 25px 0;
  min-height: 80px;
  font-weight: 500;
}

/* ============================================
   選択肢ボタン
   ============================================ */
.options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.option-btn {
  width: 100%;
  padding: 20px;
  font-size: 18px;
  text-align: left;
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
}

.option-btn:hover:not(:disabled) {
  border-color: #667eea;
  background: #f8f9ff;
  transform: translateX(10px);
}

.option-btn.selected {
  border-color: #667eea;
  background: #667eea;
  color: white;
}

.option-btn.correct {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
  animation: correctPulse 0.5s ease-in-out;
}

.option-btn.incorrect {
  border-color: #dc3545;
  background: #f8d7da;
  color: #721c24;
  animation: incorrectShake 0.5s ease-in-out;
}

.option-btn.show-correct {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
}

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

@keyframes incorrectShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* ============================================
   結果画面
   ============================================ */
.result-box {
  text-align: center;
  padding: 30px;
  background: rgba(248, 249, 250, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.score-display {
  margin-bottom: 20px;
}

.score-number {
  font-size: 48px;
  font-weight: bold;
  color: #667eea;
  font-variant-numeric: tabular-nums;
}

.score-label {
  font-size: 16px;
  color: #666;
  margin-top: 5px;
}

.percentage {
  font-size: 36px;
  font-weight: bold;
  color: #764ba2;
  font-variant-numeric: tabular-nums;
}

.prize-box {
  background: linear-gradient(135deg, rgba(255, 245, 205, 0.9) 0%, rgba(255, 229, 163, 0.9) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 3px solid #ffd700;
  border-radius: 12px;
  padding: 30px;
  margin: 20px 0;
  text-align: center;
}

.prize-box h3 {
  color: #d4af37;
  font-size: 24px;
  margin-bottom: 15px;
}

.prize-info {
  font-size: 14px;
  color: #666;
  margin-top: 15px;
  line-height: 1.8;
}

/* ============================================
   管理者画面
   ============================================ */
.admin-header {
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 24px;
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  flex: 1;
  min-width: 150px;
}

.tab-btn.active {
  background: #667eea;
  color: white;
}

.tab-content {
  display: none;
}

.form-box {
  background: rgba(248, 249, 250, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
  border: 2px solid rgba(224, 224, 224, 0.5);
}

/* ============================================
   テーブル
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.data-table th {
  background: #f8f9fa;
  font-weight: bold;
  color: #333;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: #f8f9ff;
}

.data-table td {
  font-size: 14px;
  color: #555;
}

/* テーブル内のボタン */
.data-table button {
  margin: 2px;
}

/* ============================================
   情報ボックス
   ============================================ */
.info-box {
  background: #e8f4f8;
  border-left: 4px solid #667eea;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
}

.info-box strong {
  color: #667eea;
  font-size: 16px;
}

.info-box p {
  margin: 10px 0 0 0;
  color: #555;
  line-height: 1.8;
}

/* ============================================
   モーダル
   ============================================ */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: #000;
}

/* ============================================
   ユーティリティ
   ============================================ */
.text-center {
  text-align: center;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-20 {
  margin-top: 20px;
}

/* ============================================
   レスポンシブデザイン
   ============================================ */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .container {
    padding: 0;
  }
  
  h1 {
    font-size: 24px;
    margin-bottom: 20px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .card {
    padding: 20px;
  }
  
  .question-text {
    font-size: 18px;
    min-height: 60px;
  }
  
  .option-btn {
    padding: 15px;
    font-size: 16px;
  }
  
  .option-btn:hover:not(:disabled) {
    transform: translateX(5px);
  }
  
  .timer {
    font-size: 36px;
  }
  
  .score-number {
    font-size: 36px;
  }
  
  .percentage {
    font-size: 28px;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab-btn {
    width: 100%;
  }
  
  .data-table {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 4px;
  }
  
  .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
  }
  
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px; /* iOS のズーム防止 */
  }
  
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 20px;
  }
  
  .question-text {
    font-size: 16px;
  }
  
  .option-btn {
    font-size: 14px;
    padding: 12px;
  }
  
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ============================================
   印刷用スタイル
   ============================================ */
@media print {
  body {
    background: white;
    padding: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  button {
    display: none;
  }
  
  .tabs {
    display: none;
  }
}

/* ============================================
   アクセシビリティ
   ============================================ */
:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* スクリーンリーダー専用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   アニメーション
   ============================================ */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   カスタムスクロールバー（Webkit）
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}