* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    width: 100%;
    position: relative;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 32px;
}

/* Story Box */
.story-box {
    background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
    border-left: 5px solid #0277bd;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.story-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.icon {
    font-size: 50px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.header-text strong {
    color: #01579b;
    font-size: 20px;
    display: block;
}

.header-text p {
    color: #666;
    font-size: 14px;
    margin-top: 3px;
}

.story-text {
    color: #333;
    line-height: 1.8;
    font-size: 16px;
    text-align: center;
}

.story-text strong {
    color: #0277bd;
}

/* Journey Section */
.journey-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin: 30px 0;
}

.journey-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid #4caf50;
}

.card-header {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-icon {
    font-size: 28px;
}

.location-name {
    font-size: 16px;
    font-weight: bold;
}

.journey-body {
    padding: 25px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8f5e9 100%);
}

.car-animation {
    font-size: 40px;
    text-align: center;
    margin-bottom: 15px;
    animation: drive 2s ease-in-out infinite;
}

@keyframes drive {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

.time-display {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #4caf50;
    text-align: center;
}

.time-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.time-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #2e7d32;
    font-family: 'Courier New', monospace;
}

.time-value sup {
    font-size: 20px;
    vertical-align: super;
}

.time-value sub {
    font-size: 20px;
    vertical-align: sub;
}

.arrow-divider {
    display: flex;
    justify-content: center;
    align-items: center;
}

.arrow {
    font-size: 50px;
    color: #ff9800;
    animation: pulse-arrow 2s ease-in-out infinite;
}

@keyframes pulse-arrow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Problem Section */
.problem-section {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 3px solid #ff9800;
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
}

.problem-section h3 {
    color: #e65100;
    text-align: center;
    margin-bottom: 20px;
    font-size: 20px;
}

.calculation-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calc-step {
    background: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 18px;
    border: 2px solid #ff9800;
}

.calc-step.highlight {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border-color: #f57c00;
    font-weight: bold;
}

.step-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.step-text {
    color: #333;
    font-family: 'Courier New', monospace;
}

.step-text sup {
    font-size: 14px;
    vertical-align: super;
}

.step-text sub {
    font-size: 14px;
    vertical-align: sub;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin: 30px 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #e3f2fd 100%);
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #1976d2;
}

.input-section label {
    font-size: 20px;
    font-weight: bold;
    color: #1565c0;
    text-align: center;
}

.input-hint {
    font-size: 14px;
    color: #666;
    text-align: center;
    font-style: italic;
}

.input-section input {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    font-size: 20px;
    text-align: center;
    border: 3px solid #1976d2;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.input-section input:focus {
    border-color: #0d47a1;
    box-shadow: 0 0 10px rgba(25, 118, 210, 0.3);
}

.input-section input.blink-green {
    animation: blink-green 0.6s ease;
}

.input-section input.blink-red {
    animation: blink-red 0.6s ease;
}

@keyframes blink-green {
    0%, 100% { background: white; border-color: #1976d2; }
    50% { background: #4caf50; border-color: #2e7d32; color: white; }
}

@keyframes blink-red {
    0%, 100% { background: white; border-color: #1976d2; }
    50% { background: #f44336; border-color: #c62828; color: white; }
}

.input-section button {
    padding: 15px 40px;
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-section button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.input-section button:active {
    transform: translateY(0);
}

.input-section button:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    transform: none;
}

/* Feedback */
.feedback {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    min-height: 30px;
    margin: 20px 0;
}

.feedback.success {
    color: #4caf50;
}

.feedback.error {
    color: #f44336;
}

/* Reset Button */
.reset-btn {
    display: block;
    margin: 20px auto;
    background: #4caf50;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: #388e3c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.reset-btn:active {
    transform: translateY(0);
}

/* Info Box */
.info-box {
    background: #fff3e0;
    border-left: 5px solid #ff9800;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
}

.info-box h3 {
    color: #e65100;
    margin-bottom: 10px;
    font-size: 18px;
}

.info-box p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 12px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box ol {
    margin-left: 25px;
    margin-bottom: 12px;
}

.info-box li {
    color: #555;
    line-height: 1.8;
    margin-bottom: 8px;
}

.info-box strong {
    color: #e65100;
}

.info-box sup {
    font-size: 12px;
    vertical-align: super;
}

.info-box sub {
    font-size: 12px;
    vertical-align: sub;
}

/* Clapping Animation */
.clapping-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.clapping-animation.active {
    display: block;
}

.clap-emoji {
    position: absolute;
    font-size: 70px;
    animation: clapping 2s ease-out forwards;
    opacity: 0;
}

.clap-emoji:nth-child(1) {
    left: 10%;
    top: 20%;
    animation-delay: 0s;
}

.clap-emoji:nth-child(2) {
    left: 25%;
    top: 35%;
    animation-delay: 0.15s;
}

.clap-emoji:nth-child(3) {
    left: 45%;
    top: 15%;
    animation-delay: 0.3s;
}

.clap-emoji:nth-child(4) {
    left: 60%;
    top: 40%;
    animation-delay: 0.45s;
}

.clap-emoji:nth-child(5) {
    left: 80%;
    top: 25%;
    animation-delay: 0.6s;
}

.clap-emoji:nth-child(6) {
    left: 20%;
    top: 60%;
    animation-delay: 0.75s;
}

.clap-emoji:nth-child(7) {
    left: 40%;
    top: 70%;
    animation-delay: 0.9s;
}

.clap-emoji:nth-child(8) {
    left: 65%;
    top: 65%;
    animation-delay: 1.05s;
}

.clap-emoji:nth-child(9) {
    left: 85%;
    top: 55%;
    animation-delay: 1.2s;
}

.clap-emoji:nth-child(10) {
    left: 50%;
    top: 50%;
    animation-delay: 1.35s;
}

@keyframes clapping {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: scale(1.2) rotate(15deg);
    }
    30% {
        transform: scale(0.9) rotate(-10deg);
    }
    45% {
        transform: scale(1.1) rotate(10deg);
    }
    60% {
        transform: scale(1) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(20deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 25px;
    }

    h1 {
        font-size: 26px;
    }

    .journey-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .arrow-divider {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .input-section input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 22px;
    }

    .story-text {
        font-size: 14px;
    }

    .time-value {
        font-size: 24px;
    }

    .calc-step {
        font-size: 16px;
    }

    .input-section input {
        font-size: 16px;
        padding: 12px;
    }
}
