:root {
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Prevent pull to refresh on mobile */
    overscroll-behavior-y: none;
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23ffffff" fill-opacity="0.05"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    color: white;
}

.score-board {
    font-size: 1.25rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.admin-link {
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}
.admin-link:hover { 
    opacity: 1; 
    transform: scale(1.1);
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.word-card {
    background: var(--card-bg);
    width: 100%;
    border-radius: 24px;
    padding: 3rem 1.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.4);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.word-card.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.word-card.success-anim {
    animation: pop 0.4s ease-out forwards;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.thai-word {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.3;
    background: linear-gradient(135deg, #4f46e5, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    word-break: break-word;
}

.input-area {
    width: 100%;
}

#game-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.5rem;
    font-family: inherit;
    font-weight: 600;
    text-align: center;
    border: 2px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    color: var(--text-main);
}

input:focus {
    outline: none;
    background: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.2), 0 4px 20px rgba(0,0,0,0.15);
    transform: scale(1.02);
}

input::placeholder {
    color: #cbd5e1;
    font-weight: 500;
}

button {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.1s, background 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

button:active:not(:disabled) {
    transform: scale(0.97);
}

.button-group {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.button-group button {
    flex: 1;
}

.btn-check {
    background: var(--text-main);
    color: white;
}

.btn-check:hover:not(:disabled) {
    background: #0f172a;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn-show-answer {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--text-muted);
    box-shadow: none;
}

.btn-show-answer:hover:not(:disabled) {
    background: var(--text-muted);
    color: white;
}

.btn-next {
    background: var(--success);
    color: white;
    animation: slideUp 0.3s ease-out;
}

.btn-next:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.hidden {
    display: none !important;
}

.feedback {
    min-height: 28px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}

.feedback.show {
    opacity: 1;
    transform: translateY(0);
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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