* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #2a2a2a;
    color: #e8e8e8;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Toggle Controls */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.toggle-btn {
    background: #3a3a3a;
    border: 2px solid #4a4a4a;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #e8e8e8;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

.toggle-btn.active {
    background: #4a5568;
    border-color: #5a6578;
    box-shadow: 0 2px 12px rgba(74, 85, 104, 0.4);
}

/* Total Weight Display */
.total-weight {
    text-align: center;
    padding: 20px;
    background: #333333;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.total-weight:hover {
    background: #3a3a3a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.total-weight:active {
    transform: scale(0.98);
}

.weight-value {
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.weight-unit {
    font-size: 24px;
    color: #a0a0a0;
    font-weight: 500;
}

.weight-conversion {
    font-size: 18px;
    color: #808080;
    margin-left: 8px;
}

/* Barbell Visual */
.barbell-container {
    padding: 30px 10px;
    overflow-x: auto;
    overflow-y: visible;
}

.barbell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    position: relative;
}

/* Bar sleeves (where plates load) */
.bar-sleeve {
    height: 18px;
    width: 80px;
    background: linear-gradient(180deg, #c0c0c0 0%, #909090 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    position: relative;
}

.bar-sleeve.left {
    justify-content: flex-end;
}

.bar-sleeve.right {
    justify-content: flex-start;
}

/* Bar collars */
.bar-collar {
    width: 12px;
    height: 22px;
    background: linear-gradient(180deg, #888888 0%, #606060 100%);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Center bar (grip area) */
.bar-center {
    height: 14px;
    width: 120px;
    background: linear-gradient(180deg, #d0d0d0 0%, #a0a0a0 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
}

.plates-container {
    display: flex;
    align-items: center;
    gap: 1px;
    min-height: 140px;
}

.plates-container.left {
    flex-direction: row-reverse;
}

.plates-container.right {
    flex-direction: row;
}

.plate {
    border-radius: 2px;
    border: 2px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.3s ease;
    animation: plateSlideIn 0.3s ease;
    width: 8px; /* Thin edge view */
}

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

.plates-container.left .plate {
    animation: plateSlideInLeft 0.3s ease;
}

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

/* Plate heights based on weight (vertical bars) */
/* Power mode - 25/20/15 same size, 10 slightly smaller, then small plates */
.plate.size-25 { height: 100px; }
.plate.size-20 { height: 100px; }
.plate.size-15 { height: 100px; }
.plate.size-10 { height: 85px; }
.plate.size-5 { height: 55px; }
.plate.size-2_5 { height: 45px; }
.plate.size-1_25 { height: 32px; }

/* Fitness mode - 45/25 same size, 10 slightly smaller (matches power 10kg) */
.plate.size-45 { height: 100px; }
/* Size 25 already defined above */
/* Size 10 already defined above as 85px */
/* Sizes 5 and 2.5 already defined above */

/* Plate colors - muted versions */
.plate.red {
    background: radial-gradient(circle at 30% 30%, #c94545, #a83232);
}

.plate.blue {
    background: radial-gradient(circle at 30% 30%, #4a7ba7, #375a7f);
}

.plate.yellow {
    background: radial-gradient(circle at 30% 30%, #d4a944, #b8923a);
}

.plate.green {
    background: radial-gradient(circle at 30% 30%, #5a9367, #447552);
}

.plate.white {
    background: radial-gradient(circle at 30% 30%, #e8e8e8, #c8c8c8);
    color: #333;
}

.plate.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #2a2a2a);
    color: #e8e8e8;
}

.plate.silver {
    background: radial-gradient(circle at 30% 30%, #b8b8b8, #909090);
}

/* Plate Buttons */
.plate-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plate-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.plate-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.3);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.plate-row.small .plate-btn {
    width: 60px;
    height: 60px;
    font-size: 16px;
}

.plate-btn:active {
    transform: scale(0.92);
}

.plate-btn.red {
    background: radial-gradient(circle at 30% 30%, #c94545, #a83232);
    color: white;
}

.plate-btn.blue {
    background: radial-gradient(circle at 30% 30%, #4a7ba7, #375a7f);
    color: white;
}

.plate-btn.yellow {
    background: radial-gradient(circle at 30% 30%, #d4a944, #b8923a);
    color: white;
}

.plate-btn.green {
    background: radial-gradient(circle at 30% 30%, #5a9367, #447552);
    color: white;
}

.plate-btn.white {
    background: radial-gradient(circle at 30% 30%, #e8e8e8, #c8c8c8);
    color: #333;
}

.plate-btn.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #2a2a2a);
    color: #e8e8e8;
}

.plate-btn.silver {
    background: radial-gradient(circle at 30% 30%, #b8b8b8, #909090);
    color: #333;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    padding: 10px 0;
}

.action-btn {
    flex: 1;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: scale(0.97);
}

.action-btn.unload {
    background: #4a5568;
    color: #e8e8e8;
}

.action-btn.unload:hover {
    background: #5a6578;
}

.action-btn.reset {
    background: #a83232;
    color: #e8e8e8;
}

.action-btn.reset:hover {
    background: #c94545;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: #333333;
    border-radius: 16px;
    padding: 30px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    text-align: center;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    border: 2px solid #4a4a4a;
    border-radius: 8px;
    background: #2a2a2a;
    color: #e8e8e8;
    margin-bottom: 20px;
    text-align: center;
}

.modal-content input:focus {
    outline: none;
    border-color: #4a7ba7;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.cancel {
    background: #4a4a4a;
    color: #e8e8e8;
}

.modal-btn.cancel:hover {
    background: #5a5a5a;
}

.modal-btn.confirm {
    background: #4a7ba7;
    color: #e8e8e8;
}

.modal-btn.confirm:hover {
    background: #5a8bb7;
}

.modal-btn:active {
    transform: scale(0.97);
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .weight-value {
        font-size: 48px;
    }
    
    .plate-btn {
        width: 60px;
        height: 60px;
        font-size: 16px;
    }
    
    .plate-row.small .plate-btn {
        width: 50px;
        height: 50px;
        font-size: 14px;
    }
}
