:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-bg: #f8f9fa;
  --white: #fff;
  --text-dark: #333;
  --text-light: #6c757d;
  --border-radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.1);
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.page-wrapper {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 20px;
  color: var(--text-dark);
  line-height: 1.6;
}

.main-container {
  max-width: 900px;
  margin: auto;
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.main-title {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 1px;
}

.textarea-wrapper { 
  position: relative; 
  margin-bottom: 20px;
}

.highlight-layer, .input-textarea {
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: transparent;
  padding: 16px;
  pointer-events: none;
  border-radius: var(--border-radius);
  border: 2px solid #e9ecef;
}

.input-textarea {
  width: 100%;
  height: 280px;
  padding: 16px;
  border: 2px solid #e9ecef;
  border-radius: var(--border-radius);
  background: var(--white);
  resize: vertical;
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.input-textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.wrong-word { 
  text-decoration: underline wavy var(--danger-color); 
  position: relative;
  cursor: help;
}

.wrong-word:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger-color);
  color: var(--white);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  margin-bottom: 2px;
}

.button-controls { 
  margin: 20px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 12px 20px;
  background: var(--primary-color);
  border: 0;
  color: var(--white);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,123,255,0.2);
}

.btn:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.btn:active {
  transform: translateY(0);
}

.stats-display { 
  margin: 20px 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--light-bg);
  padding: 15px;
  border-radius: var(--border-radius);
}

.stats-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-light);
}

.stats-item strong {
  color: var(--text-dark);
}

.progress-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: conic-gradient(var(--primary-color) 0deg, var(--primary-color) 0deg, #e9ecef 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.progress-circle::after {
  content: attr(data-percent);
  background: var(--white);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--primary-color);
  font-weight: bold;
  z-index: 2;
  box-shadow: 0 0 0 3px var(--white);
  border: 2px solid #f8f9fa;
}

.progress-circle.low { 
  box-shadow: 0 4px 20px rgba(40,167,69,0.3); 
  --primary-color: var(--success-color);
}

.progress-circle.low::after { color: var(--success-color); }

.progress-circle.medium { 
  box-shadow: 0 4px 20px rgba(255,193,7,0.3); 
  --primary-color: var(--warning-color);
}

.progress-circle.medium::after { color: var(--warning-color); }

.progress-circle.high { 
  box-shadow: 0 4px 20px rgba(220,53,69,0.3); 
  --primary-color: var(--danger-color);
}

.progress-circle.high::after { color: var(--danger-color); }

.suggestions-box { 
  margin-top: 20px;
  background: var(--light-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.suggestions-box.empty {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
}

.suggestions-box div { 
  margin-bottom: 12px; 
  padding: 12px; 
  background: var(--white); 
  border-radius: 8px; 
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: var(--transition);
}

.suggestions-box div:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.suggestions-box strong { 
  color: var(--danger-color); 
  margin-right: 10px; 
  font-size: 16px;
}

.sug {
  display: inline-block;
  padding: 6px 12px;
  margin: 4px;
  background: #e3f2fd;
  border: 1px solid #bbdefb;
  border-radius: 20px;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,123,255,0.1);
}

.sug:hover {
  background: #bbdefb;
  color: #0056b3;
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 3px 6px rgba(0,123,255,0.2);
}

.loading-indicator {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.usage-guide {
  margin-top: 30px;
  padding: 20px;
  background: var(--light-bg);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
}

.usage-guide h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 20px;
  font-weight: 500;
}

.usage-guide p {
  color: var(--text-dark);
  margin-bottom: 10px;
  line-height: 1.7;
}

.usage-guide ul {
  color: var(--text-light);
  padding-left: 20px;
}

.usage-guide li {
  margin-bottom: 8px;
  color: var(--text-dark);
}

@media (max-width: 768px) {
  .main-container {
    padding: 20px;
    margin: 10px;
  }
  
  .button-controls {
    justify-content: center;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .stats-display {
    font-size: 16px;
    gap: 10px;
  }
  
  .progress-circle {
    width: 60px;
    height: 60px;
  }
  
  .progress-circle::after {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
  
  .input-textarea {
    height: 200px;
    font-size: 14px;
  }
  
  .usage-guide {
    padding: 15px;
  }
}