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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
    transition: background 0.5s ease;
}

body.multiply-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body.divide-mode {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body.subtract-mode {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.header {
    background: rgba(255, 255, 255, 0.98);
    /* backdrop-filter: blur(15px); - disabled for Chrome compatibility */
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.5em;
    transition: transform 0.3s ease;
}

.logo-icon:hover {
    transform: rotate(360deg) scale(1.1);
}

.home-icon-btn {
    font-size: 1.8em;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-icon-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.5);
}

.logo h1 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2em;
    font-family: 'Segoe UI', sans-serif;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    font-weight: 800;
}

.logo h1.subtract-mode {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1.multiply-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1.divide-mode {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.score-panel {
    background: rgba(255, 255, 255, 0.98);
    /* backdrop-filter: blur(15px); - disabled for Chrome compatibility */
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    text-align: center;
}

.score-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #dee2e6;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.score-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.score-item:hover::before {
    left: 100%;
}

.score-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.score-label {
    font-size: 1em;
    color: #666;
    margin-bottom: 8px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
}

.score-value {
    font-size: 2.2em;
    font-weight: 900;
    color: #2c3e50;
    font-family: 'Segoe UI', sans-serif;
}

.score-correct {
    border-color: #27ae60;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.score-correct .score-value {
    color: #27ae60;
}

.score-streak {
    border-color: #f39c12;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.score-streak .score-value {
    color: #f39c12;
}

.score-accuracy {
    border-color: #3498db;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.score-accuracy .score-value {
    color: #3498db;
}

.user-badge {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 700;
    font-family: 'Segoe UI', sans-serif;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.user-badge.subtract-mode {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.user-badge.multiply-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.user-badge.divide-mode {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.logout-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    font-family: 'Segoe UI', sans-serif;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.logout-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.container {
    background: rgba(255, 255, 255, 0.98);
    /* backdrop-filter: blur(15px); - disabled for Chrome compatibility */
    padding: 2.5rem;
    border-radius: 25px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.15);
    max-width: 900px;
    margin: 0 auto;
}

.navigation {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(248,249,250,0.95) 100%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.8);
}

.nav-btn {
    padding: 1rem 1.5rem;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    color: white;
    font-family: 'Segoe UI', sans-serif;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.nav-btn:hover::before {
    left: 100%;
}

/* Home - Green/Teal */
.nav-btn.home-btn,
.nav-btn[href*="dashboard"] {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 20px rgba(17, 153, 142, 0.4);
}

.nav-btn.home-btn:hover,
.nav-btn[href*="dashboard"]:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 30px rgba(17, 153, 142, 0.5);
}

/* Addition - Purple/Indigo */
.nav-btn[href*="addition"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.nav-btn[href*="addition"]:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.nav-btn[href*="addition"].active {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6), inset 0 0 20px rgba(255,255,255,0.2);
}

/* Subtraction - Pink/Orange */
.nav-btn[href*="subtraction"] {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    box-shadow: 0 4px 20px rgba(250, 112, 154, 0.4);
}

.nav-btn[href*="subtraction"]:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 30px rgba(250, 112, 154, 0.5);
}

.nav-btn[href*="subtraction"].active {
    box-shadow: 0 8px 25px rgba(250, 112, 154, 0.6), inset 0 0 20px rgba(255,255,255,0.2);
}

/* Multiplication - Pink/Red */
.nav-btn[href*="multiplication"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 20px rgba(240, 147, 251, 0.4);
}

.nav-btn[href*="multiplication"]:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 30px rgba(240, 147, 251, 0.5);
}

.nav-btn[href*="multiplication"].active {
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.6), inset 0 0 20px rgba(255,255,255,0.2);
}

/* Division - Blue/Cyan */
.nav-btn[href*="division"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 4px 20px rgba(79, 172, 254, 0.4);
}

.nav-btn[href*="division"]:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.5);
}

.nav-btn[href*="division"].active {
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.6), inset 0 0 20px rgba(255,255,255,0.2);
}

/* Active state ring */
.nav-btn.active {
    transform: translateY(-3px);
    border: 3px solid rgba(255,255,255,0.5);
}

.nav-btn.active::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #28a745;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.mode-btn {
    padding: 1.5rem 2rem;
    font-size: 1.3rem;
    border: 3px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    transform: translate(-50%, -50%);
    z-index: -1;
}

.mode-btn:hover::before {
    width: 300px;
    height: 300px;
}

.mode-btn.active.add-mode {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-color: #4facfe;
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
    transform: translateY(-2px);
}

.mode-btn.active.subtract-mode {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-color: #e74c3c;
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    transform: translateY(-2px);
}

.mode-btn.active.multiply-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: #f093fb;
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
    transform: translateY(-2px);
}

.mode-btn.active.divide-mode {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-color: #4facfe;
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
    transform: translateY(-2px);
}

.mode-btn:hover:not(.active) {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.mode-btn:hover:not(.active)::before {
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
}

.title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 3rem;
    font-family: 'Segoe UI', sans-serif;
    font-size: 1.2em;
    font-weight: 500;
}

.grid {
    display: grid;
    grid-template-columns: 90px 90px 90px 90px;
    grid-template-rows: 90px 90px 15px 90px;
    gap: 8px;
    justify-content: center;
    margin: 3rem 0;
    padding: 20px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 20px;
    box-shadow: inset 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
}

.grid.multiply-mode {
    grid-template-columns: 90px 90px 90px 90px 90px;
    grid-template-rows: 90px 90px 15px 90px 90px 15px 90px;
    max-width: 500px;
}

/* Only hide cell-1-0 (first column of second row) for non-multiply grids */
/* cell-1-4+ are needed for dynamic grids with 5+ columns */
.grid:not(.multiply-mode) #cell-1-0 {
    display: none;
}

.cell {
    border: 3px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #2c3e50;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Hide borders for first two rows */
#cell-0-0, #cell-0-1, #cell-0-2, #cell-0-3,
.operator-cell, #cell-1-1, #cell-1-2, #cell-1-3 {
    border: none;
    font-size: 3.8rem;
    box-shadow: none;
}

.operator-cell {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    border-radius: 15px;
    font-size: 4rem;
}

.operator-cell.add-mode {
    color: #4facfe;
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    text-shadow: 2px 2px 4px rgba(79, 172, 254, 0.2);
}

.operator-cell.subtract-mode {
    color: #e74c3c;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
    text-shadow: 2px 2px 4px rgba(231, 76, 60, 0.2);
}

.operator-cell.multiply-mode {
    color: #f093fb;
    background: linear-gradient(135deg, #fdf2ff 0%, #fae6ff 100%);
    text-shadow: 2px 2px 4px rgba(240, 147, 251, 0.2);
}

.operator-cell.divide-mode {
    color: #4facfe;
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    text-shadow: 2px 2px 4px rgba(79, 172, 254, 0.2);
}

.line {
    grid-column: 1 / -1;
    border-top: 5px solid #333;
    margin: 8px 0;
    border-radius: 3px;
}

#line-1 {
    grid-column: 1 / 5; /* Spans 4 columns for normal operations */
}

#line-2 {
    grid-column: 1 / 6; /* Spans 5 columns for multiplication */
}

.grid.multiply-mode #line-1 {
    grid-column: 1 / 6; /* Expand to 5 columns in multiply mode */
}

/* For visual consistency in multiplication, align visible line with visible content */
.grid.multiply-mode #line-1,
.grid.multiply-mode #line-2 {
    margin-left: 0;
}

.input-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 5px;
}

.input-box {
    border: 4px solid #27ae60;
    width: 80px;
    height: 80px;
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    color: #27ae60;
    text-align: center;
    outline: none;
    border-radius: 15px;
    font-family: 'Courier New', monospace;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.2);
}

.input-box:focus {
    background: linear-gradient(135deg, #d5f4d5 0%, #c3e6cb 100%);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.4);
    transform: scale(1.05);
}

.feedback {
    margin: 2.5rem 0;
    padding: 1.5rem;
    border-radius: 15px;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', sans-serif;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.btn {
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    font-family: 'Segoe UI', sans-serif;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-submit {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.3);
}

.btn-submit.subtract-mode {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.btn-submit.multiply-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.3);
}

.btn-submit.divide-mode {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.3);
}

.btn-clear {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.3);
}

.btn-random {
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(142, 68, 173, 0.3);
}

.btn-reset {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.3);
}

.btn:hover {
    transform: translateY(-4px) scale(1.02);
}

.btn-submit:hover {
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.4);
}

.btn-clear:hover {
    box-shadow: 0 10px 30px rgba(243, 156, 18, 0.4);
}

.btn-random:hover {
    box-shadow: 0 10px 30px rgba(142, 68, 173, 0.4);
}

.btn-reset:hover {
    box-shadow: 0 10px 30px rgba(149, 165, 166, 0.4);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.achievement {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #8b7d00;
    padding: 15px 25px;
    border-radius: 30px;
    font-weight: 800;
    margin: 15px 0;
    border: 3px solid #ffd700;
    /* animation: glow 2s infinite alternate; - disabled for Chrome compatibility */
    box-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700;
    display: none;
    font-size: 1.3rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

@keyframes glow {
    from { 
        box-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700, 0 0 30px #ffd700;
        transform: scale(1);
    }
    to { 
        box-shadow: 0 0 15px #ffd700, 0 0 25px #ffd700, 0 0 35px #ffd700;
        transform: scale(1.02);
    }
}

.loading {
    display: none;
    text-align: center;
    padding: 1.5rem;
    color: #4facfe;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
}

.loading.show {
    display: block;
}

.loading.subtract-mode {
    color: #e74c3c;
}

.loading.multiply-mode {
    color: #f093fb;
}

.loading.divide-mode {
    color: #4facfe;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4facfe;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
    transition: border-top-color 0.3s ease;
}

.spinner.subtract-mode {
    border-top-color: #e74c3c;
}

.spinner.multiply-mode {
    border-top-color: #f093fb;
}

.spinner.divide-mode {
    border-top-color: #4facfe;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .navigation {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 15px;
    }

    .nav-btn {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    .nav-btn.active::after {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        top: -6px;
        right: -6px;
    }

    .mode-selector {
        grid-template-columns: 1fr;
        gap: 1rem;
        max-width: 300px;
    }

    .mode-btn {
        padding: 1.2rem 1.5rem;
        font-size: 1.1rem;
    }

    .grid {
        grid-template-columns: 70px 70px 70px 70px;
        grid-template-rows: 70px 70px 10px 70px;
    }

    .grid.multiply-mode {
        grid-template-columns: 60px 60px 60px 60px 60px;
        grid-template-rows: 60px 60px 8px 60px 60px 8px 60px;
        max-width: 350px;
    }
    
    .cell {
        font-size: 2.5rem;
        min-height: 70px;
    }

    .grid.multiply-mode .cell {
        font-size: 2rem;
        min-height: 60px;
    }
    
    #cell-0-0, #cell-0-1, #cell-0-2, #cell-0-3, #cell-0-4,
    .operator-cell, #cell-1-1, #cell-1-2, #cell-1-3, #cell-1-4 {
        font-size: 2.8rem;
    }

    .grid.multiply-mode #cell-0-0, .grid.multiply-mode #cell-0-1, 
    .grid.multiply-mode #cell-0-2, .grid.multiply-mode #cell-0-3, .grid.multiply-mode #cell-0-4,
    .grid.multiply-mode .operator-cell, .grid.multiply-mode #cell-1-1, 
    .grid.multiply-mode #cell-1-2, .grid.multiply-mode #cell-1-3, 
    .grid.multiply-mode #cell-1-4 {
        font-size: 2.2rem;
    }
    
    .input-box {
        width: 60px;
        height: 60px;
        font-size: 2.5rem;
    }

    .grid.multiply-mode .input-box {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .container {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .buttons {
        grid-template-columns: 1fr;
    }

    .score-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Pulsing animation for active mode - disabled for Chrome compatibility */
.mode-btn.active {
    /* animation: pulse 2s infinite; */
    transform: translateY(-2px) scale(1.02);
}

@keyframes pulse {
    0% {
        transform: translateY(-2px) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        transform: translateY(-2px) scale(1);
    }
}

/* ========== AVATAR SYSTEM STYLES ========== */

/* Header Avatar Display */
.header-avatar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-mini {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.avatar-mini:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.avatar-mini .hat-mini {
    position: absolute;
    top: -8px;
    font-size: 1rem;
}

.avatar-mini .accessory-mini {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 0.9rem;
}

/* Coins Display in Header */
.coins-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
    cursor: pointer;
    transition: transform 0.2s;
}

.coins-badge:hover {
    transform: translateY(-2px);
}

.coins-badge .coin-icon {
    font-size: 1.1rem;
}

/* Avatar Link Button */
.avatar-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Coin Earned Animation */
.coin-earned {
    position: fixed;
    font-size: 1.5rem;
    animation: coinFloat 1s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes coinFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

/* Coin Notification */
.coin-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 15px;
    font-weight: bold;
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.4);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    z-index: 1000;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}