/* The panels over the map: the conversation with an NPC, the journal window, roll cards and the flat dice. */

/* --- Roll cards --------------------------------------------------------------------------------------------------------------- */

.tt-rollcard {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
    max-width: 100%;
    padding: 10px 16px 12px;
    border: 1px solid var(--tt-gold);
    border-radius: 12px;
    background: rgba(12, 14, 20, 0.9);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.tt-rollcard[data-side="foe"] { border-color: #c4574d; }

.tt-roll-head {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.tt-roll-who {
    color: var(--tt-muted);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tt-roll-label {
    color: var(--tt-gold-hi);
    font-family: var(--tt-serif);
    font-size: 1.05rem;
}

.tt-roll-math {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.05rem;
}

.tt-dice-row {
    display: inline-flex;
    gap: 5px;
}

.tt-die {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 4px;
    border: 1px solid rgba(246, 220, 146, 0.7);
    border-radius: 7px;
    background: linear-gradient(160deg, #2c2f3d, #14161e);
    color: #fff4d2;
    font-weight: 700;
}

.tt-die.is-dropped {
    opacity: 0.45;
    text-decoration: line-through;
}

.tt-roll-notation {
    color: var(--tt-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tt-roll-total {
    font-family: var(--tt-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}

.tt-die.is-negative { border-color: rgba(255, 154, 138, 0.7); color: #ffb0a2; }

.tt-roll-part {
    color: var(--tt-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.tt-roll-part-value {
    color: #fff4d2;
    font-weight: 700;
}

.tt-roll-verdict {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 12px;
}

/* what the roll was against: the number in a box under its name */
.tt-roll-target {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
    padding: 2px 10px 3px;
    border: 1px solid rgba(246, 220, 146, 0.55);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
    line-height: 1.1;
}

.tt-roll-target-label {
    color: var(--tt-muted);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tt-roll-target-value {
    color: #fff;
    font-family: var(--tt-serif);
    font-size: 1.3rem;
    font-weight: 700;
}

.tt-roll-result {
    padding: 2px 14px;
    border-radius: 12px;
    font-family: var(--tt-serif);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tt-roll-result-detail {
    display: block;
    margin-top: -2px;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-align: center;
    opacity: 0.85;
}

.tt-tone-good { background: rgba(88, 194, 107, 0.25); color: #8fe3a0; }
.tt-tone-great { background: rgba(246, 220, 146, 0.3); color: #ffe9a8; box-shadow: 0 0 14px rgba(246, 220, 146, 0.5); }
.tt-tone-bad { background: rgba(217, 72, 63, 0.25); color: #ff9a8a; }
.tt-tone-awful { background: rgba(217, 72, 63, 0.4); color: #ffb0a2; }

.tt-rollcard.is-compact {
    min-width: 0;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 6px 10px;
    border-color: rgba(226, 185, 90, 0.35);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: none;
    text-align: left;
}

.tt-rollcard.is-compact .tt-roll-head { flex-direction: row; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.tt-rollcard.is-compact .tt-roll-label { font-size: 0.85rem; }
.tt-rollcard.is-compact .tt-roll-who { font-size: 0.66rem; }
.tt-rollcard.is-compact .tt-roll-math { gap: 4px 6px; font-size: 0.85rem; justify-content: flex-start; }
.tt-rollcard.is-compact .tt-roll-part { font-size: 0.78rem; }
.tt-rollcard.is-compact .tt-roll-verdict { justify-content: flex-start; gap: 4px 8px; }
.tt-rollcard.is-compact .tt-roll-target { flex-direction: row; gap: 6px; align-items: baseline; min-width: 0; padding: 0 8px; border-radius: 6px; }
.tt-rollcard.is-compact .tt-roll-target-label { font-size: 0.58rem; }
.tt-rollcard.is-compact .tt-roll-target-value { font-size: 0.95rem; }
.tt-rollcard.is-compact .tt-die { min-width: 22px; height: 22px; font-size: 0.8rem; border-radius: 5px; }
.tt-rollcard.is-compact .tt-roll-total { font-size: 1rem; }
.tt-rollcard.is-compact .tt-roll-result { padding: 0 8px; font-size: 0.9rem; }

.tt-rollcard-host {
    position: absolute;
    z-index: 3;
    top: 16%;
    left: 0;
    right: 0;
    width: fit-content;
    max-width: calc(100% - 24px);
    margin: 0 auto;
    animation: tt-pop 0.25s ease both;
}

@keyframes tt-pop {
    from { opacity: 0; transform: scale(0.9); }
}

.tt-flatdice {
    position: absolute;
    top: 42%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 14px;
}

.tt-flatdie {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border: 2px solid var(--tt-gold-hi);
    border-radius: 14px;
    background: linear-gradient(160deg, #2c2f3d, #14161e);
    color: #fff4d2;
    font-family: var(--tt-serif);
    font-size: 1.8rem;
    font-weight: 800;
    animation: tt-tumble 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.tt-flatdie-sides {
    position: absolute;
    margin-top: -48px;
    color: var(--tt-muted);
    font-size: 0.7rem;
}

.tt-flatdie[data-side="foe"] { border-color: #e0685c; }

@keyframes tt-tumble {
    from { opacity: 0; transform: translateY(-120px) rotate(-540deg); }
    to { opacity: 1; }
}

/* --- Conversation ---------------------------------------------------------------------------------------------------------- */

.tt-conversation {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    gap: 18px;
    width: min(780px, calc(100% - 520px));
    max-height: 56%;
    margin: 0 auto;
    padding: 16px 20px;
    border: 1px solid var(--tt-gold);
    border-radius: 16px;
    /* translucent over the battlemap; the blur keeps whatever lies under it (the thread's lines, the map's detail) from showing through the text
     * and the option buttons. It is on only while people talk (the panel steps aside while events play, so the map under it is still). */
    background: rgba(12, 14, 20, var(--tt-conversation-alpha));
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.7);
    user-select: text;
}

@media (max-width: 1500px) {
    .tt-root[data-layout="dock"] .tt-conversation {
        width: min(700px, calc(100% - 440px));
        margin-left: 100px;
    }
}

.tt-convo-who {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 120px;
    text-align: center;
}

.tt-convo-portrait {
    width: 100px;
    height: 100px;
    overflow: hidden;
    border: 2px solid var(--tt-gold);
    border-radius: 50%;
    background: #14161c;
    box-shadow: 0 0 18px rgba(226, 185, 90, 0.35);
}

.tt-convo-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 12%;
}

.tt-convo-name {
    font-family: var(--tt-serif);
    color: var(--tt-gold-hi);
}

.tt-convo-role {
    color: var(--tt-muted);
    font-size: 0.78rem;
}

/* what was said and what can be answered, and under it the box to say something of one's own: the first scrolls when the panel is full, the box stays at the
   bottom of the panel */
.tt-convo-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.tt-convo-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--tt-gold-dim) transparent;
}

/* what was said in this conversation before the reply on show (the party's lines and the speaker's answers, oldest first): it scrolls when it is long, and
   the reply and the options stay where they are */
.tt-convo-lines {
    max-height: 6.5rem;
    margin: 0 0 10px;
    padding: 6px 10px;
    overflow-y: auto;
    border-left: 2px solid rgba(226, 185, 90, 0.35);
    border-radius: 0 8px 8px 0;
    background: rgba(0, 0, 0, 0.28);
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: var(--tt-gold-dim) transparent;
}

.tt-convo-line {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.tt-convo-line + .tt-convo-line {
    margin-top: 6px;
}

.tt-convo-line-name {
    margin-right: 6px;
    color: var(--tt-gold);
    font-family: var(--tt-serif);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tt-convo-line.is-npc .tt-convo-line-name { color: #9fd0f0; }
.tt-convo-line.is-player .tt-convo-line-text { color: var(--tt-text); }
.tt-convo-line.is-npc .tt-convo-line-text { color: #f4ecd9; }

.tt-convo-text {
    margin: 0 0 12px;
    font-size: 1.08rem;
    line-height: 1.5;
}

.tt-convo-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tt-convo-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid rgba(226, 185, 90, 0.35);
    border-radius: 10px;
    background: rgba(226, 185, 90, 0.07);
    color: var(--tt-text);
    text-align: left;
    cursor: pointer;
}

.tt-convo-option:hover {
    border-color: var(--tt-gold-hi);
    background: rgba(226, 185, 90, 0.2);
}

/* an option the party tried is greyed: an asked one (no check) can be picked again, to hear the speaker's words; a spent one (tried with its check, passed or
   failed) cannot be picked again: it is a disabled button, and its number key skips it */
.tt-convo-option.is-asked,
.tt-convo-option.is-spent {
    border-color: rgba(226, 185, 90, 0.18);
    background: rgba(226, 185, 90, 0.03);
    color: var(--tt-muted);
}

.tt-convo-option.is-asked { cursor: pointer; }

.tt-convo-option.is-asked:hover {
    border-color: rgba(226, 185, 90, 0.4);
    background: rgba(226, 185, 90, 0.12);
}

.tt-convo-option.is-spent {
    cursor: not-allowed;
}

.tt-convo-option.is-spent:hover {
    border-color: rgba(226, 185, 90, 0.18);
    background: rgba(226, 185, 90, 0.03);
}

.tt-convo-option.is-spent .tt-convo-label {
    text-decoration: line-through;
    text-decoration-color: rgba(226, 185, 90, 0.5);
}

.tt-convo-option.is-asked .tt-convo-num,
.tt-convo-option.is-spent .tt-convo-num,
.tt-convo-option.is-asked .tt-check,
.tt-convo-option.is-spent .tt-check {
    color: var(--tt-muted);
}

.tt-convo-option.is-asked .tt-check,
.tt-convo-option.is-spent .tt-check {
    border-color: rgba(143, 199, 242, 0.35);
    background: none;
}

.tt-convo-num {
    flex: none;
    width: 22px;
    color: var(--tt-gold);
    font-family: var(--tt-serif);
    font-weight: 700;
}

.tt-convo-label {
    flex: 1;
}

.tt-check {
    flex: none;
    padding: 2px 9px;
    border: 1px solid #8fc7f2;
    border-radius: 11px;
    background: rgba(90, 160, 224, 0.18);
    color: #b8dcf7;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.tt-convo-leave {
    align-self: flex-end;
    margin-top: 8px;
    padding: 6px 4px;
    border: 0;
    background: none;
    color: var(--tt-muted);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

/* the box to say something of one's own to the speaker through Tod: the box of Tod's thread (tt/tabletop_thread.css), at the bottom of the panel */
.tt-convo-say {
    flex: none;
    padding-top: 8px;
}

/* while the events of an answer play (dice, a walk) the dialogue steps aside */
.tt-root.is-playing .tt-conversation {
    opacity: 0;
    pointer-events: none;
}

/* while people talk the dialogue takes the hotbar's place at the bottom */
.tt-root:not(.is-playing):has(.tt-conversation:not([hidden])) .tt-hotbar {
    visibility: hidden;
}

/* a conversation Tod holds goes on in a fight: there the hotbar stays (the hero acts while talking), and the panel stands above it, short enough to leave the top
   bar and a share of the map (what the fight is framed in) free */
.tt-conversation.in-fight {
    bottom: calc(var(--tt-hotbar-h) + 12px);
    max-height: min(56%, max(150px, calc(70% - var(--tt-hotbar-h) - var(--tt-top-band, 56px) - 24px)));
}

.tt-root:not(.is-playing):has(.tt-conversation.in-fight:not([hidden])) .tt-hotbar {
    visibility: visible;
}

.tt-root[data-layout="sheet"] .tt-conversation {
    bottom: 0;
    width: 100%;
    max-height: 62%;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
}

.tt-root[data-layout="sheet"] .tt-convo-who {
    flex-direction: row;
    width: auto;
    gap: 10px;
    text-align: left;
}

.tt-root[data-layout="sheet"] .tt-convo-portrait {
    width: 52px;
    height: 52px;
}

.tt-root[data-layout="sheet"] .tt-convo-text { font-size: 1rem; }

.tt-root[data-layout="sheet"] .tt-convo-lines { max-height: 5rem; }

/* in a fight (a conversation Tod holds) the panel stands over the hotbar, as Tod's sheet does, and leaves the top bar and a share of the map free */
.tt-root[data-layout="sheet"] .tt-conversation.in-fight {
    bottom: var(--tt-hotbar-h);
    max-height: min(62%, max(150px, calc(70% - var(--tt-hotbar-h) - var(--tt-top-band, 60px) - 12px)));
}

/* the on-screen keyboard is up over the panel's own box: the panel sits above it (tt/tabletop.js `watchKeyboard`) */
.tt-root.is-conversing[data-layout="sheet"] .tt-conversation {
    bottom: var(--tt-keyboard, 0px);
    max-height: calc(100% - var(--tt-keyboard, 0px) - 70px);
}

/* --- The journal ------------------------------------------------------------------------------------------------------------- */

.tt-journal-backdrop {
    z-index: 45;
}

.tt-journal {
    display: flex;
    flex-direction: column;
    --tt-dialog-width: 560px;
    border: 1px solid var(--tt-gold);
    border-radius: 16px;
    background: rgba(14, 16, 22, 0.94);
    box-shadow: 0 20px 60px #000;
    user-select: text;
}

.tt-journal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 0 20px;
}

.tt-journal-title {
    margin: 0;
    font-family: var(--tt-serif);
    font-size: 1.3rem;
    letter-spacing: 0.06em;
    color: var(--tt-gold-hi);
}

.tt-journal-tabs {
    flex-wrap: wrap;
    display: flex;
    gap: 4px;
    padding: 8px 16px 0;
    border-bottom: 1px solid rgba(226, 185, 90, 0.25);
}

.tt-journal-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--tt-muted);
    cursor: pointer;
}

.tt-journal-tab.is-active {
    border-bottom-color: var(--tt-gold);
    color: var(--tt-gold-hi);
}

.tt-journal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 20px;
}

.tt-empty {
    color: var(--tt-muted);
    font-style: italic;
}

.tt-group-title {
    margin: 14px 0 6px;
    color: var(--tt-gold);
    font-family: var(--tt-serif);
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tt-quest {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(226, 185, 90, 0.22);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.tt-quest-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 4px;
    font-family: var(--tt-serif);
    font-size: 1rem;
}

.tt-quest-kind {
    color: var(--tt-muted);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tt-quest-completed .tt-quest-title { color: #8fe3a0; }
.tt-quest-failed .tt-quest-title { color: #ff9a8a; }

.tt-objectives,
.tt-exits,
.tt-places {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tt-objectives li {
    display: flex;
    gap: 8px;
    padding: 2px 0;
    font-size: 0.92rem;
}

.tt-objectives li.is-done {
    color: var(--tt-muted);
    text-decoration: line-through;
}

.tt-exits li,
.tt-places li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tt-places li {
    justify-content: flex-start;
}

.tt-places li em {
    margin-left: auto;
    color: var(--tt-muted);
    font-size: 0.78rem;
}

.tt-places li.is-current { color: var(--tt-gold-hi); }
.tt-places li.is-unknown { color: var(--tt-muted); }

.tt-exit-label {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tt-place-text {
    margin: 0 0 8px;
    color: var(--tt-muted);
    font-size: 0.92rem;
}

.tt-roll-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}



/* --- The confirmation window (the Map Generator's dialog, bm/mg `confirmDialog`) ------------------------------------------------------ */

dialog.mg-confirm {
    --tt-dialog-width: 420px;
    padding: 22px;
    border: 1px solid #e2b95a;
    border-radius: 14px;
    background: #12141b;
    color: #f1e8d2;
    box-shadow: 0 20px 60px #000;
}

dialog.mg-confirm::backdrop {
    background: rgba(5, 6, 9, 0.6);
}

.mg-confirm .mg-export-title {
    margin: 0 0 8px;
    font-family: "Cinzel", "Trajan Pro", Georgia, serif;
    font-size: 1.25rem;
    color: #f6dc92;
}

.mg-confirm .mg-hint {
    margin: 0 0 18px;
}

.mg-confirm .mg-export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- The trade window ----------------------------------------------------------------------------------------------------------- */

.tt-trade-backdrop {
    z-index: 46;
}

.tt-trade {
    --tt-dialog-width: 760px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tt-gold);
    border-radius: 16px;
    background: rgba(14, 16, 22, 0.95);
    box-shadow: 0 20px 60px #000;
    user-select: text;
}

.tt-trade-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px 12px 16px;
    border-bottom: 1px solid rgba(226, 185, 90, 0.25);
}

.tt-trade-who {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.tt-trade-who strong {
    font-family: var(--tt-serif);
    color: var(--tt-gold-hi);
}

.tt-trade-who span {
    color: var(--tt-muted);
    font-size: 0.8rem;
}

.tt-gold {
    padding: 4px 12px;
    border: 1px solid var(--tt-line);
    border-radius: 14px;
    color: #f6dc92;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tt-trade-discount {
    color: #8fe3a0;
    font-size: 0.8rem;
}

.tt-trade-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 16px 16px;
}

.tt-trade-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.tt-goods {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tt-good {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tt-good-name {
    flex: 1;
    min-width: 0;
}

.tt-good-price {
    color: #f6dc92;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .tt-trade-columns { grid-template-columns: 1fr; }
}

/* --- A list of choices ------------------------------------------------------------------------------------------------------------ */

.tt-chooser {
    --tt-dialog-width: 380px;
    display: flex;
    flex-direction: column;
    padding: 18px;
    border: 1px solid var(--tt-gold);
    border-radius: 14px;
    background: #12141b;
    box-shadow: 0 20px 60px #000;
}

.tt-chooser-title {
    margin: 0 0 10px;
    font-family: var(--tt-serif);
    font-size: 1.1rem;
    color: var(--tt-gold-hi);
}

.tt-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tt-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 14px;
    text-align: left;
}

.tt-choice span {
    color: var(--tt-muted);
    font-size: 0.8rem;
}

/* --- The world map layer ---------------------------------------------------------------------------------------------------------- */

.tt-world {
    position: absolute;
    inset: 0;
    z-index: 11;
    display: flex;
    flex-direction: column;
    background: #17130e;
}

.tt-world-head {
    position: absolute;
    z-index: 2;
    top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.tt-world-head > * {
    pointer-events: auto;
}

.tt-world-title {
    margin: 0;
    padding: 6px 16px;
    border: 1px solid var(--tt-line);
    border-radius: 18px;
    background: var(--tt-glass);
    font-family: var(--tt-serif);
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: var(--tt-gold-hi);
}

.tt-world-tools {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--tt-line);
    border-radius: 22px;
    background: var(--tt-glass);
}

.tt-world-stage {
    position: absolute;
    inset: 0;
}

.tt-world-stage .bm-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    outline: none;
}

.tt-world-card {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(560px, calc(100% - 560px));
    margin: 0 auto;
    padding: 12px 16px;
    border: 1px solid var(--tt-gold);
    border-radius: 14px;
    background: rgba(14, 16, 22, 0.92);
    box-shadow: 0 10px 30px #000;
}

.tt-world-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tt-world-card-name {
    font-family: var(--tt-serif);
    color: var(--tt-gold-hi);
}

.tt-world-card-kind {
    color: var(--tt-muted);
    font-size: 0.8rem;
}

.tt-world-card-actions {
    display: flex;
    gap: 8px;
}

.tt-world-places {
    position: absolute;
    z-index: 2;
    left: 96px;
    top: 60px;
    max-height: calc(100% - 200px);
    width: 210px;
    overflow-y: auto;
    border: 1px solid var(--tt-line);
    border-radius: 12px;
    background: rgba(14, 16, 22, 0.92);
}

.tt-world-list {
    margin: 0;
    padding: 4px;
    list-style: none;
}

.tt-world-place {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: 40px;
    padding: 4px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--tt-text);
    text-align: left;
    cursor: pointer;
}

.tt-world-place:hover { background: rgba(226, 185, 90, 0.16); }
.tt-world-place.is-current { color: var(--tt-gold-hi); }
.tt-world-place.is-reachable .tt-world-place-name::after { content: " \2192"; color: #8fe3a0; }
.tt-world-unknown {
    padding: 6px 10px;
    color: var(--tt-muted);
    font-size: 0.78rem;
    font-style: italic;
}

.tt-world-place em { color: var(--tt-muted); font-size: 0.72rem; }

.tt-root.is-world .tt-hotbar,
.tt-root.is-world .tt-camera,
.tt-root.is-world .tt-skip {
    display: none;
}

.tt-root[data-layout="sheet"] .tt-world-places { display: none; }
.tt-root[data-layout="sheet"] .tt-world-card { width: calc(100% - 24px); bottom: 66px; flex-direction: column; align-items: stretch; }

/* on a portrait screen the map stops above the thread's strip, so its compass and scale stay in view */
.tt-root[data-layout="sheet"] .tt-world-stage {
    bottom: 54px;
}

/* the hotbar is hidden while the world map is open: the thread's sheet takes its place at the bottom */
.tt-root.is-world[data-layout="sheet"] .tt-thread {
    bottom: 0;
}

/* the world layer: the scene's name makes way for the layer's header; places that can be reached stand out, the others are named by kind */
.tt-root.is-world .tt-scene-name {
    display: none;
}

/* the header starts clear of the top-left group (its left edge: `--tt-world-head-left`, on a portrait screen the rule of `.is-world` below); with the
 * counter of the day's free requests (a player without a subscription) that group is wider */
.tt-root:has(.tt-freeplay:not([hidden])) {
    --tt-world-head-left: 400px;
}

.tt-world-head {
    left: var(--tt-world-head-left, 280px);
}

.tt-world-place {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 34px;
}

.tt-world-place .fa-solid:first-child {
    width: 1.2em;
    color: var(--tt-gold);
    text-align: center;
}

.tt-world-place-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tt-world-place.is-unknown { color: var(--tt-muted); font-style: italic; }
.tt-world-place.is-unknown .fa-solid:first-child { color: var(--tt-muted); }
.tt-world-place.is-reachable { background: rgba(88, 194, 107, 0.16); font-weight: 700; }
.tt-world-place.is-reachable .tt-world-place-name::after { content: none; }
.tt-world-go { color: #8fe3a0; }
.tt-world-place em { margin-left: auto; }

/* the secondary button of a confirmation is the gold primary's quiet partner, not a flat grey box */
.mg-confirm .mg-btn {
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid var(--tt-line);
    border-radius: 8px;
    background: transparent;
    color: var(--tt-gold-hi);
    font-family: var(--tt-body);
    cursor: pointer;
}

.mg-confirm .mg-btn:hover {
    border-color: var(--tt-gold);
    background: rgba(226, 185, 90, 0.14);
}

.mg-confirm .mg-btn-primary {
    border-color: var(--tt-gold);
    background: linear-gradient(180deg, #e8c773, #b88d34);
    color: #231a08;
    font-weight: 700;
}

.tt-good-count { color: var(--tt-gold-hi); font-style: normal; }
.tt-good-base { color: var(--tt-muted); font-style: normal; }
.tt-item-dormant { display: block; flex-basis: 100%; font-size: 0.85em; opacity: 0.75; }
.tt-good-owner { display: block; color: var(--tt-muted); font-size: 0.74rem; }
.tt-short { color: #ff9a8a; font-size: 0.78rem; white-space: nowrap; }
.tt-buyer {
    max-width: 150px;
    min-height: 36px;
    border: 1px solid var(--tt-line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--tt-text);
}

/* a portrait screen: the list of places is a sheet over the map, opened by the list button, and closed once a place is chosen */
.tt-world-list-toggle { display: none; }

.tt-root[data-layout="sheet"] .tt-world-list-toggle { display: inline-grid; }

.tt-root[data-layout="sheet"] .tt-world-places {
    display: none;
    left: 8px;
    right: 8px;
    top: 130px;
    width: auto;
    max-height: 46%;
}

.tt-root[data-layout="sheet"] .tt-world.is-listed .tt-world-places { display: block; z-index: 4; }

/* the confirmations' buttons are one height */
.mg-confirm .mg-export-actions .mg-btn { height: 44px; box-sizing: border-box; }

/* the world layer on a phone: the party column makes way, and the header keeps one line */
.tt-world-title { white-space: nowrap; }

.tt-root.is-world[data-layout="sheet"] .tt-party { display: none; }

.tt-root.is-world[data-layout="sheet"] .tt-world-head {
    left: 8px;
    right: 8px;
    top: 62px;
    justify-content: space-between;
}

.tt-root.is-world[data-layout="sheet"] .tt-world-tools { margin-right: 0; }

/* a phone pinches to zoom: the world layer's header keeps to list, whole map and close */
.tt-root[data-layout="sheet"] .tt-world-zoom { display: none; }
.tt-world-place { min-height: 40px; }

/* a purchase's toast is not laid over the goods: while the trade window is open the window leaves room, and the toasts sit at the bottom */
.tt-root.is-trading .tt-trade { max-height: calc(100dvh - 132px); }
/* one rule for a window or a card that is open: the notices keep to the bottom, the two newest only (a trade window, a loot card) */
.tt-root.is-trading .tt-toasts,
.tt-root.is-trading .tt-toasts-low,
.tt-root:has(.tt-card) .tt-toasts,
.tt-root:has(.tt-card) .tt-toasts-low { top: auto; bottom: 14px; }
.tt-trade-head { flex-wrap: wrap; }
.tt-trade-who { flex: 1 1 130px; }

/* the trade window leaves room for two toasts at the bottom (a phone as well as a desktop); older ones are not shown over the goods */
.tt-root.is-trading .tt-trade { max-height: calc(100dvh - 184px); }
.tt-root.is-trading .tt-toast:not(:nth-last-child(-n+2)),
.tt-root:has(.tt-card) .tt-toast:not(:nth-last-child(-n+2)) { display: none; }
.tt-root.is-trading .tt-trade-backdrop { align-items: flex-start; }

/* a portrait screen: notices hang under the toolbar and the turn-order bar and the free-time clock, between the party column on the left
 * and the camera buttons on the right, so that they cover none of them (a window or a card that is open moves them to the bottom, above) */
.tt-root[data-layout="sheet"]:not(.is-trading):not(:has(.tt-card)) .tt-toasts:not(.tt-toasts-low) {
    top: calc(var(--tt-top-band, 56px) + 32px);
    left: 66px;
    right: 60px;
}

.tt-root[data-layout="sheet"] .tt-toasts:not(.tt-toasts-low) .tt-toast {
    max-width: 100%;
    box-sizing: border-box;
}


/* a portrait screen: the roll card comes below the toolbar and the turn-order bar, wherever the bar ends (`--tt-top-band`, see tabletop.js) */
.tt-root[data-layout="sheet"] .tt-rollcard-host { top: calc(var(--tt-top-band, 16%) + 8px); }
/* ... and between the party column on the left (portraits 48px wide, 10px from the edge) and the camera buttons on the right (44px, 8px from
 * the edge), so that it covers neither */
.tt-root[data-layout="sheet"] .tt-rollcard-host {
    left: 66px;
    right: 60px;
    max-width: none;
}

/* a card that stays (loot, a level gained) hangs below the toolbar and the turn-order bar, never over them */
.tt-card { top: calc(var(--tt-top-band, 12%) + 12px); max-height: calc(100% - var(--tt-top-band, 12%) - 24px); }

/* a notice is a few lines: a long text (a quest's whole telling) is cut short, the journal has all of it */
.tt-toast span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

/* a portrait screen: the big title of a fight or a turn sits right under the toolbar and the turn-order bar, clear of the Skip button and the
   thread's sheet below it */
.tt-root[data-layout="sheet"] .tt-banner { top: calc(var(--tt-top-band, 16%) + 6px); }
.tt-root[data-layout="sheet"] .tt-banner-title { padding: 6px 0 2px; font-size: 1.5rem; }
.tt-root[data-layout="sheet"] .tt-banner-sub { padding-bottom: 6px; }
