/* ============================================================
   EAR TRAINING FREQUENCY TOOL — tool.css
   Answer buttons grid, score display, accuracy chart,
   streak counter, correct/wrong animations, responsive
   ============================================================ */

/* --- Settings Row --- */
.et-settings {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.et-settings__group {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.et-label {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.et-select {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  transition: border-color 0.2s;
}

.et-select:hover,
.et-select:focus {
  border-color: var(--color-primary);
  outline: none;
}

/* --- Status Bar --- */
.et-status {
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  background: rgba(0, 255, 65, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 2.4em;
  display: flex;
  align-items: center;
}

/* --- Control Buttons --- */
.et-controls {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

/* --- Expert Mode Indicator --- */
.et-expert-indicator {
  margin-bottom: var(--space-md);
  text-align: center;
}

.et-expert-label {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.et-expert-label--boost {
  color: #00ff41;
  background: rgba(0, 255, 65, 0.1);
  border: 1px solid rgba(0, 255, 65, 0.3);
}

.et-expert-label--cut {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

/* --- Answer Buttons Grid --- */
.et-answer-grid {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.et-answer-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.et-answer-grid--6 {
  grid-template-columns: repeat(3, 1fr);
}

.et-answer-grid--10 {
  grid-template-columns: repeat(5, 1fr);
}

.et-answer-btn {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  font-weight: 600;
  padding: var(--space-sm) var(--space-xs);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.3;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.et-answer-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: rgba(0, 255, 65, 0.08);
  transform: translateY(-1px);
}

.et-answer-btn:active:not(:disabled) {
  transform: translateY(0);
}

.et-answer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.et-answer-btn__label {
  font-size: var(--fs-lg);
  display: block;
}

.et-answer-btn__sub {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  display: block;
}

/* Answer result states */
.et-answer-btn--correct {
  border-color: #00ff41 !important;
  background: rgba(0, 255, 65, 0.2) !important;
  animation: et-flash-correct 0.6s ease;
}

.et-answer-btn--wrong {
  border-color: #ff3c3c !important;
  background: rgba(255, 60, 60, 0.2) !important;
  animation: et-flash-wrong 0.6s ease;
}

.et-answer-btn--reveal {
  border-color: #00ff41 !important;
  background: rgba(0, 255, 65, 0.12) !important;
}

@keyframes et-flash-correct {
  0% { background: rgba(0, 255, 65, 0.6); box-shadow: 0 0 30px rgba(0, 255, 65, 0.5); }
  100% { background: rgba(0, 255, 65, 0.2); box-shadow: none; }
}

@keyframes et-flash-wrong {
  0% { background: rgba(255, 60, 60, 0.6); box-shadow: 0 0 30px rgba(255, 60, 60, 0.5); }
  100% { background: rgba(255, 60, 60, 0.2); box-shadow: none; }
}

/* --- Round Result --- */
.et-round-result {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

.et-round-result--correct {
  color: #00ff41;
  background: rgba(0, 255, 65, 0.1);
  border: 1px solid rgba(0, 255, 65, 0.3);
}

.et-round-result--wrong {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

/* --- Stats Row --- */
.et-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.et-stat-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  text-align: center;
}

.et-stat-box__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xxs, 4px);
}

.et-stat-box__value {
  font-family: var(--font-display, var(--font-mono));
  font-size: var(--fs-xl, 1.5rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.et-stat-box__sub {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* --- Weakness Indicator --- */
.et-weakness {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: #ffaa00;
  background: rgba(255, 170, 0, 0.08);
  border: 1px solid rgba(255, 170, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-md);
  text-align: center;
}

/* --- Accuracy Chart --- */
.et-chart-container {
  margin-bottom: var(--space-md);
}

.et-chart-title {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.et-accuracy-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: var(--space-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.et-chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.et-chart-bar__fill {
  width: 100%;
  max-width: 48px;
  border-radius: 3px 3px 0 0;
  transition: height 0.4s ease;
  min-height: 2px;
  position: relative;
}

.et-chart-bar__fill--good {
  background: linear-gradient(to top, rgba(0, 255, 65, 0.6), rgba(0, 255, 65, 0.9));
}

.et-chart-bar__fill--mid {
  background: linear-gradient(to top, rgba(255, 170, 0, 0.6), rgba(255, 170, 0, 0.9));
}

.et-chart-bar__fill--bad {
  background: linear-gradient(to top, rgba(255, 60, 60, 0.6), rgba(255, 60, 60, 0.9));
}

.et-chart-bar__pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
}

.et-chart-bar__label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: 6px;
  white-space: nowrap;
  text-align: center;
}

/* --- Session History --- */
.et-history-container {
  margin-bottom: var(--space-md);
}

.et-history-count {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  font-weight: 400;
}

.et-session-history {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  max-height: 240px;
  overflow-y: auto;
}

.et-history-empty {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-sm);
}

.et-history-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xxs, 4px) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.et-history-item:last-child {
  border-bottom: none;
}

.et-history-item__icon {
  font-size: var(--fs-base);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.et-history-item__icon--correct {
  color: #00ff41;
}

.et-history-item__icon--wrong {
  color: #ff3c3c;
}

.et-history-item__text {
  flex: 1;
  color: var(--color-text-muted);
}

.et-history-item__answer {
  color: var(--color-text);
  font-weight: 600;
}

/* --- Reset Row --- */
.et-reset-row {
  text-align: center;
  padding-top: var(--space-sm);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .et-settings {
    flex-direction: column;
  }

  .et-stats-row {
    grid-template-columns: 1fr;
  }

  .et-answer-grid--10 {
    grid-template-columns: repeat(3, 1fr);
  }

  .et-answer-grid--6 {
    grid-template-columns: repeat(3, 1fr);
  }

  .et-answer-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .et-accuracy-chart {
    height: 120px;
  }

  .et-chart-bar__label {
    font-size: 8px;
  }

  .et-chart-bar__pct {
    font-size: 8px;
  }

  .et-answer-btn {
    min-height: 48px;
    padding: var(--space-xs);
  }

  .et-answer-btn__label {
    font-size: var(--fs-base);
  }
}

@media (max-width: 480px) {
  .et-answer-grid--10 {
    grid-template-columns: repeat(2, 1fr);
  }

  .et-answer-grid--6 {
    grid-template-columns: repeat(2, 1fr);
  }

  .et-controls {
    flex-direction: column;
  }

  .et-controls .btn {
    width: 100%;
  }
}
