:root {
    --bg-color: #f8f9fa;
    --container-bg: #ffffff;
    --text-color: #333333;
    --accent-color: #ffc107;
    --secondary-color: #6c757d;
    --border-color: #dee2e6;
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #333333;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    width: 90%;
    max-width: 500px;
    background-color: var(--container-bg);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    text-align: center;
}

.theme-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.subtitle {
    font-size: 1rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

.upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 15px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-box:hover {
    background-color: rgba(255, 193, 7, 0.05);
    border-color: var(--accent-color);
}

.upload-box.dragover {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: var(--accent-color);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

#preview-image {
    max-width: 100%;
    border-radius: 15px;
    margin-top: 1rem;
}

#label-container {
    margin: 2rem 0;
}

.result-bar-wrapper {
    margin-bottom: 1rem;
    text-align: left;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: bold;
}

.bar-bg {
    background-color: var(--border-color);
    border-radius: 10px;
    height: 15px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.5s ease-out;
}

.dog-bar { background-color: #ffc107; }
.cat-bar { background-color: #17a2b8; }

.retry-btn, .secondary-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.retry-btn {
    background-color: var(--accent-color);
    color: #000;
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: #fff;
}

.retry-btn:hover, .secondary-btn:hover {
    transform: scale(1.05);
}

.loader {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#webcam-container canvas {
    border-radius: 15px;
    margin-top: 1rem;
    max-width: 100%;
}