/*
   Player Council · 3D council room (council members page with ?view=3d).
   Plain CSS on purpose: the scene script and this overlay ship together and need no build.
   Colours follow the site palette (secondary #1e1b19, yellow 300-600, primary #820f04).
   */

.room3d {
    position: relative;
    height: calc(100svh - var(--room3d-offset, 4.5rem));
    min-height: 32rem;
    overflow: hidden;
    background: #060403;
    color: #d2d1d1;
    font-family: 'Titillium Web', ui-sans-serif, system-ui, sans-serif;
    user-select: none;
    cursor: url(cursor.png) 4 4, auto;
}
.room3d canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    touch-action: none;
}
.room3d.is-hover canvas,
.room3d a,
.room3d button {
    cursor: url(pointer.png) 6 2, pointer;
}

.room3d-top {
    position: absolute;
    inset: 0 0 auto 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1.25rem;
    padding: 1rem 1.25rem 2.5rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, .8), transparent);
    pointer-events: none;
}
.room3d-top > * {
    pointer-events: auto;
}
.room3d-back {
    border: 1px solid rgba(169, 140, 82, .4);
    background: rgba(12, 11, 10, .65);
    padding: .375rem .75rem;
    color: #e5cfa4;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .15s;
}
.room3d-back:hover {
    background: rgba(211, 175, 103, .12);
}
.room3d-title {
    margin: 0;
    color: #dcbf85;
    font-size: clamp(1rem, 2.4vw, 1.5rem);
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
}
.room3d-title small {
    display: block;
    margin-bottom: .2rem;
    color: #a5a4a3;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .28em;
}

.room3d-hint {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    max-width: calc(100% - 2rem);
    margin: 0;
    padding: .4rem .9rem;
    transform: translateX(-50%);
    border: 1px solid rgba(169, 140, 82, .25);
    background: rgba(12, 11, 10, .72);
    color: #d2d1d1;
    font-size: .8125rem;
    text-align: center;
    pointer-events: none;
    transition: opacity .6s;
}
.room3d-hint.is-hidden {
    opacity: 0;
}

/* seat lists down both sides of the screen, mirroring the table; the head sits top centre */
.room3d-rosters {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.room3d-roster {
    position: absolute;
    top: 5.25rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 10.5rem;
    overflow-y: auto;
    scrollbar-width: none;
}
.room3d-roster::-webkit-scrollbar {
    display: none;
}
.room3d-roster--left {
    left: 1.25rem;
}
.room3d-roster--right {
    right: 1.25rem;
}
.room3d-roster--head {
    top: 1.1rem;
    bottom: auto;
    left: 50%;
    width: auto;
    max-width: 16rem;
    transform: translateX(-50%);
}
.room3d-seat {
    display: flex;
    flex: none;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    border: 0;
    border-left: 2px solid transparent;
    background: rgba(12, 11, 10, .55);
    padding: .3rem .6rem;
    color: #d2d1d1;
    font: 600 .8125rem/1.25 inherit;
    font-family: inherit;
    text-align: left;
    pointer-events: auto;
    transition: background-color .15s, color .15s;
}
.room3d-seat b {
    flex: none;
    min-width: 1.35rem;
    color: #a98c52;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.room3d-seat span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.room3d-roster--right .room3d-seat {
    flex-direction: row-reverse;
    border-left: 0;
    border-right: 2px solid transparent;
    text-align: right;
}
.room3d-seat:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.room3d-seat.is-active {
    border-color: #d3af67;
    background: rgba(26, 3, 1, .85);
    color: #fff;
}
.room3d-roster--head .room3d-seat {
    border: 1px solid rgba(211, 175, 103, .6);
    padding: .4rem .9rem;
    color: #e5cfa4;
    font-size: .9375rem;
    font-weight: 700;
}
.room3d-roster--head .room3d-seat b {
    color: #dcbf85;
}

/* a member's tasks: a bar along the bottom, between the seat lists */
.room3d-panel {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    width: min(60rem, calc(100% - 26rem));
    max-height: 45%;
    overflow: auto;
    transform: translateX(-50%);
    border: 1px solid rgba(169, 140, 82, .45);
    background: rgba(12, 11, 10, .93);
    padding: .8rem 1.1rem .95rem;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .9);
    user-select: text;
}
.room3d-panel[hidden] {
    display: none;
}
.room3d-close {
    position: absolute;
    top: .3rem;
    right: .45rem;
    border: 0;
    background: none;
    padding: .25rem .5rem;
    color: #a5a4a3;
    font-size: 1.5rem;
    line-height: 1;
}
.room3d-close:hover {
    color: #e5cfa4;
}
.room3d-who {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .1rem .9rem;
    margin-right: 2rem;
}
.room3d-caption {
    margin: 0;
    color: #a98c52;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.room3d-name {
    margin: 0;
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 1.375rem;
    font-weight: 900;
    line-height: 1.15;
}
.room3d-count {
    margin: 0;
    color: #dcbf85;
    font-size: .875rem;
    font-weight: 600;
}
.room3d-tasks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: .4rem 1.5rem;
    margin: .65rem 0 0;
    padding: .65rem 0 0;
    border-top: 1px solid rgba(169, 140, 82, .2);
    list-style: none;
    font-size: .8125rem;
}
.room3d-tasks li {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
}
.room3d-tasks img {
    width: 1.8rem;
    height: 1.8rem;
    flex: none;
    padding: .2rem;
    border: 1px solid rgba(169, 140, 82, .4);
    background: #0c0b0a;
    object-fit: contain;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, .8);
}
.room3d-tasks span {
    flex: 1;
    overflow: hidden;
    color: #d2d1d1;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.room3d-tasks b {
    flex: none;
    margin-left: .35rem;
    color: #787675;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}
.room3d-tasks b.is-done {
    color: #dcbf85;
}

/* narrow screens: one row of seats under the title and the tasks as a bottom sheet */
@media (max-width: 1000px) {
    .room3d-rosters {
        inset: 4.6rem 0 auto 0;
        display: flex;
        gap: .25rem;
        overflow-x: auto;
        padding: 0 .75rem .35rem;
        pointer-events: auto;
        scrollbar-width: none;
    }
    .room3d-rosters::-webkit-scrollbar {
        display: none;
    }
    .room3d-roster {
        display: contents;
    }
    .room3d-seat,
    .room3d-roster--right .room3d-seat,
    .room3d-roster--head .room3d-seat {
        flex-direction: row;
        border: 1px solid rgba(169, 140, 82, .3);
        padding: .3rem .6rem;
        font-size: .8125rem;
        text-align: left;
    }
    .room3d-seat.is-active {
        border-color: #d3af67;
    }
    .room3d-panel {
        inset: auto 0 0 0;
        width: auto;
        max-height: 44%;
        transform: none;
        border-width: 1px 0 0;
    }
    .room3d-hint {
        bottom: .6rem;
    }
}

/* phones on their side: a slim title bar so the room keeps most of the little height there is */
@media (max-height: 540px) and (orientation: landscape) {
    .room3d {
        min-height: 16rem;
    }
    .room3d-top {
        flex-wrap: nowrap;
        gap: .75rem;
        padding: .5rem .75rem 1.5rem;
    }
    .room3d-back {
        flex: none;
        padding: .25rem .6rem;
        font-size: .8125rem;
    }
    .room3d-title {
        min-width: 0;
        overflow: hidden;
        font-size: 1rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .room3d-title small {
        display: none;
    }
    .room3d-rosters {
        top: 2.6rem;
    }
    .room3d-seat,
    .room3d-roster--right .room3d-seat,
    .room3d-roster--head .room3d-seat {
        padding: .2rem .5rem;
        font-size: .75rem;
    }
    /* the tasks as a sheet down the right, so the member stays in view on the left */
    .room3d-panel {
        inset: 4.75rem 0 0 auto;
        width: min(24rem, 48%);
        max-height: none;
        padding: .5rem .9rem .6rem;
        border-width: 1px 0 0 1px;
    }
    .room3d-tasks {
        grid-template-columns: 1fr;
    }
    .room3d-name {
        font-size: 1.125rem;
    }
    .room3d-tasks {
        gap: .3rem;
        margin-top: .4rem;
        padding-top: .4rem;
        font-size: .75rem;
    }
    .room3d-tasks img {
        width: 1.5rem;
        height: 1.5rem;
    }
    .room3d-hint {
        font-size: .75rem;
    }
}
