* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    background: #f5faff;
    color: #172033;
}

.custom-counter-page {
    min-height: 100vh;
    padding: 30px 18px;
}

.counter-container {
    width: min(760px, 100%);
    margin: 0 auto;
}


/* =====================================
   HEADER
===================================== */

.counter-page-header {
    display: flex;
    align-items: center;
    gap: 15px;

    background: #ffffff;

    padding: 20px;

    border-radius: 20px;

    margin-bottom: 20px;

    box-shadow:
        0 8px 30px rgba(30, 90, 140, .08);
}

.counter-icon {
    width: 60px;
    height: 60px;

    border-radius: 18px;

    background: #e6f6ff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 30px;
}

.counter-page-header h1 {
    margin: 0 0 5px;
    font-size: 25px;
}

.counter-page-header p {
    margin: 0;
    color: #718096;
}


/* =====================================
   CARDS
===================================== */

.setup-card,
.counter-card {
    background: #ffffff;

    border-radius: 24px;

    padding: 24px;

    box-shadow:
        0 12px 35px rgba(30, 90, 140, .08);
}

.setup-card h2 {
    margin-top: 0;
}

.hidden {
    display: none !important;
}


/* =====================================
   INPUTS
===================================== */

.field-label {
    display: block;

    margin: 18px 0 7px;

    font-weight: 700;
}

.text-input,
.number-input,
.confirmation-input {
    width: 100%;

    padding: 14px 15px;

    border-radius: 13px;

    border: 1px solid #d4e2ec;

    background: #fbfdff;

    font-size: 17px;

    outline: none;
}

.text-input:focus,
.number-input:focus,
.confirmation-input:focus {
    border-color: #19a7ef;

    box-shadow:
        0 0 0 3px rgba(25, 167, 239, .12);
}


/* =====================================
   MODE
===================================== */

.mode-section {
    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 12px;

    margin-top: 18px;
}

.mode-option input {
    display: none;
}

.mode-card {
    display: block;

    padding: 17px;

    border: 2px solid #dfe9f0;

    border-radius: 16px;

    cursor: pointer;

    transition: .2s;
}

.mode-card strong,
.mode-card small {
    display: block;
}

.mode-card small {
    margin-top: 5px;
    color: #718096;
}

.mode-option input:checked + .mode-card {
    border-color: #16a6ef;

    background: #eef9ff;

    box-shadow:
        0 0 0 3px rgba(22, 166, 239, .08);
}


/* =====================================
   MAIN BUTTON
===================================== */

.main-btn {
    width: 100%;

    margin-top: 23px;

    padding: 15px;

    border: 0;

    border-radius: 15px;

    background: #16a6ef;

    color: #ffffff;

    font-size: 18px;

    font-weight: 800;

    cursor: pointer;
}


/* =====================================
   COUNTER TOP
===================================== */

.counter-top {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 12px;
}

.current-counter-name {
    font-size: 23px;
    font-weight: 800;
}

.counter-mode-label {
    margin-top: 5px;
    color: #718096;
}

.small-action-btn {
    border: 1px solid #dce7ee;

    background: #ffffff;

    padding: 9px 13px;

    border-radius: 12px;

    cursor: pointer;
}


/* =====================================
   COUNTER CIRCLE
===================================== */

.circle-wrapper {
    display: flex;

    justify-content: center;

    padding: 35px 0 20px;
}

.count-circle {
    width: 270px;
    height: 270px;

    border-radius: 50%;

    border: 10px solid #bbebff;

    background:
        linear-gradient(
            145deg,
            #1aaff4,
            #0d94dc
        );

    color: #ffffff;

    cursor: pointer;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    box-shadow:
        0 18px 45px rgba(10, 150, 220, .27),
        inset 0 5px 12px rgba(255,255,255,.20);

    transition:
        transform .12s,
        opacity .2s;
}

.count-circle:active {
    transform: scale(.97);
}

.count-circle.paused {
    opacity: .55;
    cursor: not-allowed;
}

.count-circle.finished {
    background: #27b76e;
    border-color: #c9f3dd;
}

.circle-label {
    font-size: 15px;
    opacity: .87;
}

.current-count {
    display: block;

    font-size: 75px;

    line-height: 1.1;

    margin: 6px 0;
}

.circle-hint {
    font-size: 13px;
    opacity: .8;
}


/* =====================================
   STATUS
===================================== */

.counter-status {
    text-align: center;

    min-height: 24px;

    margin-bottom: 20px;

    color: #637184;

    font-weight: 700;
}


/* =====================================
   ACTIONS
===================================== */

.counter-actions {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 10px;
}

.action-btn {
    border: 0;

    border-radius: 14px;

    padding: 13px 8px;

    font-weight: 800;

    cursor: pointer;
}

.action-btn.pause {
    background: #fff4cf;
    color: #82630a;
}

.action-btn.stop {
    background: #ffe8e8;
    color: #b63737;
}

.action-btn.restart {
    background: #e9f4ff;
    color: #1477b2;
}


/* =====================================
   INFORMATION
===================================== */

.counter-info {
    margin-top: 20px;

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 10px;
}

.info-box {
    background: #f6fafe;

    border-radius: 14px;

    padding: 13px;

    text-align: center;
}

.info-box span,
.info-box strong {
    display: block;
}

.info-box span {
    color: #718096;
    font-size: 12px;
}

.info-box strong {
    margin-top: 5px;
    font-size: 18px;
}


/* =====================================
   CONFIRM MODAL
===================================== */

.confirm-modal {
    position: fixed;

    inset: 0;

    background: rgba(15, 23, 42, .55);

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    z-index: 99999;
}

.confirm-box {
    width: min(430px, 100%);

    background: #ffffff;

    border-radius: 22px;

    padding: 26px;

    text-align: center;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, .25);
}

.warning-icon {
    font-size: 40px;
}

.confirm-box h2 {
    margin-bottom: 8px;
}

.confirm-box p {
    color: #687589;
}

.confirmation-code {
    margin: 18px 0;

    padding: 12px;

    border-radius: 14px;

    background: #eef8ff;

    color: #087ebd;

    font-size: 35px;

    font-weight: 900;

    letter-spacing: 8px;
}

.confirmation-input {
    text-align: center;

    font-size: 22px;
}

.confirmation-error {
    color: #dc3545 !important;

    font-weight: 700;
}

.confirm-actions {
    display: flex;

    gap: 10px;

    margin-top: 17px;
}

.confirm-actions button {
    flex: 1;

    padding: 13px;

    border: 0;

    border-radius: 13px;

    cursor: pointer;

    font-weight: 800;
}

.confirm-restart-btn {
    background: #e44848;
    color: #ffffff;
}

.cancel-btn {
    background: #edf2f6;
    color: #334155;
}


/* =====================================
   BACK
===================================== */

.back-row {
    text-align: center;

    margin-top: 20px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 11px 22px;

    background: #ffffff;
    color: #0ea5e9;

    border: 1px solid #bae6fd;
    border-radius: 14px;

    text-decoration: none;
    font-size: 16px;
    font-weight: 600;

    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.08);

    transition: 0.2s ease;
}

.back-btn:hover {
    background: #f0f9ff;
    border-color: #7dd3fc;
    transform: translateY(-1px);
}

.back-btn:active {
    transform: translateY(0);
}

/* =====================================
   MOBILE
===================================== */

@media (max-width: 600px) {

    .custom-counter-page {
        padding: 15px 12px;
    }

    .setup-card,
    .counter-card {
        padding: 18px;
    }

    .count-circle {
        width: 230px;
        height: 230px;
    }

    .current-count {
        font-size: 65px;
    }

    .mode-section {
        grid-template-columns: 1fr;
    }

    .counter-actions {
        grid-template-columns: 1fr;
    }

    .counter-info {
        grid-template-columns: 1fr;
    }
}

/* =====================================
   MOBILE SIMPLE COUNTER CONTROLS
===================================== */

/* =====================================
   COUNTER ACTION DROPDOWN
===================================== */

.mobile-simple-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.mobile-press-count {
    width: 180px;
    background: #f4f9fd;
    border: 1px solid #e0eaf1;
    border-radius: 14px;
    padding: 10px 16px;
    text-align: center;
}

.mobile-press-count span {
    display: block;
    font-size: 12px;
    color: #718096;
}

.mobile-press-count strong {
    display: block;
    margin-top: 3px;
    font-size: 22px;
    color: #172033;
}


/* Arrow */

.mobile-actions-toggle {
    width: 48px;
    height: 48px;

    border: 0;
    border-radius: 14px;

    background: #eaf6fd;
    color: #168dcc;

    font-size: 18px;

    cursor: pointer;

    transition: transform .2s ease;
}

.mobile-actions-toggle:hover {
    background: #dff2fc;
}

.mobile-actions-toggle.open {
    transform: rotate(180deg);
}


/* Dropdown */

.mobile-actions-menu {
    display: none;

    width: 240px;

    margin: 10px auto 0;

    padding: 10px;

    background: #ffffff;

    border: 1px solid #e3edf4;
    border-radius: 14px;

    box-shadow: 0 10px 30px rgba(0,0,0,.08);

    gap: 8px;
}

.mobile-actions-menu.show {
    display: grid;
}

.mobile-actions-menu .action-btn {
    width: 100%;
}


/* =====================================
   MOBILE
===================================== */

@media (max-width: 600px) {

    .mobile-simple-row {
        margin-top: 16px;
    }

    .mobile-press-count {
        flex: 1;
        max-width: 220px;
        width: auto;
    }

    .mobile-actions-menu {
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 600px) {

    /* Hide desktop action/info blocks */
    .counter-actions,
    .desktop-counter-info {
        display: none;
    }

    /* Show only press count + arrow */
    .mobile-simple-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-top: 16px;
    }

    .mobile-press-count {
        flex: 1;
        max-width: 220px;

        background: #f4f9fd;

        border-radius: 14px;

        padding: 10px 16px;

        text-align: center;

        border: 1px solid #e0eaf1;
    }

    .mobile-press-count span {
        display: block;

        font-size: 12px;

        color: #718096;
    }

    .mobile-press-count strong {
        display: block;

        margin-top: 3px;

        font-size: 22px;

        color: #172033;
    }

    .mobile-actions-toggle {
        width: 48px;
        height: 48px;

        border: 0;

        border-radius: 14px;

        background: #eaf6fd;

        color: #168dcc;

        font-size: 18px;

        cursor: pointer;

        transition: transform .2s;
    }

    .mobile-actions-toggle.open {
        transform: rotate(180deg);
    }

    .mobile-actions-menu {
        margin-top: 10px;

        display: none;

        grid-template-columns: 1fr;

        gap: 8px;
    }

    .mobile-actions-menu.show {
        display: grid;
    }

    .mobile-actions-menu .action-btn {
        width: 100%;
    }

}

.count-circle {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow:
        0 18px 45px rgba(10, 150, 220, .27),
        inset 0 5px 12px rgba(255,255,255,.20);
}

.count-circle:focus,
.count-circle:focus-visible,
.count-circle:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}