/* Scope styles to Loyang2 so they do not conflict with FW2 shell */

.player_stats {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 78%;
    height: 100%;
}

.player_draw_deck {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22%;
    height: 100%;
    flex-shrink: 0;
    padding: 0 3% 0 1%;
    box-sizing: border-box;
}

.player_draw_deck_icon {
    position: relative;
    height: 50%;
    aspect-ratio: 638 / 980;
}

.player_draw_deck_icon img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.player_draw_deck_icon img:last-child {
    z-index: 1;
}

#board_container_inner {
    flex: 1 1 auto;
    position: relative;
    order: 2;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 40 / 27;
    background-color: #367123;
    background-image:
        radial-gradient(ellipse at 48% 46%, rgba(86, 152, 54, 0.36) 0%, rgba(54, 113, 35, 0) 58%, rgba(22, 52, 12, 0.42) 100%),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0px, rgba(255, 255, 255, 0.018) 2px, transparent 2px, transparent 6px);
    border-radius: 1.1% / 1.63%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/* Unified recessed card-zone trays behind #stalls+#helpers (left) and #customers+#customers2 (right) */
#board_container_inner::before,
#board_container_inner::after {
    content: '';
    position: absolute;
    top: 43.14%;
    height: 56.86%;
    z-index: 0;
    pointer-events: none;
    background: rgba(12, 32, 6, 0.14);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.07);
}

#board_container_inner::before {
    left: 0;
    width: 33.75%;
    border-radius: 2.67% / 2.35%;
}

#board_container_inner::after {
    left: 43.46%;
    width: 37.00%;
    border-radius: 2.43% / 2.35%;
}

.has_background_image {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* Scaled text using inline SVG */
.scaled_text {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.scaled_text_outer {
    width: 100%;
    float: left;
    position: relative;
}

.scaled_text_inner {
    width: 100%;
    height: 0;
    position: relative;
    left: 0;
    top: 0;
}

/* Top Row: Hidden Field Stack, Open Fields, Card Stack */
#fieldstack_outer {
    position: absolute;
    left: 0;
    top: 0;
    width: 9.38%;
    height: 21.24%;
    z-index: 5;
}

#fieldstack_outer .fieldstack_img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
}

#fieldDiv {
    position: absolute;
    left: 9.38%;
    top: 0;
    width: 77.25%;
    height: 21.24%;
    z-index: 2;
    overflow: hidden;
    white-space: nowrap;
    background: rgba(12, 32, 6, 0.14);
    border-radius: 1.17% / 6.28%;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.07);
}

.field_wrapper {
    display: inline-block;
    position: relative;
    height: 100%;
    aspect-ratio: 638 / 980;
    margin-right: 4px;
    vertical-align: top;
    box-sizing: border-box;
    flex-shrink: 0;
    align-self: center;
}

.field_wrapper:last-child {
    margin-right: 0;
}

.field_wrapper > .field_img {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.18);
}

.field_vegetable {
    position: absolute;
    height: 20%;
    z-index: 3;
    pointer-events: auto;
    transform: translateY(-5%);
}

.field_vegetable.wheat { width: 27.06%; }
.field_vegetable.pumpkin { width: 34.12%; }
.field_vegetable.turnip { width: 29.41%; }
.field_vegetable.cabbage { width: 24.71%; }
.field_vegetable.bean { width: 27.06%; }
.field_vegetable.leek { width: 23.53%; }

.field_vegetable > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Field vegetable slot positions by field capacity and slot index */
/* Starting field (capacity 9) */
.field_slot_0_0 { left: 5.88%; top: 23.08%; }
.field_slot_0_1 { left: 36.47%; top: 23.08%; }
.field_slot_0_2 { left: 65.88%; top: 23.08%; }
.field_slot_0_3 { left: 5.88%; top: 47.69%; }
.field_slot_0_4 { left: 36.47%; top: 47.69%; }
.field_slot_0_5 { left: 65.88%; top: 47.69%; }
.field_slot_0_6 { left: 5.88%; top: 72.31%; }
.field_slot_0_7 { left: 36.47%; top: 72.31%; }
.field_slot_0_8 { left: 65.88%; top: 72.31%; }

/* 3-capacity fields */
.field_slot_3_0 { left: 51.76%; top: 23.08%; }
.field_slot_3_1 { left: 51.76%; top: 47.69%; }
.field_slot_3_2 { left: 51.76%; top: 72.31%; }
.field_slot_3_3 { left: 21.18%; top: 47.69%; }

/* 4-capacity fields */
.field_slot_4_0 { left: 21.18%; top: 47.69%; }
.field_slot_4_1 { left: 51.76%; top: 47.69%; }
.field_slot_4_2 { left: 21.18%; top: 72.31%; }
.field_slot_4_3 { left: 51.76%; top: 72.31%; }
.field_slot_4_4 { left: 21.18%; top: 23.08%; }

/* 5-capacity fields */
.field_slot_5_0 { left: 21.18%; top: 23.08%; }
.field_slot_5_1 { left: 51.76%; top: 23.08%; }
.field_slot_5_2 { left: 21.18%; top: 47.69%; }
.field_slot_5_3 { left: 51.76%; top: 47.69%; }
.field_slot_5_4 { left: 51.76%; top: 72.31%; }
.field_slot_5_5 { left: 21.18%; top: 72.31%; }

/* 6-capacity fields */
.field_slot_6_0 { left: 21.18%; top: 23.08%; }
.field_slot_6_1 { left: 51.76%; top: 23.08%; }
.field_slot_6_2 { left: 21.18%; top: 47.69%; }
.field_slot_6_3 { left: 51.76%; top: 47.69%; }
.field_slot_6_4 { left: 21.18%; top: 72.31%; }
.field_slot_6_5 { left: 51.76%; top: 72.31%; }
.field_slot_6_6 { left: 36.47%; top: 72.31%; }

#stack {
    position: absolute;
    left: 87.65%;
    top: 0;
    width: 11.25%;
    height: 25.65%;
    z-index: 2;
}

#stack .deckinfo,
#fieldstack_outer .deckinfo {
    width: 35%;
    right: -5%;
    top: -5%;
    position: absolute;
    z-index: 10;
    cursor: pointer;
}

#stack .card_count {
    position: absolute;
    left: 0;
    bottom: 15%;
    width: 100%;
    z-index: 3;
    pointer-events: none;
}

#stack .card_count text {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

#stack .card_count.card_count_empty text {
    fill: #ff3b30;
}

.drawDeckPopup {
    max-width: 600px;
    max-height: 570px;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: center;
}

.drawDeckPopup > img {
    width: 90px;
    height: auto;
    margin: 4px;
    vertical-align: top;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
}

.fieldStackPopup {
    max-width: 80vw;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: center;
    padding: 0.5em;
}

.field_stack_section {
    margin-bottom: 1.2em;
}

.field_stack_section:last-child {
    margin-bottom: 0.2em;
}

.field_stack_section_title {
    font-weight: bold;
    font-size: 1.05em;
    margin-bottom: 0.5em;
    text-align: center;
    color: #333333;
}

.field_stack_row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6em;
}

.field_stack_card_img {
    width: 5.5em;
    height: auto;
    vertical-align: top;
    box-shadow: 0.08em 0.08em 0.3em rgba(0, 0, 0, 0.4);
    border-radius: 0.3em;
}

/* Left side: Storehouse, Stalls, Helpers */
#storeHouseDiv {
    position: absolute;
    left: 0;
    top: 22.06%;
    width: 20.96%;
    height: 20.26%;
    z-index: 2;
}

#stalls {
    position: absolute;
    left: 0;
    top: 43.14%;
    width: 33.75%;
    height: 28.43%;
    z-index: 2;
    overflow: hidden;
    white-space: nowrap;
}

#helpers {
    position: absolute;
    left: 0;
    top: 71.57%;
    width: 33.75%;
    height: 28.43%;
    z-index: 2;
    overflow: hidden;
    white-space: nowrap;
}

/* Center: Player Board & Path of Prosperity */
#playerBoard {
    position: absolute;
    left: 21.18%;
    top: 22.06%;
    width: 45.66%;
    height: 77.12%;
    z-index: 1;
}

#playerBoard .board_img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

#shopDiv {
    position: absolute;
    left: 26.81%;
    top: 1.69%;
    width: 71.74%;
    height: 23.31%;
    z-index: 3;
    pointer-events: none;
}

#shopDiv .shop_slot {
    position: absolute;
    height: 31.82%;
    pointer-events: auto;
}

#shopDiv .shop_slot > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#shop_slot_0_0 { left: 3.70%; top: 7.27%; width: 10.44%; }
#shop_slot_0_1 { left: 16.50%; top: 7.27%; width: 10.44%; }
#shop_slot_0_2 { left: 16.50%; top: 65.45%; width: 10.44%; }

#shop_slot_1_0 { left: 29.63%; top: 7.27%; width: 13.47%; }
#shop_slot_1_1 { left: 29.63%; top: 65.45%; width: 13.47%; }

#shop_slot_2_0 { left: 45.12%; top: 7.27%; width: 11.45%; }
#shop_slot_2_1 { left: 45.12%; top: 65.45%; width: 11.45%; }

#shop_slot_3_0 { left: 60.61%; top: 7.27%; width: 9.43%; }
#shop_slot_3_1 { left: 60.61%; top: 65.45%; width: 9.43%; }

#shop_slot_4_0 { left: 74.07%; top: 7.27%; width: 10.44%; }
#shop_slot_4_1 { left: 74.07%; top: 65.45%; width: 10.44%; }

#shop_slot_5_0 { left: 89.56%; top: 7.27%; width: 9.09%; }
#shop_slot_5_1 { left: 89.56%; top: 65.45%; width: 9.09%; }

#shopDiv .shop_slot.supply_slot {
    opacity: 0.65;
}

#shopDiv .shop_slot.supply_slot.active {
    opacity: 1;
}

#shopDiv .shop_slot.active,
#shopDiv .shop_slot.clickable {
    cursor: pointer;
    z-index: 8;
    background: radial-gradient(circle, rgba(255, 235, 59, 0.45) 0%, rgba(255, 235, 59, 0.12) 50%, transparent 72%);
    border-radius: 50%;
    filter: drop-shadow(0 0 2.5px #ffffff) drop-shadow(0 0 7px #ffeb3b) drop-shadow(0 0 12px #ff9800);
}

#shopDiv .shop_slot.active:hover,
#shopDiv .shop_slot.clickable:hover {
    transform: scale(1.22);
    filter: drop-shadow(0 0 4px #ffffff) drop-shadow(0 0 14px #ffeb3b) drop-shadow(0 0 22px #ff6600) brightness(1.18);
    z-index: 12;
}

/* Shop Done Button */
.shop_done_btn {
    position: absolute;
    left: 2.5%;
    top: 11.5%;
    width: 22.5%;
    aspect-ratio: 140 / 30;
    z-index: 10;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    user-select: none;
}

.shop_done_btn .button_bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.shop_done_btn .shop_done_text {
    position: relative;
    width: 90%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.shop_done_btn.active,
.shop_done_btn.clickable {
    cursor: pointer;
}

.shop_done_btn.active:hover,
.shop_done_btn.clickable:hover {
    filter: drop-shadow(0 0 4px #ffeb3b) brightness(1.08);
}

/* Contextual board action buttons (matching FW1 placements) */
.board_button {
    position: absolute;
    width: 16.47%;
    aspect-ratio: 140 / 30;
    z-index: 10;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    user-select: none;
}

.board_button .button_bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.board_button .board_button_text {
    position: relative;
    width: 90%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.board_button.active,
.board_button.clickable {
    cursor: pointer;
}

.board_button.active:hover,
.board_button.clickable:hover {
    filter: drop-shadow(0 0 4px #ffeb3b) brightness(1.08);
}

#btn_tout_deliver {
    left: 46.47%;
    top: 67.5%;
}

#btn_done_ploughman,
#btn_done_harvesting {
    left: 47.06%;
    top: 22.88%;
}

#btnFillMarketStalls,
#btnFinishMarketCrier {
    left: 0;
    top: 39.22%;
}

#btnPayForField {
    left: 55.29%;
    top: 22.88%;
}

#meeple {
    position: absolute;
    width: 5.62%;
    height: 7.52%;
    z-index: 5;
    transition: left 0.3s ease, top 0.3s ease;
}

#meeple img,
#meeple .meeple_img {
    width: 100%;
    height: 100%;
}

#meeple.meeple_step_0 { top: 0%; left: 0%; }
#meeple.meeple_step_1 { top: 92.0%; left: 35.16%; }
#meeple.meeple_step_2 { top: 88.2%; left: 36.00%; }
#meeple.meeple_step_3 { top: 83.7%; left: 36.47%; }
#meeple.meeple_step_4 { top: 79.9%; left: 37.41%; }
#meeple.meeple_step_5 { top: 74.8%; left: 38.34%; }
#meeple.meeple_step_6 { top: 70.3%; left: 37.59%; }
#meeple.meeple_step_7 { top: 66.2%; left: 37.59%; }
#meeple.meeple_step_8 { top: 61.4%; left: 36.94%; }
#meeple.meeple_step_9 { top: 56.4%; left: 35.44%; }
#meeple.meeple_step_10 { top: 51.6%; left: 35.53%; }
#meeple.meeple_step_11 { top: 46.4%; left: 35.72%; }
#meeple.meeple_step_12 { top: 41.2%; left: 36.94%; }
#meeple.meeple_step_13 { top: 36.8%; left: 34.78%; }
#meeple.meeple_step_14 { top: 34.8%; left: 31.50%; }
#meeple.meeple_step_15 { top: 33.7%; left: 28.50%; }
#meeple.meeple_step_16 { top: 34.0%; left: 25.03%; }
#meeple.meeple_step_17 { top: 29.4%; left: 22.59%; }
#meeple.meeple_step_18 { top: 24.8%; left: 22.59%; }
#meeple.meeple_step_19 { top: 20.9%; left: 24.94%; }
#meeple.meeple_step_20 { top: 21.1%; left: 28.31%; }

/* Right side: Customers & Round indicator */
#customers {
    position: absolute;
    left: 43.46%;
    top: 43.14%;
    width: 37.00%;
    height: 28.43%;
    z-index: 2;
    overflow: hidden;
    white-space: nowrap;
}

#customers2 {
    position: absolute;
    left: 43.46%;
    top: 71.57%;
    width: 37.00%;
    height: 28.43%;
    z-index: 2;
    overflow: hidden;
    white-space: nowrap;
}

#roundDiv,
#phaseDiv {
    position: absolute;
    left: 81.06%;
    width: 17.84%;
    height: 3.35%;
    z-index: 2;
    box-sizing: border-box;
    overflow: hidden;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

#roundDiv {
    top: 26.96%;
    background: linear-gradient(180deg, #f6efe0 0%, #ece0c2 100%);
    border: 1.5px solid #6b4c23;
    border-bottom: 1px solid rgba(107, 76, 35, 0.45);
    border-radius: 3.6% 3.6% 0 0 / 29% 29% 0 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 2px 0 4px -2px rgba(0, 0, 0, 0.25), -2px 0 4px -2px rgba(0, 0, 0, 0.25);
}

#phaseDiv {
    top: 30.31%;
    background: linear-gradient(180deg, #ece0c2 0%, #e0cfa6 100%);
    border: 1.5px solid #6b4c23;
    border-top: none;
    border-radius: 0 0 3.6% 3.6% / 0 0 29% 29%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);
}

/* Right column Action Menu (FW1 style) */
#actionMenu {
    position: absolute;
    left: 81.06%;
    top: 35.0%;
    width: 17.84%;
    height: 50.33%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#tutorialLink {
    position: absolute;
    left: 81.06%;
    top: 93.8%;
    width: 17.84%;
    height: 5.2%;
    z-index: 2;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    background: linear-gradient(180deg, #f6efe0 0%, #e4d4af 100%);
    border: 1.5px solid #6b4c23;
    border-radius: 5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 4px rgba(0, 0, 0, 0.28);
    color: #4a3312;
    font-weight: 700;
    font-size: clamp(10px, 1.05vw, 15px);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

#tutorialLink:hover,
#tutorialLink:focus-visible {
    background: linear-gradient(180deg, #fff9ec 0%, #f0e2be 100%);
    color: #2f1f08;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 2px 6px rgba(0, 0, 0, 0.35);
    text-decoration: none;
}

#tutorialLink:focus-visible {
    outline: 2px solid #fff3b0;
    outline-offset: 2px;
}

.menu_button {
    position: relative;
    width: 100%;
    height: 8.24%;
    margin-bottom: 0.84%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    user-select: none;
}

.menu_button:last-child {
    margin-bottom: 0;
}

.menu_button .button_bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.menu_button .bg_active {
    display: none;
}

.menu_button.active .bg_inactive {
    display: none;
}

.menu_button.active .bg_active {
    display: block;
}

.menu_button .menu_text {
    position: relative;
    width: 92%;
    z-index: 2;
    pointer-events: none;
}

.menu_button text {
    fill: #8c825a;
    transition: fill 0.15s ease;
}

.menu_button.active {
    cursor: pointer;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
    transition: filter 0.12s ease, transform 0.08s ease;
}

.menu_button.active:hover {
    filter: brightness(1.08) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.42));
}

.menu_button.active:active {
    transform: translateY(1px);
    filter: brightness(0.98) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.menu_button.active text {
    fill: #1a2010;
}

/* Display Cards (Stalls, Helpers, Customers) */
.card_wrapper {
    display: inline-block;
    position: relative;
    height: 96%;
    aspect-ratio: 102 / 174;
    vertical-align: top;
    box-sizing: border-box;
    margin-right: 4px;
    flex-shrink: 0;
    align-self: center;
}

.card_wrapper:last-child {
    margin-right: 0;
}

.board_card_img {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 89.66%;
    object-fit: contain;
    display: block;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: default;
    z-index: 1;
}

/* Card Zoom Icon */
.card_zoom_icon {
    position: absolute;
    top: 3%;
    right: 3%;
    width: 20%;
    aspect-ratio: 1;
    height: auto;
    z-index: 15;
    cursor: pointer;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
    opacity: 0.85;
    transition: transform 0.15s ease, opacity 0.15s ease;
    box-shadow: none;
    border: none;
}

.card_zoom_icon:hover {
    opacity: 1;
    transform: scale(1.2);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 4px #ffeb3b);
}

#helpers .board_card_img {
    cursor: default;
}

#helpers .board_card_img.active {
    cursor: pointer;
}

/* Helper in-play badge (scroll/pill style) */
.helper_in_play_badge {
    position: absolute;
    bottom: 24%;
    left: 3%;
    width: 94%;
    height: 13%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #faf1d7 0%, #e4cf92 100%);
    border: 1.5px solid #5a381e;
    border-radius: 12% / 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    z-index: 10;
    pointer-events: none;
    box-sizing: border-box;
}

/* Starting customer badge (Introductory variant) */
.starting_customer_badge {
    position: absolute;
    bottom: 24%;
    left: 3%;
    width: 94%;
    height: 18%;
    background: linear-gradient(180deg, #faf1d7 0%, #e4cf92 100%);
    border: 1.5px solid #5a381e;
    border-radius: 12% / 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    z-index: 10;
    pointer-events: none;
    box-sizing: border-box;
}

.court_handcard_wrapper .starting_customer_badge {
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    height: 18%;
}

.card_wrapper.active,
.customer_card.active,
.customer2_card.active,
.stall_card.active,
.helper_card.active,
.court_handcard_wrapper.active,
.court_table_card_wrapper.active,
.solo_card_wrapper.active,
#stack.active,
#storeHouseDiv.active,
#storeHouseDiv.active .full_image {
    cursor: pointer;
}

#storeHouseDiv.active {
    z-index: 6;
}

.board_card_img.active,
.card_wrapper.active .board_card_img,
.customer_card.active .board_card_img,
.customer2_card.active .board_card_img,
.stall_card.active .board_card_img,
.helper_card.active .board_card_img,
.solo_card_wrapper.active .solo_card_img,
#stack.active .cardstack_img,
#storeHouseDiv.active .full_image {
    cursor: pointer;
    box-shadow: 0 0 8px 3px #ffdd44, 0 2px 5px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 5% / 3.2%;
}

#storeHouseDiv.active:hover {
    z-index: 8;
}

.board_card_img.active:hover,
.card_wrapper.active:hover .board_card_img,
.customer_card.active:hover .board_card_img,
.customer2_card.active:hover .board_card_img,
.stall_card.active:hover .board_card_img,
.helper_card.active:hover .board_card_img,
.solo_card_wrapper.active:hover .solo_card_img,
#stack.active:hover .cardstack_img,
#storeHouseDiv.active:hover .full_image {
    box-shadow: 0 0 14px 5px #ffe666, 0 4px 10px rgba(0, 0, 0, 0.6);
    transform: translateY(-2%);
}

/* Distinct red glow when selecting a customer for No Delivery */
.card_wrapper.active.no_delivery_target .board_card_img {
    box-shadow: 0 0 8px 3px #ff5252, 0 2px 5px rgba(0, 0, 0, 0.4);
}
.card_wrapper.active.no_delivery_target:hover .board_card_img {
    box-shadow: 0 0 14px 5px #ff7777, 0 4px 10px rgba(0, 0, 0, 0.6);
    transform: translateY(-2%);
}

/* The courtyard uses a red action glow for strong contrast against its parchment background. */
#court .court_handcard_wrapper.active,
#court .court_table_card_wrapper.active {
    border: 3px solid #ff3030;
    border-radius: 6% / 4%;
    box-shadow: 0 0 10px 4px #ff3030, 0 2px 5px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

#court .court_handcard_wrapper.active:hover,
#court .court_table_card_wrapper.active:hover {
    border-color: #ff6060;
    box-shadow: 0 0 16px 6px #ff6060, 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* Regular customer satisfaction marker (blue/red, 1/2) */
.rc_satisfied_marker {
    position: absolute;
    left: 69.6%;
    top: 24.7%;
    width: 28.4%;
    aspect-ratio: 1 / 1;
    height: auto;
    z-index: 20;
    pointer-events: auto;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
    cursor: help;
}

/* Regular customer delivered vegetables */
.rc_delivered_veg {
    position: absolute;
    height: 14.94%;
    width: auto;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.rc_delivered_veg_1 {
    left: 20.59%;
}

.rc_delivered_veg_2 {
    left: 46.08%;
}

.rc_delivered_slot_0 {
    top: 75.86%;
}

.rc_delivered_slot_1 {
    top: 56.32%;
}

.rc_delivered_slot_2 {
    top: 36.78%;
}

/* Regular customer checkmark */
.rc_checkmark {
    position: absolute;
    width: 14.71%;
    height: auto;
    z-index: 6;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.rc_checkmark_slot_0 {
    left: 56.86%;
    top: 90.23%;
}

.rc_checkmark_slot_1 {
    left: 54.90%;
    top: 71.26%;
}

.rc_checkmark_slot_2 {
    left: 54.90%;
    top: 52.30%;
}

/* Regular customer double delivery badge (Messenger Boy) */
.rc_double_delivery {
    position: absolute;
    left: 60.78%;
    width: 32%;
    height: 12%;
    pointer-events: none;
    z-index: 10;
    user-select: none;
}

.rc_double_delivery_slot_0 {
    top: 78.16%;
}

.rc_double_delivery_slot_1 {
    top: 58.62%;
}

.rc_double_delivery_slot_2 {
    top: 39.08%;
}

/* Market Stall Vegetable Slots */
.stall_veg {
    position: absolute;
    top: 44.83%;
    height: 14.94%;
    width: auto;
    transform: translateX(-50%);
    z-index: 5;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
    pointer-events: auto;
}

.stall_veg.active {
    cursor: pointer;
    z-index: 8;
    background: radial-gradient(circle, rgba(255, 235, 59, 0.45) 0%, rgba(255, 235, 59, 0.12) 50%, transparent 72%);
    border-radius: 50%;
    filter: drop-shadow(0 0 2.5px #ffffff) drop-shadow(0 0 7px #ffeb3b) drop-shadow(0 0 12px #ff9800);
}

.stall_veg.active:hover {
    transform: translateX(-50%) scale(1.25);
    filter: drop-shadow(0 0 4px #ffffff) drop-shadow(0 0 14px #ffeb3b) drop-shadow(0 0 22px #ff6600) brightness(1.18);
    z-index: 12;
}

.stall_empty {
    position: absolute;
    top: 44.83%;
    height: 18.39%;
    width: 21.57%;
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
    opacity: 0.85;
}

.stall_slot_1 { left: 26.47%; }
.stall_slot_2 { left: 50.98%; }
.stall_slot_3 { left: 77.45%; }

.stall_veg.stall_trade_selected {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #2e7d32, 0 0 10px 4px rgba(46, 125, 50, 0.85);
    border-radius: 50%;
    z-index: 9;
}


#twopack .twopack_card.twopack_top_selected {
    outline: none;
    border-radius: 5% / 3.2%;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #2e7d32, 0 0 12px 4px rgba(46, 125, 50, 0.85);
}

/* Two-Pack bottom card tuck indicator */
.below_card_wrapper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 9.8%;
    overflow: hidden;
    z-index: 6;
    border: 1px solid black;
    border-radius: 3px 3px 0 0;
    pointer-events: none;
}

.below_card_wrapper img {
    width: 100%;
    height: auto;
    aspect-ratio: 102 / 157;
    display: block;
}

/* Two-Pack Zoom Modal (side-by-side) */
.twopack_zoom_container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}

.twopack_zoom_col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.twopack_zoom_badge {
    padding: 4px 12px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 10px;
    text-align: center;
    user-select: none;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.twopack_zoom_badge.top_card_badge {
    background-color: #3b7320;
    color: #ffffff;
    border: 1px solid #285214;
}

.twopack_zoom_badge.bottom_card_badge {
    background-color: #8c825a;
    color: #ffffff;
    border: 1px solid #5c5538;
}

.twopack_zoom_col .magnified {
    width: 230px;
    max-width: 42vw;
    height: fit-content;
    height: fit-content;
    min-height: 0;
    flex: 0 0 auto;
    aspect-ratio: 638 / 980;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.single_card_zoom_container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 320px;
    margin: 0 auto;
}

.card_zoom_desc {
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #2b1f13;
    background: rgba(245, 237, 218, 0.95);
    border: 1px solid #c7b99c;
    border-radius: 4px;
    text-align: center;
    max-width: 280px;
    box-sizing: border-box;
}

.card_zoom_desc_twopack {
    max-width: 230px;
    font-size: 12px;
}

/* Tenant Farmer Private Fields Selection Modal */
.tenant_farmer_fields_container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
    padding: 1em;
    max-height: 70vh;
    overflow-y: auto;
}

.tenant_farmer_field_card {
    width: 6em;
    aspect-ratio: 638 / 980;
    position: relative;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tenant_farmer_field_card.active,
.tenant_farmer_field_card.clickable {
    cursor: pointer;
}

.tenant_farmer_field_card.active:hover,
.tenant_farmer_field_card.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px 3px #ffdd44, 0 4px 10px rgba(0, 0, 0, 0.5);
}

.tenant_farmer_field_card img {
    width: 100%;
    height: 100%;
    display: block;
}

/* Overlays */
.loyang_overlay {
    position: absolute;
    z-index: 100;
    background: linear-gradient(155deg, #f3ebd6 0%, #e1d2af 100%);
    border: 2px solid #5a381e;
    border-radius: 1% / 2.1%;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    overflow: hidden;
}

#court {
    left: 0;
    top: 0;
    width: 100%;
    aspect-ratio: 99 / 47;
    height: auto;
    flex: 1 1 auto;
    order: 1;
    position: relative;
    box-sizing: border-box;
}

#court.solo_court {
    left: 0.5%;
    top: 0.5%;
    width: 83.5%;
    height: auto;
    aspect-ratio: 10 / 8;
    background: linear-gradient(135deg, #f2ead6 0%, #dfceaa 100%);
    border: 2px solid #5a381e;
    border-radius: 1.2% / 1.5%;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    padding: 0.5% 1%;
    box-sizing: border-box;
    z-index: 100;
}

#court.solo_court.minimized {
    width: 3.5%;
    min-width: 28px;
    height: 5.5%;
    min-height: 28px;
    padding: 0;
    background: linear-gradient(180deg, #faf4e4 0%, #e5d5ad 100%);
}

.solo_grid_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 7.5%;
    padding: 0 1% 0 3.5%;
    border-bottom: 1.5px solid #8b6834;
    margin-bottom: 0.5%;
    flex-shrink: 0;
    box-sizing: border-box;
}

.solo_grid_title {
    position: relative;
    height: 75%;
    width: 25%;
    flex-shrink: 0;
}

.solo_grid_bought_badge {
    position: relative;
    height: 75%;
    width: 38%;
    background-color: #e5ecd2;
    border: 1px solid #719b4b;
    border-radius: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1%;
    flex-shrink: 0;
}

.board_button.solo_done_btn {
    position: relative;
    left: auto;
    top: auto;
    height: 75%;
    width: 18%;
    aspect-ratio: 140 / 30;
    display: none;
    box-sizing: border-box;
    flex-shrink: 0;
}

.board_button.solo_done_btn.active {
    display: flex;
    cursor: pointer;
}

#solo_grid_container {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    gap: 0.8%;
    overflow: hidden;
    min-height: 0;
}

.solo_grid_row {
    display: flex;
    align-items: center;
    flex: 1;
    background-color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(139, 104, 52, 0.3);
    border-radius: 4px;
    padding: 0.4% 0.8%;
    gap: 1.5%;
    min-height: 0;
    box-sizing: border-box;
}

.solo_grid_cost {
    width: 14%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.solo_cost_label {
    position: relative;
    width: 90%;
    height: 38%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8%;
    padding: 0 4%;
    user-select: none;
    pointer-events: none;
}

.solo_cost_label.cost_free {
    background-color: #eaf2de;
    border: thin solid #65923c;
}

.solo_cost_label.cost_1 {
    background-color: #fdf3db;
    border: thin solid #c48b28;
}

.solo_cost_label.cost_2 {
    background-color: #fde9df;
    border: thin solid #b54a16;
}

.solo_grid_slots {
    display: flex;
    flex: 1;
    height: 100%;
    align-items: center;
    justify-content: space-around;
    gap: 1%;
    min-width: 0;
}

.solo_card_slot {
    height: 96%;
    aspect-ratio: 638 / 980;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 31%;
    box-sizing: border-box;
}

.solo_card_slot.empty_slot {
    border: 1.5px dashed rgba(139, 104, 52, 0.4);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.04);
}

.solo_card_wrapper {
    height: 100%;
    width: 100%;
    position: relative;
    cursor: default;
}

.solo_card_img {
    height: 100%;
    width: 100%;
    object-fit: contain;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    display: block;
}

.solo_card_wrapper.active .solo_card_img {
    cursor: pointer;
    box-shadow: 0 0 8px 3px #78d63c, 0 2px 5px rgba(0, 0, 0, 0.4);
}

.solo_card_wrapper.active:hover .solo_card_img {
    box-shadow: 0 0 14px 5px #a6ff55, 0 4px 10px rgba(0, 0, 0, 0.6);
    transform: translateY(-2%);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Imaginary Opponent panel styling */
#playerData .playerData.imaginary_opponent_panel {
    padding: 0;
    justify-content: space-between;
    align-items: stretch;
    background: linear-gradient(180deg, #f3ede0 0%, #e1d7c0 100%);
    border: 1.5px dashed #7a5e3b;
}

#playerData .playerData.imaginary_opponent_panel .basicDesc {
    background: linear-gradient(180deg, #e2d9c5 0%, #cfc1a3 100%);
    border-bottom: 1.5px dashed rgba(122, 94, 59, 0.55);
}

#playerData .playerData.imaginary_opponent_panel .playerDataDetail,
body.loyang_portrait #playerData .playerData.imaginary_opponent_panel .playerDataDetail {
    flex-direction: column;
}

.imaginary_opponent_panel .playerInfoLogin {
    font-style: italic;
    color: #443322;
}

.imaginary_opponent_panel .opp_spacer {
    width: 5%;
    height: 85%;
    flex-shrink: 0;
}

#court.minimized {
    width: 3.5%;
    min-width: 28px;
    height: 5.5%;
    min-height: 28px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

#court.minimized > *:not(#court_toggle) {
    display: none;
}

#court_toggle {
    position: absolute;
    left: 0.6%;
    top: 0.6%;
    width: 2.8%;
    aspect-ratio: 1;
    height: auto;
    min-width: 18px;
    min-height: 18px;
    background: linear-gradient(180deg, #faf4e4 0%, #e5d5ad 100%);
    border: 1.5px solid #6b4c23;
    border-radius: 18%;
    cursor: pointer;
    z-index: 105;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

#court.minimized #court_toggle {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    min-width: 0;
    min-height: 0;
}

#court_toggle:hover {
    background: linear-gradient(180deg, #fffaf0 0%, #eddca8 100%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

#court_toggle img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

#court_handcards_section {
    position: absolute;
    left: 0;
    top: 0;
    width: 31%;
    height: 100%;
    border-right: 2px solid #7a572c;
    box-sizing: border-box;
    background: linear-gradient(180deg, #f3ebd6 0%, #e4d5b2 100%);
    overflow: hidden;
}

.court_handcards_title {
    width: 100%;
    height: 8%;
    margin-top: 1%;
    margin-bottom: 1%;
    text-align: center;
}

#court_handcards_grid {
    position: absolute;
    left: 2%;
    top: 9%;
    width: 96%;
    height: 89%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: space-around;
    isolation: isolate;
}

.court_handcard_wrapper {
    width: 46%;
    height: auto;
    aspect-ratio: 638 / 980;
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Default stacking & smooth transition */
    z-index: 1;
    transition: transform 0.2s ease, z-index 0s;
}

.court_handcard_wrapper.num_handcards5 {
    /* Negative left margin creates horizontal overlap */
    margin-left: -23%;
}

.court_handcard_wrapper:hover {
    z-index: 10;
    transform: scale(1.1); /* Optional zoom effect on hover */
}

.court_handcard_wrapper:first-child {
  margin-left: 0;
}

.court_handcard_wrapper img:not(.card_zoom_icon),
.handcard_img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: default;
}

.court_handcard_wrapper img:not(.card_zoom_icon):hover,
.handcard_img:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Action Arrow (retired - cards/elements are directly clickable with active glow) */
.card_action_arrow {
    display: none;
}

#stack .clickMe,
#stack .deckinfo,
#fieldstack_outer .clickMe,
#fieldstack_outer .deckinfo {
    box-shadow: none;
    border: none;
}

/* Magnified card popup styling */
.board_card_img.magnified,
.handcard_img.magnified,
.court_card_img.magnified {
    position: static;
    width: 280px;
    height: auto;
    aspect-ratio: 638 / 980;
    max-width: 90vw;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

#court_table_section {
    position: absolute;
    left: 31%;
    top: 0;
    width: 69%;
    height: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, #f6efe0 0%, #e7dab8 100%);
    overflow: hidden;
}

#court_bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    mix-blend-mode: multiply;
}

#court_tablecards_container {
    position: absolute;
    left: 3%;
    top: 4%;
    width: 94%;
    height: 92%;
    overflow: hidden;
    white-space: nowrap;
    z-index: 2;
}

.court_table_row {
    height: 48%;
    white-space: nowrap;
    display: flex;
    align-items: baseline;
    width: max-content;
}

.court_table_card_wrapper {
    height: 88%;
    aspect-ratio: 638 / 980;
    margin-right: 6px;
    flex-shrink: 0;
    display: inline-block;
    position: relative;
}

.court_table_card_wrapper.court_card_hidden {
    visibility: hidden !important;
    pointer-events: none !important;
}

.court_table_card_wrapper img:not(.card_zoom_icon),
.court_card_img {
    height: 100%;
    width: 100%;
    object-fit: contain;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: default;
}

.court_table_card_wrapper img:not(.card_zoom_icon):hover,
.court_card_img:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 10;
}

#handcards {
    left: 0.55%;
    top: 43%;
    width: 25.26%;
    height: 56.18%;
    border-radius: 3.6% / 2.4%;
    box-sizing: border-box;
}

.handcards_title {
    width: 100%;
    margin: 0 0 3% 0;
    padding: 2% 0;
    background: linear-gradient(180deg, #efe4c6 0%, #dfd0a7 100%);
    border-bottom: 1.5px solid rgba(107, 76, 35, 0.45);
    box-sizing: border-box;
}

.handcards_card {
    float: left;
    width: 42%;
    margin: 1% 4%;
    height: auto;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

#twopack {
    left: 83.4%;
    top: 0.8%;
    width: 15.8%;
    height: 73%;
    border-radius: 6% / 2%;
    box-sizing: border-box;
    padding: 0 0 1% 0;
    overflow: hidden;
}

.twopack_header {
    width: 100%;
    padding: 3% 4%;
    background: linear-gradient(180deg, #efe4c6 0%, #dfd0a7 100%);
    border-bottom: 1.5px solid rgba(107, 76, 35, 0.45);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.twopack_card_wrapper {
    position: relative;
    width: 82%;
    margin: 2.2% auto;
    text-align: center;
}

.twopack_card {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 638 / 980;
    object-fit: contain;
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.twopack_card.active,
.twopack_card.clickable {
    cursor: pointer;
    box-shadow: 0 0 8px 3px #ffdd44, 0 2px 5px rgba(0, 0, 0, 0.4);
}

.twopack_card.active:hover,
.twopack_card.clickable:hover {
    transform: scale(1.03);
    filter: drop-shadow(0 0 6px #ffeb3b);
}

.twopack_no_card {
    position: relative;
    width: 82%;
    margin: 2.5% auto 2% auto;
    aspect-ratio: 140 / 30;
    text-align: center;
    box-sizing: border-box;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.twopack_no_card.active,
.twopack_no_card.clickable {
    cursor: pointer;
}

.twopack_no_card .button_bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.twopack_no_card .twopack_no_card_text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.twopack_no_card.active:hover,
.twopack_no_card.clickable:hover {
    transform: scale(1.03);
    filter: brightness(1.08);
}

/* Framework Modal: Unified Loyang Theme */
.loyang_modal .modal-content,
#modalAdvanceProsperity .modal-content,
#modalSubsistenceFarmer .modal-content {
    background: linear-gradient(180deg, #f9f6ee 0%, #f1ead9 100%);
    border: 2px solid #5a381e;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    overflow: hidden;
}

.loyang_modal .modal-header,
#modalAdvanceProsperity .modal-header,
#modalSubsistenceFarmer .modal-header {
    background: linear-gradient(180deg, #efe4c6 0%, #dfd0a7 100%);
    border-bottom: 1.5px solid #8b6834;
    border-radius: 8px 8px 0 0;
    padding: 10px 16px;
}

.loyang_modal .modal-title,
#modalAdvanceProsperity .modal-title,
#modalSubsistenceFarmer .modal-title {
    color: #2b1f13;
    font-weight: bold;
    font-size: 1.15em;
}

.loyang_modal .modal-body,
#modalAdvanceProsperity .modal-body,
#modalSubsistenceFarmer .modal-body {
    padding: 14px 18px 12px 18px;
    color: #2b1f13;
}

.loyang_modal .modalText,
#modalAdvanceProsperity .modalText,
#modalSubsistenceFarmer .modalText {
    color: #3a301e;
    font-size: 0.95em;
    font-weight: 500;
    margin-bottom: 10px;
}

#modalAdvanceProsperity .advancement_header_row {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 0.85em;
    color: #2b4b1a;
    border-bottom: 1.5px solid #7c9842;
    padding: 0 8px 4px 34px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.loyang_modal .choicesAll,
#modalAdvanceProsperity .choicesAll,
#modalSubsistenceFarmer .choicesAll {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
}

.loyang_modal .list-group-item,
#modalAdvanceProsperity .list-group-item,
#modalSubsistenceFarmer .list-group-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(90, 56, 30, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    margin-bottom: 0;
}

.loyang_modal .list-group-item:hover,
#modalAdvanceProsperity .list-group-item:hover,
#modalSubsistenceFarmer .list-group-item:hover {
    background-color: rgba(240, 207, 85, 0.3);
    border-color: #6b4c23;
}

.loyang_modal .list-group-item.loyang2-state-1,
.loyang_modal .list-group-item.active,
#modalAdvanceProsperity .list-group-item.loyang2-state-1,
#modalAdvanceProsperity .list-group-item.active,
#modalSubsistenceFarmer .list-group-item.loyang2-state-1,
#modalSubsistenceFarmer .list-group-item.active {
    background-color: rgba(240, 207, 85, 0.45);
    border-color: #5a381e;
    box-shadow: 0 0 6px rgba(90, 56, 30, 0.25);
}

.loyang_modal .list-group-item input[type="radio"],
#modalAdvanceProsperity .list-group-item input[type="radio"],
#modalSubsistenceFarmer .list-group-item input[type="radio"] {
    margin-right: 12px;
    margin-top: 0;
    accent-color: #367123;
    cursor: pointer;
}

#modalAdvanceProsperity .advancement_choice_content,
#modalSubsistenceFarmer .advancement_choice_content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}

#modalAdvanceProsperity .advancement_step_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 26px;
    padding: 0 8px;
    font-weight: bold;
    font-size: 13px;
    color: #1a2010;
    background: #ffffff;
    border: 1.5px solid #367123;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    user-select: none;
}

#modalAdvanceProsperity .advancement_cost,
#modalSubsistenceFarmer .advancement_cost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    font-size: 13px;
    color: #1a2010;
    user-select: none;
}

#modalAdvanceProsperity .advancement_cost .coin_icon,
#modalSubsistenceFarmer .advancement_cost .coin_icon {
    width: 18px;
    height: 18px;
    aspect-ratio: 1;
    display: inline-block;
    vertical-align: middle;
}

.loyang_modal .modal-footer,
#modalAdvanceProsperity .modal-footer,
#modalSubsistenceFarmer .modal-footer {
    background-color: #ede4cd;
    border-top: 1px solid rgba(139, 104, 52, 0.35);
    border-radius: 0 0 8px 8px;
    padding: 10px 16px;
}

.loyang_modal .btn-primary,
#modalAdvanceProsperity .btn-primary,
#modalSubsistenceFarmer .btn-primary {
    background-color: #367123;
    border-color: #255017;
    font-weight: bold;
}

.loyang_modal .btn-primary:hover,
#modalAdvanceProsperity .btn-primary:hover,
#modalSubsistenceFarmer .btn-primary:hover {
    background-color: #2b5c1c;
    border-color: #1a3810;
}

.loyang_modal .btn-secondary {
    background-color: #8c7a5b;
    border-color: #6b5b40;
    color: #ffffff;
}

.loyang_modal .btn-secondary:hover {
    background-color: #75654a;
    border-color: #574a34;
}

#modalSubsistenceFarmer .subsistence_veg_item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

#modalSubsistenceFarmer .subsistence_veg_img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    vertical-align: middle;
}

#modalSubsistenceFarmer .subsistence_veg_name {
    font-weight: bold;
    font-size: 13px;
    color: #1a2010;
}

/* Tutorial Lesson Menu in Side Panel */
.loyangTutorialLogTitle {
    font-size: 1rem;
    margin: .75rem .6rem .4rem;
    font-weight: bold;
}
.loyangTutorialLog {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.loyangTutorialLog h3 {
    font-size: .85rem;
    margin: .9rem .6rem .3rem;
    color: #555;
}
.loyangTutorialLogEntry {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    width: 100%;
    padding: .4rem .6rem;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: transparent;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    font-size: 0.85rem;
}
.loyangTutorialLogEntry .bi-circle {
    color: #777;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.loyangTutorialLogEntry .bi-check-circle {
    color: #28723d;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.loyangTutorialLogEntry:hover, .loyangTutorialLogEntry[aria-current], .loyangTutorialLogEntry.active {
    background: #e5edf8;
    font-weight: 600;
}
.loyangTutorialLogEntry:focus-visible {
    outline: 2px solid #5d8233;
    outline-offset: -2px;
}

/* Player data styling (Option B: colored header strip + warm parchment mat body) */
#board {
    flex: 0 0 80%;
    display: flex;
    flex-direction: column;
    position: relative;
}

#playerData {
    flex: 0 0 20%;
    max-width: 20%;
    min-width: 0;
    aspect-ratio: 10 / 27;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-top: 0;
    box-sizing: border-box;
    gap: 0.8%;
}

#playerData .basicDesc img.symbol {
  display: none;
}

#playerData .playerData {
    box-sizing: border-box;
    padding: 0;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(180deg, #f7f1e0 0%, #e7d9b8 100%);
    border: 2px solid #6b4c23;
    border-radius: 4% / 6%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: #1a2b10;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

#playerData .playerData.color0 {
    border-color: #3b6ea5;
    color: #1a2b10;
}

#playerData .playerData.color0 .playerDataBasic,
#playerData .playerData.color0 .basicDesc {
    background: linear-gradient(180deg, #d7e8fd 0%, #b3d1fa 100%);
    border-bottom: 1.5px solid rgba(59, 110, 165, 0.45);
}

#playerData .playerData.color1 {
    border-color: #b84a42;
    color: #1a2b10;
}

#playerData .playerData.color1 .playerDataBasic,
#playerData .playerData.color1 .basicDesc {
    background: linear-gradient(180deg, #fdd9d9 0%, #f7b4b4 100%);
    border-bottom: 1.5px solid rgba(184, 74, 66, 0.45);
}

#playerData .playerData.color2 {
    border-color: #3b7a46;
    color: #1a2b10;
}

#playerData .playerData.color2 .playerDataBasic,
#playerData .playerData.color2 .basicDesc {
    background: linear-gradient(180deg, #d4f5df 0%, #a9e6be 100%);
    border-bottom: 1.5px solid rgba(59, 122, 70, 0.45);
}

#playerData .playerData.color3 {
    border-color: #c4941d;
    color: #1a2b10;
}

#playerData .playerData.color3 .playerDataBasic,
#playerData .playerData.color3 .basicDesc {
    background: linear-gradient(180deg, #fef3a8 0%, #f5df72 100%);
    border-bottom: 1.5px solid rgba(196, 148, 29, 0.45);
}

#playerData .playerData.selected_player {
    outline: none;
    border-color: #f0cf55;
    box-shadow: 0 0 0 2px #f0cf55, 0 0 12px rgba(240, 207, 85, 0.72), 0 4px 12px rgba(0, 0, 0, 0.35);
}

#playerData .playerDataBasic,
#playerData .basicDesc {
    width: 100%;
    height: 24%;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    box-sizing: border-box;
    padding: 2% 3.5%;
    margin-bottom: 0;
    position: relative;
}

#playerData .player_switch_arrow {
    position: relative;
    width: 13%;
    height: 85%;
    flex-shrink: 0;
    margin-right: 3%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15%;
    box-sizing: border-box;
    cursor: pointer;
    background-color: #ffffff;
    border: 0.15em solid #235414;
    color: #235414;
    box-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.2);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

#playerData .player_switch_arrow_svg {
    width: 80%;
    height: 80%;
    display: block;
}

#playerData .player_switch_arrow:hover {
    background-color: #e4f2dc;
    border-color: #14350a;
    color: #14350a;
    transform: translateX(-10%);
    box-shadow: 0 0.15em 0.35em rgba(0, 0, 0, 0.35);
}

#playerData .player_switch_arrow.selected_arrow {
    cursor: default;
    background-color: #235414;
    border: 0.15em solid #14350a;
    color: #ffffff;
    box-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.3);
    transform: none;
}

#playerData .player_switch_arrow.selected_arrow:hover {
    background-color: #235414;
    border-color: #14350a;
    color: #ffffff;
    transform: none;
    box-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.3);
}

#playerData .player_order_badge {
    position: relative;
    width: 13%;
    height: 85%;
    flex-shrink: 0;
    margin-right: 3%;
    cursor: default;
}

.player_order_badge .player_order_badge_img,
#playerData .player_order_badge img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

#playerData .playerDataBasic > div.name,
#playerData .basicDesc > div.name {
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#playerData .basicDesc>* {
    padding-left: 0;
}

#game {
    background-color: #2e601d;
    background-image: radial-gradient(ellipse at center, #346d22 0%, #234d15 100%);
}

#game .playerDataBasic>* {
    padding-left: 0;
}

#playerData .playerDataBasic > div.name:hover text,
#playerData .basicDesc > div.name:hover text {
    fill: #235414;
}

#playerData .playerDataDetail,
#playerData .playerDetail {
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-around;
    position: relative;
    padding: 2% 3%;
    box-sizing: border-box;
}

#playerData .basicDesc > .pinDisplay {
    position: absolute;
    right: 2%;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 2;
}

#playerData .basicDesc > .pinDisplay input {
    margin: 0 4px 0 0;
    cursor: pointer;
}

#playerData .basicDesc > .pinDisplay .player_pin,
#playerData .playerDataBasic .player_pin {
    height: 80%;
    width: auto;
    cursor: pointer;
}

.player_info_row {
    display: flex;
    align-items: center;
    width: 96%;
    flex: 1 1 0;
    min-height: 0;
    margin: 1.5% auto;
    background: rgba(255, 253, 245, 0.75);
    border: 1px solid rgba(107, 76, 35, 0.32);
    border-radius: 6px;
    padding: 0 2.5%;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.85), 0 1px 2px rgba(0, 0, 0, 0.08);
    position: relative;
}

.player_info_row .stat_icon {
    height: 75%;
    aspect-ratio: 1;
    width: auto;
    object-fit: contain;
    margin-right: 3%;
    flex-shrink: 0;
    position: relative;
}

.coin_icon {
    display: inline-block;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><defs><radialGradient id="g" cx="40%" cy="40%" r="60%"><stop offset="0%" stop-color="%23f0cf55"/><stop offset="100%" stop-color="%23b8860b"/></radialGradient></defs><path fill="url(%23g)" stroke="%237c5c06" stroke-width="1.5" fill-rule="evenodd" d="M 16,1 A 15,15 0 1,0 16,31 A 15,15 0 1,0 16,1 Z M 11.5,11.5 H 20.5 V 20.5 H 11.5 Z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-sizing: border-box;
}

.stall_icon {
    display: inline-block;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 5,5 L 10.5,5 L 9.5,13 L 3,13 Z" fill="%23c25244"/><path d="M 10.5,5 L 16,5 L 16,13 L 9.5,13 Z" fill="%23f5e6c8"/><path d="M 16,5 L 21.5,5 L 22.5,13 L 16,13 Z" fill="%23c25244"/><path d="M 21.5,5 L 27,5 L 29,13 L 22.5,13 Z" fill="%23f5e6c8"/><path d="M 3,13 L 5,5 L 27,5 L 29,13 Z" fill="none" stroke="%235a2818" stroke-width="1.2"/><path d="M 6,13 L 6,18 M 26,13 L 26,18" stroke="%236e4024" stroke-width="2" stroke-linecap="round"/><path d="M 4,18 L 28,18 L 27,27 L 5,27 Z" fill="%239c6644" stroke="%234a2c16" stroke-width="1.2"/><line x1="3" y1="18" x2="29" y2="18" stroke="%23c89369" stroke-width="2" stroke-linecap="round"/><line x1="16" y1="19" x2="16" y2="27" stroke="%234a2c16" stroke-width="1"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-sizing: border-box;
}

.customer_icon {
    display: inline-block;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="21" cy="9" r="4" fill="%237c9cb8"/><path d="M 16,27 C 16,21 19,17.5 22,17.5 C 24,17.5 27,19.5 28,27 Z" fill="%237c9cb8"/><circle cx="12" cy="11" r="4.5" fill="%2334516d" stroke="%231a3044" stroke-width="0.8"/><path d="M 5,28 C 5,20.5 8.5,17 12,17 C 15.5,17 19,20.5 19,28 Z" fill="%2334516d" stroke="%231a3044" stroke-width="0.8"/><path d="M 9.5,20 L 12,23 L 14.5,20" stroke="%238faec8" stroke-width="1" fill="none"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-sizing: border-box;
}

.player_info_row .coin_icon {
}

.player_info_row .loan_icon {
    border-radius: 22%;
    background: radial-gradient(circle at 35% 30%, #e06b5c 0%, #b83a2d 68%, #852218 100%);
    border: 1px solid #5e1810;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.38), 0 1px 2px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

.player_info_row .loan_icon svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.player_info_row .stat_text_container {
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

.player_info_row .loan_info_icon {
    position: absolute;
    right: 2.5%;
    top: 12.5%;
    height: 75%;
    width: auto;
    aspect-ratio: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: none;
    border: none;
    z-index: 2;
}

.player_info_row .loan_info_icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

.player_info_row .loan_info_icon.clickMe {
    box-shadow: none;
    border: none;
}

.creditCardPopup {
    text-align: center;
    padding: 0.5em;
    display: flex;
    justify-content: center;
    align-items: center;
}

.credit_card_popup_img {
    width: 460px;
    max-width: 85vw;
    max-height: 75vh;
    height: auto;
    aspect-ratio: 980 / 638;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    display: block;
}

#playerData .name text,
#playerData .player_info_row text,
#playerData .player_order_badge text {
    dominant-baseline: central;
}

/* Extra decorative panels (FW1 style: 4 divs total in #playerData) */
#playerData .playerData.extra_panel:not(.imaginary_opponent_panel) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: default;
}

#playerData .playerData.dragon_panel,
#playerData .playerData.hall_panel {
    padding: 5%;
    background: linear-gradient(155deg, #f6efe0 0%, #e4d4b0 100%);
    border: 2px solid #7a572c;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.25),
        inset 0 0 0 3px rgba(255, 250, 238, 0.45),
        inset 0 0 0 4.5px rgba(122, 87, 44, 0.32);
}

#playerData .dragon_panel img.loyang_logo {
    max-width: 85%;
    max-height: 36%;
    height: auto;
    object-fit: contain;
    margin-bottom: 3%;
    pointer-events: none;
}

#playerData .dragon_panel img.loyang_dragon {
    max-width: 85%;
    max-height: 52%;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

#playerData .hall_panel .publisher_link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

#playerData .hall_panel img.hall_games_logo {
    max-width: 85%;
    max-height: 85%;
    height: auto;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.15s ease;
}

#playerData .hall_panel img.hall_games_logo:hover {
    transform: scale(1.05);
}

/* -------------------------------------------------------------------------
   Gamelog custom rendering
   ------------------------------------------------------------------------- */
/* Player colors: 0: Blue, 1: Red, 2: Green, 3: Yellow */
#log .move.color0,
.color0 {
    background-color: #cbe2fd;
    color: #212529;
}

#log .move.color1,
.color1 {
    background-color: #fecaca;
    color: #212529;
}

#log .move.color2,
.color2 {
    background-color: #c6f6d5;
    color: #212529;
}

#log .move.color3,
.color3 {
    background-color: #fef08a;
    color: #212529;
}

#log .move a {
    color: #0b5ed7;
    font-weight: 600;
}

.log-player-name {
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.3;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#log .move.color0 .harvest_item,
#log .move.color1 .harvest_item,
#log .move.color2 .harvest_item,
#log .move.color3 .harvest_item {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(0, 0, 0, 0.15);
    color: #212529;
}

#log .harvest_item {
    display: inline-flex;
    align-items: center;
    margin: 0 3px;
    padding: 1px 5px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    vertical-align: middle;
    font-size: 0.9em;
}

#log .veg_icon {
    height: 1.5em;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    margin: 0 2px;
}

#log .coin_icon {
    width: 1.25em;
    height: 1.25em;
    vertical-align: middle;
    margin: 0 2px 2px 2px;
}

#log .harvest_item .veg_icon {
    margin-right: 3px;
}

#log .harvest_item .harvest_count {
    font-weight: bold;
    color: #2b3d16;
}

.log_card_wrapper {
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
}

.view_large_gamelog {
    position: fixed;
    z-index: 1200;
}

.view_large_gamelog:not(.pinned) {
    pointer-events: none;
}

img.large_log {
    position: fixed;
    top: 4%;
    right: 2%;
    width: 28%;
    max-width: 270px;
    height: auto;
    aspect-ratio: 638 / 980;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 0 2px rgba(90, 56, 30, 0.85);
    animation: logCardFadeIn 0.15s ease-out;
}

img.large_log.large_log_left {
    left: 10px;
    right: auto;
}

img.large_log.pinned {
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.8), 0 0 0 2px #4caf50;
}

@keyframes logCardFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    img.large_log {
        animation: none !important;
    }
}

#log .field_card_log,
#log .card_log {
    height: 3.2em;
    width: auto;
    vertical-align: middle;
    margin: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    cursor: pointer;
}

#log .log_card_wrapper:hover .field_card_log,
#log .log_card_wrapper:hover .card_log,
#log .field_card_log:hover,
#log .card_log:hover {
    transform: scale(1.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    filter: brightness(1.05);
    position: relative;
    z-index: 5;
}

#log .effectRevealedField,
#log .effectHarvestedVegetables,
#log .effectSpentCash,
#log .effectEarnedCash,
#log .effectDiscardedHelper,
#log .effectRevealedBottomCard,
#log .effectRevealedCourtyardCard,
#log .effectDrawnCards {
    display: inline-block;
    margin-left: 4px;
}

/* Field & Storehouse interactive highlights */
.field_wrapper.active,
.field_wrapper.clickable {
    cursor: pointer;
    box-shadow: 0 0 8px #ffeb3b;
    border-radius: 5% / 3.2%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.field_wrapper.active:hover,
.field_wrapper.clickable:hover {
    box-shadow: 0 0 14px #ffeb3b, inset 0 0 10px rgba(255, 235, 59, 0.4);
    transform: translateY(-2%);
}

.field_wrapper.selected {
    outline: none;
    border-radius: 5% / 3.2%;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #2e7d32, 0 0 12px 3px rgba(46, 125, 50, 0.85);
}

.field_wrapper.selected::after {
    content: "\2713";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 1.3em;
    height: 1.3em;
    line-height: 1.3em;
    text-align: center;
    font-size: 0.85em;
    font-weight: 700;
    color: #ffffff;
    background: #2e7d32;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    z-index: 15;
    pointer-events: none;
}

/* Game-log hover/click and replay-mode board element highlight */
.field_wrapper.loyang_log_highlight,
.card_wrapper.loyang_log_highlight {
    outline: none;
    border-radius: 5% / 3.2%;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #0288d1, 0 0 14px 4px rgba(2, 136, 209, 0.85);
    z-index: 12;
}

#log .log_field_link {
    cursor: pointer;
}

#log .log_field_link:focus-visible {
    outline: 2px solid #0288d1;
    outline-offset: 2px;
    border-radius: 3px;
}

#storeHouseDiv .store_veg {
    position: absolute;
    width: 14%;
    height: 21%;
    text-align: center;
    font-weight: bold;
    z-index: 3;
}

#storeHouseDiv .store_veg.store_veg_wheat { left: 41.6%; top: 38.0%; }
#storeHouseDiv .store_veg.store_veg_pumpkin { left: 56.6%; top: 38.0%; }
#storeHouseDiv .store_veg.store_veg_turnip { left: 71.6%; top: 38.0%; }
#storeHouseDiv .store_veg.store_veg_cabbage { left: 41.6%; top: 71.0%; }
#storeHouseDiv .store_veg.store_veg_bean { left: 56.6%; top: 71.0%; }
#storeHouseDiv .store_veg.store_veg_leek { left: 71.6%; top: 71.0%; }

#storeHouseDiv .store_veg > img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#storeHouseDiv .store_veg .store_veg_count {
    position: absolute;
    left: 0;
    top: 0;
    width: 85%;
    height: 100%;
    z-index: 4;
}

#storeHouseDiv .store_veg.active,
#storeHouseDiv .store_veg.clickable {
    cursor: pointer;
    z-index: 8 !important;
    background: radial-gradient(circle, rgba(255, 235, 59, 0.45) 0%, rgba(255, 235, 59, 0.12) 50%, transparent 72%);
    border-radius: 50%;
    filter: drop-shadow(0 0 2.5px #ffffff) drop-shadow(0 0 7px #ffeb3b) drop-shadow(0 0 12px #ff9800);
}

#storeHouseDiv .store_veg.active:hover,
#storeHouseDiv .store_veg.clickable:hover {
    transform: scale(1.22);
    filter: drop-shadow(0 0 4px #ffffff) drop-shadow(0 0 14px #ffeb3b) drop-shadow(0 0 22px #ff6600) brightness(1.18);
    z-index: 12 !important;
}

#storeHouseDiv .store_veg.selected {
    outline: none;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px #2e7d32, 0 0 10px 4px rgba(46, 125, 50, 0.85);
    z-index: 10 !important;
}

.scrollable_container {
    overflow: hidden;
}

/* Custom scroll elements (FW1 style) */
.scrollDiv {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: max-content;
    box-sizing: border-box;
    align-items: center;
}

.scrollDiv.scroll_ltr {
    left: 0;
    right: auto;
    justify-content: flex-start;
}

.scrollDiv.scroll_rtl {
    left: auto;
    right: 0;
    min-width: 100%;
    justify-content: flex-end;
}

#stalls .scrollDiv,
#helpers .scrollDiv {
    left: unset;
    right: 0;
    min-width: 100%;
    justify-content: flex-end;
}

#court_tablecards_container .scrollDiv {
    flex-direction: column;
    justify-content: space-between;
    min-width: 100%;
    width: max-content;
    align-items: baseline;
    padding-left: 2%;
    padding-top: 3%;
    box-sizing: border-box;
}

.buttonLeft,
.buttonRight {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    cursor: pointer;
    height: 30%;
    width: auto;
    aspect-ratio: 13 / 26;
    user-select: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
    transition: opacity 0.15s ease, transform 0.1s ease, filter 0.15s ease;
}

#court_tablecards_container .buttonLeft,
#court_tablecards_container .buttonRight {
    height: 15%;
}

.buttonLeft {
    left: 0;
}

.buttonRight {
    right: 0;
}

.buttonLeft:hover,
.buttonRight:hover {
    filter: brightness(1.18) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.72));
    transform: translateY(-50%) scale(1.1);
}

/* =========================================================================
   PORTRAIT MODE & RESPONSIVE LAYOUT
   ========================================================================= */

/* Hide portrait-specific bars when in landscape mode */
/* Hide portrait-specific bars when in landscape mode */
body:not(.loyang_portrait) #loyangTopBar,
body:not(.loyang_portrait) #loyangActionMenuBar {
    display: none;
}

/* Main game container in portrait */
body.loyang_portrait #game {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.6%;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Top Status Bar (Draw Deck, Round Tracker, Phase Indicator) */
body.loyang_portrait #loyangTopBar {
    order: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    background: linear-gradient(180deg, #f7f3e8 0%, #ebe2ce 100%);
    border: 1.5px solid #8b6834;
    border-radius: 6px;
    padding: 0.8% 1.2%;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    gap: 1.5%;
}

body.loyang_portrait #loyangTopBar #stack {
    position: relative;
    left: auto;
    top: auto;
    flex: 0 0 22%;
    width: 22%;
    aspect-ratio: 980 / 638;
    height: auto;
    overflow: visible;
}

.cardstack_img, .full_image {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}

.cardstack_img {
    border-radius: 5% / 3.2%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
}

body.loyang_portrait #loyangTopBar #stack .cardstack_img {
    width: calc(100% * 638 / 980);
    height: calc(100% * 980 / 638);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    object-fit: contain;
}

body.loyang_portrait #loyangTopBar #stack .deckinfo {
    width: 24%;
    height: auto;
    aspect-ratio: 1;
    right: -4%;
    top: -6%;
    position: absolute;
    z-index: 10;
}

body.loyang_portrait #loyangTopBar #stack .card_count {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    width: 100%;
    height: 55%;
    z-index: 3;
    pointer-events: none;
}

body.loyang_portrait #loyangStatusGroup {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0;
    border: 1.5px solid #6b4c23;
    border-radius: 1.8% / 9%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

body.loyang_portrait #loyangTopBar #roundDiv,
body.loyang_portrait #loyangTopBar #phaseDiv {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    aspect-ratio: auto;
    height: auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    padding: 0 0.5%;
}

body.loyang_portrait #loyangTopBar #roundDiv {
    background: linear-gradient(180deg, #f6efe0 0%, #ece0c2 100%);
    border-bottom: 1px solid rgba(107, 76, 35, 0.45);
}

body.loyang_portrait #loyangTopBar #phaseDiv {
    background: linear-gradient(180deg, #ece0c2 0%, #e0cfa6 100%);
}

body.loyang_portrait #loyangTopBar #tutorialLink {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    flex: 0 0 auto;
    align-self: stretch;
    padding: 0 2.5%;
    font-size: clamp(11px, 3vw, 16px);
    border-radius: 5px;
}

/* Player Information Header (#playerData) */
body.loyang_portrait #playerData {
    order: 2;
    flex: none;
    width: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    height: auto;
    min-height: 0;
    margin: 0.8% 0;
    gap: 1.2%;
    overflow: visible;
}

/* Solo and 2-player games: 2 side-by-side columns */
body.loyang_portrait.players_1 #playerData,
body.loyang_portrait.players_2 #playerData {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 1.2%;
}

body.loyang_portrait.players_1 #playerData .playerData,
body.loyang_portrait.players_2 #playerData .playerData {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    height: auto;
    min-height: 0;
}

/* 3 and 4-player games: 2x2 grid */
body.loyang_portrait.players_3 #playerData,
body.loyang_portrait.players_4 #playerData {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2%;
}

body.loyang_portrait.players_3 #playerData .playerData,
body.loyang_portrait.players_4 #playerData .playerData {
    width: 100%;
    min-width: 0;
    margin: 0;
    height: auto;
    min-height: 0;
}

/* Internal player card layout in portrait */
body.loyang_portrait #playerData .playerData {
    box-sizing: border-box;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    min-height: 0;
    gap: 0;
    border-radius: 2.5% / 4.5%;
}

body.loyang_portrait #playerData .basicDesc {
    width: 100%;
    flex: none;
    height: auto;
    min-height: 0;
    aspect-ratio: 100 / 18;
    margin-bottom: 0;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    position: relative;
}

body.loyang_portrait #playerData .basicDesc > .pinDisplay {
    right: 1.5%;
}

body.loyang_portrait #playerData .player_switch_arrow,
body.loyang_portrait #playerData .player_order_badge {
    height: 85%;
    max-height: 85%;
    max-width: 15.5%;
    width: auto;
    aspect-ratio: 1;
    margin-right: 1.5%;
    flex-shrink: 0;
}

body.loyang_portrait #playerData .basicDesc > div.name {
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

body.loyang_portrait #playerData .playerDataDetail,
body.loyang_portrait #playerData .playerDetail {
    width: 100%;
    flex: none;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    padding: 4px 6px 6px 6px;
    gap: 4px;
    aspect-ratio: auto;
}

body.loyang_portrait #playerData .player_stats {
    width: 78%;
    height: 100%;
    flex: 1 1 auto;
}

body.loyang_portrait #playerData .player_draw_deck {
    width: 22%;
    height: 100%;
    flex: 0 0 22%;
}

body.loyang_portrait #playerData .player_draw_deck_icon {
    height: 50%;
}

body.loyang_portrait #playerData .player_info_row {
    width: 100%;
    flex: none;
    margin: 0;
    height: auto;
    min-height: 0;
    aspect-ratio: 100 / 12;
    padding: 0 2.5%;
    border-radius: 4px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

body.loyang_portrait #playerData .player_info_row .stat_icon {
    height: 80%;
    max-height: 80%;
    max-width: 14%;
    width: auto;
    aspect-ratio: 1;
    object-fit: contain;
    flex-shrink: 0;
    margin-right: 2.5%;
}

body.loyang_portrait #playerData .player_info_row img.stat_icon {
    height: 80%;
    max-height: 80%;
    max-width: 14%;
    width: auto;
    aspect-ratio: 1;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

body.loyang_portrait #playerData .player_info_row .stat_text_container {
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Hide filler panels in portrait mode */
body.loyang_portrait #playerData .extra_panel.dragon_panel,
body.loyang_portrait #playerData .extra_panel.hall_panel {
    display: none;
}

/* Action Menu Bar (Horizontal layout using percentages and native button aspect ratio) */
body.loyang_portrait #loyangActionMenuBar {
    order: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 1% 1%;
    margin: 0;
    background-color: #367123;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

body.loyang_portrait #loyangActionMenuBar #actionMenu {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    column-gap: 0.8%;
    row-gap: 1.2%;
    padding: 0;
    box-sizing: border-box;
}

body.loyang_portrait #loyangActionMenuBar .menu_button {
    position: relative;
    flex: 1 1 15.5%;
    max-width: 24%;
    aspect-ratio: 140 / 48;
    height: auto;
    margin: 0;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    body.loyang_portrait #loyangActionMenuBar .menu_button {
        flex: 1 1 22.8%;
        max-width: 32%;
        margin: 0;
    }
}

/* Two-Pack Bar in portrait mode (between Action Menu and Game Board) */
body.loyang_portrait #twopack {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    flex: 0 0 auto;
    align-self: stretch;
    z-index: 5;
    order: 4;
    grid-template-columns: 24% 24% 28%;
    grid-template-rows: max-content;
    grid-auto-rows: max-content;
    align-content: start;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 1.5% 2%;
    border: 1.5px solid #8b6834;
    border-radius: 1.5% / 4%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    gap: 3.5%;
}

#twopack:not(.twopack_active),
body.loyang_portrait #twopack:not(.twopack_active) {
    display: none;
}

#twopack.twopack_active {
    display: block;
}

body.loyang_portrait #twopack.twopack_active {
    display: grid;
    height: auto;
    flex: 0 0 auto;
}

body.loyang_portrait #twopack .twopack_header {
    grid-column: 1 / -1;
    order: 0;
    width: 100%;
    padding: 0 0 0.8% 0;
    background: none;
    border-bottom: 1px solid rgba(107, 76, 35, 0.35);
}

body.loyang_portrait #twopack .twopack_header .scaled_text_outer {
    width: 31%;
    min-width: 120px;
    max-width: 210px;
    float: none;
    margin: 0 auto;
}

body.loyang_portrait #twopack .twopack_card_wrapper {
    position: relative;
    width: 100%;
    max-width: none;
    height: auto;
    grid-column: auto;
    aspect-ratio: auto;
    align-self: flex-start;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    order: 1;
}

body.loyang_portrait #twopack .twopack_card {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 638 / 980;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

body.loyang_portrait #twopack #twopack_no_card {
    position: relative;
    width: 100%;
    max-width: none;
    height: auto;
    grid-column: auto;
    aspect-ratio: 140 / 48;
    align-self: center;
    margin: 0;
    order: 2;
}

@media (max-width: 480px) {
    body.loyang_portrait #twopack {
        grid-template-columns: 28% 28% 32%;
    }
    body.loyang_portrait #twopack .twopack_card_wrapper {
        width: 100%;
    }
    body.loyang_portrait #twopack #twopack_no_card {
        width: 100%;
    }
}

/* Game Board (#board) in portrait mode */
body.loyang_portrait #board {
    order: 5;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    position: relative;
    margin: 0 auto;
    border-radius: 1.5% / 1.3%;
    overflow: hidden;
}

body.loyang_portrait #board_container_inner {
    width: calc(100% * 906.67 / 606);
    border-radius: 0;
    box-shadow: none;
}

/* Cut open fields row at the right hand side of the shop */
body.loyang_portrait #fieldDiv {
    width: 57.46%;
    border-radius: 1.57% / 6.28%;
}

/* Cut customer queues at the right hand side of the shop */
body.loyang_portrait #customers,
body.loyang_portrait #customers2 {
    width: 23.38%;
}

body.loyang_portrait #board_container_inner::after {
    width: 23.38%;
    border-radius: 3.85% / 2.35%;
}

/* Defense-in-depth: hide any duplicate board-inner menu/stack elements */
body.loyang_portrait #board_container_inner #roundDiv,
body.loyang_portrait #board_container_inner #phaseDiv,
body.loyang_portrait #board_container_inner #actionMenu,
body.loyang_portrait #board_container_inner #stack {
    display: none;
}

/* Court / solo court overlay spans visible board width (0 to 606px) */
body.loyang_portrait #court:not(.minimized) {
    left: 0;
    width: 100%;
}

body.loyang_portrait #court.solo_court:not(.minimized) {
    left: 0;
    width: 100%;
}

/* Keep the courtyard action highlight compact on small screens. */
body.loyang_portrait #court .court_handcard_wrapper.active,
body.loyang_portrait #court .court_table_card_wrapper.active {
    border-width: 2px;
    box-shadow: 0 0 5px 2px #ff3030, 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.loyang_portrait #court .court_handcard_wrapper.active:hover,
body.loyang_portrait #court .court_table_card_wrapper.active:hover {
    box-shadow: 0 0 7px 3px #ff6060, 0 2px 5px rgba(0, 0, 0, 0.5);
}


