/* ============================================================
   Simple Typing - typing.css
   Typing screen, results view, and certificate action styles.
   ============================================================ */

#st-plugin #st-screen-typing {
  padding: 28px 34px 40px;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.04), rgba(255, 255, 255, 0) 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.46));
}

#st-plugin #st-screen-typing .st-unicode-hint {
  margin-bottom: 18px;
}

#st-plugin .st-unicode-hint {
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.14);
  color: var(--st-dim);
  font-size: 0.88rem;
  line-height: 1.7;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.08);
}

#st-plugin .st-unicode-hint strong {
  color: var(--st-accent);
}

#st-plugin #st-text-display {
  position: relative;
  min-height: 460px;
  margin-bottom: 24px;
  border-radius: 30px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.92)),
    rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.12);
  overflow: hidden !important;
  cursor: text;
}

#st-plugin #st-text-display:focus,
#st-plugin #st-text-display:focus-within {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08), 0 24px 52px rgba(15, 23, 42, 0.12);
}

#st-plugin #st-text-display::before,
#st-plugin #st-text-display::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 62px;
  z-index: 5;
  pointer-events: none;
}

#st-plugin #st-text-display::before {
  top: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

#st-plugin #st-text-display::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

#st-plugin .st-text-inner {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  padding: 30px 34px 42px;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  color: var(--st-muted);
  font-family: var(--st-sans) !important;
  font-size: clamp(1.18rem, 1.35vw, 1.42rem) !important;
  font-weight: 500;
  line-height: 1.92 !important;
  letter-spacing: 0.01em;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#st-plugin .st-text-inner::-webkit-scrollbar {
  display: none;
}

#st-plugin .st-sentence {
  display: inline;
  transition: color 0.18s ease, filter 0.18s ease;
}

#st-plugin .st-sentence.st-active-sentence {
  color: rgba(16, 33, 61, 0.88);
  filter: saturate(1.05);
}

#st-plugin .st-sentence-placeholder {
  display: none;
}

#st-plugin .st-word {
  display: inline-block !important;
  white-space: nowrap !important;
}

#st-plugin .st-char {
  display: inline !important;
  white-space: pre-wrap !important;
}

#st-plugin .st-char.st-space {
  display: inline !important;
  white-space: pre !important;
}

#st-plugin .st-char.st-pending {
  color: inherit;
}

#st-plugin .st-char.st-correct {
  color: var(--st-text);
}

#st-plugin .st-char.st-incorrect {
  color: var(--st-red);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

#st-plugin .st-char.st-current {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #315ff4);
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

#st-plugin .st-focus-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(244, 247, 255, 0.76);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

#st-plugin .st-focus-overlay span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 280px;
  min-height: 64px;
  padding: 14px 26px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(37, 99, 235, 0.14);
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.12);
  color: var(--st-text);
  font-size: 1rem;
  font-weight: 700;
}

@keyframes stShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

#st-plugin #st-text-display.st-shake {
  animation: stShake 0.22s ease;
}

#st-plugin #st-typing-input {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#st-plugin .st-typing-toolbar {
  padding: 26px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.92)),
    rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(37, 99, 235, 0.08);
  box-shadow: 0 24px 42px rgba(15, 23, 42, 0.08);
}

#st-plugin .st-typing-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

#st-plugin .st-back-btn {
  flex: 0 0 auto;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--st-dim);
  font-size: 0.88rem;
  font-weight: 800;
}

#st-plugin .st-back-btn:hover {
  color: var(--st-accent);
}

#st-plugin .st-typing-info {
  flex: 1;
  min-width: 0;
}

#st-plugin .st-typing-info strong {
  display: block;
  margin-bottom: 3px;
  font-family: var(--st-display);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--st-text);
}

#st-plugin .st-typing-info span {
  display: block;
  color: var(--st-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

#st-plugin .st-timelimit-indicator {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.14);
  color: var(--st-accent);
  font-family: var(--st-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

#st-plugin .st-live-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

#st-plugin .st-stat-box {
  padding: 22px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  border: 1px solid rgba(37, 99, 235, 0.08);
  text-align: center;
}

#st-plugin .st-stat-val {
  font-family: var(--st-mono);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--st-accent);
}

#st-plugin .st-stat-val.green {
  color: var(--st-green);
}

#st-plugin .st-stat-val.blue {
  color: var(--st-accent2);
}

#st-plugin .st-stat-label {
  margin-top: 10px;
  color: var(--st-dim);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#st-plugin .st-progress-bar {
  height: 10px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

#st-plugin .st-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa 55%, #d4a017);
  transition: width 0.16s linear;
}

#st-plugin .st-keyboard-hint {
  text-align: center;
  color: var(--st-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

#st-plugin .st-keyboard-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(37, 99, 235, 0.12);
  color: var(--st-text);
  font-family: var(--st-mono);
  font-size: 0.74rem;
  font-weight: 700;
}

#st-plugin #st-screen-results {
  padding-top: 34px;
}

#st-plugin .st-results-hero {
  padding: 18px 0 28px;
  text-align: center;
}

#st-plugin .st-result-trophy {
  display: block;
  margin-bottom: 10px;
  font-size: 4rem;
  line-height: 1;
}

#st-plugin .st-results-hero h2 {
  font-family: var(--st-display);
  font-size: clamp(2.1rem, 3vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--st-text);
}

#st-plugin .st-results-hero p {
  margin-top: 6px;
  color: var(--st-dim);
  font-size: 0.95rem;
}

#st-plugin .st-res-progress {
  color: var(--st-accent);
  font-weight: 700;
}

#st-plugin .st-results-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

#st-plugin .st-result-card {
  padding: 24px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  border: 1px solid rgba(37, 99, 235, 0.08);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.08);
  text-align: center;
}

#st-plugin .st-result-val {
  font-family: var(--st-mono);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
}

#st-plugin .st-result-label {
  margin-top: 10px;
  color: var(--st-dim);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#st-plugin .st-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

#st-plugin .st-cert-section {
  padding: 28px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.94)),
    rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(37, 99, 235, 0.08);
  box-shadow: 0 24px 44px rgba(15, 23, 42, 0.08);
}

#st-plugin .st-cert-form {
  width: min(100%, 760px);
  margin: 0 auto 28px;
}

#st-plugin .st-cert-form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--st-text);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

#st-plugin .st-cert-form-input {
  width: 100%;
  min-height: 54px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--st-text);
  font-size: 0.95rem;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.02);
}

#st-plugin .st-cert-form-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

#st-plugin .st-cert-form-note {
  margin-bottom: 16px;
  color: var(--st-dim);
  font-size: 0.88rem;
  line-height: 1.75;
}

#st-plugin .st-cert-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

#st-plugin .st-cert-platforms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

#st-plugin .st-cert-share-note {
  min-height: 24px;
  color: var(--st-dim);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.7;
}

#st-plugin .st-cert-share-note.is-info {
  color: var(--st-accent);
}

#st-plugin .st-cert-share-note.is-success {
  color: var(--st-green);
}

#st-plugin .st-cert-share-note.is-error {
  color: var(--st-red);
}

@media (max-width: 1080px) {
  #st-plugin .st-live-stats,
  #st-plugin .st-results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  #st-plugin #st-screen-typing,
  #st-plugin #st-screen-results {
    padding: 24px 18px 34px;
  }

  #st-plugin #st-text-display {
    min-height: 380px;
    border-radius: 24px;
  }

  #st-plugin .st-text-inner {
    padding: 24px 22px 34px;
  }

  #st-plugin .st-typing-toolbar,
  #st-plugin .st-cert-section {
    padding: 20px;
    border-radius: 22px;
  }

  #st-plugin .st-typing-meta {
    flex-wrap: wrap;
  }

  #st-plugin .st-typing-meta .st-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  #st-plugin #st-text-display {
    min-height: 320px;
  }

  #st-plugin .st-focus-overlay span {
    min-width: 0;
    width: 100%;
  }

  #st-plugin .st-live-stats,
  #st-plugin .st-results-grid,
  #st-plugin .st-cert-actions,
  #st-plugin .st-cert-platforms {
    grid-template-columns: 1fr;
  }

  #st-plugin .st-result-actions {
    flex-direction: column;
  }

  #st-plugin .st-result-actions .st-btn {
    width: 100%;
  }
}
