/* --- ใช้ Google Fonts เดิม (Kanit & Poppins) --- */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&family=Poppins:wght@700&display=swap');

/* --- 🎨 ชุดสี "Creative Dawn" --- */
:root {
    --bg-gradient-start: #fde2e4; /* สีชมพูอ่อน */
    --bg-gradient-end: #e2e2f6;   /* สีม่วงอ่อน */
    --card-bg: #ffffff;
    --text-primary: #192a51;     /* สีน้ำเงินเข้ม */
    --text-secondary: #57606f;
    --word-color: #0d1b2a;
    --accent-speak: #ff6a88;      /* สีชมพูสดใส */
    --accent-listen: #00a896;     /* สีเขียวอมฟ้า */
    --accent-next: #a8a8a8;
    --correct-bg: rgba(0, 168, 150, 0.1);
    --incorrect-bg: rgba(255, 106, 136, 0.1);
    --correct-text: #007a6e;
    --incorrect-text: #e53856;
}

/* --- 🌅 พื้นฐานและพื้นหลัง --- */
body {
    font-family: 'Kanit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    background-attachment: fixed;
    box-sizing: border-box;
}

.container {
    text-align: center;
    max-width: 550px;
    width: 100%;
}

h1 {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 2rem;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

/* --- 🃏 การ์ดคำศัพท์ --- */
.card {
    background: var(--card-bg);
    border-radius: 24px; /* เพิ่มความโค้งมน */
    padding: 2rem 2.5rem 2.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06), 0 15px 35px rgba(0, 0, 0, 0.08);
    border: 1px solid #ffffff;
    transition: transform 0.3s ease;
}

/* --- 📊 ส่วนแสดงสถานะ --- */
.stats-container {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
    font-size: 0.9rem;
}

/* --- 🅰️ การแสดงผลคำศัพท์ --- */
#word-display {
    font-family: 'Poppins', sans-serif;
    font-size: 4.2rem;
    font-weight: 700;
    color: var(--word-color);
    margin: 0.5rem 0;
    cursor: pointer;
}

#translation-display {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 1.5rem 0;
     /* เพิ่ม 3 บรรทัดนี้เข้าไป */
    opacity: 0; /* ซ่อนไว้ในตอนแรก */
    transform: translateY(15px); /* เลื่อนลงเล็กน้อย */
    transition: opacity 0.4s ease, transform 0.4s ease; /* เพิ่ม animation */
}
/* เพิ่ม class ใหม่นี้เข้าไปที่ใดก็ได้ในไฟล์ style.css */
#translation-display.visible {
    opacity: 1; /* ทำให้มองเห็น */
    transform: translateY(0); /* เลื่อนกลับที่เดิม */
}
/* --- 💬 พื้นที่แสดงผลลัพธ์ --- */
.feedback {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem auto;
    padding: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}
.feedback.correct {
    color: var(--correct-text);
    background-color: var(--correct-bg);
}
.feedback.incorrect {
    color: var(--incorrect-text);
    background-color: var(--incorrect-bg);
}

/* --- 🔘 ปุ่มควบคุม --- */
.buttons {
    display: grid;
    grid-template-columns: 1fr 1.5fr; /* ทำให้ปุ่มพูดใหญ่กว่า */
    gap: 1rem;
}
button {
    font-family: 'Kanit', sans-serif;
    padding: 0.9rem 1rem;
    border-radius: 50px; /* ทรงแคปซูล */
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}
button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}
button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

#speak-btn {
    background: #fff;
    color: var(--accent-listen);
    border: 2px solid var(--accent-listen);
}

#check-mic-btn {
    background: var(--accent-speak);
    color: #fff;
    border: 2px solid var(--accent-speak);
}
#check-mic-btn:disabled {
    background: #d1d1d1;
    border-color: #d1d1d1;
    cursor: not-allowed;
    animation: pulse 2s infinite;
}

#next-btn {
    background-color: #f0f0f0;
    color: #555;
    width: 100%;
    margin-top: 1rem;
}

.instructions {
    margin-top: 2.5rem;
    color: var(--text-secondary);
    opacity: 0.9;
}

/* ---  pulsing animation for disabled button --- */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 106, 136, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(255, 106, 136, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 106, 136, 0); }
}

/* --- 📱 Responsive สำหรับมือถือ --- */
@media (max-width: 600px) {
    body { padding: 1rem; }
    .card { padding: 1.5rem; }
    #word-display { font-size: 3.2rem; }
    .buttons {
        display: flex;
        flex-direction: column-reverse; /* เอาปุ่มพูดไว้ล่างสุดให้กดง่าย */
    }
}
/* --- 👨‍💻 สไตล์สำหรับส่วนท้าย (Footer) --- */
.page-footer {
  text-align: center;
  margin-top: 3rem; /* ระยะห่างจากเนื้อหาด้านบน */
  color: var(--text-secondary);
  opacity: 0.9;
}

.page-footer p {
  margin: 0.2rem 0; /* ลดระยะห่างระหว่างบรรทัด */
  font-size: 0.95rem;
}

.page-footer .developer-name {
  font-weight: 600; /* ทำให้ชื่อตัวหนาขึ้น */
  font-size: 1rem;
  color: var(--text-primary);
}

.page-footer .developer-title {
    font-size: 0.9rem;
}