* {
    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: flex-start;
    padding: 20px;
    margin: 0;
    overflow: auto;
}

body.fullscreen-mode {
    padding: 0;
    overflow: auto;
}

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

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    margin: -20px -20px 20px -20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px 20px 0 0;
    gap: 20px;
}

.top-nav .logo {
    flex-shrink: 0;
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 120px;
    text-align: left;
}

.top-nav h2 {
    flex: 1 !important;
    text-align: center !important;
    margin: 0 !important;
    color: white !important;
    font-size: 18px !important;
}

.top-nav button {
    flex-shrink: 0;
    min-width: 120px;
}

.container.fullscreen-active {
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 20px;
    overflow-y: auto;
}

.container.fullscreen-active .top-nav {
    margin: -20px -20px 20px -20px;
    border-radius: 0;
}

.fullscreen-btn {
    padding: 8px 12px;
    font-size: 14px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.fullscreen-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.star-badge {
    position: static;
    padding: 8px 14px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid #eee;
    font-size: 15px;
    font-weight: 800;
    color: #ffb400;
    letter-spacing: 1px;
    text-align: center;
    margin-top: 10px;
}

.fullscreen-btn:hover {
    background: #764ba2;
    transform: scale(1.1);
}

.main-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 0;
}

.canvas-section {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    height: fit-content;
}

.section {
    padding: 20px;
    border-radius: 10px;
    background: #f9f9f9;
}

.section h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
}

.canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
}

canvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

#drawingCanvas {
    background-image: 
        repeating-linear-gradient(
            to bottom,
            #ff0000 0px,
            #ff0000 1px,
            white 1px,
            white 58px,
            #cccccc 58px,
            #cccccc 59px,
            white 59px,
            white 116px,
            #cccccc 116px,
            #cccccc 117px,
            white 117px,
            white 174px
        );
    background-size: 100% 174px;
    background-repeat: repeat-y;
}

#replayCanvas {
    background: white;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-right: 0;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-clear {
    background: #e0e0e0;
    color: #333;
    display: none;
}

.btn-clear:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.btn-again {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    margin-top: 0;
}

.btn-again:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.playback-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 5px solid #667eea;
}

.btn-play, .btn-stop {
    padding: 10px 20px;
    font-size: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-play:hover, .btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.playback-speed {
    font-size: 13px;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.speed-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.canvas-container {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
}

#replayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.preview-container {
    width: 100%;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#previewCanvas {
    display: block;
    background: white;
    border-radius: 4px;
    cursor: crosshair;
}

.speed-slider {
    flex: 1;
    max-width: 80px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.playback-speed input {
    width: 80px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.playback-speed input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.playback-speed input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.rating-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    margin: 0;
    font-size: 13px;
}

.rating-container h3 {
    color: #333;
    margin-bottom: 10px;
    margin-top: 0;
    font-size: 14px;
}

.rating-score {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    margin-bottom: 0;
}

.rating-details {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

.rating-score {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    margin-bottom: 15px;
}

.rating-details {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
}

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

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

.rating-detail-label {
    font-weight: 600;
    color: #333;
}

.rating-detail-value {
    color: #667eea;
    font-weight: 600;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    canvas {
        max-width: 100%;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .rating-score {
        font-size: 36px;
    }
}

/* Alert Modal */
.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.alert-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

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

.alert-content p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #333;
}

.btn-alert-ok {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 30px;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-alert-ok:hover {
    transform: scale(1.05);
}

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