* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    position: relative;
}

.back-button {
    display: inline-block;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #667eea;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: all 0.3s;
    border: 2px solid #e9ecef;
}

.back-button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateX(-5px);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

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

.subtitle {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.score-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.score-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.score-label {
    margin-right: 10px;
}

.score-number {
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-reset {
    padding: 10px 20px;
    font-size: 0.9rem;
    border: 2px solid #e53e3e;
    background: white;
    color: #e53e3e;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-reset:hover {
    background: #e53e3e;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.custom-controls {
    text-align: center;
    margin: 20px 0;
}

.btn-toggle {
    padding: 12px 25px;
    font-size: 1rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-toggle:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-toggle.active {
    background: #667eea;
    color: white;
}

.custom-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin: 10px 0;
}

.custom-inputs input,
.custom-inputs select {
    padding: 8px 12px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 80px;
    text-align: center;
    transition: border-color 0.3s;
}

.custom-inputs input::-webkit-outer-spin-button,
.custom-inputs input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-inputs input[type=number] {
    -moz-appearance: textfield;
}

.custom-inputs input:focus,
.custom-inputs select:focus {
    outline: none;
    border-color: #667eea;
}

.custom-inputs select {
    width: 60px;
    cursor: pointer;
}

.custom-inputs span {
    font-weight: bold;
    color: #666;
}

.problem-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: nowrap;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    overflow-x: auto;
}

.problem-section.correct-answer {
    animation: correctPulse 0.6s ease-out;
    box-shadow: 0 0 30px rgba(72, 187, 120, 0.8);
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
        box-shadow: none;
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 40px rgba(72, 187, 120, 1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(72, 187, 120, 0.8);
    }
}

.starting-time,
.time-change,
.answer-inline {
    text-align: center;
}

.equals {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
}

.answer-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.answer-clock-container-inline .clock {
    cursor: pointer;
    border-color: #48bb78;
}

.answer-inline .time-input-group {
    margin-top: 10px;
}

.clock-small {
    width: 200px;
    height: 200px;
}

.clock-container-small {
    margin: 15px 0;
}

.clock {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: white;
    border: 5px solid #667eea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    margin: 0 auto;
}

.clock-face {
    width: 100%;
    height: 100%;
    position: relative;
}

#minuteTicks {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.minute-tick {
    position: absolute;
    width: 1px;
    height: 5px;
    background: #aaa;
    top: 5px;
    left: 50%;
    margin-left: -0.5px;
    transform-origin: 50% 95px;
}

.minute-tick.five-minute {
    height: 8px;
    width: 2px;
    margin-left: -1px;
    background: #777;
    top: 5px;
}

.hour-marker {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    text-align: center;
    z-index: 2;
}

.hour-marker span {
    display: inline-block;
    margin-top: 10px;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
}

.hour-marker:nth-child(2) span { transform: rotate(0deg); }
.hour-marker:nth-child(3) span { transform: rotate(-30deg); }
.hour-marker:nth-child(4) span { transform: rotate(-60deg); }
.hour-marker:nth-child(5) span { transform: rotate(-90deg); }
.hour-marker:nth-child(6) span { transform: rotate(-120deg); }
.hour-marker:nth-child(7) span { transform: rotate(-150deg); }
.hour-marker:nth-child(8) span { transform: rotate(-180deg); }
.hour-marker:nth-child(9) span { transform: rotate(-210deg); }
.hour-marker:nth-child(10) span { transform: rotate(-240deg); }
.hour-marker:nth-child(11) span { transform: rotate(-270deg); }
.hour-marker:nth-child(12) span { transform: rotate(-300deg); }
.hour-marker:nth-child(13) span { transform: rotate(-330deg); }

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    background: #333;
    border-radius: 10px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hour-hand {
    width: 5px;
    height: 45px;
    margin-left: -2.5px;
    background: #333;
    z-index: 3;
}

.minute-hand {
    width: 4px;
    height: 70px;
    margin-left: -2px;
    background: #667eea;
    z-index: 4;
}

.center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #e53e3e;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: bold;
}

.time-display,
.change-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 120px;
}

.change-display {
    color: #667eea;
}

.operation {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
}

.operator {
    display: inline-block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 2rem;
}

#answerClock .minute-hand {
    background: #48bb78;
}

.button-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.draggable-hand {
    cursor: grab;
    transition: none;
}

.draggable-hand:active {
    cursor: grabbing;
}

.draggable-hand:hover {
    filter: brightness(1.2);
}

.time-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: white;
    padding: 8px 15px;
    border-radius: 10px;
    border: 2px solid #48bb78;
}

.time-input-group input {
    padding: 10px;
    font-size: 1.3rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 60px;
    text-align: center;
    transition: border-color 0.3s;
}

/* Remove up/down arrows from number inputs */
.time-input-group input::-webkit-outer-spin-button,
.time-input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-input-group input[type=number] {
    -moz-appearance: textfield;
}

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

.colon {
    font-size: 1.5rem;
    font-weight: bold;
    color: #48bb78;
}

.btn-primary,
.btn-secondary {
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.feedback {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    min-height: 40px;
    padding: 15px;
    border-radius: 10px;
    transition: all 0.3s;
}

.feedback.correct {
    color: #38a169;
    background: #c6f6d5;
    animation: celebrate 0.5s ease-out;
}

.feedback.incorrect {
    color: #e53e3e;
    background: #fed7d7;
    animation: shake 0.5s ease-out;
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .score-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .score-display {
        font-size: 1rem;
        padding: 12px 25px;
    }
    
    .score-number {
        font-size: 1.3rem;
    }
    
    .problem-section {
        gap: 10px;
        padding: 15px;
        flex-wrap: nowrap;
    }
    
    .starting-time .clock-container-small {
        display: none;
    }
    
    .clock {
        width: 150px;
        height: 150px;
        border: 4px solid #667eea;
    }
    
    .minute-tick {
        transform-origin: 50% 70px;
    }
    
    .hour-hand {
        height: 35px;
    }
    
    .minute-hand {
        height: 50px;
    }
    
    .hour-marker span {
        font-size: 0.85rem;
        margin-top: 7px;
    }
    
    .center-dot {
        width: 10px;
        height: 10px;
    }
    
    .time-display,
    .change-display {
        font-size: 1.3rem;
        padding: 10px 12px;
        min-width: 80px;
    }
    
    .operation {
        font-size: 1.5rem;
    }
    
    .operator {
        width: 35px;
        height: 35px;
        line-height: 35px;
        font-size: 1.2rem;
    }
    
    .label {
        font-size: 0.75rem;
    }
    
    .answer-inline .clock-small {
        width: 150px;
        height: 150px;
    }
    
    .answer-clock-container-inline .minute-tick {
        transform-origin: 50% 70px;
    }
    
    .answer-clock-container-inline .hour-hand {
        height: 35px;
    }
    
    .answer-clock-container-inline .minute-hand {
        height: 50px;
    }
    
    .equals {
        font-size: 1.5rem;
    }
    
    .time-input-group input {
        width: 50px;
        font-size: 1.1rem;
        padding: 8px;
    }
    
    .colon {
        font-size: 1.2rem;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

