/* ===============================
   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;
}

/* ===============================
   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;
    }
}

/* ===============================
   STATS – CĂN GIỮA CHUẨN
================================ */

.stats {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 14px;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;

    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: rgba(0, 0, 0, 0.04);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.stat-item span {
    font-weight: 700;
    color: #1976d2;
}

#downloadCount {
    color: #e53935;
}

.note-zalo {
    margin-top: 8px;
    font-size: 13px;
    color: #555;
    text-align: center;
}

/* ===============================
   TOP ACTIONS (HOME + UPLOAD)
================================ */

.top-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* Nút về trang chủ – nhỏ vừa text */
.btn-home {
    padding: 12px 14px;
    border-radius: 14px;

    background: linear-gradient(135deg,
            #1565c0,
            #42a5f5);

    color: #fff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    transition: all 0.2s ease;
}

/* Giữ nguyên file-btn nhưng cho nó chiếm hết phần còn lại */
.file-btn {
    flex: 1;
    /* chiếm phần còn lại */
    display: flex;
    /* bỏ block */
    align-items: center;
    justify-content: center;

    padding: 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;
}