/* ==========================================================================
   SAKE DIPLOMA - RONJUTSU AI GRADER & 200-CHAR TRAINER STYLES
   ========================================================================== */

/* Top Disclaimer Alert (Directly above .ronjutsu-wrap) */
.ronjutsu-disclaimer-top {
  background: #fffbf5;
  border-bottom: 1px solid #fed7aa;
  padding: 10px 0;
}

.disclaimer-alert-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.disclaimer-alert-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.disclaimer-icon {
  font-size: 15px;
}

.disclaimer-alert-title {
  font-size: 13px;
  font-weight: 800;
  color: #1c1917;
  margin: 0;
}

.disclaimer-alert-text {
  font-size: 12px;
  color: #44403c;
  line-height: 1.5;
  margin: 0;
  font-weight: 500;
}

.ronjutsu-wrap {
  padding: 16px 0 32px;
  background: #f8fafc;
  min-height: 70vh;
}

.ronjutsu-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 15px;
}

.card-box {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding: 18px 20px;
  margin-bottom: 16px;
}

/* Question Selector */
.q-select-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.q-badge {
  display: inline-block;
  background: #2563eb;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.page-ref-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.q-select-wrap {
  position: relative;
  width: 100%;
  margin-top: 6px;
}

.q-select-dropdown {
  width: 100%;
  padding: 14px 44px 14px 18px;
  font-size: 15px;
  font-weight: 800;
  border: 2.5px solid #2563eb;
  border-radius: 8px;
  background-color: #ffffff;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px 20px;
  transition: all 0.2s ease;
}

.q-select-dropdown:hover {
  border-color: #1d4ed8;
  background-color: #f8fafc;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
  transform: translateY(-1px);
}

.q-select-dropdown:focus {
  border-color: #1d4ed8;
  background-color: #ffffff;
  outline: none;
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.25);
}

.q-select-dropdown option {
  font-size: 14.5px;
  font-weight: 600;
  color: #1e293b;
  padding: 8px 12px;
}

.q-select-dropdown option[disabled] {
  color: #1e293b;
  font-weight: 700;
  background-color: #f1f5f9;
}

.q-display-box {
  background: #f1f5f9;
  border-left: 5px solid #2563eb;
  padding: 18px 22px;
  border-radius: 0 8px 8px 0;
  margin-top: 16px;
  animation: fadeInQ 0.25s ease forwards;
}

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

.q-display-text {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.6;
  color: #0f172a;
}

.q-display-note {
  font-size: 13px;
  color: #1e293b;
  margin-top: 6px;
}

/* Input Area & Character Counter */
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.char-counter-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

.char-count {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  transition: color 0.2s;
}

.char-max {
  font-size: 15px;
  color: #1e293b;
  font-weight: 600;
}

.char-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-left: 8px;
}

.status-ok { background: #dbeafe; color: #1e40af; }
.status-good { background: #dcfce7; color: #166534; }
.status-over { background: #fee2e2; color: #991b1b; }

.ronjutsu-textarea {
  width: 100%;
  min-height: 160px;
  padding: 16px;
  font-size: 16px;
  line-height: 1.8;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  resize: vertical;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Meiryo", sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ronjutsu-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.ronjutsu-textarea.over-limit {
  border-color: #ef4444;
  background-color: #fef2f2;
}

/* Quota Status Display */
.quota-status-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 12px;
  font-size: 13px;
}

.quota-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.quota-status-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quota-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  display: inline-block;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.quota-dot.dot-warning {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.quota-dot.dot-empty {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.quota-text {
  font-weight: 700;
  color: #334155;
}

.quota-text strong {
  color: #1e3a8a;
}

.quota-reset-note {
  font-size: 11.5px;
  color: #1e293b;
  font-weight: 500;
}

.quota-bar-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #2563eb);
  border-radius: 9999px;
  transition: width 0.4s ease, background 0.4s ease;
}

.quota-bar-fill.bar-warning {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.quota-bar-fill.bar-empty {
  background: #ef4444;
}

/* Action Buttons */
.editor-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-grade-ai {
  flex: 2;
  min-width: 220px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-grade-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-model-ans {
  flex: 1;
  min-width: 160px;
  background: #f8fafc;
  color: #334155;
  border: 1.5px solid #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  padding: 14px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-model-ans:hover {
  background: #f1f5f9;
  border-color: #1e293b;
}

.btn-clear {
  background: none;
  border: none;
  color: #1e293b;
  font-size: 13px;
  cursor: pointer;
  padding: 0 10px;
  text-decoration: underline;
}

/* Result Box */
.result-box {
  display: none;
  background: #ffffff;
  border-radius: 12px;
  border: 2px solid #2563eb;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.1);
  animation: fadeIn 0.4s ease;
}

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

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f1f5f9;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-number {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 42px;
  font-weight: 900;
  color: #2563eb;
  line-height: 1;
}

.score-denom {
  font-size: 18px;
  color: #1e293b;
  font-weight: 600;
}

.score-badge {
  font-size: 14px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 9999px;
}

.badge-pass { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-fail { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

.result-section-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.keyword-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keyword-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.kw-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.kw-ok { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.kw-partial { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.kw-miss { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.kw-neutral { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

.feedback-bubble {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  line-height: 1.7;
  color: #1e3a8a;
  margin-top: 8px;
}

.model-answer-box {
  background: #fdf4ff;
  border: 1.5px solid #f0abfc;
  padding: 16px 20px;
  border-radius: 8px;
  margin-top: 20px;
}

.model-answer-text {
  font-size: 15px;
  line-height: 1.8;
  color: #701a75;
  font-weight: 500;
}

/* API Key Guide Modal / Alert */
.api-guide-banner {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.api-guide-text {
  font-size: 13.5px;
  color: #92400e;
  line-height: 1.5;
}

.api-guide-link {
  font-weight: 700;
  color: #b45309;
  text-decoration: underline;
  white-space: nowrap;
}

/* ==========================================================================
   AI Loading Overlay & Animations
   ========================================================================== */
.ai-loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999;
  justify-content: center;
  align-items: center;
}

.ai-loading-card {
  background: #ffffff;
  padding: 36px 32px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 360px;
  width: 90%;
  animation: aiCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aiCardPop {
  0% { transform: scale(0.9) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.ai-spinner-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.ai-spinner-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid #e2e8f0;
  border-top-color: #2563eb;
  border-right-color: #9333ea;
  animation: aiSpin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

.ai-spinner-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  animation: aiIconPulse 1.5s ease-in-out infinite;
}

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

@keyframes aiIconPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}

.ai-loading-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.ai-loading-sub {
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.5;
}

/* Optgroup styling in dropdown */
.q-select-dropdown optgroup {
  font-weight: 800;
  color: #1e3a8a;
  background: #f1f5f9;
  padding: 6px 0;
}

.q-select-dropdown option {
  font-weight: 500;
  color: #0f172a;
  background: #ffffff;
  padding: 8px 12px;
}

/* 2次試験対策 テイスティングセット＆公式グッズ案内ボックス */
.school-recommend-box {
  margin-top: 20px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1.5px solid #fdba74;
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.school-recommend-content {
  flex: 1;
  min-width: 250px;
}

.school-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  background: #ea580c;
  color: #ffffff;
  padding: 3px 9px;
  border-radius: 9999px;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.school-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #1c1917;
  margin: 0 0 5px;
}

.school-text {
  font-size: 12.5px;
  color: #262626;
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
}

.school-action-wrap {
  flex-shrink: 0;
}

.btn-school-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 11px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}

.btn-school-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.4);
  color: #ffffff !important;
}

.btn-school-link span {
  font-size: 13.5px;
  font-weight: 800;
}

.btn-school-link .link-sub {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.95;
  margin-top: 3px;
}


