/* ===============================
   GLOBAL THEME – HỘI KHÓA 25 NĂM
   Xanh tuổi trẻ – Đỏ hoa phượng
================================ */

:root {
    --blue-main: #1976d2;
    --blue-soft: #4fc3f7;
    --red-main: #e53935;
    --red-soft: #ff5252;
    --gray-main: #90a4ae;
}

/* ===============================
   RESET & BASE
================================ */

* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

body {
    margin: 0;
    min-height: 100vh;

    /* 👉 2 LỚP BACKGROUND: GRADIENT + ẢNH */
    background:
        linear-gradient(180deg,
            rgba(25, 118, 210, 0.75),
            rgba(255, 82, 82, 0.65)),
        url("../assets/bg.jpg") center / cover no-repeat;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===============================
   LAYOUT
================================ */

.app {
    width: 100%;
    max-width: 420px;
    padding: 16px;
}

.card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    text-align: center;
}

/* ===============================
   FILE SELECT BUTTON
================================ */

.file-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg,
            var(--blue-main),
            var(--blue-soft));
    color: #fff;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    user-select: none;
}

/* ===============================
   AVATAR AREA
================================ */

.avatar-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 12px 0;
    border-radius: 50%;
    overflow: hidden;
    background: #eaeaea;

    touch-action: none;
}

#canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    pointer-events: auto;
    cursor: grab;
}

/* Khi đang kéo thì đổi thành bàn tay nắm */
#canvas.dragging {
    cursor: grabbing !important;
}

/* Đảm bảo nút bấm nổi lên trên cùng */
.control button.icon {
    position: relative;
    z-index: 20;
}

/* ===============================
   CONTROL PANEL
================================ */

.control {
    margin: 12px 0;
}

.control label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===============================
   ICON BUTTONS
================================ */

button.icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg,
            var(--red-main),
            var(--red-soft));
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

button.icon:active {
    transform: scale(0.95);
}

/* ===============================
   RANGE SLIDER
================================ */

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 5px;
    appearance: none;
    background: linear-gradient(90deg,
            var(--blue-main),
            var(--blue-soft));
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--red-main);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--red-main);
    cursor: pointer;
}

/* ===============================
   ACTION BUTTONS
================================ */

.actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.actions button {
    flex: 1;
    padding: 12px;
    border-radius: 14px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}

.btn-back {
    background: linear-gradient(135deg,
            #607d8b,
            var(--gray-main));
}

.btn-next {
    background: linear-gradient(135deg,
            var(--red-main),
            var(--red-soft));
}

.control,
.actions {
    position: relative;
    z-index: 10;
}

button.icon {
    position: relative;
    z-index: 20;
}

/* ===============================
   RESPONSIVE
================================ */

@media (min-width: 768px) {
    .app {
        max-width: 460px;
    }
}