.panel-drag-handle {
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.panel-drag-handle:active {
    cursor: grabbing;
}
.panel-drag-handle:focus-visible {
    outline: 2px solid #527862;
    outline-offset: 3px;
}
.panel-moved {
    position: fixed !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow: auto;
    z-index: 38;
}
.quest.panel-moved {
    display: block;
    padding-bottom: 12px;
}
.signed-out .quest.panel-moved,
.desktop-hud-hidden .quest.panel-moved {
    display: none;
}
.minimap-controls {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.minimap-controls button {
    min-height: 32px;
    border-radius: 10px;
    padding: 5px 9px;
    font-size: 12px;
    background: var(--paper);
}
.right-rail {
    gap: 10px;
}
.right-rail .map-shell.minimap-small {
    width: 96px;
    height: 96px;
    border-width: 4px;
}
.map-shell.minimap-small .map-label {
    display: none;
}
.minimap-controls[hidden],
.map-shell[hidden],
#pocket-tycoon[hidden],
#tycoon-open[hidden] {
    display: none !important;
}
#pocket-tycoon {
    position: fixed;
    right: 16px;
    top: 100px;
    width: 420px;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 116px);
    overflow: auto;
    z-index: 40;
    padding: 14px;
    border: 1px solid #d1dbc8;
    border-radius: 18px;
    background: #f7f5e9;
    color: #354d41;
    box-shadow: 0 12px 48px #203c4538;
    font-size: 13px;
}
.tycoon-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 19px;
}
.tycoon-head button {
    min-width: 40px;
    min-height: 40px;
    font-size: 24px;
}
.tycoon-fishing {
    padding: 7px 9px;
    border-radius: 10px;
    background: #e2ecd9;
    margin: 8px 0;
}
.tycoon-score {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.tycoon-score p {
    margin: 0 0 9px;
    padding: 8px;
    background: #fffdf5;
    border-radius: 9px;
}
.tycoon-board {
    display: grid;
    grid-template: repeat(4, minmax(70px, 1fr)) / repeat(4, minmax(0, 1fr));
    gap: 4px;
}
.tycoon-tile {
    border: 1px solid #d0d8c6;
    border-top: 5px solid var(--tile-color, #a9bcb0);
    border-radius: 8px;
    background: #fffdf5;
    padding: 4px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 11px;
    line-height: 1.3;
}
.tycoon-tile small {
    font-size: 10px;
    margin-top: 3px;
}
.tycoon-tile b {
    color: #477b60;
    min-height: 16px;
}
.tycoon-tile.owned-you {
    background: #deedd6;
    outline: 1px solid #6d9362;
}
.tycoon-tile.owned-bot {
    background: #f0dfcd;
    outline: 1px solid #b6906d;
}
.tycoon-center {
    grid-area: 2 / 2 / 4 / 4;
    display: grid;
    place-content: center;
    text-align: center;
    white-space: pre-line;
    line-height: 2;
    border-radius: 18px;
    background: #e9eedf;
    font-weight: 600;
}
.tycoon-status {
    min-height: 20px;
    margin: 10px 0;
}
.tycoon-actions {
    display: flex;
    gap: 8px;
}
.tycoon-actions button {
    flex: 1;
    padding: 10px;
    min-height: 44px;
    background: #54745e;
    color: white;
    border-radius: 10px;
}
.tycoon-actions button:disabled {
    opacity: 0.5;
}
#pocket-tycoon details {
    margin: 10px 0;
}
.tycoon-history {
    max-height: 110px;
    overflow: auto;
    margin: 8px 0 0;
    padding-left: 24px;
    font-size: 12px;
    line-height: 1.5;
}
#tycoon-open {
    position: fixed;
    right: 16px;
    bottom: 96px;
    z-index: 36;
    padding: 10px 16px;
    border-radius: 20px;
    background: #f7f5e9;
    color: #354d41;
}
@media (max-width: 650px), (pointer: coarse) {
    #pocket-tycoon {
        top: 70px;
        right: 8px;
        width: min(380px, calc(100vw - 16px));
        max-height: calc(100dvh - 86px);
        padding: 10px;
    }
    #tycoon-open {
        left: auto;
        right: 8px;
        top: 66px;
        bottom: auto;
        transform: none;
        font-size: 12px;
    }
    .minimap-controls {
        margin-bottom: 8px;
    }
}
/* Illustrated shared board and expandable window. */
#pocket-tycoon {
    width: 500px;
}
.tycoon-head strong {
    margin-right: auto;
}
.tycoon-head {
    position: sticky;
    top: -14px;
    background: #f7f5e9;
    z-index: 5;
    padding: 3px 0;
}
.tycoon-layout[hidden],
.tycoon-lobby[hidden],
.tycoon-score[hidden] {
    display: none !important;
}
.tycoon-board {
    position: relative;
    aspect-ratio: 1;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    margin-top: 12px;
}
.tycoon-tile {
    justify-content: flex-end;
    padding: 3px 1px 5px;
    box-shadow: 0 3px 0 #c9d4bc;
}
.tycoon-tile-art {
    width: 80%;
    max-height: 62%;
}
.tycoon-tile-art svg {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 68px;
}
.tycoon-tile.is-owned {
    outline: 3px solid var(--owner-color);
    outline-offset: -3px;
}
.tycoon-pawn {
    position: absolute;
    width: 35px;
    height: 48px;
    transform: translate(-50%, -90%);
    transition:
        left 150ms ease,
        top 150ms ease;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 2px 1px #52604940);
}
.tycoon-pawn svg {
    width: 100%;
    height: 100%;
}
.tycoon-center {
    background: radial-gradient(ellipse at center, #fffbea, #dfe9cd);
    border: 2px dashed #bdceb0;
    padding: 6px;
    line-height: 1.5;
    font-size: 12px;
}
.tycoon-center-art {
    width: 100%;
    max-width: 150px;
    margin: auto;
}
.tycoon-center-art svg {
    width: 100%;
    display: block;
}
.tycoon-dice {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
}
.tycoon-dice span {
    width: 28px;
    height: 28px;
    border-bottom: 3px solid;
    border-radius: 5px;
}
.tycoon-dice svg {
    width: 100%;
    height: 100%;
}
.tycoon-score p {
    border-left: 4px solid var(--actor-color);
    font-size: 11px;
    margin-bottom: 0;
}
.tycoon-score .is-turn {
    box-shadow: 0 0 0 2px var(--actor-color);
    background: white;
}
.tycoon-room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}
.tycoon-room-code {
    letter-spacing: 0.5px;
}
.tycoon-room-info button {
    padding: 6px;
    font-size: 11px;
}
.tycoon-lobby > button,
.tycoon-join button {
    padding: 10px;
    min-height: 44px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #54745e;
    color: white;
}
.tycoon-lobby > button {
    display: block;
    width: 100%;
}
.tycoon-join {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.tycoon-join input {
    min-width: 0;
    flex: 1;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #afbea5;
    text-transform: uppercase;
}
.tycoon-lobby-seats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.tycoon-lobby-seat {
    background: #edf0de;
    border-radius: 14px;
    padding: 8px;
    text-align: center;
    overflow-wrap: anywhere;
}
.tycoon-lobby-seat svg {
    height: 94px;
    max-width: 100%;
}
.tycoon-countdown {
    font-size: 11px;
    color: #6b775d;
}
.tycoon-error {
    color: #a34036;
}
#pocket-tycoon.tycoon-expanded {
    left: 12px !important;
    top: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    width: calc(100vw - 24px);
    max-width: none;
    max-height: calc(100dvh - 24px);
    margin: 0;
}
.tycoon-expanded .tycoon-layout {
    display: grid;
    grid-template-columns: minmax(0, 650px) minmax(230px, 1fr);
    gap: 24px;
    align-items: start;
    max-width: 1050px;
    margin: auto;
}
.tycoon-expanded .tycoon-board {
    width: 100%;
}
.tycoon-expanded .tycoon-pawn {
    width: 48px;
    height: 65px;
}
.tycoon-expanded .tycoon-tile-art svg {
    max-height: 100px;
}
.tycoon-expanded .tycoon-tile {
    font-size: 14px;
}
.tycoon-expanded .tycoon-tile small {
    font-size: 12px;
}
.tycoon-expanded .tycoon-score {
    grid-template-columns: repeat(4, 1fr);
}
.tycoon-expanded .tycoon-history {
    max-height: 350px;
}
@media (max-width: 700px) {
    #pocket-tycoon {
        width: min(500px, calc(100vw - 16px));
    }
    .tycoon-expanded .tycoon-layout {
        display: block;
    }
    .tycoon-expanded .tycoon-score {
        grid-template-columns: 1fr 1fr;
    }
    .tycoon-expanded .tycoon-pawn {
        width: 35px;
        height: 48px;
    }
    .tycoon-expanded .tycoon-tile {
        font-size: 11px;
    }
    .tycoon-expanded .tycoon-tile small {
        font-size: 10px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tycoon-pawn {
        transition: none;
    }
}
.cloud-course {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 2px solid #b9d2dc;
    background: #c4e5f5;
}
.cloud-course:focus-visible {
    outline: 3px solid #bc9b55;
}
.cloud-controls {
    display: flex;
    gap: 10px;
    margin: 12px 0;
}
.cloud-controls button {
    flex: 1;
    min-height: 48px;
    touch-action: none;
    user-select: none;
    background: #dae9ec;
    border-radius: 12px;
}
[data-cloud-start] {
    min-height: 44px;
    padding: 10px 24px;
    border-radius: 12px;
    background: #f0d998;
}
/* Property development, event feedback, and a desktop board that fits its window. */
.tycoon-tile {
    position: relative;
    cursor: pointer;
}
.tycoon-tile:focus-visible,
.tycoon-tile.is-selected {
    box-shadow:
        inset 0 0 0 2px #ba9345,
        0 3px 0 #c9d4bc;
}
.tycoon-buildings {
    position: absolute;
    right: 2px;
    top: 0;
    width: 55%;
    max-width: 76px;
    pointer-events: none;
    z-index: 2;
}
.tycoon-buildings svg {
    width: 100%;
    display: block;
    filter: drop-shadow(0 2px 1px #4e584030);
}
.tycoon-buildings.just-built {
    animation: tycoon-build 600ms ease-out;
}
.tycoon-property {
    padding: 10px;
    background: #fff9e9;
    border: 1px solid #dcc89b;
    border-radius: 12px;
}
.tycoon-property p {
    margin: 5px 0;
    font-size: 12px;
}
.tycoon-property small {
    color: #6b775d;
}
.tycoon-center-art {
    max-width: 90px;
}
.tycoon-event {
    font-size: 12px;
    line-height: 1.4;
    margin: 8px 0;
}
.tycoon-event.is-new {
    animation: tycoon-build 450ms ease-out;
}
.tycoon-center button {
    border-radius: 12px;
    padding: 10px;
    background: #54745e;
    color: white;
    min-height: 40px;
}
.tycoon-center button:disabled {
    opacity: 0.5;
}
.tycoon-cash-change {
    display: inline-block;
    margin-left: 6px;
    color: #9b6538;
    animation: tycoon-build 450ms ease-out;
}
.tycoon-rolling .tycoon-dice span {
    animation: tycoon-dice-roll 180ms linear infinite;
}
.tycoon-rolling .tycoon-dice span:nth-child(even) {
    animation-direction: reverse;
}
@keyframes tycoon-build {
    from {
        transform: translateY(-16px) scale(0.65);
        opacity: 0.2;
    }
    to {
        transform: none;
        opacity: 1;
    }
}
@keyframes tycoon-dice-roll {
    0% {
        transform: rotate(-18deg) translateY(-4px);
    }
    50% {
        transform: rotate(18deg) translateY(2px);
    }
    100% {
        transform: rotate(-18deg) translateY(-4px);
    }
}
@media (min-width: 900px) {
    #pocket-tycoon {
        width: min(1120px, calc(100vw - 32px));
        height: min(820px, calc(100dvh - 32px));
        max-height: calc(100dvh - 32px);
        top: 16px;
        right: 16px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 14px;
    }
    #pocket-tycoon.tycoon-expanded {
        height: calc(100dvh - 24px);
    }
    #pocket-tycoon .tycoon-head {
        position: static;
        flex: 0 0 44px;
        margin-bottom: 8px;
    }
    #pocket-tycoon .tycoon-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 310px;
        gap: 20px;
        flex: 1;
        min-height: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        align-items: stretch;
    }
    #pocket-tycoon .tycoon-board {
        width: min(100%, calc(100dvh - 125px), 730px);
        aspect-ratio: 1;
        height: auto;
        align-self: center;
        justify-self: center;
        margin: 0;
    }
    #pocket-tycoon .tycoon-side {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: 0;
        overflow: hidden;
    }
    #pocket-tycoon .tycoon-side > * {
        flex-shrink: 0;
        margin-top: 0;
        margin-bottom: 0;
    }
    #pocket-tycoon .tycoon-score {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    #pocket-tycoon .tycoon-score p {
        padding: 6px;
        overflow-wrap: anywhere;
    }
    #pocket-tycoon .tycoon-side .tycoon-history {
        flex: 1 1 0;
        min-height: 30px;
        max-height: none;
        overflow-y: auto;
    }
    #pocket-tycoon details[open] {
        max-height: 120px;
        overflow-y: auto;
    }
    #pocket-tycoon .tycoon-lobby {
        min-height: 0;
        overflow: auto;
    }
    #pocket-tycoon .tycoon-pawn {
        width: 43px;
        height: 59px;
    }
    #pocket-tycoon .tycoon-tile {
        font-size: 12px;
    }
    #pocket-tycoon .tycoon-tile small {
        font-size: 11px;
    }
}
@media (max-width: 899px) {
    #pocket-tycoon .tycoon-layout {
        display: block;
    }
    .tycoon-side > .tycoon-score {
        margin: 10px 0;
    }
    .tycoon-event {
        font-size: 10px;
        margin: 4px 0;
    }
    .tycoon-center-art {
        max-width: 45px;
    }
    .tycoon-center button {
        padding: 5px;
        font-size: 11px;
    }
    .tycoon-property {
        margin-top: 10px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tycoon-buildings.just-built,
    .tycoon-event.is-new,
    .tycoon-cash-change,
    .tycoon-rolling .tycoon-dice span {
        animation: none;
    }
}
.tycoon-board {
    grid-template: repeat(6, minmax(0, 1fr)) / repeat(6, minmax(0, 1fr));
}
.tycoon-center {
    grid-area: 2 / 2 / 6 / 6;
}
#pocket-tycoon.tycoon-expanded {
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0;
    max-width: none;
}
.tycoon-rules-popup {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 24px;
    border: 1px solid #cabb97;
    border-radius: 18px;
    background: #fff9ea;
    color: #354d41;
    line-height: 1.7;
}
.tycoon-rules-popup::backdrop {
    background: #20352e88;
    backdrop-filter: blur(3px);
}
.tycoon-rules-popup button {
    display: block;
    margin-left: auto;
    padding: 10px 24px;
    border-radius: 10px;
    background: #54745e;
    color: white;
}
.tycoon-side > button {
    padding: 6px;
    border-radius: 8px;
    background: #e7ecd9;
}
@media (min-width: 900px) {
    #pocket-tycoon .tycoon-tile {
        font-size: 10px;
    }
    #pocket-tycoon .tycoon-tile small {
        font-size: 9px;
    }
    #pocket-tycoon .tycoon-tile-art {
        max-height: 52%;
    }
    #pocket-tycoon .tycoon-pawn {
        width: 32px;
        height: 44px;
    }
    #pocket-tycoon .tycoon-side .tycoon-fishing {
        font-size: 11px;
        padding: 5px;
    }
}
@media (max-width: 899px) {
    .tycoon-tile,
    .tycoon-expanded .tycoon-tile {
        font-size: 8px;
        padding: 1px;
    }
    .tycoon-tile small,
    .tycoon-expanded .tycoon-tile small {
        font-size: 7px;
        margin-top: 0;
    }
    .tycoon-tile-art {
        max-height: 48%;
    }
    .tycoon-pawn,
    .tycoon-expanded .tycoon-pawn {
        width: 24px;
        height: 33px;
    }
}
.tycoon-personality {
    display: block;
    font-size: 10px;
    color: #68775a;
    margin-top: 3px;
}
.tycoon-reaction {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 14px;
    padding: 8px;
    background: #fff9e9;
    border: 1px solid #d6c69e;
    text-align: left;
    max-width: 300px;
    margin: 10px auto 0;
    line-height: 1.4;
}
.tycoon-reaction-face {
    flex: 0 0 42px;
}
.tycoon-reaction-face svg {
    width: 42px;
    height: 57px;
    display: block;
}
.tycoon-reaction p {
    font-size: 12px;
    margin: 3px 0 0;
    font-weight: normal;
}
.tycoon-reaction strong {
    font-size: 11px;
}
.tycoon-reaction[data-mood='sad'] {
    background: #eef2f8;
}
@media (max-width: 899px) {
    .tycoon-reaction {
        margin-top: 5px;
        padding: 5px;
        gap: 4px;
    }
    .tycoon-reaction-face {
        flex-basis: 25px;
    }
    .tycoon-reaction-face svg {
        width: 25px;
        height: 34px;
    }
    .tycoon-reaction p,
    .tycoon-reaction strong {
        font-size: 9px;
    }
}
.tycoon-win-reward {
    display: block;
    margin-top: 8px;
    padding: 10px;
    border-radius: 12px;
    background: #f4dfa2;
    color: #685128;
}
.tycoon-stream {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tycoon-stream[hidden],
.tycoon-chat[hidden],
.tycoon-history[hidden] {
    display: none !important;
}
.tycoon-stream-tabs {
    display: flex;
    gap: 6px;
}
.tycoon-stream-tabs button {
    flex: 1;
    padding: 6px;
    border-radius: 8px;
    background: #e7ecd9;
}
.tycoon-stream-tabs button[aria-pressed='true'] {
    background: #54745e;
    color: white;
}
.tycoon-chat {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-height: 0;
}
.tycoon-messages {
    flex: 1;
    min-height: 35px;
    overflow-y: auto;
    background: #fffaf0;
    border-radius: 9px;
    padding: 7px;
    font-size: 12px;
    overflow-wrap: anywhere;
}
.tycoon-messages p {
    margin: 0 0 6px;
}
.tycoon-chat-form {
    display: flex;
    gap: 6px;
}
.tycoon-chat-form input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 8px;
    border: 1px solid #c7cfb7;
    border-radius: 8px;
    background: white;
    color: #354d41;
}
.tycoon-chat-form button {
    padding: 8px 12px;
    border-radius: 8px;
    background: #54745e;
    color: white;
}
.tycoon-chat > small {
    color: #a34f40;
}
#pocket-tycoon:not(.tycoon-playing) .tycoon-stream {
    max-height: 230px;
    flex: 1;
}
@media (min-width: 900px) {
    #pocket-tycoon .tycoon-side > .tycoon-stream {
        flex: 1 1 150px;
        min-height: 120px;
    }
    #pocket-tycoon .tycoon-stream .tycoon-history {
        flex: 1;
        min-height: 0;
    }
    #pocket-tycoon .tycoon-stream-tabs,
    #pocket-tycoon .tycoon-chat-form {
        flex-shrink: 0;
    }
}
@media (max-width: 899px) {
    .tycoon-stream {
        height: 240px;
        margin-top: 10px;
    }
}

/* A minimized match stays subscribed without covering the world. */
.tycoon-minimized {
    position: fixed;
    right: 16px;
    bottom: 90px;
    z-index: 40;
    max-width: calc(100vw - 32px);
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid #be9360;
    border-radius: 16px;
    background: #fff4dc;
    color: #513d2b;
    box-shadow: 0 4px 18px #39271833;
    cursor: pointer;
}
.tycoon-minimized[hidden] {
    display: none !important;
}
.tycoon-minimized.is-turn {
    border-color: #487b52;
    background: #e7f4db;
}

.tycoon-victory {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(ellipse, #fff0b970, #43325622 65%, transparent);
    animation: tycoon-celebrate-fade 6.5s both;
}
.tycoon-victory-card {
    position: relative;
    width: min(460px, calc(100vw - 40px));
    padding: 20px 28px 28px;
    box-sizing: border-box;
    border: 4px solid #e6b74b;
    border-radius: 32px;
    background: linear-gradient(145deg, #fffbee, #fff0c5);
    color: #65472a;
    text-align: center;
    box-shadow: 0 16px 70px #67492b55;
    animation: tycoon-victory-pop 0.6s cubic-bezier(0.2, 1.5, 0.5, 1) both;
}
.tycoon-victory-art svg {
    width: min(240px, 48vw);
    height: 170px;
}
.tycoon-victory-player {
    position: absolute;
    top: 108px;
    right: 15%;
    width: 72px;
    transform: rotate(12deg);
}
.tycoon-victory-player svg {
    width: 100%;
}
.tycoon-victory-card h2 {
    font-size: clamp(32px, 7vw, 52px);
    margin: 0 0 8px;
    color: #af721f;
}
.tycoon-victory-card p {
    margin: 12px 0 0;
}
.tycoon-victory-card .tycoon-victory-reward {
    font-size: 24px;
    font-weight: 800;
    color: #54854f;
}
.tycoon-confetti {
    position: absolute;
    top: -20px;
    left: var(--x);
    width: 10px;
    height: 18px;
    animation: tycoon-confetti-fall 3.2s var(--delay) 2 both;
}
@keyframes tycoon-confetti-fall {
    to {
        transform: translateY(105vh) rotate(var(--spin));
    }
}
@keyframes tycoon-victory-pop {
    from {
        opacity: 0;
        transform: scale(0.6) rotate(-6deg);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes tycoon-celebrate-fade {
    0%,
    87% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tycoon-victory,
    .tycoon-victory-card {
        animation: none;
    }
    .tycoon-confetti {
        display: none;
    }
}
