.sensesound-fabric-selection-placement-shell {
    background: #000;
    color: #fff;
    padding: 36px;
    border: 1px solid #111;
    box-sizing: border-box;
    position: relative;
    overflow-x: clip;
}

.sensesound-fabric-selection-placement-shell button {
    appearance: none;
    border-radius: 0;
    box-shadow: none;
    text-transform: none;
    font-family: inherit;
    font-weight: inherit;
    line-height: normal;
}

.sensesound-placement-source {
    width: fit-content;
    margin-bottom: 24px;
}

.sensesound-placement-source-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
}

.sensesound-placement-fabric-chip {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    background: #08131c center/cover no-repeat;
    color: #fff !important;
    width: 120px !important;
    height: 120px !important;
    aspect-ratio: 1 / 1;
    padding: 8px;
    text-align: center;
    cursor: grab;
    border-radius: 0;
    box-shadow: none;
    font: inherit;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sensesound-fabric-selection-placement-shell .sensesound-fabric-selection-back-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 14px 10px 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.sensesound-fabric-selection-placement-shell .sensesound-fabric-selection-back-btn::before {
    content: "←";
    font-size: 14px;
    line-height: 1;
    font-family: Helvetica, Arial, sans-serif;
    margin-top: -3px;
}

.sensesound-fabric-selection-placement-shell .sensesound-fabric-selection-back-btn:hover {
    background: #fff;
    border-color: #fff;
    color: #000;
    transform: translateY(-0.5px);
}

.sensesound-fabric-selection-placement-shell .sensesound-fabric-selection-back-btn:focus-visible,
.sensesound-fabric-selection-placement-shell .sensesound-fabric-selection-back-btn:focus {
    outline: 2px solid #9fd1f2;
    outline-offset: 2px;
}

.sensesound-fabric-selection-gallery-toolbar {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.sensesound-fabric-selection-placement-shell .sensesound-placement-submit-btn {
    border: none !important;
    background: #3d9cea !important;
    color: #fff !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 10px;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(61, 156, 234, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sensesound-fabric-selection-placement-shell .sensesound-placement-submit-btn:hover:not([disabled]):not(.is-disabled) {
    background: #5aadf0 !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(61, 156, 234, 0.45);
}

.sensesound-fabric-selection-placement-shell .sensesound-placement-submit-btn:focus-visible,
.sensesound-fabric-selection-placement-shell .sensesound-placement-submit-btn:focus {
    outline: 2px solid rgba(157, 247, 255, 0.8);
    outline-offset: 2px;
}

.sensesound-placement-submit-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(4px);
}

.sensesound-placement-submit-modal-dialog {
    position: relative;
    width: min(100%, 520px);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    background: #05090d;
    color: #fff;
    padding: 28px 24px 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.sensesound-placement-submit-modal .sensesound-fabric-selection-back-btn::before {
    content: none !important;
}

.sensesound-placement-submit-modal-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    background: transparent !important;
    color: #fff !important;
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

.sensesound-placement-submit-modal-close:hover {
    background: #fff !important;
    color: #000 !important;
    border-color: #fff !important;
}

.sensesound-placement-submit-modal-close:focus-visible {
    outline: 2px solid #9fd1f2 !important;
    outline-offset: 2px !important;
}

.sensesound-placement-submit-modal-title {
    margin: 0 32px 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.sensesound-placement-submit-form {
    display: grid;
    gap: 16px;
}

.sensesound-placement-submit-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #d3d3d3;
}

.sensesound-placement-submit-field input {
    border: 1px solid #0d4c75;
    background: #08131c;
    color: #fff;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sensesound-placement-submit-field input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.sensesound-placement-submit-field input:focus {
    outline: none;
    border-color: #9fd1f2;
    box-shadow: 0 0 0 2px rgba(159, 209, 242, 0.2);
}

.sensesound-placement-submit-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.sensesound-placement-submit-feedback {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

.sensesound-placement-submit-feedback.is-error {
    color: #ff7676;
}

.sensesound-placement-submit-feedback.is-success {
    color: #86e9a9;
}

.sensesound-placement-submit-primary {
    border: 1px solid #0d4c75 !important;
    background: #0d4c75 !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease !important;
}

.sensesound-placement-submit-primary:hover:not([disabled]) {
    background: #125a8a !important;
    border-color: #125a8a !important;
    transform: translateY(-0.5px) !important;
}

.sensesound-placement-submit-primary:disabled {
    opacity: 0.7 !important;
    cursor: not-allowed !important;
}

/* Thank-you success state inside modal */
.sensesound-placement-submit-success {
    text-align: center;
    padding: 24px 16px 16px;
}

.sensesound-placement-submit-success-check {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(134, 233, 169, 0.2);
    border: 2px solid #86e9a9;
    color: #86e9a9;
    font-size: 32px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sensesound-placement-submit-success-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.sensesound-placement-submit-success-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #b8d4e3;
}

.sensesound-placement-fabric-chip span {
    position: relative;
    z-index: 2;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
}

.sensesound-placement-fabric-chip::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.52));
    pointer-events: none;
}

.sensesound-placement-fabric-chip.is-dragging {
    opacity: 0.55;
    transform: scale(0.98);
}

.sensesound-placement-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sensesound-placement-table-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #fff;
}

.sensesound-placement-clear-all-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    background: transparent !important;
    color: #ff7676 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sensesound-placement-clear-all-btn:hover:not([disabled]) {
    background: rgba(255, 118, 118, 0.15) !important;
    border-color: #ff7676 !important;
}

.sensesound-placement-clear-all-btn[disabled] {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

.sensesound-placement-table-wrap {
    --grid-max-width: 680px;
    --grid-border-color: #000;
    --grid-line-color: #000;

    width: min(100%, 500px);
    max-width: 900px;
    margin: 0;
}

.sensesound-placement-table-overlay {
    position: relative;
    width: 100%;
    max-width: var(--grid-max-width);
    aspect-ratio: 4 / 5;
    overflow: visible;
    border: 5px solid white;
    background: var(--grid-line-color);
    margin-right: auto;
}

.sensesound-placement-table {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows:
        minmax(0, 0.8fr)
        minmax(0, 1fr)
        minmax(0, 1fr)
        minmax(0, 1fr)
        minmax(0, 0.8fr);
    grid-template-areas:
        "fcl f4hl f2h f4hr fcr"
        "l4hf front front front r4hf"
        "l2h middle middle middle r2h"
        "l4hb back back back r4hb"
        "bcl b4hl b2h b4hr bcr";
    gap: 1px;
    width: 100%;
    height: 100%;
    border: 1px solid black;
}

.sensesound-placement-cell {
    min-height: 0;
    cursor: default;
    transition: background-color 0.15s ease;
}

.sensesound-placement-cell-inner {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #d9d9d9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Panel indicator pseudo-element — always renders above fabric fill */
.sensesound-placement-cell-inner::after {
    content: "";
    position: absolute;
    background: #fff;
    border: 1.5px solid #555;
    border-radius: 0;
    pointer-events: none;
    z-index: 1;
}

/* --- Cloud panels (front / middle / back) --- */
.sensesound-placement-cell.is-cloud .sensesound-placement-cell-inner::after {
    width: 82%;
    height: 62%;
    border: 2px solid #444;
    outline: 1.5px solid #555;
    outline-offset: clamp(-7px, -1.4vw, -3px);
    border-radius: 2px;
}

.sensesound-placement-cell.is-cloud[data-placement-cell="middle-cloud"] .sensesound-placement-cell-inner::after {
    height: 50%;
}

/* --- Corner panels --- */
[data-placement-cell="fcl"] .sensesound-placement-cell-inner::after {
    width: 85%;
    height: 10%;
    top: 22%;
    left: 0;
    transform: rotate(-30deg);
}

[data-placement-cell="fcr"] .sensesound-placement-cell-inner::after {
    width: 85%;
    height: 10%;
    top: 22%;
    right: 0;
    transform: rotate(30deg);
}

[data-placement-cell="bcl"] .sensesound-placement-cell-inner::after {
    width: 85%;
    height: 10%;
    bottom: 22%;
    left: 0;
    transform: rotate(30deg);
}

[data-placement-cell="bcr"] .sensesound-placement-cell-inner::after {
    width: 85%;
    height: 10%;
    bottom: 22%;
    right: 0;
    transform: rotate(-30deg);
}

/* --- Front wall edge panels (horizontal) --- */
[data-placement-cell="f4hl"] .sensesound-placement-cell-inner::after,
[data-placement-cell="f2h"] .sensesound-placement-cell-inner::after,
[data-placement-cell="f4hr"] .sensesound-placement-cell-inner::after {
    height: 10%;
    top: 4%;
}

[data-placement-cell="f4hl"] .sensesound-placement-cell-inner::after {
    width: 80%;
    right: 3%;
}

[data-placement-cell="f2h"] .sensesound-placement-cell-inner::after {
    width: 70%;
}

[data-placement-cell="f4hr"] .sensesound-placement-cell-inner::after {
    width: 80%;
    left: 3%;
}

/* --- Back wall edge panels (horizontal) --- */
[data-placement-cell="b4hl"] .sensesound-placement-cell-inner::after,
[data-placement-cell="b2h"] .sensesound-placement-cell-inner::after,
[data-placement-cell="b4hr"] .sensesound-placement-cell-inner::after {
    height: 10%;
    bottom: 4%;
}

[data-placement-cell="b4hl"] .sensesound-placement-cell-inner::after {
    width: 80%;
    right: 3%;
}

[data-placement-cell="b2h"] .sensesound-placement-cell-inner::after {
    width: 70%;
}

[data-placement-cell="b4hr"] .sensesound-placement-cell-inner::after {
    width: 80%;
    left: 3%;
}

/* --- Left wall edge panels (vertical) --- */
[data-placement-cell="l4hf"] .sensesound-placement-cell-inner::after {
    width: 10%;
    height: 60%;
    left: 5%;
    top: 50%;
    transform: rotate(15deg) translateY(-50%);
}

[data-placement-cell="l2h"] .sensesound-placement-cell-inner::after {
    width: 10%;
    height: 50%;
    left: 6%;
}

[data-placement-cell="l4hb"] .sensesound-placement-cell-inner::after {
    width: 10%;
    height: 62%;
    left: 6%;
    top: 50%;
    transform: translateY(-50%);
}

/* --- Right wall edge panels (vertical) --- */
[data-placement-cell="r4hf"] .sensesound-placement-cell-inner::after {
    width: 10%;
    height: 60%;
    right: 5%;
    top: 50%;
    transform: rotate(-15deg) translateY(-50%);
}

[data-placement-cell="r2h"] .sensesound-placement-cell-inner::after {
    width: 10%;
    height: 50%;
    right: 6%;
}

[data-placement-cell="r4hb"] .sensesound-placement-cell-inner::after {
    width: 10%;
    height: 62%;
    right: 6%;
    top: 50%;
    transform: translateY(-50%);
}



.sensesound-placement-cell.is-drop-target {
    outline: 3px solid #68b5ff;
    outline-offset: -3px;
}

.sensesound-placement-cell.is-drop-target .sensesound-placement-cell-inner {
    background-color: rgba(104, 181, 255, 0.25);
}

@media (max-width: 900px) {
    .sensesound-placement-table-wrap {
        --grid-max-width: 400px;
        width: 100%;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    }

    .sensesound-fabric-selection-placement-shell {
        padding: 24px 18px;
    }

    .sensesound-placement-source {
        width: 100%;
    }

    .sensesound-placement-source-list {
        width: 100%;
        justify-content: flex-start;
    }

    .sensesound-placement-fabric-chip {
        flex: 0 0 calc((100% - 30px) / 4);
        max-width: calc((100% - 30px) / 4);
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
    }
}
