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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

.main-layout {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    align-items: flex-start;
}

.completed-sidebar, .points-sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    width: 300px;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 20px;
}

.completed-sidebar h3, .points-sidebar h3 {
    color: #2d3748;
    margin: 0 0 20px 0;
    font-size: 1.3em;
    text-align: center;
}

/* Points Sidebar */
.points-display {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f59f00, #f76707);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(245, 159, 0, 0.3);
}

.total-points {
    font-size: 4em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.points-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1em;
    margin-top: 5px;
}

.points-breakdown {
    margin-bottom: 20px;
}

.points-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.points-item-label {
    color: #6c757d;
    font-size: 0.9em;
}

.points-item-value {
    color: #2d3748;
    font-weight: bold;
    font-size: 1.1em;
}

.completed-list {
    list-style: none;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.completed-task-item {
    background: #e8f5e9;
    border-left: 4px solid #51cf66;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.checkmark-icon {
    color: #51cf66;
    font-weight: bold;
    font-size: 1.2em;
}

.completed-task-text {
    flex: 1;
    color: #2d3748;
    font-size: 0.95em;
}

.completion-time {
    color: #6c757d;
    font-size: 0.8em;
}

.container {
    grid-column: 2;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    color: white;
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2em;
    margin-bottom: 30px;
}

/* Machine Styling */
.machine {
    background: linear-gradient(145deg, #ff6b6b, #ee5a6f);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    border: 8px solid #c92a2a;
}

.machine-top {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.light {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: blink 2s infinite;
}

.light-1 {
    animation-delay: 0s;
}

.light-2 {
    animation-delay: 0.66s;
}

.light-3 {
    animation-delay: 1.33s;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
    50%, 100% {
        opacity: 0.3;
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
}

/* Display Window */
.display-window {
    background: #2d3748;
    border-radius: 15px;
    padding: 30px;
    min-height: 200px;
    margin-bottom: 30px;
    border: 5px solid #1a202c;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.display-content {
    color: #fff;
    font-size: 1.5em;
    width: 100%;
}

.idle-message {
    opacity: 0.7;
}

.idle-message .emoji {
    font-size: 3em;
    margin-top: 10px;
}

.task-display, .reward-display {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.task-display {
    color: #ffd93d;
    font-weight: bold;
}

.reward-display {
    color: #51cf66;
    font-weight: bold;
}

.task-icon, .reward-icon {
    font-size: 2em;
    margin-bottom: 15px;
    display: block;
}

/* Timer Display */
.timer-display {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.timer-value {
    font-size: 3em;
    font-weight: bold;
    color: #ffd93d;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.timer-value.warning {
    color: #ff6b6b;
    animation: timerPulse 1s infinite;
}

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

.timer-btn {
    background: linear-gradient(145deg, #667eea, #764ba2);
    border: none;
    border-radius: 12px;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

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

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

.timer-btn.running {
    background: linear-gradient(145deg, #ff6b6b, #ee5a6f);
}

.timer-btn.skip-mode {
    background: linear-gradient(145deg, #51cf66, #37b24d);
}

.timer-btn.alarm-dismiss {
    background: linear-gradient(145deg, #ff6b6b, #fa5252);
    animation: alarmPulse 0.5s infinite;
}

.timer-value.alarm-active {
    color: #ff6b6b;
    animation: alarmFlash 0.5s infinite;
}

@keyframes alarmPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(255, 107, 107, 0.8);
    }
}

@keyframes alarmFlash {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Machine Controls */
.machine-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.lever {
    background: linear-gradient(145deg, #f59f00, #f76707);
    border: none;
    border-radius: 20px;
    padding: 20px 40px;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
}

.lever:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

.lever:not(:disabled):active {
    transform: translateY(4px) scale(0.98);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

.lever.pulling {
    animation: pullAnimation 0.6s ease-out;
}

@keyframes pullAnimation {
    0% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(10px) scale(0.95);
    }
    100% {
        transform: translateY(0);
    }
}

.lever-handle {
    position: absolute;
    top: -10px;
    right: 20px;
    width: 10px;
    height: 40px;
    background: #c92a2a;
    border-radius: 5px;
}

.lever-text {
    position: relative;
    z-index: 1;
}

.complete-btn {
    background: linear-gradient(145deg, #51cf66, #37b24d);
    border: none;
    border-radius: 20px;
    padding: 20px 40px;
    font-size: 1.3em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    animation: pulse 2s infinite;
}

.complete-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

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

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 8px 30px rgba(81, 207, 102, 0.6);
    }
}

.complete-btn.completing {
    animation: completeAnimation 0.6s ease-out;
}

@keyframes completeAnimation {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Stats */
.stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    gap: 15px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 20px;
    flex: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: white;
    font-size: 2em;
    font-weight: bold;
}

/* Settings Button */
.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 15px 30px;
    font-size: 1.1em;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #e9ecef;
}

.modal-header h2 {
    color: #2d3748;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: #adb5bd;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #495057;
}

.modal-body {
    padding: 30px;
}

.section {
    margin-bottom: 30px;
}

.section h3 {
    color: #2d3748;
    margin-bottom: 10px;
}

.section-description {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.input-group button {
    padding: 12px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.input-group button:hover {
    background: #5568d3;
}

.item-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.item-list li {
    background: #f8f9fa;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.item-list li:hover {
    background: #e9ecef;
}

.item-text {
    flex: 1;
    color: #2d3748;
    text-align: left;
}

.completed-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.completed-item {
    background: #e8f5e9 !important;
    border-left: 4px solid #51cf66;
}

/* Custom Checkbox */
.checkbox-container {
    display: inline-block;
    position: relative;
    cursor: pointer;
    user-select: none;
    margin-right: 10px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    display: inline-block;
    height: 20px;
    width: 20px;
    background-color: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
}

.checkbox-container:hover .checkmark {
    border-color: #667eea;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #51cf66;
    border-color: #51cf66;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: #ee5a6f;
}

.danger-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 25px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.danger-btn:hover {
    background: #ee5a6f;
}

.empty-message {
    color: #adb5bd;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Ultimate Reward Styles */
.ultimate-reward-preview {
    margin-top: 15px;
}

.ultimate-reward-set {
    background: linear-gradient(135deg, #f59f00, #f76707);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.ultimate-reward-icon {
    font-size: 1.5em;
}

.ultimate-reward-item-text {
    flex: 1;
    font-weight: bold;
}

/* Completion Modal */
.completion-modal .modal-content {
    max-width: 800px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    animation: modalSlideIn 0.5s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.completion-header {
    text-align: center;
    padding: 40px 30px 20px;
}

.completion-title {
    font-size: 2.5em;
    margin: 0;
    animation: titlePulse 2s ease-in-out infinite;
    text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
}

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

.completion-body {
    padding: 20px 40px 40px;
}

.completion-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 40px;
}

.completion-stat {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
}

.completion-stat-value {
    font-size: 4em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.completion-stat-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.ultimate-reward-container {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 3px solid #ffd93d;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    animation: rewardGlow 2s ease-in-out infinite;
}

@keyframes rewardGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 217, 61, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 217, 61, 0.8);
    }
}

.ultimate-reward-title {
    font-size: 2em;
    margin-bottom: 20px;
    animation: titlePulse 2s ease-in-out infinite;
}

.ultimate-reward-text {
    font-size: 1.8em;
    font-weight: bold;
    color: #ffd93d;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.completion-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.reset-btn {
    background: linear-gradient(145deg, #ff6b6b, #ee5a6f);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 15px 35px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.close-completion-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    border-radius: 15px;
    padding: 15px 35px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-completion-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Celebration Animation */
@keyframes celebrate {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    75% {
        transform: scale(1.1) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.celebrating {
    animation: celebrate 0.6s ease-out;
}

/* Layout for sections on larger screens */
.sections-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 768px) {
    .sections-container {
        grid-template-columns: 1fr 1fr;
    }

    .section.stats-section {
        grid-column: 1 / -1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .completed-sidebar, .points-sidebar {
        width: 100%;
        position: static;
        grid-column: 1;
    }

    .completed-sidebar {
        grid-row: 2;
    }

    .container {
        grid-column: 1;
        grid-row: 1;
    }

    .points-sidebar {
        grid-row: 3;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .stats {
        flex-direction: column;
    }

    .machine {
        padding: 20px;
    }

    .lever, .complete-btn {
        font-size: 1.2em;
        padding: 15px 30px;
    }

    .display-content {
        font-size: 1.2em;
    }

    .completed-sidebar {
        padding: 15px;
    }
}
