/*
 * World editor, region toolbar, and transfer-dialog styles.
 */

.world-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #19231e;
    border-bottom: 1px solid #b6a17132;
}
.world-toolbar button {
    font-size: 11px;
    padding: 5px 10px;
}
.world-toolbar > span {
    font-size: 10px;
    color: var(--muted);
    flex: 1;
}
.reveal-shape-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    color: var(--muted);
    margin-left: auto;
}
.reveal-shape-label select {
    font-size: 11px;
    padding: 5px 8px;
    max-width: 150px;
}
#world-dialog {
    width: min(760px, calc(100vw - 28px));
}
#region-dialog,
#transfer-dialog {
    width: min(620px, calc(100vw - 28px));
}
.world-help,
.world-gates > p {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    margin: 15px 0;
}
.world-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.world-actions button {
    font-size: 12px;
    white-space: normal;
}
.world-map-row,
.world-region-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    width: 100%;
    white-space: normal;
    text-align: left;
    padding: 13px;
    margin: 8px 0;
}
.world-map-row[aria-pressed='true'] {
    background: #3b4533;
    border-color: #b6a171;
}
.world-region-row strong {
    font-weight: 500;
    font-size: 12px;
}
.world-region-row span {
    font-size: 11px;
    color: var(--muted);
}
.world-region-item {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 8px 0;
}
.world-region-item .world-region-row {
    flex: 1;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}
.world-region-delete {
    flex: 0 0 auto;
    padding: 10px 12px;
    font-size: 12px;
}
#world-edit,
.world-gates {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.world-gates h3 {
    font-family: Zodiak, Georgia, serif;
    font-size: 20px;
    font-weight: 300;
    color: #d8c59c;
}
.world-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.region-bounds {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.world-fields input,
.region-bounds input {
    min-width: 0;
    width: 100%;
}
.world-grid {
    margin: 20px 0;
}
.world-grid summary {
    cursor: pointer;
    color: #d8c59c;
    font-size: 13px;
}
.world-grid p {
    color: var(--muted);
    font-size: 12px;
}
.world-grid form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}
.world-grid label {
    flex: 1;
    min-width: 80px;
}
.world-grid input {
    width: 100%;
}
.world-grid button {
    margin-bottom: 15px;
    font-size: 12px;
}
#region-error,
#transfer-error {
    color: #e9a99c;
    font-size: 12px;
}
#region-error:empty,
#transfer-error:empty,
#world-upload-status:empty {
    display: none;
}
#region-add-map {
    font-size: 11px;
    margin: 0 0 15px;
}
#region-form > .dialog-actions {
    flex-wrap: wrap;
}
#transfer-copy {
    color: var(--muted);
    font-size: 13px;
    margin: 16px 0;
}
#world-draw-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    z-index: 5;
    pointer-events: none;
    background: #192d23f5;
    color: #f3dcaa;
    border: 1px solid #b6a171;
    padding: 10px 16px;
    border-radius: 7px;
    font-size: 12px;
    text-align: center;
}
.map-region[role='button'] {
    cursor: pointer;
}
.map-region[role='button']:hover > path,
.map-region:focus > path {
    fill-opacity: 0.25;
    stroke: #fff1b8;
    stroke-width: 3;
}
.map-region:focus {
    outline: none;
}
.map-region.secret {
    opacity: 0.6;
}
.map-region text {
    font-family: Satoshi, system-ui, sans-serif;
}
@media (max-width: 680px) {
    .world-toolbar {
        padding: 7px 10px;
        gap: 6px;
    }
    .world-toolbar > span {
        display: none;
    }
    .world-toolbar button {
        font-size: 10px;
    }
    .reveal-shape-label {
        font-size: 9px;
    }
    .reveal-shape-label select {
        font-size: 10px;
        max-width: 120px;
    }
    .region-bounds {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .world-region-row {
        align-items: start;
        flex-direction: column;
        gap: 5px;
    }
    .world-fields {
        gap: 8px;
    }
    .world-fields label {
        font-size: 11px;
    }
    .world-actions button {
        flex: 1;
    }
    .world-grid form {
        gap: 8px;
    }
}

.map-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.map-upload button,
#transfer-add-map {
    font-size: 11px;
}
.map-upload span {
    font-size: 11px;
    color: var(--muted);
}

.world-region-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 5px 16px;
    background: #13211b;
    border-bottom: 1px solid #87b4af44;
    flex-shrink: 0;
}
.world-region-tools[hidden] {
    display: none;
}
.world-region-tools span {
    font-size: 11px;
    color: #adc8be;
    flex: 1;
    min-width: 0;
}
.world-region-tools button {
    font-size: 10px;
    padding: 4px 8px;
}
.map-region[role='button'] {
    cursor: move;
}
.map-region.selected > path {
    stroke: #a8e0df;
    stroke-width: 2;
    fill-opacity: 0.16;
}
.region-handles {
    touch-action: none;
}
@media (max-width: 680px) {
    .world-region-tools {
        padding: 5px 10px;
        gap: 5px;
        flex-wrap: wrap;
    }
    .world-region-tools span {
        font-size: 10px;
    }
    .world-region-tools button {
        font-size: 9px;
    }
}

.world-region-tools select {
    font-size: 10px;
    padding: 4px 6px;
    max-width: 145px;
}
.world-region-tools select[hidden] {
    display: none;
}

/* World context belongs to the main header; the location strip stays one row. */
.gm-header { height: 64px; gap: 10px; padding-inline: 16px; }
.gm-header .room-heading { flex: 1 1 120px; min-width: 70px; max-width: 200px; }
.gm-header .world-toolbar { padding: 0; gap: 6px; border: 0; background: none; flex-wrap: nowrap; min-width: 0; margin-right: auto; }
.gm-header .world-toolbar label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; min-width: 0; }
#current-world { width: clamp(130px, 16vw, 230px); min-width: 0; font-size: 12px; padding: 7px 9px; text-overflow: ellipsis; }
.gm-header .world-toolbar button { padding: 7px 9px; white-space: nowrap; }
/* Room setup, view mode, then the joined player-screen action. */
.gm-header > :is(#asset-library, #room-settings, #game-settings, #split-view, #screen-settings),
.gm-header .player-screen-actions > button {
    min-height: 40px; margin: 0; padding: 8px 12px; font-size: 13px; line-height: 1.4;
}
.gm-header > #split-view { margin-left: 6px; }
#asset-library {
    display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap;
    border: 1px solid var(--accent); border-radius: 7px; font-weight: 600;
    color: var(--accent); background: var(--light-control, #262d28);
}
#asset-library:hover { background: var(--light-hover, #354036); }
.player-screen-actions { display: inline-flex; align-items: stretch; flex-shrink: 0; }
.player-screen-actions > #open-screen { border-radius: 7px 0 0 7px; }
.gm-header .player-screen-actions > .screen-link-button {
    min-width: 36px; margin-left: -1px; padding-inline: 9px;
    border-radius: 0 7px 7px 0; border-left-color: #ffffff40;
}
.player-screen-actions > button:focus-visible { position: relative; z-index: 1; }
#world-home-button[aria-pressed='true'] { background: #344238; border-color: #718265; color: #ecdfb8; }
#scene-tabs { min-width: 0; flex: 1; align-items: center; }
.location-tab-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.location-tab-group + .location-tab-group { border-left: 1px solid #66725c; padding-left: 13px; margin-left: 7px; }
.location-group-label { color: #a2afa0; font-size: 10px; padding-right: 3px; max-width: 160px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.empty-locations { font-size: 11px; color: var(--muted); white-space: nowrap; }
/* Options float above the board, preserving the same map geometry when opened. */
#board-host > .grid-options-panel { position: absolute; top: 12px; right: 12px; z-index: 9; width: min(430px, calc(100% - 24px)); max-height: calc(100% - 24px); box-sizing: border-box; border: 1px solid #64735e; border-radius: 10px; box-shadow: 0 12px 36px #0008; padding: 12px 14px; }
.grid-panel-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-panel-heading strong { font-size: 12px; font-weight: 500; color: #e0cfaa; }
#close-grid-options { font-size: 14px; padding: 3px 8px; }
.grid-options-panel .reveal-shape-label { margin: 0; grid-column: 1 / -1; }
.grid-options-panel .reveal-shape-label select { width: auto; max-width: none; }
#board-host > .world-region-tools { position: absolute; bottom: 12px; left: 12px; right: 12px; z-index: 6; min-height: 34px; border: 1px solid #64735e; border-radius: 8px; padding: 6px 10px; box-shadow: 0 8px 24px #0006; background: #13211bf5; }
@media (min-width: 901px) {
    .workspace .board-toolbar { height: 56px; min-height: 56px; }
    .workspace .presentation-bar { min-height: 31px; }
}
@media (max-width: 1150px) {
    .gm-header { gap: 7px; padding-inline: 10px; }
    .gm-header > button { font-size: 11px; padding: 7px 9px; }
    .gm-header > :is(#asset-library, #room-settings, #game-settings, #split-view, #screen-settings),
    .gm-header .player-screen-actions > button { min-height: 36px; font-size: 11px; padding: 7px 9px; }
    .gm-header .room-heading > button { font-size: 15px; }
    #current-world { width: 150px; }
    .gm-header .world-toolbar label { gap: 4px; }
}
@media (max-width: 680px) {
    .player-screen-actions { display: none; }
    .gm-header > #split-view { margin-left: 0; }
    .gm-header > :is(#asset-library, #room-settings, #game-settings, #split-view, #screen-settings) { padding-inline: 8px; }
}
@media (max-width: 760px) {
    .gm-header { height: auto; min-height: 100px; padding-block: 7px; flex-wrap: wrap; gap: 7px; }
    .gm-header .world-toolbar { order: 10; width: 100%; justify-content: flex-start; }
    .gm-header .world-toolbar label { flex: 1; }
    #current-world { flex: 1; width: 100px; max-width: 290px; }
    .gm-header .room-heading { max-width: none; }
    .location-group-label { max-width: 95px; }
}

/* Keep people controls in the roster, with a visible handle when it is closed. */
.workspace > #toggle-roster { position: absolute; left: 0; top: 44%; z-index: 8; border-radius: 0 9px 9px 0; padding: 10px 12px; background: #344238; color: #ecdfb8; border: 1px solid #7b9274; box-shadow: 3px 4px 14px #0005; font-size: 12px; }
.workspace > #toggle-roster:hover { background: #465b4b; }
#roster-panel > #browse-portraits { margin: 0 12px 14px; padding: 10px; font-size: 12px; text-align: left; color: #f1dba9; border-color: #766d4c; }
#gm.split-view .workspace .board-toolbar {
    height: auto;
    min-height: 56px;
    flex-flow: row wrap;
    align-items: center;
    align-content: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 6px 12px;
}
#gm.split-view .board-toolbar .map-heading {
    width: auto;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
}
#gm.split-view .board-toolbar .board-options {
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
    flex-wrap: wrap;
    row-gap: 4px;
}
