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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    width: 100vw;
    min-height: 100vh;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 10px;
    width: 100%;
    flex: 1;
}

.count-button {
    border: 2px solid;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    touch-action: manipulation;
}

/* Green buttons - TA, BD, RF */
.count-button[data-id="1"],
.count-button[data-id="2"], 
.count-button[data-id="3"] {
    background: rgb(240, 253, 244);
    border-color: rgb(187, 247, 208);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
}

.count-button[data-id="1"]:hover,
.count-button[data-id="2"]:hover,
.count-button[data-id="3"]:hover {
    background: rgb(134, 239, 172);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.count-button[data-id="1"]:active,
.count-button[data-id="2"]:active,
.count-button[data-id="3"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

/* Purple buttons - LP, UP */
.count-button[data-id="4"],
.count-button[data-id="6"] {
    background: rgb(250, 245, 255);
    border-color: rgb(196, 181, 253);
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.1);
}

.count-button[data-id="4"]:hover,
.count-button[data-id="6"]:hover {
    background: rgb(196, 181, 253);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

.count-button[data-id="4"]:active,
.count-button[data-id="6"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(147, 51, 234, 0.3);
}

/* Orange buttons - QU, CM, NTA */
.count-button[data-id="7"],
.count-button[data-id="8"],
.count-button[data-id="9"] {
    background: rgb(255, 247, 237);
    border-color: rgb(254, 215, 170);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1);
}

.count-button[data-id="7"]:hover,
.count-button[data-id="8"]:hover,
.count-button[data-id="9"]:hover {
    background: rgb(254, 215, 170);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.count-button[data-id="7"]:active,
.count-button[data-id="8"]:active,
.count-button[data-id="9"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}


.undo-button {
    border: 2px solid rgb(59, 130, 246);
    border-radius: 12px;
    background: rgb(96, 165, 250);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    touch-action: manipulation;
}

.undo-button.start-state {
    border-color: rgb(34, 197, 94) !important;
    background: rgb(34, 197, 94) !important;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2) !important;
}

.undo-button.start-state:hover {
    background: rgb(22, 163, 74) !important;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3) !important;
}

.undo-button:hover {
    background: rgb(59, 130, 246);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.undo-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

.undo-button.disabled {
    background: #9ca3af;
    border-color: #6b7280;
    cursor: not-allowed;
    opacity: 0.5;
}

.undo-icon, .play-icon {
    width: 48px;
    height: 48px;
    color: white;
    margin-bottom: 12px;
}

.undo-text {
    font-size: 20px;
    font-weight: 500;
    color: white;
    margin-bottom: 8px;
}

.timer-display {
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: rgba(255, 255, 255, 0.8);
}

.timer-display.expired {
    color: #ef4444;
    font-weight: 700;
}

.settings-button {
    border: none;
    border-radius: 12px;
    background: #6b7280;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    width: 100%;
    touch-action: manipulation;
}

.settings-button:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-button:active {
    transform: translateY(0);
}

.label {
    font-size: 20px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}

.count {
    font-size: 48px;
    font-weight: 500;
    color: #000000;
}

.description {
    font-size: 14px;
    font-weight: 400;
    color: #000000;
    margin-top: 2px;
    margin-bottom: 4px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 0;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.combined-content {
    max-width: 600px;
    width: 95%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.modal-sections {
    display: flex;
    gap: 30px;
    margin: 20px 0;
}

.summary-section {
    flex: 1;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.question-section {
    flex: 1;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.summary-section h3,
.question-section h3 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 18px;
    text-align: left;
}

.question-item {
    margin-bottom: 20px;
}

.question-item label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.question-item input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.question-item input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
}

.question-item input[type="number"]:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

.error-message {
    color: #dc2626;
    font-size: 14px;
    margin-top: 10px;
}

.modal-button.primary {
    background: #059669;
    font-size: 18px;
    padding: 18px 24px;
}

.modal-button.primary:hover {
    background: #047857;
}

#summary-list .result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

#summary-list .result-item:last-child {
    border-bottom: none;
}

.alternative-session {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #059669;
    padding: 20px 0;
}

@media (max-width: 768px) {
    .modal-sections {
        flex-direction: column;
        gap: 20px;
    }
    
    .combined-content {
        max-width: 95%;
    }
}

.modal-button {
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    touch-action: manipulation;
}

.modal-button:hover {
    background: #2563eb;
}

.modal-button:active {
    background: #1d4ed8;
}

/* Toast notifications handle success/error states now */

#results-list {
    margin: 20px 0;
    font-size: 16px;
    line-height: 1.6;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.result-item:last-child {
    border-bottom: none;
}

h2 {
    text-align: center;
    color: #374151;
    margin-bottom: 10px;
}

.question-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.version-info {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #28a745;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background-color: #dc3545;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .button-grid {
        gap: 10px;
    }
    
    .label {
        font-size: 16px;
    }
    
    .count {
        font-size: 28px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
    }
}