@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Noto+Sans+KR:wght@300;400;700&display=swap');

:root {
  --bg-color: #0f172a;
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.4);
  --error-color: #f43f5e;
  --success-color: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.game-container {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  max-width: 900px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  overflow: hidden;
}

header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.status {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Question Area */
.question-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.prompt {
  font-size: 5rem; /* Large font size */
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
}

.details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.roman {
  color: var(--accent-color);
  font-weight: 600;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: absolute;
  right: -3.5rem;
}

.icon-btn:hover {
  color: var(--accent-color);
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Input Area */
.input-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#user-input {
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-size: 3rem; /* Large font size */
  color: var(--text-primary);
  text-align: center;
  width: 100%;
  max-width: 400px;
  outline: none;
  transition: all 0.3s ease;
  font-family: 'Noto Sans KR', sans-serif;
}

#user-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px var(--accent-glow);
}

#user-input.error {
  border-color: var(--error-color);
  animation: shake 0.4s ease-in-out;
}

#user-input.success {
  border-color: var(--success-color);
}

.feedback {
  min-height: 3rem;
  text-align: center;
  font-size: 1.1rem;
  color: var(--error-color);
  line-height: 1.5;
  white-space: pre-wrap; /* allow newlines */
}

/* Keyboard */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 800px;
  margin-top: 1rem;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.key {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  min-width: 3.5rem;
  height: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: all 0.1s ease;
  user-select: none;
}

.key .eng {
  font-size: 0.75rem;
  opacity: 0.7;
  position: absolute;
  top: 4px;
  left: 6px;
}

.key .kor {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.key.shifted-output {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.12);
}

.key.shifted-output .kor {
  color: var(--accent-color);
}

.key.active {
  background: var(--accent-color);
  color: #000;
  box-shadow: 0 0 20px var(--accent-glow);
  border-color: transparent;
  transform: translateY(2px);
}

.key.active .eng, .key.active .kor {
  color: #000;
}

/* Screens */
.screen {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Game screen is always visible in the background to preserve IME state */
#game-screen {
  display: flex;
}

#title-screen, #results-screen {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(15, 23, 42, 0.85); /* Dark overlay */
  backdrop-filter: blur(8px);
  z-index: 10;
  justify-content: center;
  padding: 2rem;
}

.screen.active {
  display: flex;
}

/* Results */
.results-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.results-card h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.results-card p {
  font-size: 1.25rem;
  margin: 0.5rem 0;
}

button.primary {
  background: var(--accent-color);
  color: #0f172a;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

button.primary:hover {
  background: #7dd3fc;
  box-shadow: 0 0 15px var(--accent-glow);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkbox-wrap input {
  accent-color: var(--accent-color);
}
