/* Salad Bowl is a DOM board: the garden on the left, the bowl and the
   nutrient bars on the right. The pictures are 112×112 PNGs in food/, cut
   from the illustrated icon sheets. */

/* the board takes the whole width; the side panels sit in a row below it */
.game {
    grid-template-columns: minmax(0, 1fr);
}
.game .side {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
}

.sb-stage {
    width: 100%;
    min-height: 640px;
    background: linear-gradient(160deg, #f3fbe9, #fffaf0 60%, #f4f7ff);
}

.sb-board {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 22px;
    padding: 20px;
}
/* ---------- the shelf: tabs, colour filters, cards ---------- */
.sb-garden {
    min-width: 0;
}
.sb-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 10px;
}
.sb-tabs button {
    flex: 1;
    padding: 9px 8px 8px;
    border: none;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    background: transparent;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: -2px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.sb-tabs button:hover {
    background: rgba(255, 255, 255, 0.7);
}
.sb-tabs button[aria-selected="true"] {
    color: var(--ink);
    background: var(--surface);
    border-bottom-color: var(--teal);
}
.sb-tabs b {
    display: inline-block;
    min-width: 0;
    margin-left: 4px;
    font-family: "DM Mono", monospace;
    font-size: 12px;
    color: #0b8a7a;
}
.sb-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.sb-filters[hidden] {
    display: none;
}
.sb-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    font-size: 12.5px;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--ink);
}
.sb-chip i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(27, 34, 64, 0.2);
}
.sb-chip[aria-pressed="true"] {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.sb-veg {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
    /* as tall as the screen allows, so the whole shelf scrolls less */
    max-height: max(560px, calc(100vh - 240px));
    max-height: max(560px, calc(100dvh - 240px));
    overflow-y: auto;
    align-content: start;
    padding: 2px 4px 6px 2px;
}
.sb-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-card);
    transition:
        transform 0.12s,
        border-color 0.15s,
        opacity 0.15s;
}
.sb-card[hidden] {
    display: none;
}
.sb-card:hover {
    transform: translateY(-2px);
    border-color: var(--teal);
}
.sb-card img {
    width: 68px;
    height: 68px;
}
.sb-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}
.sb-badges {
    display: flex;
    gap: 2px;
    min-height: 20px;
}
.sb-card.in {
    opacity: 0.45;
    border-style: dashed;
    box-shadow: none;
}
.sb-card.in::after {
    content: "✓";
    position: absolute;
    top: 4px;
    right: 6px;
    font-weight: 800;
    color: var(--teal);
}
.sb-card.hinted {
    animation: sb-glow 1.6s ease-out 2;
}
@keyframes sb-glow {
    0%,
    100% {
        box-shadow: var(--shadow-card);
    }
    30% {
        box-shadow: 0 0 0 4px var(--yellow);
        transform: translateY(-3px);
    }
}

.sb-badge {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    background: color-mix(in srgb, var(--c) 22%, white);
    border: 1px solid color-mix(in srgb, var(--c) 55%, white);
}

/* ---------- the order card ---------- */
.sb-kitchen {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.sb-task {
    background: var(--surface);
    border: 1.5px solid #ffd9a8;
    border-radius: var(--r-md);
    padding: 10px 14px;
}
.sb-task b {
    font-family: "Bricolage Grotesque";
    font-size: 19px;
    font-weight: 800;
}
.sb-task p {
    font-size: 14px;
    color: var(--ink-soft);
    margin-top: 2px;
}

/* ---------- the bowl ---------- */
.sb-bowl-wrap {
    position: relative;
    width: min(100%, 420px);
    aspect-ratio: 2 / 1.15;
    margin: 4px auto 0;
}
.sb-bowl {
    position: absolute;
    inset: 0;
}
.sb-bowl::before {
    /* the back rim and the inside of the bowl */
    content: "";
    position: absolute;
    left: 2%;
    right: 2%;
    top: 44%;
    height: 22%;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 40%, #6aa84f, #3f7a35);
    border: 4px solid #e9d8b8;
}
.sb-bowl-front {
    /* the front of the bowl, drawn over the bottom of the vegetables */
    position: absolute;
    left: 2%;
    right: 2%;
    top: 55%;
    bottom: 0;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    background: linear-gradient(180deg, #fff7e8, #f1dcb6);
    border: 4px solid #e9d8b8;
    border-top: none;
    box-shadow: inset 0 -10px 18px rgba(160, 110, 40, 0.18);
    pointer-events: none;
    z-index: 2;
}
.sb-bowl-front::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: -9px;
    height: 10px;
    border-radius: 0 0 10px 10px;
    background: #e3cba0;
}
.sb-in {
    position: absolute;
    z-index: 1;
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    padding: 0;
    border: none;
    background: none;
    animation: sb-drop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
    transition:
        left 0.25s,
        top 0.25s;
}
.sb-in img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 3px 3px rgba(27, 34, 64, 0.22));
}
.sb-in:hover img {
    filter: drop-shadow(0 0 3px var(--coral));
}
/* the protein sits on top; the dressing is a little dish beside the bowl */
.sb-in.kind-1 {
    z-index: 3;
}
.sb-in.kind-2 {
    z-index: 3;
    width: 76px;
    height: 76px;
    margin: -38px 0 0 -38px;
}
@keyframes sb-drop {
    from {
        transform: translateY(-60px) scale(0.6);
        opacity: 0;
    }
}
.sb-bowl.shake {
    animation: sb-shake 0.35s;
}
@keyframes sb-shake {
    25% {
        transform: translateX(-6px);
    }
    75% {
        transform: translateX(6px);
    }
}

.sb-say {
    min-height: 3.6em;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    color: var(--ink);
    padding: 0 6px;
}
.sb-say.pop {
    animation: sb-fade 0.3s;
}
@keyframes sb-fade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

/* ---------- the nutrient bars ---------- */
.sb-group {
    font-size: 13px;
    font-weight: 800;
    margin: 4px 0 -2px;
}
.sb-group small {
    font-family: "DM Mono", monospace;
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-left: 4px;
}
.sb-meters {
    list-style: none;
    display: grid;
    gap: 7px;
    padding: 0;
    margin: 0;
}
.sb-meters li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
}
.sb-meters li.free {
    opacity: 0.5;
}
.sb-mval {
    font-size: 12.5px;
}
.sb-mval small {
    color: var(--ink-soft);
    font-weight: 400;
}
.sb-meters li.met .sb-mval {
    color: #0b8a7a;
    font-weight: 700;
}
.sb-meter {
    grid-column: 1 / -1;
    position: relative;
    height: 14px;
    margin-top: 3px;
    border-radius: 999px;
    background: var(--tint);
    overflow: hidden;
}
.sb-meter i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--c);
    transition: width 0.35s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.sb-meter em {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    margin-left: -1.5px;
    background: var(--ink);
    border-radius: 2px;
}
.sb-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.sb-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* where the energy comes from */
.sb-split {
    font-size: 12.5px;
}
.sb-split-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.sb-split-empty {
    color: var(--ink-soft);
}
.sb-split-bar {
    display: flex;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--tint);
}
.sb-split-bar i {
    display: block;
    height: 100%;
    transition: width 0.35s;
}
.sb-split-key {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 5px;
    color: var(--ink-soft);
}
.sb-split-key i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    margin-right: 4px;
}

/* ---------- overlay ---------- */
.sb-learned {
    list-style: none;
    padding: 0;
    margin: 16px auto 0;
    max-width: 440px;
    display: grid;
    gap: 8px;
    text-align: left;
    font-size: 14.5px;
    color: rgba(255, 255, 255, 0.92);
}
.sb-learned li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.sb-learned .sb-badge {
    flex: none;
}
.sb-levels {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 18px auto 0;
    max-width: 520px;
}
.sb-levels button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-family: "Bricolage Grotesque";
    font-size: 18px;
    font-weight: 800;
}
.sb-levels button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.24);
}
.sb-levels button[aria-current] {
    background: #fff;
    color: var(--ink);
}
.sb-levels button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    font-size: 15px;
}
.sb-levels button.sb-free {
    width: auto;
    padding: 0 14px;
    font-size: 16px;
}

/* ---------- side panel: the nutrient key ---------- */
.sb-key {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}
.sb-key li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 13.5px;
    line-height: 1.35;
}
.sb-key .sb-badge {
    flex: none;
}
.sb-key .sb-key-head {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: 4px;
}

/* ---------- wide screens: shelf | bowl | bars, three columns ---------- */
@media (min-width: 1200px) {
    .sb-board {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    }
    .sb-kitchen {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr;
        grid-template-areas:
            "task    bars"
            "bowl    bars"
            "say     bars"
            "actions bars";
        column-gap: 22px;
        row-gap: 10px;
        align-items: start;
    }
    .sb-task { grid-area: task; }
    .sb-bowl-wrap { grid-area: bowl; }
    .sb-say { grid-area: say; }
    .sb-actions { grid-area: actions; }
    .sb-bars { grid-area: bars; }
}

/* ---------- small screens: bowl and bars first, then the garden ---------- */
@media (max-width: 760px) {
    .sb-board {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    /* on a phone: the order, the bowl and Hint, then the shelf, then the
       bars — so the shelf is never far from the bowl */
    .sb-kitchen {
        display: contents;
    }
    .sb-task {
        order: 1;
    }
    .sb-bowl-wrap {
        order: 2;
    }
    .sb-say {
        order: 3;
    }
    .sb-actions {
        order: 4;
    }
    .sb-garden {
        order: 5;
    }
    .sb-bars {
        order: 6;
    }
    .sb-veg {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
        max-height: 420px;
    }
    .sb-card img {
        width: 56px;
        height: 56px;
    }
    .sb-tabs button {
        font-size: 13px;
        padding: 8px 4px 7px;
    }
    .sb-in {
        width: 60px;
        height: 60px;
        margin: -30px 0 0 -30px;
    }
    .sb-in.kind-2 {
        width: 46px;
        height: 46px;
        margin: -23px 0 0 -23px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sb-in,
    .sb-card.hinted,
    .sb-bowl.shake,
    .sb-say.pop {
        animation: none;
    }
}

/* the shell styles .stat as flex, which would override [hidden] */
.hud .stat[hidden] {
    display: none;
}
/* above the bowl's front, which is lifted over the vegetables */
.sb-stage .overlay {
    z-index: 5;
}
