@import url('colors.css');

.card-count{
    position: relative;
    text-align: center;
    height: 410px;
    padding: 30px 0;
}
#deck-count-container table tbody > tr:nth-child(odd) > td{
    border-bottom: 1px solid var(--border-light);
}
#deck-count-container table{
    border-radius: 8px;
    margin: 0;
    background: transparent;
}
#deck-count-container table td {
    border: none;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
#deck-count-container table td:first-child {
    font-weight: 600;
    color: var(--accent-blue-light);
}
#deck-count-container table td:last-child {
    font-weight: 700;
    font-size: 15px;
    color: var(--accent-blue);
    text-align: right;
}
#deck-count-container{
    border: 2px solid var(--border-light);
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    position: absolute;
    width: 280px;
    max-width: 85%;
    border-radius: 10px;
    box-shadow: 0 6px 20px var(--shadow-dark);
    padding: 12px;
}
#tuning label{
    font-weight: normal;
}
#tuning{
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    color: var(--text-primary);
    margin: 20px auto;
    width: 350px;
    max-width: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    box-shadow: 0 15px 35px var(--shadow-dark), 0 5px 15px var(--shadow-medium);
    z-index: 10000;
    overflow: hidden;
    display: none;
    animation: slideInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#speed-display{
    color: var(--accent-blue);
}
#tuning.show {
    z-index: 10000222;
    display: block;
}

#tuning.slide-out {
    animation: slideOutScale 0.3s ease forwards;
}
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-secondary) 30%, var(--accent-blue) 100%);
    border-radius: 3px;
}

/* Educational Content Styles */
.counting-trainer-header {
    text-align: center;
    padding: 60px 0;
    color: var(--text-light);
    border-radius: 10px;
}

.counting-trainer-header h1 {
    margin-bottom: 10px;
    font-size: 2.5em;
}

.educational-content {
    max-width: 1200px;
    margin: 0 auto 40px;
}

.training-tips,
.counting-explanation {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
}

.counting-explanation h2 {
    color: var(--text-primary);
    border-bottom: 3px solid var(--accent-blue);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.counting-explanation h3 {
    color: var(--accent-blue-light);
    margin-top: 25px;
    margin-bottom: 15px;
}

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

.skill-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--success-green);
    border: 1px solid var(--border-light);
    transition: transform 0.3s ease;
}

.skill-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-light);
}

.skill-item h4 {
    color: var(--success-green);
    margin-bottom: 10px;
}

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

.system-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--accent-blue);
    transition: all 0.3s ease;
}

.system-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-light);
}

.system-card h4 {
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.system-details p {
    margin: 5px 0;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.card-values {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 5px;
    border: 1px solid var(--border-light);
}

.card-values span {
    display: block;
    margin: 5px 0;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.low-cards { color: var(--success-green); }
.neutral-cards { color: var(--warning-orange); }
.high-cards { color: var(--error-red); }

.progression-steps {
    margin: 20px 0;
}

.step-item {
    display: flex;
    align-items: flex-start;
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid var(--accent-purple);
    border: 1px solid var(--border-light);
}

.step-number {
    background: var(--accent-purple);
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    margin-right: 20px;
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.step-content ul {
    margin-top: 10px;
    padding-left: 20px;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
}

.performance-table th {
    background: var(--primary-dark);
    color: var(--text-light);
    padding: 15px;
    text-align: left;
    font-weight: bold;
}

.performance-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.performance-table tr:nth-child(even) {
    background: var(--bg-primary);
}

.performance-table tr:hover {
    background: var(--bg-tertiary);
}

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

.challenge-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--error-red);
    border: 1px solid var(--border-light);
}

.challenge-item h4 {
    color: var(--error-red);
    margin-bottom: 10px;
}

.trainer-interface {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-light);
    margin-bottom: 30px;
    text-align: center;
    border: 1px solid var(--border-light);
}

.card-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}
input[type=range]:focus {
    outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: transparent;
    border-radius: 4px;
    border: none;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-dark);
    cursor: pointer;
    box-shadow: 0 3px 8px var(--shadow-medium), inset 0 1px 0 rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.9);
    margin-top: -7px;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px var(--shadow-medium), inset 0 1px 0 rgba(255,255,255,0.4);
    box-shadow: 0 4px 12px rgba(15, 76, 58, 0.5), inset 0 1px 0 rgba(255,255,255,0.4);
}

input[type=range]:hover {
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15), 0 0 0 2px rgba(15, 76, 58, 0.1);
}
input[type=range]:focus::-webkit-slider-runnable-track {
    background: var(--accent-blue);
}
input[type=range]::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-secondary) 30%, var(--accent-blue) 100%);
    border-radius: 3px;
    border: none;
}
input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #2a6b4f 100%);
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(15, 76, 58, 0.4);
    border: 2px solid rgba(255,255,255,0.9);
    transition: all 0.3s ease;
}
input[type=range]::-ms-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
    border-width: 8px 0;
    color: transparent;
}
input[type=range]::-ms-fill-lower {
    background: #2a6495;
    border: 0.2px solid #010101;
    border-radius: 2.6px;
    box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type=range]::-ms-fill-upper {
    background: #3071a9;
    border: 0.2px solid #010101;
    border-radius: 2.6px;
    box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type=range]::-ms-thumb {
    box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
    border: 1px solid #000000;
    height: 36px;
    width: 16px;
    border-radius: 3px;
    background: #ffffff;
    cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
    background: #3071a9;
}
input[type=range]:focus::-ms-fill-upper {
    background: #367ebd;
}
#actions .btn-default{
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 12px;
    background: var(--primary-dark);
    border: 1px solid var(--border-light);
    color: var(--text-light);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 20px rgba(15, 76, 58, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

#actions .btn-default:hover{
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(15, 76, 58, 0.35), inset 0 1px 0 rgba(255,255,255,0.3);
}

#actions .btn-default:hover::before {
    left: 100%;
}

#actions .btn-default:active{
    transform: translateY(0) scale(1.02);
    box-shadow: 0 4px 15px rgba(15, 76, 58, 0.3), inset 0 2px 4px rgba(0,0,0,0.1);
}

#actions .btn-default .glyphicon {
    font-size: 16px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

/* Improved Actions Layout */
#actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    background: var(--bg-primary);
    margin: 0;
    border-radius: 0 0 20px 20px;
}

#actions .speed-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: inset 0 2px 8px var(--shadow-light);
    border: 1px solid var(--border-light);
}

#actions label {
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 13px;
    margin: 0;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

/* Panel heading improvements */
#tuning .panel-heading {
    background: var(--primary-dark) !important;
    color: var(--text-light) !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 16px 24px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    border: none !important;
    margin: 0 !important;
    position: relative !important;
    text-align: center !important;
}

#tuning .panel-heading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    border-radius: 20px 20px 0 0;
    pointer-events: none;
}

#tuning .panel-heading h4 {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    position: relative;
    z-index: 1;
}

/* Settings Panel Close Button */
.settings-close-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.settings-close-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.settings-close-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Settings overlay */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}
div#notification_container.question{
    bottom: 0;
    top: auto;
    color: var(--text-light);
}

/* Strategy Question Styling for Counting Trainer */
.strategy-question-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px var(--shadow-dark), 0 8px 20px var(--shadow-medium);
    max-width: 650px;
    margin: 20px auto;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid rgba(15, 76, 58, 0.1);
}

.cards-display {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #2a6b4f 100%);
    border-radius: 15px;
    color: #fff;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2), 0 8px 25px rgba(15, 76, 58, 0.3);
    position: relative;
}

.cards-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    border-radius: 15px;
    pointer-events: none;
}

.player-hand, .dealer-hand {
    text-align: center;
    flex: 1;
    position: relative;
    z-index: 1;
}

.player-hand h5, .dealer-hand h5 {
    margin-bottom: 20px;
    font-weight: bold;
    color: #fff;
    font-size: 1.3em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

.hand-cards {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.strategy-card {
    width: 70px;
    height: 98px;
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.2);
}

.strategy-card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
}

.strategy-question-text {
    font-size: 1.8em;
    font-weight: 700;
    color: #0f4c3a;
    text-align: center;
    margin: 25px 0;
    display: block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
}

.strategy-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.strategy-answer-option {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    border: 3px solid var(--border-light);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--bg-primary);
    margin: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.strategy-answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(15, 76, 58, 0.1), transparent);
    transition: left 0.6s ease;
}

.strategy-answer-option:hover {
    border-color: var(--accent-blue);
    background: var(--bg-secondary);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.strategy-answer-option:hover::before {
    left: 100%;
}

.strategy-answer-option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.4);
    accent-color: #0f4c3a;
}

.strategy-answer-option input[type="radio"]:checked + .answer-text {
    color: #0f4c3a;
    font-weight: bold;
}

.strategy-answer-option:has(input[type="radio"]:checked) {
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
    box-shadow: 0 8px 25px var(--shadow-medium), inset 0 2px 10px var(--shadow-light);
}

.answer-text {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.strategy-submit {
    width: 100%;
    padding: 18px;
    font-size: 1.3em;
    font-weight: bold;
    background: linear-gradient(135deg, #0f4c3a 0%, #2a6b4f 50%, #1a5f4a 100%);
    border: none;
    border-radius: 15px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(15, 76, 58, 0.3);
    position: relative;
    overflow: hidden;
}

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

.strategy-submit:hover {
    background: linear-gradient(135deg, #2a6b4f 0%, #0f4c3a 50%, #1a5f4a 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(15, 76, 58, 0.4);
}

.strategy-submit:hover::before {
    left: 100%;
}

.strategy-submit:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(15, 76, 58, 0.3);
}

/* ===== GAME STAGE OVERLAY ===== */
.counting-game-stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.counting-game-stage.stage-active {
    opacity: 1;
    visibility: visible;
}

.counting-game-stage.stage-exit {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
}

.stage-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.stage-header {
    background: var(--gradient-primary);
    color: var(--text-light);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px var(--shadow-medium);
}

.stage-header h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    text-shadow: 2px 2px 4px var(--shadow-dark);
}

.stage-controls {
    display: flex;
    gap: 10px;
}

.stage-controls .btn {
    padding: 8px 15px;
    font-size: 0.9em;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.stage-controls .btn-warning {
    background: var(--gradient-orange);
    color: var(--primary-dark);
}

.stage-controls .btn-warning:hover {
    background: var(--btn-warning-hover);
    transform: translateY(-2px);
}

.stage-controls .btn-success {
    background: var(--gradient-green);
    color: var(--text-light);
}

.stage-controls .btn-success:hover {
    background: var(--btn-success-hover);
    transform: translateY(-2px);
}

.stage-controls .btn-danger {
    background: var(--error-red);
    color: var(--text-light);
}

.stage-controls .btn-danger:hover {
    background: var(--error-red-dark);
    transform: translateY(-2px);
}

.stage-game-area {
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
    gap: 40px;
    background: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 8px 30px var(--shadow-dark);
    border: 1px solid var(--border-light);
}

.stage-card-display {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stage-card-image {
    width: 200px;
    height: 280px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-dark);
    transition: all 0.3s ease;
    border: 3px solid var(--border-light);
}

.stage-card-image:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px var(--shadow-dark);
}

.stage-stats {
    flex: 1;
    max-width: 400px;
}

.stat-group {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 6px 20px var(--shadow-medium);
    border: 1px solid var(--border-light);
    min-width: 300px;
    display: flex;
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
}

.stage-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.stage-stats .stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--accent-blue);
    text-shadow: 0 1px 2px var(--shadow-light);
}

/* Stage Responsive Design */
@media (max-width: 768px) {
    .stage-content {
        padding: 10px;
    }
    
    .stage-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .stage-header h2 {
        font-size: 1.4em;
    }
    
    .stage-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .stage-game-area {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    
    .stage-card-image {
        width: 150px;
        height: 210px;
    }
    
    .stage-stats {
        max-width: 100%;
    }
    
    .stat-group {
        padding: 20px;
    }
    
    .stage-stats .stat-item {
        padding: 10px 0;
    }
    
    .stat-label {
        font-size: 1em;
    }
    
    .stat-value {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .stage-header h2 {
        font-size: 1.2em;
    }
    
    .stage-controls .btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .stage-card-image {
        width: 120px;
        height: 168px;
    }
    
    .stat-group {
        padding: 15px;
    }
}

/* Responsive Design for Strategy Questions */
@media (max-width: 768px) {
    .cards-display {
        flex-direction: column;
        gap: 20px;
    }
    
    .strategy-card {
        width: 50px;
        height: 70px;
    }
    
    .strategy-answers {
        grid-template-columns: 1fr;
    }
    
    .strategy-answer-option {
        padding: 12px 15px;
    }
    
    .strategy-question-container {
        margin: 10px;
        padding: 15px;
        max-height: 95vh;
    }
}

/* Counting Trainer Enhanced Design - Preserve Original Background */
.countgame {
    /* Keep original background image */
    background-image:  url('/media/images/site-21count-potrait.jpg') ,linear-gradient(to bottom, #075b0f 0%,#061f0a 100%);
    background-size: contain;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.countgame::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Add subtle overlay effects over the original background */
    background: linear-gradient(135deg, rgba(15, 20, 25, 0.3) 0%, rgba(26, 35, 50, 0.2) 50%, rgba(15, 20, 25, 0.3) 100%),
                radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container-fluid {
    position: relative;
    z-index: 1;
}

/* Card Display Enhancements */
.cardImage {
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3));
    animation: cardFlip 0.8s ease-in-out;
}

.cardImage:hover {
    transform: scale(1.05) rotateY(5deg);
    filter: drop-shadow(0 12px 24px rgba(0,0,0,0.4));
}

/* Deck Count Container */
#deck-count-container {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 30px var(--shadow-dark);
    border: 2px solid var(--border-light);
    animation: fadeInUp 0.8s ease-out;
    bottom: 310px;
}

#deck-count-container .table {
    margin-bottom: 0;
    background: transparent;
}

#deck-count-container td {
    border: none;
    padding: 12px 16px;
    font-size: 1.1em;
    font-weight: 500;
}

#deck-count-container td:first-child {
    font-weight: bold;
}

#deck-count-container td:last-child {
    font-weight: bold;
    font-size: 1.3em;
}

/* Enhanced Controls Panel */
#tuning {
    z-index: 100;
    position: fixed;
    background: var(--bg-secondary);
    backdrop-filter: blur(15px);
    border: 2px solid var(--border-light);
    border-radius: 20px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15), 0 8px 25px rgba(0,0,0,0.1);
    overflow: hidden;
}

#tuning .panel-heading {
    background: linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #2a6b4f 100%);
    color: white;
    border-radius: 0;
    padding: 20px 25px;
    font-weight: bold;
    font-size: 1.2em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
    position: relative;
}

#tuning .panel-heading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

#actions {
    padding: 30px 25px;
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
    background: linear-gradient(145deg, rgba(255,255,255,0.8) 0%, rgba(248,249,250,0.9) 100%);
}

#actions .btn {
    background: linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #2a6b4f 100%);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(15, 76, 58, 0.3), inset 0 2px 10px rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
}

#actions .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.6s ease;
}

#actions .btn:hover {
    transform: translateY(-5px) scale(1.15);
    box-shadow: 0 15px 35px rgba(15, 76, 58, 0.4), inset 0 2px 10px rgba(255,255,255,0.3);
}

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

#actions .btn:active {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 20px rgba(15, 76, 58, 0.3);
}

#actions .btn .glyphicon {
    font-size: 1.4em;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#actions label {
    color: #0f4c3a;
    font-weight: bold;
    font-size: 1.1em;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    letter-spacing: 0.3px;
}

.speed-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    flex: 1;
    min-width: 250px;
    background: rgba(255,255,255,0.6);
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

#speed {
    flex: 1;
    height: 12px;
    background: linear-gradient(90deg, #e8e9ea 0%, #dee2e6 50%, #2a6b4f 100%);
    border-radius: 6px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#speed:hover {
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.15), 0 0 0 3px rgba(15, 76, 58, 0.1);
}

#speed::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #2a6b4f 100%);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(15, 76, 58, 0.4), inset 0 2px 6px rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid rgba(255,255,255,0.8);
}

#speed::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 6px 20px rgba(15, 76, 58, 0.5), inset 0 2px 6px rgba(255,255,255,0.4);
}

#speed::-webkit-slider-thumb:active {
    transform: scale(1.1);
    box-shadow: 0 2px 10px rgba(15, 76, 58, 0.4);
}

/* Firefox slider styling */
#speed::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f4c3a 0%, #1a5f4a 50%, #2a6b4f 100%);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(15, 76, 58, 0.4);
    border: 3px solid rgba(255,255,255,0.8);
    transition: all 0.3s ease;
}

#speed::-moz-range-track {
    height: 12px;
    background: linear-gradient(90deg, #e8e9ea 0%, #dee2e6 50%, #2a6b4f 100%);
    border-radius: 6px;
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes cardFlip {
    0% {
        transform: rotateY(-90deg);
        opacity: 0;
    }
    50% {
        transform: rotateY(0deg);
        opacity: 0.8;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

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

/* Card Count Animation */
#cardCountValue, #counter {
    transition: all 0.3s ease;
    animation: pulse 0.6s ease-in-out;
}

/* Notification Enhancements */
.notification {
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2) !important;
    animation: slideInUp 0.5s ease-out !important;
}

.notification .close {
    background: rgba(15, 76, 58, 0.1);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.notification .close:hover {
    background: rgba(15, 76, 58, 0.2);
    transform: scale(1.1);
}

/* Additional Card Animations */
.cardImage.flipping {
    animation: cardFlipOut 0.3s ease-in;
}

@keyframes cardFlipOut {
    to {
        transform: rotateY(-90deg);
        opacity: 0;
    }
}

/* Count Feedback Animation */
.count-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: all 1.5s ease-out;
}

.count-feedback.positive {
    color: #28a745;
}

.count-feedback.negative {
    color: #dc3545;
}

.count-feedback.animate {
    opacity: 1;
    transform: translate(-50%, -150%);
}

/* Counter Update Animation */
#cardCountValue.updating,
#counter.updating {
    animation: counterPulse 0.3s ease-in-out;
}

@keyframes counterPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: #0f4c3a;
    }
}

/* Pulse Highlight for Deck Count Container */
.pulse-highlight {
    animation: pulseHighlight 1s ease-in-out;
}

@keyframes pulseHighlight {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 48px rgba(15, 76, 58, 0.4);
    }
}

/* Card Container Positioning */
.card-count {
    position: relative;
    text-align: center;
    padding: 40px 20px;
}

/* Enhanced Button Animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Smooth Scrolling Fix */
html {
    scroll-behavior: smooth;
}

body.countgame {
    overflow-x: hidden;
    background-repeat: no-repeat;
    background-position: bottom center;
    background-image: url('/media/images/21count-green-logo.png')  ,linear-gradient(to bottom, #075b0f 0%,#061f0a 100%);
    background-size: auto;
    height: auto;
    background-color: black;
}

/* Custom Answer Notification Styles */
.answer-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 30px 40px;
    box-shadow: 0 25px 80px var(--shadow-dark), 0 10px 30px var(--shadow-medium);
    z-index: 10001;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border: 3px solid;
}

.answer-notification.correct {
    border-color: var(--success-green);
    background: var(--bg-secondary);
}

.answer-notification.incorrect {
    border-color: var(--error-red);
    background: var(--bg-secondary);
}

.answer-notification-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.answer-notification.correct .answer-notification-icon {
    color: var(--success-green);
}

.answer-notification.incorrect .answer-notification-icon {
    color: var(--error-red);
}

.answer-notification-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.answer-notification.correct .answer-notification-title {
    color: var(--success-green);
}

.answer-notification.incorrect .answer-notification-title {
    color: var(--error-red);
}

.answer-notification-message {
    font-size: 18px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 600;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.answer-notification-explanation {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 18px;
    margin: 15px 0;
    font-size: 15px;
    color: var(--text-primary);
    border-left: 4px solid var(--accent-blue);
    font-weight: 500;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    border: 1px solid var(--border-light);
}

.answer-notification-close {
    background: var(--primary-dark);
    color: var(--text-light);
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-medium);
}

.answer-notification-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
    background: var(--accent-blue);
}

.answer-notification-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(15, 76, 58, 0.3);
}

.answer-notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes slideInScale {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.answer-notification.slide-out {
    animation: slideOutScale 0.3s ease forwards;
}

@keyframes slideOutScale {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .countgame::before {
        background: radial-gradient(circle at 50% 50%, rgba(120, 119, 198, 0.05) 0%, transparent 50%);
    }
    
    .cardImage {
        max-width: 200px;
        height: auto;
    }
    
    #deck-count-container {
        width: 280px;
        padding: 12px;
    }
    
    #tuning {
        width: 320px;
        margin: 15px auto 30px auto;
        padding: 12px;
    }
    
    #actions {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    #actions .speed-container {
        min-width: auto;
        width: 100%;
        justify-content: space-between;
    }
    
    #actions .btn-default {
        width: 44px;
        height: 44px;
        align-self: center;
    }
    
    #actions label {
        font-size: 13px;
    }
    
    .panel-heading {
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    #deck-count-container {
        width: 260px;
    }
    
    #tuning {
        width: 280px;
    }
    
    #deck-count-container table td {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    #deck-count-container table td:last-child {
        font-size: 15px;
    }
    
    /* Mobile Answer Notifications */
    .answer-notification {
        padding: 20px 25px;
        max-width: 90%;
    }
    
    .answer-notification-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .answer-notification-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .answer-notification-message {
        font-size: 14px;
    }
    
    .answer-notification-explanation {
        padding: 12px;
        font-size: 13px;
    }
    
    /* Mobile Settings Panel */
    #tuning {
        width: 320px;
        margin: 10px auto;
    }
    
    .settings-close-btn {
        width: 28px;
        height: 28px;
        right: 15px;
        font-size: 14px;
    }
}
