:root{
  --bg-start: #0f172a;
  --bg-end: #000000;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.3);
  --error-subtle: rgba(255, 255, 255, 0.1);
}

*{box-sizing:border-box}
html,body{height:100%;overflow:hidden}
body{
  margin:0;
  background: radial-gradient(circle at center, var(--bg-start), var(--bg-end));
  font-family: "Georgia", "Times New Roman", serif; /* Elegant serif for English */
  color:var(--text-primary);
  display:flex;
  justify-content:center;
  align-items:center;
}

#app-frame{
  width: 100%;
  height: 100%;
  border:none;
  background:transparent;
  display:flex;
  flex-direction:column;
  position: relative;
}

main{
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content: center; /* Center vertically */
  overflow:hidden;
  position:relative;
  z-index: 10; /* Above the background echoes */
}

#english-wrap{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  margin-bottom: 2rem;
}

#english-word{
  font-size: 3rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  transition: opacity 500ms ease, transform 500ms ease;
  white-space: pre;
  text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#english-word .letter{
  display:inline-block;
  transition: color 300ms ease, text-shadow 300ms ease, transform 200ms ease;
}

#english-word .letter.correct{
  color: var(--text-primary);
  text-shadow: 0 0 15px var(--accent-glow), 0 0 5px var(--accent);
}

#english-word .letter.incorrect{
  color: var(--text-secondary);
  opacity: 0.5;
  transform: translateY(2px); /* Subtle shake/drop instead of red */
}

/* The cascade container is now the "Echo Chamber" */
#mandarin-cascade{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0; /* Behind everything */
  overflow: hidden;
}

.mandarin-echo{
  position: absolute;
  color: var(--accent);
  font-family: "Noto Serif SC", "Songti SC", serif; /* Calligraphic style if available */
  font-weight: 400;
  opacity: 0;
  user-select: none;
  will-change: transform, opacity;
  text-shadow: 0 0 20px var(--accent-glow);
}

/* Completed grid is now a subtle history log at the bottom */
#completed-grid{
  position:fixed;
  left:0;
  bottom:0;
  width:100%;
  height: auto;
  padding: 20px;
  display:flex;
  flex-direction:row;
  flex-wrap:wrap;
  justify-content: center;
  gap: 12px;
  pointer-events:none;
  z-index: 5;
  opacity: 0.6;
}

.completed-char{
  font-size: 1.2rem;
  color: var(--text-secondary);
  opacity: 0;
  animation: fadeIn 1s forwards;
}

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

/* new word change animations */
#english-word.fade-out-down{opacity:0;transform:translateY(20px) scale(0.95)}
#english-word.fade-in-up{opacity:0;transform:translateY(-20px) scale(1.05)}

/* Responsiveness */
@media (max-width: 600px) {
  #english-word {
    font-size: 2rem;
  }
}
