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

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    height: 100%;
    margin: 0;
    padding: 0;
    padding-top: 70px;
    position: relative;
    overflow: hidden;
}

/* Global Header */
.global-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(102, 126, 234, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    z-index: 1001;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.logo-diamond {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}

.logo-text {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 50%, #ffffff 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.6));
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
}

.nav-links a:hover {
    color: #ffffff;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Falling Diamond Snow Effect */
.diamond-snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snow-diamond {
    position: absolute;
    top: -20px;
    color: #ffffff;
    font-size: 0.8rem;
    opacity: 0.9;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9));
    animation: snowfall 8s linear infinite;
}

.snow-diamond::before {
    content: '◆';
}

@keyframes snowfall {
    0% {
        top: -20px;
        opacity: 0;
        transform: translateX(0) rotate(0deg);
    }
    10% {
        opacity: 0.9;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        top: 100vh;
        opacity: 0;
        transform: translateX(20px) rotate(360deg);
    }
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 10;
    padding: 20px;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Login Screen */
.login-container, .level-container, .scores-container, .victory-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #764ba2;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.login-form {
    margin: 30px 0;
}

.login-form input {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.remember-me {
    text-align: left;
    margin: 15px 0;
}

.remember-me label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: #555;
}

.remember-me input[type="checkbox"] {
    width: auto;
    margin: 0 8px 0 0;
    cursor: pointer;
    transform: scale(1.2);
}

.remember-me span {
    user-select: none;
}

.hint {
    font-size: 0.9rem;
    color: #666;
    margin-top: 15px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-back, .btn-guest {
    padding: 15px 30px;
    margin: 10px 5px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #f0f0f0;
    color: #667eea;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.btn-back {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
}

.btn-back:hover {
    background: #f9f9f9;
}

.btn-guest {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
}

.btn-guest:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.6);
}

/* Level Selection */
.level-container {
    max-width: 800px;
    margin: 0 auto;
}

.welcome-text {
    color: #764ba2;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.level-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 30px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.level-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.level-card:nth-child(2) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.level-card:nth-child(3) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.level-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.level-card h3 {
    color: white;
    margin: 10px 0;
}

.level-card p {
    opacity: 0.9;
    margin-bottom: 10px;
}

.stars {
    font-size: 1.2rem;
}

.buttons-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

/* Game Screen */
.game-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.game-header {
    margin-bottom: 20px;
}

.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.info-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 10px;
    color: white;
    text-align: center;
}

.label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.game-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin: 20px 0;
}

.word-list {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
}

.word-list h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.word-item {
    padding: 10px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.word-item.found {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    text-decoration: line-through;
}

.grid-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-grid {
    display: grid;
    gap: 5px;
    background: #f0f0f0;
    padding: 15px;
    border-radius: 10px;
}

.cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cell:hover {
    background: #f0f0ff;
    transform: scale(1.05);
}

.cell:active {
    transform: scale(0.95);
}

.cell.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.cell.found {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    border-color: #43e97b;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Account History Stats */
.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    margin: 10px 0;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* High Scores Screen */
.scores-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.scores-table {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    min-height: 200px;
}

.score-row {
    display: grid;
    grid-template-columns: 50px 1fr 100px 100px;
    gap: 10px;
    padding: 15px;
    margin: 10px 0;
    background: white;
    border-radius: 8px;
    align-items: center;
}

.score-row.top {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-weight: 700;
}

.rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

/* Victory Screen */
.victory-container {
    max-width: 600px;
}

.victory-message {
    font-size: 1.3rem;
    color: #764ba2;
    margin: 20px 0;
}

.victory-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.stat {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    padding: 20px;
    border-radius: 10px;
    color: white;
}

.stat-label {
    display: block;
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.victory-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .screen {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .login-container, .level-container, .scores-container, .victory-container {
        padding: 20px;
        max-width: 100%;
        margin: 0;
    }
    
    .game-container {
        padding: 5px;
        max-width: 100%;
        margin: 0;
    }
    
    /* Login Form */
    .login-form input {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .btn-primary, .btn-secondary, .btn-back, .btn-guest {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
        margin: 5px 0;
    }
    
    /* Level Cards */
    .levels-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 20px 0;
    }
    
    .level-card {
        padding: 20px 15px;
    }
    
    .level-card h3 {
        font-size: 1.1rem;
        margin: 8px 0;
    }
    
    .level-card p {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .level-icon {
        font-size: 2.2rem;
    }
    
    .buttons-row {
        flex-direction: column;
        width: 100%;
        margin-top: 15px;
    }
    
    .buttons-row button {
        width: 100%;
        margin: 5px 0;
    }
    
    .welcome-text {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    /* Game Screen */
    .game-info {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .info-item {
        padding: 10px;
    }
    
    .label {
        font-size: 0.75rem;
    }
    
    .value {
        font-size: 1.2rem;
    }
    
    .game-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .word-list {
        padding: 10px;
        order: 2;
    }
    
    .word-list h3 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .word-item {
        padding: 6px 10px;
        font-size: 0.85rem;
        margin: 5px 0;
        display: inline-block;
        width: auto;
        margin-right: 8px;
    }
    
    .grid-container {
        order: 1;
    }
    
    .word-grid {
        padding: 4px;
        gap: 1.5px;
        width: fit-content;
        margin: 0 auto;
        display: grid;
    }
    
    .cell {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        border-radius: 5px;
        border-width: 1.5px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .game-controls button {
        width: 100%;
    }
    
    /* Stats Cards */
    .history-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    /* Scores Table */
    .scores-tabs {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .tab-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
        flex: 1;
    }
    
    .scores-table {
        padding: 15px;
    }
    
    .score-row {
        grid-template-columns: 40px 1fr 70px 70px;
        gap: 5px;
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .rank {
        font-size: 1.2rem;
    }
    
    /* Victory Screen */
    .victory-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .victory-buttons button {
        width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .cell {
        width: 31px;
        height: 31px;
        font-size: 0.75rem;
        border: 1.5px solid #ddd;
    }
    
    .word-grid {
        padding: 3px;
        gap: 1.5px;
        width: fit-content;
        margin: 0 auto;
        display: grid;
    }
    
    .info-item {
        padding: 8px;
    }
    
    .label {
        font-size: 0.7rem;
    }
    
    .value {
        font-size: 1rem;
    }
    
    .score-row {
        grid-template-columns: 35px 1fr 60px 60px;
        font-size: 0.75rem;
    }
}
