:root {
  --atg-bg: #090b11;
  --atg-panel: rgba(14, 18, 30, 0.9);
  --atg-border: rgba(255, 255, 255, 0.12);
  --atg-text: #eef2ff;
  --atg-muted: #bdc7e6;
  --atg-accent: #f59e0b;
  --atg-accent-strong: #d97706;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(140% 120% at 10% 0%, rgba(245, 158, 11, 0.14), rgba(9, 11, 17, 0) 45%),
    radial-gradient(130% 110% at 90% 100%, rgba(56, 189, 248, 0.12), rgba(9, 11, 17, 0) 50%),
    var(--atg-bg);
  color: var(--atg-text);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.18;
}

body::after {
  background: radial-gradient(circle at 50% 22%, rgba(245, 158, 11, 0.12), transparent 58%);
}

.typing-page {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  padding: 20px 18px 34px;
}

.game-title {
  margin: 0 0 10px;
  font-size: clamp(1.95rem, 3.8vw, 2.75rem);
  line-height: 1.18;
  letter-spacing: 0.01em;
}

.game-subtitle {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  color: var(--atg-muted);
  line-height: 1.5;
  font-size: clamp(0.95rem, 1.45vw, 1.08rem);
}

.typing-page > .container {
  margin-top: 18px !important;
}

.typing-card {
  border: 1px solid var(--atg-border);
  border-radius: 18px;
  background: var(--atg-panel);
  max-width: 980px;
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.typing-card .card-subtitle,
.typing-card .card-text,
.typing-card span,
.typing-card label,
.typing-card .form-check-label {
  color: var(--atg-muted);
}

.typing-card .card-text {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

#targetText {
  min-height: 64px;
  line-height: 1.52;
  font-size: clamp(1.35rem, 3vw, 2rem) !important;
  font-family: "Noto Sans Ethiopic", "Abyssinica SIL", sans-serif;
  color: #f5f8ff;
}

#typingInput {
  font-size: clamp(1.15rem, 2.2vw, 1.65rem);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(8, 12, 24, 0.86);
  color: var(--atg-text);
  font-family: "Noto Sans Ethiopic", "Abyssinica SIL", sans-serif;
}

#typingInput::placeholder {
  color: #8e99bc;
}

#typingInput:focus {
  border-color: rgba(245, 158, 11, 0.62);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
  background: rgba(8, 12, 24, 0.9);
  color: var(--atg-text);
}

.kbd-container {
  min-height: 20px;
  margin-bottom: 8px;
  text-align: left;
}

.kbd-helper {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 6px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.76);
  color: #cdd7f6;
  font-size: 0.72rem;
}

.form-check-input {
  background-color: rgba(8, 12, 24, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}

.form-check-input:checked {
  background-color: var(--atg-accent);
  border-color: var(--atg-accent);
}

.progress {
  background-color: rgba(8, 12, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#restartBtn,
.modal-footer .btn-primary,
.typing-card .btn-primary {
  border: 1px solid rgba(245, 158, 11, 0.48);
  background: linear-gradient(135deg, var(--atg-accent), var(--atg-accent-strong));
  color: #161616;
  font-weight: 600;
  border-radius: 11px;
}

#restartBtn:hover,
.modal-footer .btn-primary:hover,
.typing-card .btn-primary:hover {
  filter: brightness(1.04);
}

.kbd_targetText {
  font-size: 0.72rem;
  vertical-align: middle;
  color: #8e99bc;
}

.word-container {
  display: inline-block;
  position: relative;
  margin-right: 4px;
}

.word-container.animated-underline::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 2px;
  background: #60a5fa;
  width: 100%;
  animation: underline-grow 1.5s infinite;
}

.kbd_targetText.animated-underline {
  position: relative;
}

.kbd_targetText.animated-underline::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 2px;
  background: #60a5fa;
  width: 100%;
  animation: underline-grow 1.5s infinite;
}

@keyframes underline-grow {
  0% {
    width: 0;
  }

  50% {
    width: 100%;
  }

  100% {
    width: 0;
  }
}

.text-success {
  color: #86efac !important;
}

.modal-content {
  background: #101728;
  color: var(--atg-text);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.modal-header,
.modal-footer {
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-close {
  filter: invert(1) grayscale(1);
}

@media (max-width: 700px) {
  .typing-page {
    padding: 14px 12px 24px;
  }

  .game-title {
    font-size: clamp(1.55rem, 7.2vw, 2.05rem);
  }

  .game-subtitle {
    font-size: clamp(0.9rem, 3.6vw, 1rem);
    line-height: 1.42;
  }

  #targetText {
    font-size: clamp(1.15rem, 6vw, 1.5rem) !important;
  }

  #typingInput {
    font-size: 1.05rem;
  }

  .typing-card {
    padding: 14px !important;
  }
}
