/*--------------------------------------------------*/
/*--Circle Generator Tool Panel--*/
/*--------------------------------------------------*/

.circle-tool-panel {
    box-sizing: border-box;

    width: min(100%, 900px);
    max-width: 100%;

    margin: 0 auto 32px auto;

    background-color: #2a2022;

    border: 2px solid #87454e;
    border-radius: 12px;

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.3);

    overflow: hidden;
}


/*--------------------------------------------------*/
/*--Circle Generator Controls--*/
/*--------------------------------------------------*/

.circle-controls {
    box-sizing: border-box;

    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr;

    width: 100%;
    min-width: 0;

    background-color: transparent;

    border-bottom: 1px solid #87454e;
}


/*--Shared Sections--*/

.control-section {
    box-sizing: border-box;

    min-width: 0;

    padding: 24px 26px;
}


.render-section,
.details-section {
    border-left: 1px solid rgba(237, 135, 148, 0.16);
}


/*--Section Titles--*/

.control-title {
    margin: 0;

    color: #ed8794;

    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;

    text-shadow:
        0 0 6px rgba(237, 135, 148, 0.25);
}


.control-divider {
    height: 1px;

    margin: 12px 0 20px 0;

    background-color: rgba(237, 135, 148, 0.16);
}


/*--Rows--*/

.control-row {
    box-sizing: border-box;

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

    width: 100%;
    min-width: 0;
    min-height: 44px;

    gap: 18px;

    color: #c8c8c8;

    font-size: 13px;
}


.control-row + .control-row {
    margin-top: 8px;
}


/*--------------------------------------------------*/
/*--Number Inputs--*/
/*--------------------------------------------------*/

.number-input {
    position: relative;

    box-sizing: border-box;

    width: 105px;
    height: 34px;

    flex-shrink: 0;
}


.control-row .number-input input[type="number"] {
    box-sizing: border-box;

    width: 100%;
    height: 100%;

    padding: 0 29px 0 10px;

    background-color: #21191b;
    color: white;

    border: 1px solid #5d3a40;
    border-radius: 7px;

    outline: none;

    text-align: center;

    font-size: 13px;

    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.control-row .number-input input[type="number"]:hover {
    border-color: #87454e;
}


.control-row .number-input input[type="number"]:focus {
    background-color: #2f2326;

    border-color: #d26070;

    box-shadow:
        0 0 7px rgba(210, 96, 112, 0.22);
}


/*--Hide Browser Number Arrows--*/

.control-row .number-input input[type="number"]::-webkit-inner-spin-button,
.control-row .number-input input[type="number"]::-webkit-outer-spin-button {
    margin: 0;

    -webkit-appearance: none;
}


/*--------------------------------------------------*/
/*--Custom Number Arrows--*/
/*--------------------------------------------------*/

.number-arrows {
    position: absolute;

    top: 1px;
    right: 1px;

    width: 24px;
    height: calc(100% - 2px);

    display: grid;
    grid-template-rows: 1fr 1fr;

    overflow: hidden;

    border-left: 1px solid #5d3a40;
    border-radius: 0 6px 6px 0;
}


.number-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    background-color: #2a2022;
    color: #ed8794;

    border: none;

    font-size: 7px;
    line-height: 1;

    cursor: pointer;

    user-select: none;

    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}


.number-arrow-up {
    border-bottom: 1px solid #5d3a40;
}


.number-arrow:hover {
    background-color: #87454e;
    color: white;
}


.number-arrow:active {
    background-color: #d26070;
    color: white;
}


.number-arrow:focus-visible {
    position: relative;

    outline: 1px solid #ed8794;
    outline-offset: -2px;

    z-index: 2;
}


/*--------------------------------------------------*/
/*--Force Circle Toggle--*/
/*--------------------------------------------------*/

.toggle {
    position: relative;

    box-sizing: border-box;

    width: 105px;
    height: 34px;

    flex-shrink: 0;

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

    cursor: pointer;
}


.toggle input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;

    pointer-events: none;
}


.toggle-slider {
    position: relative;

    width: 46px;
    height: 24px;

    background-color: #21191b;

    border: 1px solid #5d3a40;
    border-radius: 999px;

    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.toggle-slider::after {
    content: "";

    position: absolute;

    top: 3px;
    left: 3px;

    width: 16px;
    height: 16px;

    background-color: #8d777b;

    border-radius: 50%;

    transition:
        transform 0.18s ease,
        background-color 0.18s ease;
}


/*--Toggle Checked--*/

.toggle input:checked + .toggle-slider {
    background-color: #87454e;

    border-color: #d26070;

    box-shadow:
        0 0 7px rgba(210, 96, 112, 0.22);
}


.toggle input:checked + .toggle-slider::after {
    transform: translateX(22px);

    background-color: #f3dadd;
}


/*--Toggle Hover--*/

.toggle:hover .toggle-slider {
    border-color: #87454e;
}


/*--Toggle Keyboard Focus--*/

.toggle input:focus-visible + .toggle-slider {
    outline: 2px solid #d26070;
    outline-offset: 2px;
}


/*---===SIZE WARNING===---*/

.dimension-inputs {
    position: relative;
}


.size-warning {
    position: absolute;

    top: calc(100% + 10px);
    left: 50%;

    z-index: 30;

    box-sizing: border-box;

    width: max-content;
    max-width: min(300px, calc(100vw - 32px));

    padding: 11px 14px;

    transform:
        translateX(-50%)
        translateY(-4px);

    background-color: #251e20;
    color: #e9b0b6;

    border: 1px solid #8f5660;
    border-radius: 8px;

    box-shadow:
        0 7px 18px rgba(0, 0, 0, 0.35),
        0 0 10px rgba(207, 102, 117, 0.08);

    font-size: 10px;
    line-height: 1.6;

    text-align: center;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.18s ease,
        visibility 0.18s ease,
        transform 0.18s ease;
}


/*Little Arrow*/

.size-warning::before {
    content: "";

    position: absolute;

    left: 50%;
    bottom: 100%;

    width: 8px;
    height: 8px;

    background-color: #251e20;

    border-top: 1px solid #8f5660;
    border-left: 1px solid #8f5660;

    transform:
        translateX(-50%)
        translateY(4px)
        rotate(45deg);
}


.size-warning.show {
    opacity: 1;
    visibility: visible;

    transform:
        translateX(-50%)
        translateY(0);
}


/*--------------------------------------------------*/
/*--Render Options--*/
/*--------------------------------------------------*/

.render-option {
    position: relative;

    box-sizing: border-box;

    width: 105px;
    height: 34px;

    flex-shrink: 0;

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

    cursor: pointer;
}


.render-option input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;

    pointer-events: none;
}


.render-radio {
    position: relative;

    width: 24px;
    height: 24px;

    box-sizing: border-box;

    background-color: #21191b;

    border: 1px solid #5d3a40;
    border-radius: 50%;

    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.render-radio::after {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 10px;
    height: 10px;

    background-color: #f3dadd;

    border-radius: 50%;

    transform:
        translate(-50%, -50%)
        scale(0);

    transition:
        transform 0.18s ease;
}


/*--Render Hover--*/

.render-option:hover .render-radio {
    border-color: #87454e;
}


/*--Render Selected--*/

.render-option input:checked + .render-radio {
    background-color: #87454e;

    border-color: #d26070;

    box-shadow:
        0 0 7px rgba(210, 96, 112, 0.22);
}


.render-option input:checked + .render-radio::after {
    transform:
        translate(-50%, -50%)
        scale(1);
}


/*--Render Keyboard Focus--*/

.render-option input:focus-visible + .render-radio {
    outline: 2px solid #d26070;
    outline-offset: 2px;
}


/*--------------------------------------------------*/
/*--Stack Size Buttons--*/
/*--------------------------------------------------*/

.stack-size-options {
    box-sizing: border-box;

    display: flex;

    width: 105px;
    min-width: 0;

    justify-content: flex-end;

    gap: 8px;
}


.stack-size-option {
    box-sizing: border-box;

    flex: 1 1 0;

    min-width: 0;
    height: 34px;

    padding: 0 6px;

    background-color: #21191b;
    color: #999;

    border: 1px solid #5d3a40;
    border-radius: 7px;

    font-size: 12px;

    cursor: pointer;

    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.stack-size-option:hover {
    background-color: #2f2326;

    color: #ddd;

    border-color: #87454e;
}


.stack-size-option.active {
    background-color: #87454e;
    color: white;

    border-color: #d26070;

    box-shadow:
        0 0 7px rgba(210, 96, 112, 0.22);
}


/*--------------------------------------------------*/
/*--Details Values--*/
/*--------------------------------------------------*/

#block-count,
#stack-count {
    box-sizing: border-box;

    width: 105px;
    min-width: 0;

    text-align: right;

    color: #f0f0f0;

    font-size: 13px;

    white-space: nowrap;
}


/*--------------------------------------------------*/
/*--Circle Preview--*/
/*--------------------------------------------------*/

.circle-preview {
    position: relative;

    box-sizing: border-box;

    width: 100%;
    height: 600px;

    padding: 32px;

    background-color: #21191b;

    border-top: 1px solid rgba(237, 135, 148, 0.16);

    overflow: hidden;

    display: grid;
    place-items: center;

    cursor: grab;

    touch-action: none;

    outline: none;
}


.circle-preview.dragging {
    cursor: grabbing;
}


.circle-output {
    position: relative;

    display: grid;
    place-items: center;

    width: max-content;
    height: max-content;

    margin: auto;

    transform-origin: center center;

    will-change: transform;
    backface-visibility: hidden;
}


/*--------------------------------------------------*/
/*--Circle Cells--*/
/*--------------------------------------------------*/

.circle-cell {
    width: 22px;
    height: 22px;

    box-sizing: border-box;

    background-color: transparent;

    border: 1px solid rgba(255, 107, 107, 0.06);
}


.circle-cell.active {
    background-color: #f0f0f0;

    border-color: #a5a5a5;
}


/*--Center Guide Cells--*/

.circle-cell.guide {
    background-color: rgba(105, 105, 105, 0.28);

    border-color: rgba(125, 125, 125, 0.35);
}


.circle-cell.guide-alt {
    background-color: rgba(150, 150, 150, 0.38);

    border-color: rgba(170, 170, 170, 0.45);
}


/*--Cardinal Blocks--*/

.circle-cell.cardinal {
    background-color: #9f1f2d;

    border-color: #7f1723;
}


/*--------------------------------------------------*/
/*--Even-Dimension Guide Lines--*/
/*--------------------------------------------------*/

.center-line {
    position: absolute;

    background-color: rgba(184, 76, 255, 0.95);

    pointer-events: none;

    z-index: 3;

    box-shadow:
        0 0 4px rgba(184, 76, 255, 0.75),
        0 0 8px rgba(184, 76, 255, 0.35);
}


.vertical-line {
    width: 3px;

    top: 0;
    bottom: 0;

    left: 50%;

    transform: translateX(-50%);
}


.horizontal-line {
    height: 3px;

    left: 0;
    right: 0;

    top: 50%;

    transform: translateY(-50%);
}


.hidden {
    display: none;
}


/* =========================
   Preview Interaction
========================= */

.circle-preview:focus-visible {
    box-shadow:
        0 0 0 2px #242424,
        0 0 0 4px #b84cff;
}


/* =========================
   Preview Controls
========================= */

.preview-controls {
    position: absolute;

    top: 12px;
    right: 12px;

    z-index: 50;

    display: flex;
    align-items: center;

    gap: 5px;

    padding: 5px;

    background-color: rgba(24, 24, 24, 0.92);

    border: 1px solid #505050;
    border-radius: 8px;

    box-shadow:
        0 5px 14px rgba(0, 0, 0, 0.32);

    backdrop-filter: blur(3px);

    touch-action: manipulation;
}


/* =========================
   Preview Control Buttons
========================= */

.preview-control-button {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 34px;
    height: 34px;

    padding: 0 9px;

    background-color: #242424;
    color: #dedede;

    border: 1px solid #4b4b4b;
    border-radius: 6px;

    font-family: inherit;
    font-size: 14px;

    cursor: pointer;

    transition:
        background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}


.preview-control-button:hover {
    background-color: #2d2731;
    color: #d6afff;

    border-color: #7d5794;

    transform: translateY(-1px);
}


.preview-control-button:active {
    transform: translateY(0);
}


.preview-control-button:focus-visible {
    outline: 2px solid #b84cff;
    outline-offset: 2px;
}


.preview-reset-button {
    min-width: 58px;

    font-size: 10px;
}


/* =========================
   Mobile Preview Controls
========================= */

@media (max-width: 700px) {

    .preview-controls {
        top: 8px;
        right: 8px;

        gap: 4px;

        padding: 4px;
    }


    .preview-control-button {
        min-width: 36px;
        height: 36px;

        padding: 0 8px;
    }


    .preview-reset-button {
        min-width: 54px;
    }
}


/*--------------------------------------------------*/
/*--Mobile--*/
/*--------------------------------------------------*/

@media (max-width: 700px) {

    .circle-tool-panel {
        width: 100%;
        max-width: 100%;
    }


    .circle-controls {
        grid-template-columns: minmax(0, 1fr);
    }


    .render-section,
    .details-section {
        border-left: none;

        border-top: 1px solid rgba(237, 135, 148, 0.16);
    }


    .control-section {
        width: 100%;
        min-width: 0;

        padding: 22px 20px;
    }


    .control-row {
        width: 100%;
        min-width: 0;

        gap: 12px;

        font-size: 12px;
    }


    .control-row > span,
    .control-row > label {
        min-width: 0;

        overflow-wrap: anywhere;
    }


    .number-input,
    .toggle,
    .render-option,
    .stack-size-options,
    #block-count {
        width: 95px;
        max-width: 95px;

        flex-shrink: 0;
    }


    #stack-count {
        width: max-content;
        min-width: 95px;
        max-width: none;

        flex-shrink: 0;
    }

    .stack-size-options {
        gap: 6px;
    }


    .stack-size-option {
        min-width: 0;

        padding: 0 4px;

        font-size: 11px;
    }


    .circle-preview {
        width: 100%;
        height: 300px;

        padding: 22px 16px;
    }
}

/* =========================
   Mobile Size Warning Fix
========================= */

@media (max-width: 700px) {

    .size-warning {
        position: fixed;

        top: 50%;
        left: 50%;

        z-index: 2147483647;

        box-sizing: border-box;

        width: min(320px, calc(100vw - 32px));
        max-width: none;

        transform:
            translate(-50%, -50%)
            translateY(-4px);
    }


    .size-warning.show {
        transform:
            translate(-50%, -50%)
            translateY(0);
    }


    /* No arrow because popup is centered on screen */
    .size-warning::before {
        display: none;
    }

}