/* ================================================
   基本スタイル
   Phase 4: CSS変数適用
   ================================================ */

body {
  background: var(--color-bg-secondary);
  min-height: 100vh;
}

.main-content {
  background: var(--color-bg-secondary);
}

/* タイピングエリア（デフォルトは非表示） */
#typing-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9998;
}

#typing-overlay.active {
  display: block;
}

.typing-area {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 1400px;
  max-height: 90vh;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  overflow-y: auto;
}

.typing-area.active {
  display: block;
}

/* ================================================
   ログインモーダル（最優先・最前面）
   ================================================ */

.login-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 99999 !important;
}

.login-overlay.active {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.login-modal {
    background: white !important;
    border-radius: 10px !important;
    padding: 30px !important;
    width: 90% !important;
    max-width: 400px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    position: relative !important;
    z-index: 100000 !important;
}

.login-modal-header h2 {
    margin: 0 0 10px 0 !important;
    color: #333 !important;
}

.login-form-group {
    margin-bottom: 15px !important;
}

.login-form-group label {
    display: block !important;
    margin-bottom: 5px !important;
    color: #555 !important;
}

.login-form-group input {
    width: 100% !important;
    padding: 10px !important;
    border: 2px solid #ddd !important;
    border-radius: 5px !important;
}

.login-modal-submit {
    width: 100% !important;
    padding: 12px !important;
    background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-weight: bold !important;
}

/* ================================================
   タブナビゲーション
   ================================================ */

.tab-navigation {
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tab-nav-content {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
}

.tab-button {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1em;
  color: #666;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-button:hover {
  color: #FF8C00;
  background: #FFF8DC;
}

.tab-button.active {
  color: #FF8C00;
  border-bottom-color: #FF8C00;
  font-weight: bold;
}

.tab-icon {
  font-size: 1.2em;
}

.tab-content-container {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

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

/* ================================================
   問題リスト・カードスタイル
   ================================================ */

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.question-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.question-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(255, 140, 0, 0.2);
  border-color: #FF8C00;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 10px;
}

.question-title {
  font-size: 1.1em;
  font-weight: bold;
  color: #333;
  margin: 0;
  flex: 1;
  line-height: 1.4;
}

.difficulty-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

.difficulty-badge.easy {
  background: linear-gradient(135deg, #90EE90, #32CD32);
  color: white;
}

.difficulty-badge.normal {
  background: linear-gradient(135deg, #87CEEB, #4682B4);
  color: white;
}

.difficulty-badge.hard {
  background: linear-gradient(135deg, #FFB6C1, #FF69B4);
  color: white;
}

.question-preview {
  color: #666;
  font-size: 0.9em;
  line-height: 1.5;
  margin: 10px 0;
  min-height: 40px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.meta-item {
  font-size: 0.85em;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* フィルターセクション */
.filter-section {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-weight: bold;
  color: #555;
  font-size: 0.9em;
}

.filter-group select {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
}

.filter-group select:hover {
  border-color: #FF8C00;
}

.filter-group select:focus {
  outline: none;
  border-color: #FF8C00;
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1);
}

/* ================================================
   ホームタブスタイル
   ================================================ */

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

.stats-card,
.quick-start-card,
.new-titles-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stats-title,
.card-title {
  font-size: 1.3em;
  margin-bottom: 20px;
  color: #333;
  border-bottom: 2px solid #FF8C00;
  padding-bottom: 10px;
}

.stats-content {
  display: flex;
  justify-content: space-around;
  gap: 20px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2.5em;
  font-weight: bold;
  color: #FF8C00;
}

.stat-label {
  color: #666;
  font-size: 0.9em;
  margin-top: 5px;
}

.quick-start-list,
.title-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.quick-start-item,
.title-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.quick-start-item:hover,
.title-item:hover {
  background: #FFF8DC;
}

.quick-title,
.title-text {
  flex: 1;
  color: #333;
  font-size: 0.95em;
}

.new-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #FF6B6B, #FF8C00);
  color: white;
  font-size: 0.7em;
  font-weight: bold;
  border-radius: 4px;
  vertical-align: middle;
}

.start-button {
  padding: 6px 20px;
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: bold;
  transition: all 0.3s;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.4);
}

.quick-start-message,
.loading-message {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 0.95em;
}

/* ================================================
   カテゴリタブスタイル
   ================================================ */

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

.category-selector-card,
.category-titles-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.category-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 15px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.category-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.2);
  border-color: #FF8C00;
}

.category-button.active {
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  border-color: #FF8C00;
}

.category-icon {
  font-size: 2em;
}

.category-name {
  font-weight: bold;
  font-size: 0.95em;
}

.category-count {
  font-size: 0.85em;
  color: #888;
  background: #f5f5f5;
  padding: 2px 10px;
  border-radius: 10px;
}

.category-button.active .category-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.current-category-bar {
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
  padding: 15px 25px;
  border-radius: 10px;
  margin-bottom: 25px;
}

.current-category-info {
  font-size: 1.1em;
  color: #333;
}

.current-label {
  font-weight: bold;
  color: #FF8C00;
}

.current-name {
  color: #333;
  margin-left: 5px;
}

/* ================================================
   成績タブスタイル
   ================================================ */

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

/* 統計サマリーカード */
.stats-summary-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.summary-item {
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  border: 2px solid #FF8C00;
  transition: all 0.3s;
}

.summary-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.summary-label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

.summary-value {
  font-size: 2em;
  font-weight: bold;
  color: #FF6347;
}

/* 学習進捗グラフカード */
.progress-chart-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 期間切り替えボタン */
.chart-period-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.period-btn {
  padding: 10px 24px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95em;
  transition: all 0.3s;
  color: #666;
  font-weight: 500;
}

.period-btn:hover {
  border-color: #FF8C00;
  color: #FF8C00;
  transform: translateY(-2px);
}

.period-btn.active {
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  border-color: #FF8C00;
  box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

/* 直近の成績カード */
.recent-results-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.records-summary {
  margin-bottom: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
  border-radius: 8px;
}

.table-responsive {
  overflow-x: auto;
  margin-top: 15px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.results-table th {
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  padding: 12px 8px;
  text-align: left;
  font-weight: bold;
  white-space: nowrap;
}

.results-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f0f0f0;
}

.results-table tr:hover {
  background: #FFF8DC;
}

.results-table tr:nth-child(even) {
  background: #fafafa;
}

.results-table tr:nth-child(even):hover {
  background: #FFF8DC;
}

.stats-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.stats-button {
  padding: 10px 24px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95em;
  transition: all 0.3s;
  color: #666;
}

.stats-button:hover {
  border-color: #FF8C00;
  color: #FF8C00;
}

.stats-button.active {
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  border-color: #FF8C00;
}

.stats-charts {
  margin-top: 20px;
}

/* ================================================
   統計グラフスタイル
   ================================================ */

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

.stat-box {
  background: linear-gradient(135deg, var(--color-bg-accent) 0%, var(--color-bg-accent-light) 100%);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  border: var(--border-width-medium) solid var(--color-grade-master);
}

.stat-box-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

.stat-box-value {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.chart-container {
  background: white;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
  max-height: 350px !important;
  height: 350px !important;
}

.chart-container h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.1em;
  border-bottom: 2px solid #FF8C00;
  padding-bottom: 10px;
}

.no-data-message {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

/* ================================================
   レスポンシブスタイル
   ================================================ */

@media (max-width: 768px) {
  .tab-nav-content {
    justify-content: flex-start;
  }
  
  .question-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .filter-section {
    flex-direction: column;
    gap: 10px;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-group select {
    flex: 1;
  }
  
  .stats-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .results-table {
    font-size: 0.8em;
  }
  
  .results-table th,
  .results-table td {
    padding: 8px 4px;
  }
  
  .stats-controls {
    flex-direction: column;
  }
  
  .stats-button {
    width: 100%;
  }
  
  .stats-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }
  
  .stat-box-value {
    font-size: 1.5em;
  }
}

/* ================================================
   タイピングエリア内部スタイル
   ================================================ */

.typing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 2px solid #FF8C00;
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
  border-radius: 15px 15px 0 0;
}

.typing-header h2 {
  margin: 0;
  color: #333;
  font-size: 1.4em;
}

.typing-close-button {
  padding: 8px 20px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

.typing-close-button:hover {
  background: #cc0000;
  transform: scale(1.05);
}

.control-bar {
  padding: 15px 25px;
  background: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.control-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.status-bar {
  display: flex;
  gap: 15px;
  align-items: center;
}

.control-button {
  padding: 10px 20px;
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
  white-space: nowrap;
}

.control-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.4);
}

.control-button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.control-button.abort-button {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
}

.control-button.abort-button:hover {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
}

.button-icon {
  font-size: 1.1em;
}

.timer-display,
.progress-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 15px;
  background: white;
  border-radius: 8px;
  border: 2px solid #FFD700;
  min-width: 100px;
}

.timer-label,
.progress-label {
  font-size: 0.85em;
  color: #666;
  margin-bottom: 5px;
}

.timer,
.progress-text {
  font-size: 1.6em;
  font-weight: bold;
  color: #FF8C00;
  font-family: 'Courier New', monospace;
}


.typing-content {
  padding: 25px;
}

.question-answer-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.question-text-display {
  background: #FFF8DC;
  border: 2px solid #FFD700;
  border-radius: 10px;
  padding: 20px;
  overflow-y: scroll;  /* 常にスクロールバー表示 */
  max-height: 446px;  /* 478px − 32px */
  box-sizing: border-box;
}

.question-text {
  font-family: 'MS Gothic', 'Osaka-Mono', monospace;
  font-size: 1.1em;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
  color: #333;
}

.typing-input-container {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

#typing-input {
  width: 100%;
  height: 100%;
  max-height: 383px;  /* 415px − 32px */
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-family: 'MS Gothic', 'Osaka-Mono', monospace;
  font-size: 1.1em;
  line-height: 1.8;
  resize: none;
  background: white;
  box-sizing: border-box;
  overflow-y: scroll;  /* 常にスクロールバー表示 */
}

#typing-input:focus {
  outline: none;
  border-color: #FF8C00;
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1);
}

#typing-input:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

.stats-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-display {
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  border: 2px solid #FFD700;
}

.stat-display-label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 5px;
}

.stat-display-value {
  font-size: 1.8em;
  font-weight: bold;
  color: #FF8C00;
}

.typing-text-area {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  min-height: 200px;
  font-family: 'MS Gothic', 'Osaka-Mono', monospace;
  font-size: 1.1em;
  line-height: 1.8;
}

@media (max-width: 768px) {
  .typing-area {
    width: 98%;
    max-height: 95vh;
  }
  
  .typing-header h2 {
    font-size: 1.1em;
  }
  
  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .control-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .control-button {
    width: 100%;
    justify-content: center;
  }
  
  .status-bar {
    width: 100%;
    justify-content: space-around;
  }
  
  .question-answer-container {
    grid-template-columns: 1fr;
  }
  
  .question-text-display,
  #typing-input {
    min-height: 200px;
    height: auto;
  }
}

/* 問題文の文字スタイル */
.char {
  display: inline-block;
  font-family: 'MS Gothic', 'Osaka-Mono', monospace;
  white-space: pre;
}

.char.correct {
  color: #32CD32;
  background: #E8F5E9;
}

.char.incorrect {
  color: #FF4444;
  background: #FFEBEE;
  text-decoration: underline wavy #FF4444;
}

.char.current {
  background: #FFE082;
}

/* ================================================
   結果モーダル
   ================================================ */

.result-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.result-modal {
  background: white;
  border-radius: 15px;
  padding: 30px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.result-header {
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 3px solid #FF8C00;
}

.result-header h2 {
  margin: 0;
  color: #333;
  font-size: 1.8em;
}

.result-title {
  text-align: center;
  font-size: 1.3em;
  font-weight: bold;
  color: #FF8C00;
  margin-bottom: 25px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.result-item {
  background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  border: 2px solid #FFD700;
}

.result-label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 10px;
}

.result-value {
  font-size: 1.8em;
  font-weight: bold;
  color: #333;
}

.result-value.correct {
  color: #32CD32;
}

.result-value.miss {
  color: #FF4444;
}

.result-grade {
  text-align: center;
  margin: 30px 0;
}

.grade-label {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 15px;
}

.grade-badge {
  display: inline-block;
  width: 80px;
  height: 80px;
  line-height: 80px;
  font-size: 3em;
  font-weight: bold;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  box-shadow: 0 5px 15px rgba(255, 140, 0, 0.4);
}

.grade-badge.grade-s {
  background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
}

.grade-badge.grade-a {
  background: linear-gradient(135deg, #90EE90 0%, #32CD32 100%);
}

.grade-badge.grade-b {
  background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
}

.grade-badge.grade-c {
  background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
}

.grade-badge.grade-d {
  background: linear-gradient(135deg, #D3D3D3 0%, #A9A9A9 100%);
}

.certification-ranks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.rank-section {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
}

.rank-title {
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.rank-value {
  font-size: 1.3em;
  color: #FF8C00;
  font-weight: bold;
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.result-button {
  padding: 12px 30px;
  border: none;
  border-radius: 25px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
}

.result-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 140, 0, 0.4);
}

@media (max-width: 768px) {
  .result-modal {
    width: 95%;
    padding: 20px;
  }
  
  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .certification-ranks {
    grid-template-columns: 1fr;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .result-button {
    width: 100%;
  }
}

/* 未ログイン警告 */
.login-warning {
  background: #FFF3CD;
  border: 2px solid #FFC107;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.login-warning p {
  margin: 0;
  color: #856404;
  font-weight: bold;
  font-size: 1.1em;
}

/* ================================================
   入力結果の詳細（比較表示）
   ================================================ */

.comparison-section {
  background: linear-gradient(135deg, #FFF 0%, #FFF8DC 100%);
  border: 2px solid #FFE4B5;
  padding: 25px;
  border-radius: 12px;
  margin: 25px 0;
}

.comparison-section h3 {
  color: #FF6B35;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.comparison-display {
  font-family: 'Courier New', 'Consolas', 'Monaco', 'MS Gothic', monospace;
  font-size: 11pt;
  line-height: 1.8;
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #FFE4B5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

.comparison-display .char {
  display: inline-block;
  padding: 2px 4px;
  margin: 1px;
  border-radius: 3px;
}

.comparison-display .char-correct {
  background-color: #c8e6c9;
  color: #2e7d32;
}

.comparison-display .char-miss {
  background-color: #ffcdd2;
  color: #c62828;
  text-decoration: line-through;
}

.comparison-display .char-missing {
  background-color: #fff9c4;
  color: #f57f17;
}

.comparison-display .char-extra {
  background-color: #e1bee7;
  color: #6a1b9a;
}

/* 新しいグレードバッジ（typing-play-cp.phpと統一） */
.grade-badge.grade-e-,
.grade-badge.grade-e,
.grade-badge.grade-e\+ {
  background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%);
  font-size: 2em;
}

.grade-badge.grade-d-,
.grade-badge.grade-d\+ {
  background: linear-gradient(135deg, #D3D3D3 0%, #A9A9A9 100%);
  font-size: 2em;
}

.grade-badge.grade-c-,
.grade-badge.grade-c\+ {
  background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
  font-size: 2em;
}

.grade-badge.grade-b-,
.grade-badge.grade-b\+ {
  background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
  font-size: 2em;
}

.grade-badge.grade-a-,
.grade-badge.grade-a\+ {
  background: linear-gradient(135deg, #90EE90 0%, #32CD32 100%);
  font-size: 2em;
}

.grade-badge.grade-good\!,
.grade-badge.grade-fast,
.grade-badge.grade-thunder,
.grade-badge.grade-ninja,
.grade-badge.grade-comet {
  background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
  font-size: 1.2em;
  width: 100px;
  height: 100px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grade-badge.grade-professor,
.grade-badge.grade-laserbeam,
.grade-badge.grade-eddievh,
.grade-badge.grade-meijin,
.grade-badge.grade-rocket {
  background: linear-gradient(135deg, #FF6347 0%, #DC143C 100%);
  font-size: 1em;
  width: 110px;
  height: 110px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grade-badge.grade-tatsujin,
.grade-badge.grade-jedi,
.grade-badge.grade-godhand,
.grade-badge.grade-joker {
  background: linear-gradient(135deg, #8B00FF 0%, #4B0082 100%);
  font-size: 1em;
  width: 120px;
  height: 120px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 5px 15px rgba(139, 0, 255, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(139, 0, 255, 0.6);
  }
}
