/* Global Styles */
:root {
    --primary-color: #e60012;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Noto Sans JP', 'Poppins', sans-serif;
    background: var(--background);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Container */
.container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: 20px;
}

.logo-jp {
    display: block;
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(45deg, #e60012, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-en {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 4px;
}

/* Typography */
h1 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-primary);
}

h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Rules Section */
.rules {
    background: rgba(103, 126, 234, 0.05);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
}

.rules ul {
    list-style: none;
}

.rules li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #34495e;
}

.btn-tertiary {
    background: var(--warning-color);
    color: white;
}

.btn-tertiary:hover {
    background: #e67e22;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
    flex-direction: column;
    gap: 4px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-subtitle {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}

.btn-icon {
    background: transparent;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.btn-icon:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Game Screen */
#gameScreen {
    flex-direction: column;
    padding: 0;
}

.game-header {
    background: var(--card-bg);
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Timer */
.timer-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: #ecf0f1;
    stroke-width: 4;
}

.timer-circle {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 4;
    stroke-dasharray: 176;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    stroke-linecap: round;
}

.timer-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Score */
.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.score-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Game Content */
.game-content {
    max-width: 600px;
    width: 100%;
    margin: 40px auto;
    padding: 0 20px;
}

/* Word Type Badge */
.word-type-badge {
    text-align: center;
    margin-bottom: 30px;
}

#wordType {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 600;
}

/* Clue Card */
.clue-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.clue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.clue-header h3 {
    font-size: 18px;
    color: var(--text-primary);
}

#clueNumber {
    color: var(--primary-color);
}

.clue-text {
    font-size: 24px;
    line-height: 1.8;
    color: var(--text-primary);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Answer Section */
.answer-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.answer-input {
    width: 100%;
    padding: 16px;
    font-size: 20px;
    border: 2px solid #ecf0f1;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    transition: all 0.3s ease;
    font-family: 'Noto Sans JP', sans-serif;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.1);
}

.answer-buttons {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
}

/* Feedback */
.feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.feedback.success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
    border: 2px solid var(--success-color);
}

.feedback.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--error-color);
    border: 2px solid var(--error-color);
}

.feedback.hidden {
    display: none;
}

/* Results Screen */
.final-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 40px 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow);
}

.score-number {
    font-size: 48px;
    font-weight: 700;
}

.score-details {
    font-size: 24px;
    color: var(--text-primary);
}

/* Results List */
.results-list {
    margin: 40px 0;
}

.answers-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.answer-item {
    background: rgba(103, 126, 234, 0.05);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-item.correct {
    background: rgba(39, 174, 96, 0.1);
    border-left: 4px solid var(--success-color);
}

.answer-item.incorrect {
    background: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--error-color);
}

.answer-item.passed {
    background: rgba(243, 156, 18, 0.1);
    border-left: 4px solid var(--warning-color);
}

.answer-word {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.answer-meaning {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.answer-status {
    font-size: 24px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .logo-jp {
        font-size: 36px;
    }
    
    .answer-buttons {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .final-score {
        flex-direction: column;
    }
}
