/* パーセントクイズ QRコード版 スタイル */

/* リセット */
.pqr-host-root,
.pqr-player-root {
  all: initial;
  display: block !important;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif !important;
  line-height: 1.6 !important;
  color: #333 !important;
}

.pqr-host-root *,
.pqr-player-root * {
  box-sizing: border-box !important;
}

/* ホスト画面コンテナ */
.pqr-host-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pqr-host-header {
  text-align: center;
  margin-bottom: 30px;
  color: white;
}

.pqr-host-header h1 {
  font-size: 2.5em !important;
  margin: 0 0 10px 0 !important;
  color: white !important;
}

.pqr-host-subtitle {
  font-size: 1.1em;
  opacity: 0.9;
  margin: 0 !important;
}

/* 画面切り替え */
.pqr-screen {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* セットアップフォーム */
.pqr-setup-form {
  max-width: 500px;
  margin: 0 auto;
}

.pqr-form-group {
  margin-bottom: 25px;
}

.pqr-form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333 !important;
  font-size: 1.1em;
}

.pqr-number-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.pqr-btn-minus,
.pqr-btn-plus {
  width: 50px !important;
  height: 50px !important;
  background: #667eea !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  font-size: 1.5em !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
}

.pqr-btn-minus:hover,
.pqr-btn-plus:hover {
  background: #5568d3 !important;
  transform: scale(1.1) !important;
}

#pqr-group-count {
  width: 100px;
  height: 60px;
  text-align: center;
  font-size: 2em !important;
  font-weight: bold;
  border: 3px solid #667eea !important;
  border-radius: 10px !important;
  background: white !important;
}

#pqr-question-set {
  width: 100%;
  padding: 15px;
  font-size: 1.1em !important;
  border: 2px solid #ddd !important;
  border-radius: 10px !important;
  background: white !important;
  cursor: pointer !important;
}

/* ボタン */
.pqr-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  padding: 15px 40px !important;
  font-size: 1.2em !important;
  border: none !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  font-weight: bold !important;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
  transition: all 0.2s !important;
}

.pqr-btn-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
}

.pqr-btn-large {
  width: 100%;
  padding: 20px !important;
  font-size: 1.3em !important;
  margin: 20px 0 !important;
}

.pqr-btn-secondary {
  background: #95a5a6 !important;
  color: white !important;
  padding: 12px 30px !important;
  font-size: 1em !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}

.pqr-btn-warning {
  background: #f39c12 !important;
  color: white !important;
  padding: 12px 30px !important;
  font-size: 1em !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  margin-left: 10px !important;
}

/* QRコード表示 */
.pqr-qr-container {
  text-align: center;
}

.pqr-qr-container h2 {
  color: #667eea !important;
  margin-bottom: 10px !important;
}

.pqr-qr-instruction {
  color: #666;
  margin-bottom: 20px;
}

#pqr-qrcode {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

#pqr-qrcode canvas {
  border: 10px solid #667eea;
  border-radius: 15px;
  padding: 10px;
  background: white;
}

.pqr-url-display {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

#pqr-player-url {
  flex: 1;
  padding: 15px;
  border: 2px solid #ddd !important;
  border-radius: 8px !important;
  font-size: 1em !important;
  background: #f8f9fa !important;
}

.pqr-host-key-display {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 15px;
  margin: 20px 0;
}

.pqr-host-key-display p {
  margin: 0 0 10px 0 !important;
  font-weight: bold;
  color: #856404 !important;
}

#pqr-host-key {
  display: block;
  font-size: 1.5em;
  font-weight: bold;
  color: #856404;
  background: white;
  padding: 10px;
  border-radius: 5px;
  letter-spacing: 2px;
}

/* 参加者リスト */
.pqr-participants {
  margin: 30px 0;
}

.pqr-participants h3 {
  color: #333 !important;
  margin-bottom: 15px !important;
}

#pqr-participants-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.pqr-participant-item {
  background: #667eea;
  color: white;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: bold;
  font-size: 1.1em;
}

/* 問題表示 */
.pqr-game-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #eee;
}

.pqr-question-num {
  font-size: 1.2em;
  color: #667eea;
  font-weight: bold;
}

.pqr-question-display {
  background: #f8f9fa;
  padding: 30px;
  border-radius: 15px;
  margin: 20px 0;
  border-left: 5px solid #667eea;
}

.pqr-question-display h2 {
  color: #333 !important;
  font-size: 1.8em !important;
  margin: 0 !important;
  line-height: 1.4 !important;
}

/* 回答状況 */
.pqr-answer-status {
  margin: 30px 0;
}

.pqr-answer-status h3 {
  color: #333 !important;
  margin-bottom: 15px !important;
}

#pqr-answer-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.pqr-answer-item {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
}

.pqr-answer-item.answered {
  background: #28a745;
  color: white;
}

.pqr-answer-item .group-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.pqr-answer-item .answer-value {
  font-size: 1.2em;
}

/* ホスト操作 */
.pqr-host-controls {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

/* 結果表示 */
.pqr-correct-answer {
  background: #28a745;
  color: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  margin: 20px 0;
  font-size: 1.5em;
  font-weight: bold;
}

#pqr-result-list,
#pqr-ranking-list {
  margin: 20px 0;
}

.pqr-result-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 5px solid #ddd;
}

.pqr-result-item.correct {
  background: #d4edda;
  border-left-color: #28a745;
}

.pqr-result-item.incorrect {
  background: #f8d7da;
  border-left-color: #dc3545;
}

.pqr-result-icon {
  font-size: 2em;
  margin-right: 15px;
}

.pqr-ranking-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2em;
}

.pqr-ranking-item.rank-1 {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: white;
  font-size: 1.4em;
}

.pqr-ranking-item.rank-2 {
  background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
  color: white;
}

.pqr-ranking-item.rank-3 {
  background: linear-gradient(135deg, #CD7F32 0%, #B8733B 100%);
  color: white;
}

.pqr-next-controls {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

/* プレイヤー画面 */
.pqr-player-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
}

.pqr-player-screen {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.pqr-player-header h1 {
  color: #667eea !important;
  text-align: center;
  margin: 0 0 20px 0 !important;
}

.pqr-warning-box {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.pqr-warning-box p {
  margin: 0 !important;
  font-weight: bold;
  color: #856404 !important;
  font-size: 1.2em;
}

.pqr-group-display {
  text-align: center;
  margin: 20px 0;
}

.pqr-group-display h2 {
  color: #667eea !important;
  font-size: 2.5em !important;
  margin: 0 !important;
}

.pqr-wait-message,
.pqr-join-status {
  text-align: center;
  padding: 40px 20px;
}

.pqr-loading {
  margin: 20px auto;
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.pqr-question-box {
  background: #f8f9fa;
  padding: 30px;
  border-radius: 15px;
  margin: 20px 0;
  border-left: 5px solid #667eea;
}

.pqr-question-box h3 {
  color: #333 !important;
  font-size: 1.5em !important;
  margin: 0 !important;
  line-height: 1.4 !important;
}

.pqr-answer-input {
  position: relative;
  margin: 30px 0;
}

#pqr-answer-value {
  width: 100%;
  padding: 20px 60px 20px 20px;
  font-size: 2em !important;
  border: 3px solid #667eea !important;
  border-radius: 10px !important;
  text-align: center;
  background: white !important;
}

.pqr-percent-mark {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2em;
  color: #667eea;
  font-weight: bold;
}

.pqr-submitted-message {
  text-align: center;
  padding: 20px;
}

.pqr-check-icon {
  font-size: 5em;
  color: #28a745;
  animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.pqr-submitted-message h3 {
  color: #333 !important;
  margin: 20px 0 !important;
}

#pqr-my-answer {
  color: #667eea;
  font-weight: bold;
  font-size: 1.3em;
}

.pqr-wait-result {
  text-align: center;
  margin-top: 30px;
}

.pqr-result-box {
  text-align: center;
  padding: 20px;
}

#pqr-result-icon {
  font-size: 5em;
  margin-bottom: 20px;
}

.pqr-result-box h3 {
  font-size: 2em !important;
  margin: 20px 0 !important;
}

.pqr-score-display {
  background: #667eea;
  color: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  margin: 20px 0;
  font-size: 1.5em;
  font-weight: bold;
}

.pqr-next-wait {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .pqr-host-container,
  .pqr-player-container {
    padding: 10px;
  }
  
  .pqr-screen,
  .pqr-player-screen {
    padding: 20px;
  }
  
  .pqr-host-header h1 {
    font-size: 2em !important;
  }
  
  #pqr-participants-list,
  #pqr-answer-list {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  
  .pqr-host-controls,
  .pqr-next-controls {
    flex-direction: column;
  }
  
  .pqr-btn-warning {
    margin-left: 0 !important;
    margin-top: 10px !important;
  }
}

/* ===== 漁夫の利スタイルの追加CSS ===== */

/* 非表示クラス */
.pqr-hidden {
  display: none !important;
}

/* 警告メッセージ */
.pqr-notice {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 15px 20px;
  margin: 20px;
  color: #856404;
  font-size: 1em;
  text-align: center;
  font-weight: bold;
}

/* セットアップ画面の調整 */
#pqr-setup-screen {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pqr-number-value {
  width: 100px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em !important;
  font-weight: bold;
  border: 3px solid #667eea !important;
  border-radius: 10px !important;
  background: white !important;
  color: #333 !important;
}

/* QRロビー画面のレイアウト */
.pqr-qr-header {
  text-align: center;
  margin-bottom: 30px;
}

.pqr-qr-header h2 {
  color: #667eea !important;
  font-size: 2em !important;
  margin: 0 !important;
}

.pqr-lobby-content {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 30px;
  margin: 30px 0;
}

/* 左サイドバー: ホストキー */
.pqr-lobby-left {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 20px;
}

.pqr-host-key-box {
  text-align: center;
}

.pqr-host-key-label {
  font-weight: bold;
  font-size: 1.1em;
  margin-bottom: 15px;
  color: #333 !important;
}

.pqr-host-key-value {
  background: white;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 15px;
  font-size: 1.3em;
  font-weight: bold;
  font-family: monospace;
  letter-spacing: 2px;
  margin: 15px 0;
  color: #856404 !important;
  word-break: break-all;
}

.pqr-host-key-hidden {
  filter: blur(8px);
  user-select: none;
}

.pqr-btn-toggle {
  background: #667eea !important;
  color: white !important;
  padding: 10px 20px !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: bold !important;
  margin: 5px !important;
  transition: all 0.2s !important;
}

.pqr-btn-toggle:hover {
  background: #5568d3 !important;
}

.pqr-btn-copy-small {
  background: #95a5a6 !important;
  color: white !important;
  padding: 10px 20px !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: bold !important;
  margin: 5px !important;
}

.pqr-host-key-note {
  color: #dc3545 !important;
  font-weight: bold;
  margin: 10px 0 !important;
  font-size: 0.9em;
}

.pqr-host-key-desc {
  color: #666 !important;
  font-size: 0.85em;
  line-height: 1.4;
  margin: 10px 0 !important;
}

/* 中央: QRコード */
.pqr-lobby-center {
  text-align: center;
}

.pqr-qr-code-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

#pqr-qrcode canvas {
  border: 10px solid #667eea !important;
  border-radius: 15px !important;
  padding: 10px;
  background: white !important;
}

.pqr-url-container {
  margin: 30px 0;
}

.pqr-url-container p {
  color: #666;
  margin-bottom: 10px !important;
  font-weight: bold;
}

.pqr-url-box {
  display: flex;
  gap: 10px;
}

.pqr-url-box input {
  flex: 1;
  padding: 15px;
  border: 2px solid #ddd !important;
  border-radius: 8px !important;
  font-size: 1em !important;
  background: #f8f9fa !important;
}

.pqr-url-box button {
  background: #95a5a6 !important;
  color: white !important;
  padding: 15px 30px !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: bold !important;
}

/* 右サイドバー: 参加状況 */
.pqr-lobby-right {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 20px;
}

.pqr-status-box h3 {
  color: #333 !important;
  font-size: 1.2em !important;
  margin: 0 0 15px 0 !important;
  text-align: center;
}

#pqr-participants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pqr-participant-badge {
  background: #667eea;
  color: white !important;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
  font-size: 1.1em;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ボタン中央配置 */
.pqr-button-center {
  text-align: center;
  margin-top: 30px;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
  .pqr-lobby-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .pqr-lobby-left,
  .pqr-lobby-right {
    max-width: 600px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .pqr-host-header h1 {
    font-size: 1.8em !important;
  }
  
  .pqr-qr-header h2 {
    font-size: 1.5em !important;
  }
  
  #pqr-qrcode canvas {
    max-width: 100%;
    height: auto !important;
  }
}

/* ===== ぐるぐるローディングスピナー ===== */
.pqr-loading-spinner {
  width: 80px;
  height: 80px;
  border: 8px solid #f3f3f3;
  border-top: 8px solid #667eea;
  border-radius: 50%;
  animation: pqr-spin 1s linear infinite;
  margin: 30px auto;
}

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

.pqr-your-answer {
  font-size: 1.3em !important;
  font-weight: bold;
  color: #667eea !important;
  margin: 20px 0 !important;
}

/* ===== 結果発表画面のアニメーション ===== */
.pqr-result-item {
  opacity: 0;
  transform: translateY(20px);
  animation: pqr-slideIn 0.5s ease-out forwards;
}

@keyframes pqr-slideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pqr-result-item:nth-child(1) { animation-delay: 0.1s; }
.pqr-result-item:nth-child(2) { animation-delay: 0.2s; }
.pqr-result-item:nth-child(3) { animation-delay: 0.3s; }
.pqr-result-item:nth-child(4) { animation-delay: 0.4s; }
.pqr-result-item:nth-child(5) { animation-delay: 0.5s; }
.pqr-result-item:nth-child(6) { animation-delay: 0.6s; }
.pqr-result-item:nth-child(7) { animation-delay: 0.7s; }
.pqr-result-item:nth-child(8) { animation-delay: 0.8s; }

/* ===== ランキング表示（電子黒板用） ===== */
.pqr-ranking-list {
  list-style: none;
  padding: 0;
  margin: 30px 0;
}

.pqr-ranking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin: 15px 0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  font-size: 1.5em;
  opacity: 0;
  animation: pqr-slideIn 0.6s ease-out forwards;
}

.pqr-ranking-item.pqr-rank-1 {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: white !important;
  font-size: 1.8em;
  box-shadow: 0 6px 12px rgba(255,215,0,0.4);
}

.pqr-ranking-item.pqr-rank-2 {
  background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%);
  color: white !important;
}

.pqr-ranking-item.pqr-rank-3 {
  background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
  color: white !important;
}

.pqr-rank-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.pqr-rank-num {
  font-size: 2em;
  font-weight: bold;
  min-width: 80px;
}

.pqr-group-label {
  font-size: 1.2em;
  font-weight: bold;
}

.pqr-score-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.pqr-total-score {
  font-size: 2.5em;
  font-weight: bold;
  color: #667eea;
}

.pqr-ranking-item.pqr-rank-1 .pqr-total-score,
.pqr-ranking-item.pqr-rank-2 .pqr-total-score,
.pqr-ranking-item.pqr-rank-3 .pqr-total-score {
  color: white !important;
}

.pqr-penalty-score {
  font-size: 0.9em;
  color: #e74c3c;
  font-weight: bold;
}

.pqr-ranking-item.pqr-rank-1 .pqr-penalty-score,
.pqr-ranking-item.pqr-rank-2 .pqr-penalty-score,
.pqr-ranking-item.pqr-rank-3 .pqr-penalty-score {
  color: rgba(255,255,255,0.8) !important;
}
