/* PlayerBoard editor on the GITADORA game options page. */

.playerboard-editor {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 10px;
}

.playerboard-column {
    flex: 1 1 320px;
    min-width: 280px;
}

.playerboard-preview {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 320 / 554;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #6a6a6a;
    border-radius: 6px;
    background: linear-gradient(135deg, #20243a, #384d69);
    /* Dragging a sticker must not scroll the page on touch screens. */
    touch-action: none;
    user-select: none;
}

.playerboard-preview-grid {
    position: absolute;
    inset: 0;
    opacity: .25;
    background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
    background-size: 10% 10%;
}

/* The board is the backdrop; everything the player places sits on top of it. */
.playerboard-preview-board {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.playerboard-preview-board-art {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* The art is the sticker, so the marker itself is just a grab outline. */
.playerboard-preview-sticker {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1px;
    overflow: hidden;
    border: 1px dashed rgba(255, 255, 255, .5);
    border-radius: 2px;
    color: #fff;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    cursor: grab;
}

.playerboard-preview-sticker.selected {
    z-index: 3;
    border-style: solid;
    border-color: #ffcc00;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, .6);
}

.playerboard-preview-sticker:active {
    cursor: grabbing;
}

.playerboard-preview-art {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* The item ID sits in a corner so a sticker can still be identified when its
   art is small or hidden behind another sticker. */
.playerboard-preview-id {
    position: absolute;
    top: 0;
    left: 0;
    padding: 0 2px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 8px;
    line-height: 1.4;
}

/* Shown instead when the asset host has no art for the item. */
.playerboard-art-missing {
    padding: 0 3px;
    border-radius: 2px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 10px;
}

.playerboard-row {
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid #6a6a6a;
    border-radius: 5px;
    background: rgba(128, 128, 128, .12);
    cursor: pointer;
}

.playerboard-row.selected {
    border-color: #ffcc00;
    background: rgba(255, 204, 0, .12);
}

/* The board has no position or size to edit, so it is just a picker. */
.playerboard-board-row {
    cursor: default;
}

.playerboard-board-select {
    box-sizing: border-box;
    width: 100%;
    margin-top: 6px;
}

.playerboard-row-help {
    margin-top: 4px;
    font-size: .8em;
    opacity: .7;
}

.playerboard-row-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.playerboard-row-item {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: .9em;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .85;
}

.playerboard-remove {
    border: 1px solid #dadada;
    background: #f8f8f8;
    color: #333;
    font-size: .8em;
    padding: 1px 8px;
}

.playerboard-row-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.playerboard-row-fields label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .8em;
}

.playerboard-number {
    width: 70px;
}

.playerboard-add {
    border: 1px solid #dadada;
    background: #f8f8f8;
    color: #333;
    margin-bottom: 12px;
}

.playerboard-browser-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .85em;
}

.playerboard-search {
    box-sizing: border-box;
    width: 100%;
    margin: 6px 0;
}

.playerboard-item-list {
    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #6a6a6a;
    border-radius: 5px;
}

.playerboard-item {
    padding: 3px 8px;
    border: 0;
    border-bottom: 1px solid rgba(128, 128, 128, .25);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: .85em;
    text-align: left;
    cursor: pointer;
}

.playerboard-item.selected {
    background: rgba(255, 204, 0, .35);
}

.playerboard-item:last-child {
    border-bottom: 0;
}

.playerboard-item-empty {
    padding: 6px 8px;
    font-size: .85em;
    opacity: .75;
}

.playerboard-actions {
    margin-top: 12px;
}

.playerboard-save {
    border: 1px solid #cddcc1;
    background: #e7ffd4;
    color: #003000;
}

.playerboard-save:disabled {
    opacity: .5;
    cursor: default;
}
