/* Landing page: dress the start card with a half mandala rising from
   its bottom edge (the intro card only - not the related-tools cards,
   which live in .tool-content wrappers) */
.app-intro:not(.tool-content) > .gn-card {
    position: relative;
    overflow: hidden;
}

.app-intro:not(.tool-content) > .gn-card .card-body {
    position: relative;
    z-index: 1;
    padding-bottom: 7rem !important;
}

.app-intro:not(.tool-content) > .gn-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 110px;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: auto 200%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 480'%3E%3Cg transform='translate(240 240)'%3E%3Cg fill='%233b82f6' opacity='0.75'%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(30)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(60)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(90)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(120)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(150)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(180)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(210)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(240)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(270)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(300)'/%3E%3Cellipse cx='0' cy='-170' rx='26' ry='60' transform='rotate(330)'/%3E%3C/g%3E%3Cg fill='%238b5cf6' opacity='0.8'%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(15)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(45)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(75)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(105)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(135)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(165)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(195)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(225)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(255)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(285)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(315)'/%3E%3Cellipse cx='0' cy='-95' rx='18' ry='42' transform='rotate(345)'/%3E%3C/g%3E%3Ccircle r='46' fill='none' stroke='%233b82f6' stroke-width='7' opacity='0.7'/%3E%3Ccircle r='20' fill='%238b5cf6'/%3E%3C/g%3E%3C/svg%3E");
}

/* Mandala Maker - workspace left, controls right */

.mm-app {
    position: relative;
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* Stage (left): the canvas surface fills the whole workspace; the square
   mandala SVG scales to fit centered inside it */
.mm-stage {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-width: 0;
}

.mm-canvas {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Transparent mode: classic checkerboard behind the artwork */
.mm-canvas.mm-transparent {
    background-color: #fff;
    background-image: repeating-conic-gradient(#dfdfdf 0% 25%, #ffffff 0% 50%);
    background-size: 20px 20px;
}

/* The svg element stretches over the whole surface; its square viewBox
   (preserveAspectRatio "meet") keeps the drawing centered, and the wrap
   shares the drawing's background color so the gutters match seamlessly */
.mm-canvas svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Controls panel (right); header/body/footer layout comes from the shared
   .app-side-* classes in css/common.css */
.mm-panel {
    flex: 0 0 300px;
    border-left: 1px solid var(--gn-card-border);
}

.mm-label {
    font-size: 0.8rem;
    color: var(--gn-muted);
    margin-bottom: 0;
    margin-top: 0.5rem;
    display: block;
}

/* Tuck the slider closer to its label + value row */
.mm-app .form-range {
    margin-top: -2px;
}

/* Previous/next shape buttons share the select's border color */
.mm-shape-nav {
    border: 1px solid var(--bs-border-color);
    color: var(--gn-muted);
    background: none;
}

.mm-shape-nav:hover {
    border-color: var(--bs-border-color);
    background-color: var(--gn-sidebar-hover-bg);
    color: var(--gn-accent);
}

.mm-val {
    float: right;
    color: var(--gn-accent);
    font-size: 0.75rem;
}

.mm-sep {
    margin: 0.75rem 0;
    border-color: var(--gn-card-border);
    opacity: 1;
}

/* Floating round buttons on the stage (Camera Funhouse style): white
   circles with a symbol inside - constant regardless of canvas color */
.mm-fab-wrap {
    position: absolute;
    right: 1rem;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.mm-save-wrap {
    bottom: 1rem;
}

.mm-colors-wrap {
    top: 1rem;
}

.mm-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background-color: #fff;
    color: #2b2d42;
    font-size: 1.125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s, border-color 0.15s, color 0.15s;
}

.mm-fab:hover {
    border-color: var(--gn-accent);
    color: var(--gn-accent);
}

.mm-fab:active {
    transform: scale(0.95);
}

.mm-fab-menu {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 0.25rem;
    background-color: var(--gn-card-bg);
    border: 1px solid var(--gn-card-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.mm-fab-menu.d-none {
    display: none;
}

.mm-fab-menu button:not(.form-check-input) {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 0;
    border-radius: 0.375rem;
    color: var(--gn-body-color);
    font-size: 0.875rem;
    text-align: left;
    white-space: nowrap;
}

.mm-fab-menu button:hover {
    background-color: var(--gn-sidebar-hover-bg);
}

.mm-fab-menu .bi {
    color: var(--gn-accent);
}

/* Rows inside the colors menu */
.mm-colors-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem;
}

.mm-colors-check {
    padding: 0.375rem 0.5rem 0.375rem 2rem;
}

/* Shape browser overlay: covers the whole app area */
.mm-browser {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    background-color: var(--gn-card-bg);
}

.mm-browser-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gn-card-border);
}

.mm-browser-title {
    font-weight: 600;
}

.mm-browser-grid {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    padding: 1rem;
}

.mm-browser-group {
    width: 100%;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gn-accent);
    border-bottom: 1px solid var(--gn-card-border);
    padding-bottom: 4px;
    margin-top: 8px;
}

.mm-shape-card {
    width: 116px;
    padding: 8px;
    text-align: center;
    background: none;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    color: var(--gn-body-color);
    transition: border-color 0.15s, background-color 0.15s;
}

.mm-shape-card:hover,
.mm-shape-card.active {
    border-color: var(--gn-accent);
    background-color: var(--gn-sidebar-hover-bg);
}

.mm-shape-card svg {
    display: block;
    width: 84px;
    height: 84px;
    margin: 0 auto 4px;
}

.mm-shape-card span {
    display: block;
    font-size: 0.7rem;
    color: var(--gn-muted);
    line-height: 1.15;
}

/* Small screens: stack, with the preview pinned at the top so the image
   stays visible while dragging sliders in the controls below */
@media (max-width: 767px) {
    .mm-app {
        flex-direction: column;
        overflow-y: auto;
    }

    .mm-stage {
        position: sticky;
        top: 0;
        z-index: 4;
        flex: 0 0 auto;
        height: 40vh;
    }

    .mm-panel {
        flex: 0 0 auto;
        border-left: 0;
        border-top: 1px solid var(--gn-card-border);
    }

    /* The whole app container scrolls instead of the panel body; the
       base-shape header sticks right below the preview and the action
       footer sticks to the bottom edge */
    .mm-panel .app-side-body {
        overflow-y: visible;
    }

    .mm-panel .app-side-header {
        position: sticky;
        top: 40vh;
        z-index: 3;
        background-color: var(--gn-card-bg);
    }

    .mm-panel .app-side-footer {
        position: sticky;
        bottom: 0;
        z-index: 3;
        background-color: var(--gn-card-bg);
    }
}
