/* ==========================================================================
   widgets.css — Интерактивные виджеты: квиз, калькулятор, чеклист,
   диагностика, сравнение, опрос, мини-игры
   ========================================================================== */

/* --------------------------------------------------------------------------
   Общая обёртка виджета
   -------------------------------------------------------------------------- */
.widget-wrap {
  margin: 3rem 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.widget-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.widget-header-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.widget-header-text {
  flex: 1;
}

.widget-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a2e;
}

.widget-header p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
}

.widget-body {
  padding: 1.5rem 2rem 2rem;
}

/* --------------------------------------------------------------------------
   Прогресс-бар (общий)
   -------------------------------------------------------------------------- */
.widget-progress {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.widget-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.widget-progress-label {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
  text-align: right;
}

/* --------------------------------------------------------------------------
   QUIZ
   -------------------------------------------------------------------------- */
.quiz-question {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  font-size: 0.97rem;
  color: #333;
  text-align: left;
  width: 100%;
}

.quiz-option:hover {
  border-color: #667eea;
  background: #f0f0ff;
  transform: translateX(3px);
}

.quiz-option.selected {
  border-color: #667eea;
  background: #f0f0ff;
}

.quiz-option.correct {
  border-color: #27ae60;
  background: #f0fff4;
  color: #1e6e41;
}

.quiz-option.incorrect {
  border-color: #e74c3c;
  background: #fff5f5;
  color: #922b21;
}

.quiz-option.disabled {
  cursor: default;
  pointer-events: none;
}

.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.2s;
}

.quiz-option.correct .quiz-option-letter {
  background: #27ae60;
  color: #fff;
}

.quiz-option.incorrect .quiz-option-letter {
  background: #e74c3c;
  color: #fff;
}

.quiz-explanation {
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  background: #f8f9ff;
  border-left: 4px solid #667eea;
  font-size: 0.9rem;
  color: #444;
  line-height: 1.6;
  display: none;
}

.quiz-explanation.visible {
  display: block;
}

.quiz-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  gap: 0.75rem;
}

/* Quiz Result */
.quiz-result {
  text-align: center;
  padding: 1rem 0;
}

.quiz-result-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.quiz-result-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.quiz-result-score {
  font-size: 1rem;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 1rem;
}

.quiz-result-description {
  font-size: 0.97rem;
  color: #555;
  max-width: 480px;
  margin: 0 auto 1.5rem;
  line-height: 1.65;
}

.quiz-result-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   CALCULATOR
   -------------------------------------------------------------------------- */

/* Field grid: 2 columns on wider screens */
.calc-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  animation: calcFieldIn 0.3s ease both;
}

.calc-field:nth-child(1) {
  animation-delay: 0.00s;
}

.calc-field:nth-child(2) {
  animation-delay: 0.05s;
}

.calc-field:nth-child(3) {
  animation-delay: 0.10s;
}

.calc-field:nth-child(4) {
  animation-delay: 0.15s;
}

.calc-field:nth-child(5) {
  animation-delay: 0.20s;
}

.calc-field:nth-child(6) {
  animation-delay: 0.25s;
}

@keyframes calcFieldIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calc-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Number & Select inputs */
.calc-field input[type="number"],
.calc-field select {
  padding: 0.75rem 1rem;
  border: 2px solid #e8e8f0;
  border-radius: 10px;
  font-size: 1rem;
  color: #1a1a2e;
  background: #f8f8fc;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.calc-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23667eea' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

.calc-field input[type="number"]:focus,
.calc-field select:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12);
}

/* Input with unit suffix wrapper */
.calc-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.calc-input-wrap input[type="number"] {
  padding-right: 3.5rem;
}

.calc-input-unit {
  position: absolute;
  right: 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #999;
  pointer-events: none;
  white-space: nowrap;
}

/* Range slider */
.calc-range-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calc-range-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.calc-range-value {
  font-size: 1rem;
  font-weight: 700;
  color: #667eea;
  min-width: 3rem;
  text-align: right;
}

.calc-field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #667eea var(--range-pct, 50%), #e0e0ee var(--range-pct, 50%));
  outline: none;
  cursor: pointer;
  transition: background 0.15s;
}

.calc-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.calc-field input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.55);
}

.calc-field input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
  cursor: pointer;
}

.calc-field input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #e0e0ee;
}

/* Radio button group */
.calc-field-radio {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.calc-field-radio label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  padding: 0.55rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  transition: all 0.2s;
  background: #f8f8fc;
  color: #555;
}

.calc-field-radio label:hover {
  border-color: #667eea;
  background: #f0f0ff;
  color: #667eea;
}

.calc-field-radio input[type="radio"] {
  display: none;
}

.calc-field-radio label.calc-radio-checked {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));
  color: #667eea;
  font-weight: 700;
}

/* Result box */
.calc-result-box {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  color: #fff;
  margin-top: 0.25rem;
  overflow: hidden;
  transition: transform 0.2s;
  animation: calcResultAppear 0.4s ease;
}

.calc-result-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.calc-result-box::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

@keyframes calcResultAppear {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calc-result-box.calc-result-pulse {
  animation: calcResultPulseAnim 0.25s ease;
}

@keyframes calcResultPulseAnim {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.015);
  }

  100% {
    transform: scale(1);
  }
}

.calc-result-label {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.8;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calc-result-value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
  transition: opacity 0.15s;
}

.calc-result-value.calc-result-updating {
  opacity: 0.6;
}

.calc-result-unit {
  font-size: 1rem;
  opacity: 0.8;
  font-weight: 500;
}

/* Notes below result */
.calc-notes {
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calc-notes li {
  font-size: 0.83rem;
  color: #888;
  padding: 0.3rem 0.75rem 0.3rem 1.75rem;
  position: relative;
  background: #f8f8fc;
  border-radius: 6px;
  line-height: 1.5;
}

.calc-notes li::before {
  content: "ℹ";
  position: absolute;
  left: 0.55rem;
  color: #667eea;
  font-style: normal;
}

/* --------------------------------------------------------------------------
   CHECKLIST
   -------------------------------------------------------------------------- */
.checklist-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.4rem;
}

.checklist-category {
  margin-bottom: 1.5rem;
}

.checklist-category-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #eee;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  cursor: pointer;
  border-radius: 6px;
  padding-left: 0.25rem;
  transition: background 0.15s;
}

.checklist-item:hover {
  background: #f8f8ff;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #667eea;
  flex-shrink: 0;
}

.checklist-item-text {
  flex: 1;
}

.checklist-item-title {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.4;
}

.checklist-item.done .checklist-item-title {
  text-decoration: line-through;
  color: #aaa;
}

.checklist-item-freq {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 0.1rem;
}

.checklist-item-priority {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.checklist-item-priority.high {
  background: #e74c3c;
}

.checklist-item-priority.medium {
  background: #f39c12;
}

.checklist-item-priority.low {
  background: #27ae60;
}

.checklist-reset {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.checklist-reset:hover {
  color: #e74c3c;
}

/* --------------------------------------------------------------------------
   DIAGNOSTIC
   -------------------------------------------------------------------------- */
.diagnostic-step {
  animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.diagnostic-question {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.diagnostic-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.diagnostic-option {
  padding: 1rem 1.25rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.97rem;
  color: #333;
  background: #fafafa;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.diagnostic-option:hover {
  border-color: #667eea;
  background: #f0f0ff;
  transform: translateX(4px);
}

.diagnostic-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.diagnostic-breadcrumb-step {
  font-size: 0.75rem;
  background: #eef;
  color: #667eea;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.diagnostic-result {
  animation: fadeSlideIn 0.3s ease;
}

.diagnostic-result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.diagnostic-severity {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.diagnostic-severity.high {
  background: #fff0ee;
  color: #c0392b;
}

.diagnostic-severity.medium {
  background: #fff8ee;
  color: #d68910;
}

.diagnostic-severity.low {
  background: #f0fff4;
  color: #1e6e41;
}

.diagnostic-result-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.diagnostic-result-description {
  font-size: 0.97rem;
  color: #555;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.diagnostic-actions {
  margin: 0;
  padding: 0;
  list-style: none;
}

.diagnostic-actions li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
}

.diagnostic-actions li::before {
  content: "→";
  color: #667eea;
  font-weight: 700;
  flex-shrink: 0;
}

.diagnostic-back {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: #667eea;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.diagnostic-restart {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   COMPARISON
   -------------------------------------------------------------------------- */
.comparison-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.comparison-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  color: #555;
  border-bottom: 2px solid #eee;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.comparison-table th:hover {
  color: #667eea;
}

.comparison-table th.sorted-asc::after {
  content: " ↑";
  color: #667eea;
}

.comparison-table th.sorted-desc::after {
  content: " ↓";
  color: #667eea;
}

.comparison-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.comparison-table tr.best-row td {
  background: #f8f7ff;
}

.comparison-table tr.best-row td:first-child {
  border-left: 4px solid #667eea;
  padding-left: 0.75rem;
}

.comparison-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #667eea;
  color: #fff;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.comparison-bool-true {
  color: #27ae60;
  font-weight: 700;
}

.comparison-bool-false {
  color: #e74c3c;
}

.comparison-rating {
  color: #f39c12;
  letter-spacing: 1px;
}

.comparison-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #eef;
  color: #667eea;
  border-radius: 4px;
  font-size: 0.78rem;
  margin: 0.1rem;
}

/* --------------------------------------------------------------------------
   POLL
   -------------------------------------------------------------------------- */
.poll-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.poll-option {
  cursor: pointer;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  transition: all 0.2s;
  background: #fafafa;
}

.poll-option:hover {
  border-color: #667eea;
  background: #f0f0ff;
}

.poll-option.voted {
  border-color: #667eea;
  cursor: default;
}

.poll-option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.poll-option-icon {
  font-size: 1.2rem;
}

.poll-option-text {
  flex: 1;
  font-size: 0.97rem;
  color: #333;
}

.poll-option-pct {
  font-size: 0.9rem;
  font-weight: 700;
  color: #667eea;
}

.poll-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.poll-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  transition: width 0.6s ease;
  width: 0;
}

.poll-total {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: #aaa;
  text-align: right;
}

/* --------------------------------------------------------------------------
   MINI-GAME
   -------------------------------------------------------------------------- */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.game-score-box,
.game-timer-box {
  font-size: 0.85rem;
  color: #666;
}

.game-score-box strong,
.game-timer-box strong {
  font-size: 1.2rem;
  color: #667eea;
}

/* Memory Cards */
.memory-grid {
  display: grid;
  gap: 0.75rem;
  justify-content: center;
}

.memory-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.memory-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.memory-card {
  aspect-ratio: 3/2;
  cursor: pointer;
  perspective: 600px;
  min-width: 80px;
}

.memory-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
  border-radius: 8px;
}

.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-back {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.memory-card-front,
.memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.memory-card-front {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 1.4rem;
}

.memory-card-back {
  background: #fff;
  color: #333;
  border: 2px solid #e0e0e0;
  transform: rotateY(180deg);
}

/* Matching Pairs */
.matching-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.matching-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.matching-item {
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  background: #fafafa;
  transition: all 0.2s;
  text-align: center;
}

.matching-item:hover {
  border-color: #667eea;
  background: #f0f0ff;
}

.matching-item.active {
  border-color: #667eea;
  background: #e8e8ff;
}

.matching-item.matched {
  border-color: #27ae60;
  background: #f0fff4;
  color: #1e6e41;
  pointer-events: none;
}

.matching-item.wrong {
  border-color: #e74c3c;
  background: #fff5f5;
  animation: shake 0.3s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

/* Typing Speed */
.typing-display {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a2e;
  padding: 1.5rem;
  background: #f8f8ff;
  border-radius: 12px;
  margin-bottom: 1rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.typing-input {
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1.1rem;
  text-align: center;
  transition: border-color 0.2s;
}

.typing-input:focus {
  outline: none;
  border-color: #667eea;
}

.typing-input.correct {
  border-color: #27ae60;
  background: #f0fff4;
}

.typing-input.incorrect {
  border-color: #e74c3c;
  background: #fff5f5;
}

.typing-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 1.25rem;
  text-align: center;
}

.typing-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #667eea;
}

.typing-stat-label {
  font-size: 0.78rem;
  color: #aaa;
}

/* --------------------------------------------------------------------------
   Widget Related (блок "Другие инструменты")
   -------------------------------------------------------------------------- */
.widget-related {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 2px solid #f0f0f0;
}

.widget-related h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.widget-related-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.widget-related-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border: 2px solid #e8e8f0;
  border-radius: 12px;
  text-decoration: none;
  color: #333;
  background: #fafafa;
  transition: all 0.2s;
  min-width: 200px;
  max-width: 280px;
  flex: 1;
}

.widget-related-card:hover {
  border-color: #667eea;
  background: #f5f5ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.widget-related-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.widget-related-card-text {
  flex: 1;
}

.widget-related-card-type {
  font-size: 0.72rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.widget-related-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   Кнопки (общие)
   -------------------------------------------------------------------------- */
.btn-widget {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.btn-widget-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.btn-widget-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  color: #fff;
}

.btn-widget-secondary {
  background: transparent;
  border-color: #667eea;
  color: #667eea;
}

.btn-widget-secondary:hover {
  background: #f0f0ff;
}

/* --------------------------------------------------------------------------
   Адаптивность
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {

  .widget-header,
  .widget-body {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .memory-grid.cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }

  .matching-container {
    grid-template-columns: 1fr;
  }

  .widget-related-cards {
    flex-direction: column;
  }

  .widget-related-card {
    max-width: 100%;
  }

  /* Calculator — single column on small screens */
  .calc-fields {
    grid-template-columns: 1fr;
  }

  .calc-result-value {
    font-size: 2.25rem;
  }

  .calc-result-box {
    padding: 1.35rem 1.35rem;
  }

  /* Larger touch targets for range sliders */
  .calc-field input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  .calc-field input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
  }

  /* Radio pills wrap vertically */
  .calc-field-radio {
    flex-direction: column;
  }

  .calc-field-radio label {
    justify-content: center;
  }
}