
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
}

.loading-text {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  margin-bottom: 20px;
  color: #666;
}

.loading-counter {
  font-size: 48px;
  font-weight: 300;
  color: #1a1a1a;
  font-family: "JetBrains Mono", monospace;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  opacity: 0;
  transition: opacity 1s ease 0.5s;
}

.container.visible {
  opacity: 1;
}

/* Navigation */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 60px;
  padding: 30px 0;
  background: rgba(250, 250, 250, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e5e5;
  transition: all 0.3s ease;
}

.main-nav.scrolled {
  padding: 20px 0;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.nav-link {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  color: #666;
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: #1a1a1a;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 1px;
  background: #1a1a1a;
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Sections */
.section {
  padding: 120px 0;
  border-bottom: 1px solid #e5e5e5;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 80px;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  letter-spacing: -1px;
  color: #1a1a1a;
}

.section-number {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  letter-spacing: 1px;
}

.section-description {
  text-align: center;
  font-size: 16px;
  color: #666;
  margin-bottom: 60px;
  line-height: 1.8;
}

/* Converter Grid */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.input-area textarea {
  width: 100%;
  min-height: 120px;
  padding: 20px;
  border: 1px solid #e5e5e5;
  border-radius: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  background: #fff;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.input-area textarea:focus {
  outline: none;
  border-color: #1a1a1a;
}

.button-row {
  display: flex;
  gap: 20px;
  margin-top: 30px;
}

.output-area {
  min-height: 120px;
  display: flex;
  align-items: center;
}

.morse-display,
.text-display {
  width: 100%;
  min-height: 120px;
  padding: 20px;
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  word-break: break-all;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-accent {
  padding: 12px 30px;
  border: 1px solid #1a1a1a;
  background: transparent;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
}

.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  color: #1a1a1a;
}

.btn-secondary:hover {
  background: #1a1a1a;
  color: #fff;
}

.btn-accent {
  border-color: #666;
  color: #666;
}

.btn-accent:hover {
  background: #666;
  color: #fff;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Cheatsheet Grid */
.cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.cheatsheet-item {
  padding: 30px;
  border: 1px solid #e5e5e5;
  background: #fff;
  transition: all 0.3s ease;
  cursor: pointer;
}

.cheatsheet-item:hover {
  border-color: #1a1a1a;
  transform: translateY(-2px);
}

.cheatsheet-letter {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.cheatsheet-morse {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  margin-bottom: 15px;
  letter-spacing: 2px;
  color: #333;
}

.cheatsheet-phrase {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  font-style: italic;
}

/* Practice Section */
.practice-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.practice-question-area {
  margin-bottom: 60px;
}

.practice-morse {
  font-family: "JetBrains Mono", monospace;
  font-size: 4rem;
  font-weight: 300;
  letter-spacing: 8px;
  margin-bottom: 30px;
  color: #1a1a1a;
}

.practice-answer-area {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.practice-answer-area input {
  width: 80px;
  height: 80px;
  text-align: center;
  font-size: 32px;
  font-weight: 300;
  border: 1px solid #e5e5e5;
  background: #fff;
  text-transform: uppercase;
}

.practice-answer-area input:focus {
  outline: none;
  border-color: #1a1a1a;
}

.practice-result {
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 40px;
  min-height: 30px;
}

.practice-result.correct {
  color: #377e17;
}

.practice-result.incorrect {
  color: #f51515;
}

.practice-result.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  color: #1a1a1a;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.practice-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 40px;
  border-top: 1px solid #e5e5e5;
}

/* Reference Grid */
.morse-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
}

.morse-item {
  padding: 20px;
  border: 1px solid #e5e5e5;
  background: #fff;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.morse-item:hover {
  border-color: #1a1a1a;
  transform: translateY(-2px);
}

.morse-letter {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.morse-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  letter-spacing: 2px;
  color: #666;
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0;
  color: #1a1a1a;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer a {
  text-decoration: none;
  color: #1a1a1a;
}

/* Video Link */
.video-link {
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.video-link:hover {
  border-bottom-color: #1a1a1a;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .main-nav {
    flex-wrap: wrap;
    gap: 30px;
  }

  .converter-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .section {
    padding: 80px 0;
  }

  .section-header {
    flex-direction: column;
    gap: 20px;
    margin-bottom: 60px;
  }

  .practice-morse {
    font-size: 2.5rem;
    letter-spacing: 4px;
  }

  .practice-answer-area {
    flex-direction: column;
    align-items: center;
  }

  .practice-score {
    flex-direction: column;
    gap: 20px;
  }

  .cheatsheet-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    gap: 1rem;
  }
}
