:root {
    --hibiscus-red: #E31C25;
    --tropical-blue: #00A3E0;
    --sunset-gold: #FFB81C;
    --jungle-green: #009639;
    --deep-purple: #4B2C20;
    --glass-white: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--deep-purple);
}

.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.4;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--hibiscus-red);
    top: -100px;
    right: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--tropical-blue);
    bottom: -50px;
    left: -50px;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: var(--sunset-gold);
    top: 40%;
    left: 10%;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 3rem;
    color: var(--hibiscus-red);
    text-shadow: 2px 2px 0px white;
    margin-bottom: 0.5rem;
}

#stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-weight: 700;
    font-size: 1.2rem;
}

.view {
    background: var(--glass-white);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease;
}

.hidden {
    display: none !important;
}

h2 {
    font-family: 'Fredoka', sans-serif;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.selector-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

button {
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
    border-radius: 12px;
}

.level-btn, .unit-btn {
    padding: 2rem 1rem;
    background: white;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tropical-blue);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.level-btn:hover, .unit-btn:hover {
    transform: translateY(-5px);
    background: var(--tropical-blue);
    color: white;
}

.custom-btn {
    background: var(--sunset-gold);
    color: white;
    grid-column: 1 / -1;
}

.custom-btn:hover {
    background: #e6a719;
    color: white;
}

.difficulty-btn {
    padding: 1.5rem 1rem;
    font-size: 1.2rem;
}

.full-width-btn {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 1rem;
}

.primary-btn {
    padding: 1rem 2rem;
    background: var(--hibiscus-red);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.secondary-btn {
    padding: 1rem 2rem;
    background: #eee;
    color: #555;
    font-weight: 700;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.nav-header h2 {
    margin: 0;
    flex-grow: 1;
}

/* Game Area Layout */
.game-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.hangman-box {
    width: 250px;
    height: 250px;
    background: rgba(255,255,255,0.5);
    border-radius: 15px;
    padding: 10px;
}

#hangman-svg {
    width: 100%;
    height: 100%;
}

.scaffold {
    stroke: var(--deep-purple);
    stroke-width: 4;
    stroke-linecap: round;
}

.body-part {
    stroke: var(--hibiscus-red);
    stroke-width: 4;
    stroke-linecap: round;
    fill: none;
}

.eye-l, .eye-r {
    fill: none;
    stroke-width: 2;
}

.word-box {
    flex: 1;
    min-width: 300px;
    text-align: center;
}

#word-display {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.letter-slot {
    width: 35px;
    height: 45px;
    border-bottom: 4px solid var(--deep-purple);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
}

.hint-text {
    font-style: italic;
    color: #666;
    background: #f0f0f0;
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid var(--sunset-gold);
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 0.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.key {
    height: 50px;
    background: white;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
    text-transform: uppercase;
}

.key:hover {
    background: #f9f9f9;
}

.key.used {
    opacity: 0.3;
    pointer-events: none;
}

.key.correct {
    background: var(--jungle-green);
    color: white;
    border-color: var(--jungle-green);
}

.key.wrong {
    background: #ccc;
    color: #fff;
    border-color: #ccc;
}

/* Modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal {
    background: white;
    padding: 3rem;
    border-radius: 25px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

.modal h2 {
    margin-top: 0;
    color: var(--hibiscus-red);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.educational-card {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: left;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.translation-section {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.translation-section p {
    margin: 0;
}

.sentence-section {
    margin-top: 1rem;
}

.sentence-section p {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.sentence-en { font-weight: 600; color: var(--deep-purple); }
.sentence-cn { color: #d32f2f; }
.sentence-ms { color: #1976d2; }

hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 1rem 0;
}

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

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    .container { padding: 1rem; }
    .selector-grid { grid-template-columns: repeat(2, 1fr); }
    .hangman-box { width: 180px; height: 180px; }
    .letter-slot { width: 25px; height: 35px; font-size: 1.5rem; }
}
