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

body {
    font-family: 'Noto Sans', sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.score-display {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.total-score {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 25px;
    font-size: 1.1rem;
    font-family: 'Noto Sans', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.menu-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 2rem;
}

.btn-text {
    flex: 1;
    text-align: left;
    font-weight: 600;
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 12px;
}

.back-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.back-btn:hover {
    transform: translateX(-3px);
}

.game-score {
    font-size: 1.3rem;
    font-weight: 700;
}

/* Prize Pyramid */
.prize-pyramid {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.prize-level {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    margin: 3px 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.prize-level.current {
    background: linear-gradient(90deg, #ff9800 0%, #ff5722 100%);
    border-color: #ffc107;
    transform: scale(1.05);
    animation: glow 1.5s ease-in-out infinite;
}

.prize-level.completed {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
}

.prize-level.milestone {
    border-left: 4px solid #ffc107;
}

.prize-level.safe-point {
    border: 2px solid #4caf50;
    background: rgba(76, 175, 80, 0.15);
}

.safe-indicator {
    font-size: 0.9rem;
    margin-left: 5px;
}

.prize-number {
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
    opacity: 0.8;
}

.prize-amount {
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 152, 0, 0.8);
    }
}

/* Lifelines */
.lifeline-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.lifeline-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    font-family: 'Noto Sans', sans-serif;
}

.lifeline-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.lifeline-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.lifeline-btn.used {
    background: #ccc;
    opacity: 0.4;
    cursor: not-allowed;
}

.lifeline-icon {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.lifeline-text {
    font-size: 0.65rem;
    margin-top: 2px;
    font-weight: 600;
}

/* Shuffle Button */
.shuffle-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 25px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    font-family: 'Noto Sans', sans-serif;
    font-weight: 600;
}

.shuffle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

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

.shuffle-icon {
    font-size: 1.3rem;
}

.shuffle-text {
    font-size: 0.95rem;
}

/* Drag & Drop Game */
.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.periodic-table {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.element-slot {
    aspect-ratio: 1;
    border: 2px dashed #ccc;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.25rem;
    background: #e8f5e9;
    position: relative;
    min-width: 14px;
    min-height: 14px;
    transition: all 0.3s ease;
    padding: 1px;
}

.slot-position {
    position: absolute;
    top: 1px;
    left: 1px;
    font-size: 0.25rem;
    color: #999;
    font-weight: 600;
    line-height: 1;
}

.element-slot.empty {
    background: #000000;
    border: none;
}

.element-slot.drag-over {
    border-color: #4caf50;
    background: #e8f5e9;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    border-style: solid;
    border-width: 3px;
}

.element-slot.correct-target {
    border-color: #ffc107;
    background: #fff8e1;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
}

.element-slot.filled {
    border-style: solid;
}

.element-bank {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 20px;
}

.element-bank h3 {
    margin-bottom: 15px;
    text-align: center;
    font-size: 1rem;
}

.bank-elements {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.category-group {
    background: white;
    border-radius: 8px;
    padding: 10px;
    border: 2px solid #e0e0e0;
}

.category-title {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 8px;
    padding: 5px;
    background: #f5f5f5;
    border-radius: 4px;
    text-align: center;
}

.category-elements {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
    gap: 8px;
}

.element-card {
    background: white;
    border: 2px solid #1a1a1a;
    border-radius: 6px;
    padding: 4px;
    cursor: grab;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.element-card:active {
    cursor: grabbing;
}

.element-card.dragging {
    opacity: 0.5;
}

.element-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.element-symbol {
    font-size: 0.6rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.element-number {
    font-size: 0.35rem;
    color: #666;
}

.element-name {
    font-size: 0.33rem;
    margin-top: 2px;
    color: #444;
}

/* Quiz Game */
.quiz-container {
    max-width: 600px;
    margin: 0 auto;
}

.question-card {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
}

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

.answer-btn {
    background: white;
    border: 2px solid #1a1a1a;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.answer-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.answer-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.next-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    transition: transform 0.2s;
}

.next-btn:hover {
    transform: translateY(-2px);
}

.next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Compounds Game */
.compounds-container {
    max-width: 800px;
    margin: 0 auto;
}

.target-compound {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    text-align: center;
}

.compound-formula {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.compound-name {
    font-size: 1.2rem;
    color: #666;
}

.workspace {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.drop-zone {
    min-height: 150px;
    border: 3px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.drop-zone.drag-over {
    border-color: #1a1a1a;
    background: rgba(0,0,0,0.05);
}

.drop-zone p {
    color: #999;
    font-size: 1.1rem;
}

.drop-zone.has-elements p {
    display: none;
}

.available-elements {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.check-btn, .clear-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    margin: 0 10px;
    transition: transform 0.2s;
}

.check-btn:hover, .clear-btn:hover {
    transform: translateY(-2px);
}

.clear-btn {
    background: #666;
}

/* Feedback */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 1000;
    max-width: 90%;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.feedback.show {
    transform: translate(-50%, -50%) scale(1);
}

.feedback-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.feedback-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.feedback-detail {
    font-size: 1rem;
    color: #666;
    margin-bottom: 15px;
}

.feedback-points {
    font-size: 2rem;
    font-weight: 700;
    color: #4caf50;
}

/* Leaderboard */
.leaderboard {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

.leaderboard-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-entry {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
}

.leaderboard-entry.current-entry {
    background: linear-gradient(90deg, #fff9c4 0%, #ffeb3b 100%);
    border-color: #ffc107;
    animation: highlight 1s ease-in-out 3;
}

@keyframes highlight {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.entry-rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff9800;
    text-align: center;
}

.entry-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
}

.entry-date {
    font-size: 0.9rem;
    color: #666;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    #currentElementDisplay {
        order: -1;
        width: 100%;
        margin-bottom: 10px !important;
    }
    
    #gameTimerDisplay {
        width: 100%;
        margin-top: 10px !important;
    }

    .periodic-table {
        gap: 1px;
        padding: 5px;
    }

    .element-slot {
        min-width: 11px;
        min-height: 11px;
        font-size: 0.23rem;
    }
    
    .slot-position {
        font-size: 0.22rem;
    }

    .category-elements {
        grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    }

    .element-symbol {
        font-size: 0.5rem;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .answers {
        grid-template-columns: 1fr;
    }
    
    .element-bank h3 {
        font-size: 0.9rem;
    }
    
    .category-title {
        font-size: 0.75rem;
    }
    
    .prize-pyramid {
        max-height: 200px;
        padding: 10px;
    }
    
    .prize-level {
        padding: 6px 10px;
    }
    
    .prize-number,
    .prize-amount {
        font-size: 0.85rem;
    }
    
    .lifeline-btn {
        width: 60px;
        height: 60px;
    }
    
    .lifeline-icon {
        font-size: 1.3rem;
    }
    
    .lifeline-text {
        font-size: 0.6rem;
    }

    .shuffle-btn {
        padding: 10px 20px;
    }
    
    .shuffle-icon {
        font-size: 1.1rem;
    }
    
    .shuffle-text {
        font-size: 0.85rem;
    }

    .leaderboard-title {
        font-size: 1.4rem;
    }
    
    .leaderboard-entry {
        padding: 12px;
        gap: 10px;
    }
    
    .entry-rank {
        font-size: 1.2rem;
    }
    
    .entry-score {
        font-size: 1rem;
    }
    
    .entry-date {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .game-header {
        padding: 10px;
    }
    
    .back-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .game-score {
        font-size: 1.1rem;
    }

    .periodic-table {
        grid-template-columns: repeat(18, 1fr);
        gap: 1px;
        padding: 3px;
    }

    .element-slot {
        min-width: 9px;
        min-height: 9px;
        font-size: 0.2rem;
    }
    
    .slot-position {
        font-size: 0.18rem;
        top: 0.5px;
        left: 0.5px;
    }
    
    .element-card {
        padding: 3px;
    }
    
    .element-number {
        font-size: 0.3rem;
    }
    
    .element-symbol {
        font-size: 0.45rem;
    }
    
    .element-name {
        font-size: 0.28rem;
    }
    
    .category-elements {
        grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
        gap: 6px;
    }
    
    .feedback {
        padding: 25px;
        max-width: 95%;
    }
    
    .feedback-icon {
        font-size: 3rem;
    }
    
    .feedback-message {
        font-size: 1.2rem;
    }
    
    .feedback-detail {
        font-size: 0.9rem;
    }
    
    .prize-pyramid {
        max-height: 180px;
        padding: 8px;
    }
    
    .prize-level {
        padding: 5px 8px;
        margin: 2px 0;
    }
    
    .prize-number,
    .prize-amount {
        font-size: 0.75rem;
    }
    
    .lifeline-container {
        gap: 10px;
    }
    
    .lifeline-btn {
        width: 55px;
        height: 55px;
    }
    
    .lifeline-icon {
        font-size: 1.2rem;
    }
    
    .lifeline-text {
        font-size: 0.55rem;
    }

    .shuffle-btn {
        padding: 8px 16px;
    }
    
    .shuffle-icon {
        font-size: 1rem;
    }
    
    .shuffle-text {
        font-size: 0.75rem;
    }

    .leaderboard {
        padding: 15px;
    }
    
    .leaderboard-title {
        font-size: 1.2rem;
    }
    
    .leaderboard-entry {
        grid-template-columns: 40px 1fr;
        padding: 10px;
    }
    
    .entry-rank {
        font-size: 1rem;
        grid-row: 1 / 3;
    }
    
    .entry-score {
        font-size: 0.95rem;
    }
    
    .entry-date {
        font-size: 0.75rem;
        grid-column: 2;
    }
    
    .safe-indicator {
        font-size: 0.7rem;
    }
    
    .shuffle-btn {
        padding: 8px 16px;
    }
    
    .shuffle-icon {
        font-size: 1rem;
    }
    
    .shuffle-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .periodic-table {
        gap: 0.5px;
        padding: 2px;
    }
    
    .element-slot {
        min-width: 7px;
        min-height: 7px;
        font-size: 0.18rem;
        border-width: 1px;
    }
    
    .slot-position {
        font-size: 0.16rem;
    }
    
    .category-elements {
        grid-template-columns: repeat(auto-fill, minmax(25px, 1fr));
        gap: 5px;
    }
}

/* Element Categories */
.element-card.nonmetal { border-color: #0066cc; }
.element-card.noble-gas { border-color: #9c27b0; }
.element-card.alkali { border-color: #ff9800; }
.element-card.alkaline { border-color: #ff5722; }
.element-card.metalloid { border-color: #009688; }
.element-card.halogen { border-color: #e91e63; }
.element-card.metal { border-color: #607d8b; }
.element-card.transition { border-color: #795548; }
.element-card.lanthanide { border-color: #00bcd4; }
.element-card.actinide { border-color: #cddc39; }

.element-slot.nonmetal { border-color: #0066cc; }
.element-slot.noble-gas { border-color: #9c27b0; }
.element-slot.alkali { border-color: #ff9800; }
.element-slot.alkaline { border-color: #ff5722; }
.element-slot.metalloid { border-color: #009688; }
.element-slot.halogen { border-color: #e91e63; }
.element-slot.metal { border-color: #607d8b; }
.element-slot.transition { border-color: #795548; }
.element-slot.lanthanide { border-color: #00bcd4; }
.element-slot.actinide { border-color: #cddc39; }