/* Shared UI components for static + JS-generated content */

/* ---- Help / feedback messages ---- */
.help-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.help-message--correct {
  color: var(--color-success);
}

.help-message--wrong {
  color: var(--color-error);
}

.help-message--muted {
  color: var(--color-text-muted);
}

.help-message__icon {
  font-size: 30px;
}

.help-message__key {
  font-size: 15px;
}

/* ---- Typing text highlights ---- */
#typedhighlighted {
  background: none;
  color: var(--color-typed);
}

#highlighted {
  background: var(--color-current-bg);
  color: var(--color-current-text);
  text-decoration: underline;
  border-radius: 3px;
}

#unhighlighted {
  background: none;
  color: var(--color-untyped);
}

.typed-char--wrong {
  color: var(--color-char-wrong);
}

/* ---- Lesson setup overlay (JS) ---- */
.lesson-setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  background: var(--color-surface-overlay);
  backdrop-filter: blur(4px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.lesson-setup-panel {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  padding: 24px 50px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.lesson-setup-panel h1 {
  margin: 0 0 8px;
  color: var(--color-heading);
  text-align: center;
}

.lesson-setup-panel .setup-title {
  margin: 8px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--color-heading);
}

.duration-option {
  display: inline-block;
  margin-bottom: 5px;
  padding: 10px;
  color: var(--color-text);
  background: var(--color-surface-muted);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.duration-option:hover {
  border-color: var(--color-primary-light);
}

.duration-option.is-selected {
  color: var(--color-text-inverse);
  background: var(--gradient-primary);
  border-color: var(--color-primary);
}

.btn-start-lesson {
  padding: 15px 45px;
  color: var(--color-text-inverse);
  background: var(--gradient-button);
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-start-lesson:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.setup-hint {
  padding: 8px;
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: center;
}

.setup-gif {
  width: min(500px, 100%);
}

/* ---- Lesson result overlay (JS) ---- */
.lesson-result-overlay {
  position: absolute;
  inset: 0;
  padding: 10px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.result-card-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 80%;
}

.result-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.result-card-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  row-gap: 20px;
  width: 100%;
  padding: 30px;
  background: var(--gradient-result-hero);
}

.result-card-left h4 {
  margin: 0;
  color: var(--color-heading);
  font-size: 20px;
  text-align: center;
}

.result-score-ring {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 150px;
  height: 150px;
  background: var(--gradient-score-ring);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

.result-score-ring h1 {
  margin: 0;
  color: var(--color-text-inverse);
  font-size: 50px;
  line-height: 1;
}

.result-score-ring span {
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
}

.result-score-content h2 {
  margin: 0;
  color: var(--color-heading);
  font-size: 28px;
  text-align: center;
}

.result-score-content p {
  margin: 12px 0 0;
  color: var(--color-text-muted);
  text-align: center;
}

.result-card-right {
  display: flex;
  flex-direction: column;
  row-gap: 20px;
  width: 100%;
  padding: 30px;
}

.result-card-right h2,
.result-card-right h3 {
  margin: 0;
  color: var(--color-heading);
}

.result-card-right h3.result-subtitle {
  margin-bottom: 8px;
  font-size: 15px;
}

.result-card-right ul {
  display: flex;
  flex-direction: column;
  row-gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-card-right ul li {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-radius: var(--radius-sm);
}

.result-card-right ul li:nth-of-type(1) {
  background: var(--color-error-soft);
}

.result-card-right ul li:nth-of-type(1) p {
  color: var(--color-error);
}

.result-card-right ul li:nth-of-type(2) {
  background: var(--color-warning-soft);
}

.result-card-right ul li:nth-of-type(2) p {
  color: var(--color-warning);
}

.result-card-right ul li:nth-of-type(3) {
  background: var(--color-success-soft);
}

.result-card-right ul li:nth-of-type(3) p {
  color: var(--color-success);
}

.result-card-right ul li:nth-of-type(4) {
  background: var(--color-info-soft);
}

.result-card-right ul li:nth-of-type(4) p {
  color: var(--color-info);
}

.result-card-right ul li .li-left {
  display: flex;
  column-gap: 10px;
  align-items: center;
}

.result-card-right ul li .li-left p {
  margin: 0;
  font-weight: 600;
}

.result-card-right ul li .li-right p {
  margin: 0;
  color: var(--color-text-muted);
}

.result-card-right ul li .li-right p b {
  color: var(--color-heading);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.result-badge.passed {
  color: var(--color-success-text);
  background: var(--color-success-soft);
}

.result-badge.failed {
  color: var(--color-error-text);
  background: var(--color-error-soft);
}

.saved-note,
.result-compare,
.locked-next-note,
.score-earned {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.score-earned {
  width: max-content;
  padding: 7px 12px;
  color: var(--color-heading);
  background: var(--color-warning-soft);
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.mistake-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mistake-chips span {
  padding: 6px 10px;
  color: var(--color-text);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 13px;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.result-card-right a {
  padding: 12px;
  color: var(--color-text-inverse);
  background: var(--gradient-primary);
  border-radius: var(--radius-pill);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: var(--transition-fast);
}

.result-card-right a:hover {
  filter: brightness(1.05);
}

.result-card-right a.retry-action {
  background: linear-gradient(135deg, #f87171 0%, var(--color-error) 100%);
}

/* ---- Brand / nav helpers ---- */
.brand-primary {
  color: var(--color-brand-primary);
}

.brand-accent {
  color: var(--color-brand-accent);
}

.user-avatar-link {
  display: inline-flex;
  align-items: center;
  height: var(--nav-height);
  color: var(--color-text-inverse);
}

.user-avatar-link img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border: 2px solid var(--color-text-inverse);
  border-radius: 50%;
}

/* ---- Index page helpers ---- */
.index-subtitle {
  font-size: 16px;
}

.index-subtitle-sm {
  font-size: 14px;
}

.index-subtitle-xs {
  font-size: 13px;
}

.index-icon-accent {
  border-right: 4px solid var(--color-secondary);
}

.index-icon-accent-lg {
  border-right: 12px solid var(--color-secondary);
}

.text-body-lg {
  font-size: 20px;
  color: var(--color-text);
}

.text-step-num {
  font-size: 40px;
}

.footer-share-icons {
  font-size: 40px;
}

/* ---- Tutorial layout ---- */
.tutorial-help {
  margin: 0 10px 30px;
  height: 30px;
  width: auto;
  text-align: center;
}

.tutorial-cont {
  margin: auto;
}

/* ---- Difficult keys panel (JS) ---- */
.difficult-keys-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 80%;
  margin-inline: auto;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.difficult-keys-panel h5 {
  margin: 0 0 12px;
  color: var(--color-text-muted);
}

.difficult-keys-chart {
  width: 550px;
  max-width: 100%;
}

/* ---- Keyboard dynamic states (JS) ---- */
#keys td,
#buttons td,
.numpad-key,
.number-pad-visual span,
.keyboard-row span {
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.key-state-default {
  background: var(--color-key-bg) !important;
  color: var(--color-key-text) !important;
  box-shadow: var(--shadow-key);
}

.key-state-highlight {
  background: var(--color-key-highlight) !important;
  color: var(--color-text-inverse) !important;
}

.key-state-correct {
  background: var(--color-key-correct) !important;
  color: var(--color-text-inverse) !important;
}

.key-state-wrong {
  background: var(--color-key-wrong) !important;
  color: var(--color-text-inverse) !important;
}

#firstLetter {
  color: var(--color-key-highlight);
  text-decoration: underline;
  background: none;
}

@media (min-width: 550px) {
  .result-card {
    flex-direction: row;
    width: 550px;
  }

  .result-card-left,
  .result-card-right {
    width: 50%;
  }
}
