
* {
    box-sizing: border-box
}
body {
    margin: 0;
    background: #101b16;
    color: #eee4cb;
    font: 15px system-ui
}
main {
    max-width: 1450px;
    margin: auto;
    background: #19291f;
    min-height: 100dvh
}
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(120deg,#40513a,#17251e);
    border-bottom: 1px solid #aa925b
}
h1 {
    font: bold clamp(22px,4vw,36px) Georgia;
    margin: 0;
    color: #e5c785;
    letter-spacing: 2px
}
h1 span {
    color: #fff4d8
}
button,select,input {
    font: inherit;
    color: inherit;
    background: #34483a;
    border: 1px solid #8a7952;
    border-radius: 7px;
    padding: 10px;
    touch-action: manipulation
}
button {
    cursor: pointer
}
button:disabled {
    opacity: .35;
    cursor: default
}
button:hover:not(:disabled) {
    filter: brightness(1.2)
}
.gold {
    background: linear-gradient(#efd59a,#b18a46);
    color: #20271d;
    font-weight: bold
}
.pad {
    padding: 12px
}
.setup {
    max-width: 480px;
    margin: 30px auto
}
.setup label,.setup select,.setup button {
    display: block;
    width: 100%;
    margin: 12px 0
}
.players {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 6px;
    margin-bottom: 10px
}
.player {
    padding: 8px 3px;
    text-align: center;
    background: #293b30;
    border-top: 4px solid;
    border-radius: 6px;
    cursor: pointer
}
.active {
    outline: 2px solid #e8cb88
}
.player strong {
    display: block;
    font-size: 23px;
    color: #eed59c
}
.layout {
    display: grid;
    grid-template-columns: minmax(0,1.8fr) minmax(270px,1fr);
    gap: 12px
}
.map {
    border: 2px solid #a68e58;
    border-radius: 9px;
    overflow: hidden;
    background: #c7ba98
}
.map svg {
    width: 100%;
    height: auto;
    display: block
}
.land {
    cursor: pointer
}
.land:hover {
    filter: brightness(1.15)
}
.panel,.event {
    background: #26382d;
    border: 1px solid #59634b;
    border-radius: 8px;
    padding: 10px;
    margin: 8px 0
}
.event {
    text-align: center;
    min-height: 66px;
    background: #101e16
}
.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap
}
.resources,.actions {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 6px;
    margin: 9px 0
}
.resource {
    text-align: center;
    background: #34483a;
    padding: 8px 2px;
    border-radius: 7px
}
.resource b {
    display: block;
    font-size: 23px;
    color: #f1d8a1
}
.actions {
    grid-template-columns: repeat(2,1fr)
}
.actions button {
    text-align: left
}
.actions small {
    display: block;
    color: #c5c6b3
}
.wide {
    width: 100%;
    margin: 5px 0
}
small {
    font-size: 11px;
    color: #c6c8b6
}
.legend {
    display: flex;
    justify-content: space-around;
    font-size: 12px;
    padding: 7px
}
.log {
    max-height: 120px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.6
}
.dice {
    display: inline-grid;
    grid-template: repeat(3,1fr)/repeat(3,1fr);
    width: 44px;
    height: 44px;
    padding: 7px;
    gap: 3px;
    border-radius: 9px;
    background: linear-gradient(140deg,#fffbed,#e5d0a6 70%,#b49a6c);
    box-shadow: inset 2px 2px 3px white,inset -2px -2px 4px #92774c88,0 4px #8e754e,0 6px 6px #0008;
    transform: rotate(-5deg);
    margin: 4px
}
.pip {
    background: #30271e;
    border-radius: 50%;
    box-shadow: inset 1px 2px 2px #0008
}
.rolling {
    animation: roll .18s infinite alternate
}
@keyframes roll {
    to {
        transform: translateY(-7px) rotate(25deg)
    }
}
.flash {
    animation: flash .65s infinite alternate
}
@keyframes flash {
    to {
        filter: brightness(1.55)
    }
}
.march {
    stroke-dasharray: 6 4;
    animation: march .5s linear infinite
}
@keyframes march {
    to {
        stroke-dashoffset: -20
    }
}
dialog {
    background: #293c30;
    color: #eee4cb;
    border: 1px solid #c5a66c;
    border-radius: 12px;
    width: min(92vw,460px);
    max-height: 85dvh;
    padding: 20px
}
dialog::backdrop {
    background: #07110ddd
}
dialog button,dialog select,dialog input {
    display: block;
    width: 100%;
    margin: 8px 0
}
dialog h3 {
    color: #e8cc8c;
    margin-top: 0
}
.battle {
    text-align: center;
    font-size: 19px
}
.expanded {
    position: fixed;
    inset: 0;
    z-index: 10;
    overflow: auto;
    max-width: none
}
.stat {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ffffff22;
    padding: 7px 0
}
@media(max-width:760px) {
    .layout {
        grid-template-columns: 1fr
    }
    .pad {
        padding: 7px
    }
    header {
        padding: 9px
    }
    header button {
        font-size: 11px;
        padding: 7px
    }
    .player {
        font-size: 12px
    }
    .actions button {
        font-size: 13px
    }
    .legend {
        font-size: 10px
    }
}
@media(orientation:landscape) and (min-width:650px) {
    .layout {
        grid-template-columns: minmax(0,1.6fr) minmax(240px,1fr)
    }
}
/* Fullscreen and mobile viewport fix */
html {
    overflow-x: hidden
}
body {
    overflow-x: hidden
}
#game {
    width: 100%;
    min-width: 0
}
#game:fullscreen,#game:-webkit-full-screen,#game.expanded {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background: #19291f
}
#game.expanded {
    position: fixed;
    inset: 0;
    z-index: 1000
}
body.game-expanded {
    overflow: hidden
}
#game header {
    position: sticky;
    top: 0;
    z-index: 5;
    padding-top: max(9px,env(safe-area-inset-top));
    padding-left: max(9px,env(safe-area-inset-left));
    padding-right: max(9px,env(safe-area-inset-right))
}
#game .pad {
    padding-bottom: max(16px,env(safe-area-inset-bottom))
}
.layout>section {
    min-width: 0
}
.chronicle .log {
    max-height: 140px;
    overflow-y: auto;
    overscroll-behavior: contain
}
.map svg {
    max-width: 100%;
    height: auto
}
.legend {
    flex-wrap: wrap
}
.event p {
    margin: 5px 0
}
#game:fullscreen .map svg,#game.expanded .map svg {
    max-height: 52dvh;
    width: 100%;
    object-fit: contain
}
@media(max-width:760px) and (orientation:portrait) {
    #game.expanded .map svg {
        max-height: none
    }
    .chronicle .log {
        max-height: 92px
    }
}
@media(orientation:landscape) and (max-height:650px) {
    #game header {
        padding-block: 5px
    }
    #game h1 {
        font-size: 22px
    }
    .player {
        padding: 3px
    }
    .player strong {
        font-size: 18px
    }
    .chronicle .log {
        max-height: 85px
    }
    .actions button {
        padding: 6px
    }
    .panel {
        padding: 6px
    }
    .event {
        min-height: 0
    }
    .resource {
        padding: 4px
    }
    .resource b {
        font-size: 18px
    }
}
/* 0.5.2: viewport board, with independent history scroll */
#game.expanded,#game:fullscreen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--screen-h,100dvh);
    max-width: none;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right)
}
#game.expanded header,#game:fullscreen header {
    flex: none;
    position: static;
    padding: 5px 10px;
    padding-top: max(5px,env(safe-area-inset-top))
}
#game.expanded #app,#game:fullscreen #app {
    flex: 1;
    min-height: 0;
    overflow: auto
}
#game.expanded .board,#game:fullscreen .board {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0,1fr) auto;
    gap: 5px;
    padding: 6px;
    overflow: hidden
}
.board .toolbar button,.board .footer button,.board .footer select {
    padding: 4px 8px;
    font-size: 12px
}
.board .players {
    margin: 0
}
.board .player {
    padding: 3px
}
.board .player strong {
    font-size: 19px
}
.board .layout {
    min-height: 0;
    gap: 8px
}
.board .mapcol,.board .controlcol {
    min-height: 0;
    min-width: 0
}
#game.expanded .mapcol,#game:fullscreen .mapcol {
    display: grid;
    grid-template-rows: minmax(0,1fr) auto auto minmax(48px, .24fr);
    gap: 4px
}
#game.expanded .map,#game:fullscreen .map {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center
}
#game.expanded .map svg,#game:fullscreen .map svg {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain
}
#game.expanded .chronicle,#game:fullscreen .chronicle {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden
}
#game.expanded .log,#game:fullscreen .log {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: auto
}
#game.expanded .panel,#game:fullscreen .panel {
    margin: 0;
    padding: 5px 8px
}
#game.expanded .controlcol,#game:fullscreen .controlcol {
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: auto
}
#game.expanded .event,#game:fullscreen .event {
    margin: 0;
    min-height: 0;
    padding: 6px;
    overflow-wrap: anywhere
}
#game.expanded .resources,#game:fullscreen .resources,#game.expanded .actions,#game:fullscreen .actions {
    margin: 0;
    gap: 4px
}
#game.expanded .resource,#game:fullscreen .resource {
    padding: 3px 1px
}
#game.expanded .actions button,#game:fullscreen .actions button {
    padding: 7px;
    font-size: 13px
}
#game.expanded .wide,#game:fullscreen .wide {
    margin: 0
}
#game.expanded .legend,#game:fullscreen .legend {
    padding: 2px;
    font-size: 10px
}
@media (orientation:landscape) and (min-width:500px) {
    #game.expanded .layout,#game:fullscreen .layout {
        grid-template-columns: minmax(0,1.65fr) minmax(0,1fr)
    }
}
@media (orientation:portrait) and (max-width:760px) {
    #game.expanded .layout,#game:fullscreen .layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0,1fr) auto;
        gap: 4px
    }
    #game.expanded .mapcol,#game:fullscreen .mapcol {
        grid-template-rows: minmax(0,1fr) auto auto 48px
    }
    #game.expanded .controlcol,#game:fullscreen .controlcol {
        gap: 3px;
        overflow: visible
    }
    #game.expanded .actions,#game:fullscreen .actions {
        grid-template-columns: repeat(4,minmax(0,1fr))
    }
    #game.expanded .actions button,#game:fullscreen .actions button {
        padding: 4px 2px;
        font-size: 10px;
        text-align: center;
        overflow-wrap: anywhere
    }
    #game.expanded .actions small,#game:fullscreen .actions small {
        font-size: 9px
    }
    #game.expanded .event,#game:fullscreen .event {
        font-size: 11px;
        padding: 3px
    }
    #game.expanded .resource b,#game:fullscreen .resource b {
        font-size: 17px
    }
    #game.expanded .dice,#game:fullscreen .dice {
        width: 29px;
        height: 29px;
        padding: 4px;
        gap: 2px;
        margin: 2px
    }
    #game.expanded .wide,#game:fullscreen .wide {
        padding: 5px
    }
    #game.expanded .panel,#game:fullscreen .panel {
        font-size: 11px
    }
    #game.expanded .player strong,#game:fullscreen .player strong {
        font-size: 15px
    }
}
@media (orientation:landscape) and (max-height:520px) {
    #game.expanded .board,#game:fullscreen .board {
        grid-template-rows: auto auto minmax(0,1fr) auto;
        gap: 2px;
        padding: 3px
    }
    #game.expanded header,#game:fullscreen header {
        padding-block: 2px
    }
    #game.expanded .player,#game:fullscreen .player {
        font-size: 10px;
        padding: 1px
    }
    #game.expanded .player strong,#game:fullscreen .player strong {
        font-size: 13px
    }
    #game.expanded .player small,#game:fullscreen .player small {
        font-size: 9px
    }
    #game.expanded .mapcol,#game:fullscreen .mapcol {
        grid-template-rows: minmax(0,1fr) auto auto 40px;
        gap: 2px
    }
    #game.expanded .panel,#game:fullscreen .panel {
        padding: 2px 4px;
        font-size: 10px
    }
    #game.expanded .controlcol,#game:fullscreen .controlcol {
        gap: 2px
    }
    #game.expanded .actions,#game:fullscreen .actions {
        grid-template-columns: repeat(4,minmax(0,1fr))
    }
    #game.expanded .actions button,#game:fullscreen .actions button {
        font-size: 10px;
        padding: 3px 2px
    }
    #game.expanded .actions small,#game:fullscreen .actions small {
        font-size: 8px
    }
    #game.expanded .event,#game:fullscreen .event {
        font-size: 10px;
        padding: 2px
    }
    #game.expanded .event p,#game:fullscreen .event p {
        margin: 2px
    }
    #game.expanded .dice,#game:fullscreen .dice {
        width: 25px;
        height: 25px;
        padding: 4px;
        gap: 2px;
        margin: 1px
    }
    #game.expanded .resource b,#game:fullscreen .resource b {
        font-size: 14px
    }
    #game.expanded .resource small,#game:fullscreen .resource small {
        font-size: 9px
    }
    #game.expanded .wide,#game:fullscreen .wide {
        padding: 4px;
        font-size: 12px
    }
}
/* 0.5.3 */
.menu-bg {
    background: linear-gradient(90deg,#14251de8,#14251d77),url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 650'%3E%3Crect width='1000' height='650' fill='%23616a50'/%3E%3Ccircle cx='780' cy='155' r='95' fill='%23c9b17b' opacity='.55'/%3E%3Cpath d='M0 400L180 180 300 340 480 120 650 350 820 210 1000 400V650H0Z' fill='%233c5140'/%3E%3Cpath d='M0 480L200 400 400 480 650 380 1000 450V650H0Z' fill='%232c3c31'/%3E%3Cg fill='%23212d25'%3E%3Cpath d='M620 440V270H650V245H680V270H710V310H800V270H830V245H860V270H890V440Z'/%3E%3Cpath d='M760 310V190H765V310M765 190L835 205 765 225Z'/%3E%3Cpath d='M540 540L565 360 570 360 555 540ZM920 540L900 345 905 345 935 540Z'/%3E%3Ccircle cx='550' cy='460' r='22'/%3E%3Ccircle cx='920' cy='460' r='22'/%3E%3C/g%3E%3C/svg%3E") center/cover;
    min-height: calc(100dvh - 65px);
    padding: 12px
}
.menu-bg .setup {
    background: #19291fdd;
    border: 1px solid #85734e;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 12px 35px #0005
}
.duel {
    display: grid;
    grid-template-columns: 1fr 24px 1fr;
    align-items: center;
    gap: 4px;
    background: #14241b;
    border: 1px solid #b39a60;
    border-radius: 8px;
    padding: 6px;
    font-size: 12px
}
.duel>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px
}
.duel strong {
    font-size: 20px;
    color: #eed59c
}
.duel small {
    font-size: 10px
}
.duel .dice {
    margin: 3px
}
.toolbar #clock {
    font-variant-numeric: tabular-nums;
    color: #f0d39a;
    font-weight: bold
}
@media(max-height:520px) {
    .duel {
        padding: 2px;
        font-size: 10px
    }
    .duel strong {
        font-size: 13px
    }
    .duel small {
        font-size: 8px
    }
}
/* Painted medieval art direction */
body,main {
    background: #151713 url(assets/leather.webp) repeat;
    color: #f3dfb2
}
header {
    background: #211b13 url(assets/header.webp) center/100% 100%;
    min-height: 64px;
    border: 2px solid #9c7435
}
header h1 {
    color: #f6d590;
    text-shadow: 0 2px 3px #000;
    background: #201b13d9;
    padding: 2px 16px;
    border-radius: 10px
}
header small,header button {
    background: #201b13e8;
    padding: 5px 9px
}
.panel,.event,.resource,.player,.duel,dialog {
    background: linear-gradient(145deg,#28271f,#111713);
    border: 1px solid #9e793d;
    box-shadow: inset 0 0 0 2px #302615,0 2px 4px #0008
}
.player {
    border-top: 4px solid
}
.active {
    outline: 2px solid #e8c66c
}
.map {
    border: 2px solid #c7a05c;
    background: #211b13;
    box-shadow: 0 2px 10px #000a
}
.map svg {
    font-family: Georgia,serif
}
.country-labels {
    font-family: Georgia,serif;
    font-size: 30px;
    font-weight: bold;
    letter-spacing: 5px;
    text-anchor: middle;
    fill: #3a2815;
    paint-order: stroke;
    stroke: #d9c39b;
    stroke-width: 1px
}
.land {
    transition: fill .35s,fill-opacity .25s
}
.land:hover {
    fill-opacity: .78;
    stroke: #fff4b8;
    stroke-width: 5
}
button,select {
    background: linear-gradient(#3a3020,#191b15);
    border: 1px solid #b78b46;
    box-shadow: inset 0 0 0 2px #332716,0 2px 3px #0007;
    color: #f7e5bc
}
button.gold {
    background: linear-gradient(#f4d18b,#aa7731);
    color: #24190e
}
.menu-bg {
    background: linear-gradient(90deg,#14150fe8,#14150f55),url(assets/map.webp) center/cover
}
.menu-bg .setup {
    background: #1b1b15e8;
    border: 2px solid #b98d47
}
.toolbar,.footer {
    color: #eed5a2
}
.legend {
    color: #f1d8a1
}
.chronicle .log {
    color: #e9d8b7
}
@media(max-width:760px) {
    header {
        min-height: 40px
    }
    header h1 {
        padding: 1px 5px
    }
}
/* 0.6.1: clean art layers */
body,main {
    background: #161a15 url(assets/background.webp) center/cover no-repeat fixed
}
header {
    background: linear-gradient(180deg,#302619,#141713 48%,#231c12);
    border: 1px solid #b68b49;
    box-shadow: inset 0 0 0 3px #241c12,inset 0 0 0 4px #79552c;
    position: relative
}
header h1 {
    background: none;
    padding: 2px 8px;
    white-space: nowrap
}
header small,header button {
    background: #211c15;
    position: relative;
    z-index: 1
}
header h1 span {
    color: #f6d590
}
.res-icon {
    width: 1.55em;
    height: 1.55em;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block
}
.resource .res-icon {
    width: 30px;
    height: 30px
}
.legend .res-icon {
    width: 20px;
    height: 20px
}
.actions small .res-icon {
    width: 17px;
    height: 17px
}
.land:hover {
    stroke: #fff4b8;
    stroke-width: 4
}
.map svg image {
    image-rendering: auto
}
@media(max-height:520px) {
    .resource .res-icon {
        width: 18px;
        height: 18px
    }
    .actions small .res-icon {
        width: 12px;
        height: 12px
    }
}
/* 0.6.2 */
#game.expanded,#game:fullscreen {
    background: #161a15 url(assets/background.webp) center/cover no-repeat;
    background-attachment: scroll
}
#game::backdrop {
    background: #161a15 url(assets/background.webp) center/cover no-repeat
}
.header-actions {
    display: flex;
    gap: 5px;
    align-items: center
}
#rulesDialog {
    width: min(92vw,680px);
    max-height: 85dvh;
    overflow: auto
}
#rulesDialog h4 {
    color: #e8cc8c;
    margin: 1em 0 .25em
}
#rulesDialog p {
    margin: 0 0 .75em;
    line-height: 1.5
}
#rulesDialog>button {
    position: sticky;
    bottom: 0
}
@media(max-width:500px) {
    #game header h1 {
        font-size: clamp(15px,4vw,23px);
        padding: 0 3px
    }
    #game header small {
        font-size: 9px;
        padding: 3px
    }
    .header-actions {
        gap: 2px
    }
    #game header button {
        font-size: 10px;
        padding: 5px 3px
    }
}
/* 0.6.3: rules header outside scroll area */
#rulesDialog {
    padding: 0;
    overflow: hidden;
    max-height: 85dvh
}
#rulesDialog[open] {
    display: flex;
    flex-direction: column
}
#rulesDialog .rules-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #9e793d;
    flex: none;
    background: #211c15
}
#rulesDialog .rules-head h3 {
    margin: 0
}
#rulesDialog .rules-head button {
    width: auto;
    margin: 0;
    flex: none
}
#rulesDialog section {
    overflow-y: auto;
    min-height: 0;
    padding: 0 16px 16px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch
}
.setup {
    max-height: none;
    overflow: visible
}
.name-row,.order-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0
}
.name-row input {
    min-width: 0;
    flex: 1;
    background: #171813;
    color: #f7e5bc;
    border: 1px solid #b78b46;
    padding: 9px;
    border-radius: 6px
}
.name-row select {
    width: auto
}
.order-row {
    justify-content: space-between;
    border: 1px solid;
    padding: 8px;
    border-radius: 6px
}
.setup fieldset {
    border: 1px solid #9e793d;
    margin: 8px 0
}
.setup fieldset label {
    display: flex;
    align-items: center;
    gap: 8px
}
.setup input[type=checkbox] {
    width: auto
}
.land.attack-target {
    stroke: #ff8c70;
    stroke-width: 6;
    stroke-dasharray: 12 6
}
.land.move-target {
    stroke: #a8f4a1;
    stroke-width: 6;
    stroke-dasharray: 12 6
}
#app.menu-bg {
    overflow: auto;
    min-height: 0
}
/* 0.7.1: production feedback and portrait fullscreen */
.production-glow {
    fill: #ffe49a;
    fill-opacity: .12;
    stroke: #fff2b0;
    stroke-width: 9;
    stroke-linejoin: round;
    animation: productionPulse .55s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 8px #ffc44d)
}
.production-rise {
    animation: productionRise 1.65s ease-out both;
    transform-box: fill-box;
    transform-origin: center
}
@keyframes productionPulse {
    from {
        fill-opacity: .06;
        stroke-opacity: .55
    }
    to {
        fill-opacity: .25;
        stroke-opacity: 1
    }
}
@keyframes productionRise {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(.8)
    }
    15% {
        opacity: 1;
        transform: translateY(-8px) scale(1)
    }
    75% {
        opacity: 1
    }
    100% {
        opacity: 0;
        transform: translateY(-85px)
    }
}
@media(prefers-reduced-motion:reduce) {
    .production-glow,.production-rise {
        animation: none
    }
}
@media (orientation:portrait) and (max-width:760px) {
    #game.expanded .board,#game:fullscreen .board {
        height: auto;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        overflow: visible
    }
    #game.expanded .layout,#game:fullscreen .layout {
        display: flex;
        flex-direction: column;
        flex: none;
        gap: 8px
    }
    #game.expanded .mapcol,#game:fullscreen .mapcol {
        display: block;
        width: 100%;
        flex: none
    }
    #game.expanded .map,#game:fullscreen .map {
        display: block;
        width: 100%;
        height: auto;
        min-height: 0;
        aspect-ratio: 3/2
    }
    #game.expanded .map svg,#game:fullscreen .map svg {
        display: block;
        width: 100%;
        height: auto;
        max-height: none;
        aspect-ratio: 3/2
    }
    #game.expanded .chronicle,#game:fullscreen .chronicle {
        display: block;
        min-height: 48px
    }
    #game.expanded .log,#game:fullscreen .log {
        max-height: 92px;
        overflow: auto
    }
    #game.expanded .controlcol,#game:fullscreen .controlcol {
        overflow: visible;
        flex: none
    }
    #game.expanded .panel,#game:fullscreen .panel {
        margin: 5px 0
    }
    #game.expanded .actions,#game:fullscreen .actions {
        grid-template-columns: repeat(2,minmax(0,1fr))
    }
    #game.expanded .actions button,#game:fullscreen .actions button {
        font-size: 13px;
        padding: 8px;
        text-align: left
    }
}
.name-row {
    flex-wrap: wrap
}
.name-row .deck-input {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%
}
/* 0.7.4 visual feedback */
#game header h1 {
    color: #f3e5c7
}
#game header h1 span {
    color: #e6a53c;
    text-shadow: 0 0 10px #e6a53c55,0 2px 3px #000
}
.player {
    position: relative;
    overflow: hidden
}
.player.active {
    outline: 2px solid var(--player-color);
    background: linear-gradient(145deg,color-mix(in srgb,var(--player-color) 38%,#25241c),#151913);
    animation: turnGlow 1.8s ease-in-out infinite alternate
}
.turn-badge,.turn-spacer {
    display: block;
    height: 14px;
    line-height: 14px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .7px
}
.turn-badge {
    color: #fff3d4;
    text-shadow: 0 1px 2px #000
}
.log-name {
    color: color-mix(in srgb,var(--log-color) 75%,white);
    font-weight: 750
}
@keyframes turnGlow {
    from {
        box-shadow: inset 0 0 8px var(--player-color)
    }
    to {
        box-shadow: inset 0 0 18px var(--player-color),0 0 8px var(--player-color)
    }
}
.build-glow {
    fill: #ffe6a1;
    stroke: #ffe6a1;
    stroke-width: 7;
    animation: buildGlow 1.45s ease-out both
}
.build-rise {
    transform-box: fill-box;
    transform-origin: center;
    animation: buildRise 1.45s ease-out both
}
.build-rise.build-fort {
    animation-name: fortRise
}
.build-rise.build-soldier {
    animation-name: soldierRise
}
.build-dust {
    fill: #d7b783;
    animation: dust .9s ease-out both
}
.build-uni {
    filter: drop-shadow(0 0 12px #ffd36a)
}
@keyframes buildGlow {
    0% {
        fill-opacity: .05;
        stroke-opacity: 0
    }
    25% {
        fill-opacity: .32;
        stroke-opacity: 1
    }
    100% {
        fill-opacity: 0;
        stroke-opacity: 0
    }
}
@keyframes buildRise {
    0% {
        opacity: 0;
        transform: translateY(25px) scale(.65)
    }
    25% {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
    70% {
        opacity: 1
    }
    100% {
        opacity: 0;
        transform: translateY(-65px)
    }
}
@keyframes fortRise {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(.8)
    }
    20% {
        opacity: 1;
        transform: translateX(-5px)
    }
    30% {
        transform: translateX(5px)
    }
    40% {
        transform: translateX(0)
    }
    75% {
        opacity: 1
    }
    100% {
        opacity: 0;
        transform: translateY(-55px)
    }
}
@keyframes soldierRise {
    0% {
        opacity: 0;
        transform: scale(.6)
    }
    20% {
        opacity: 1;
        transform: scale(1.2)
    }
    40% {
        transform: scale(1)
    }
    75% {
        opacity: 1
    }
    100% {
        opacity: 0;
        transform: translateY(-75px)
    }
}
@keyframes dust {
    from {
        opacity: .8
    }
    to {
        opacity: 0;
        transform: translate(var(--dx),var(--dy)) scale(1.8)
    }
}
@media(prefers-reduced-motion:reduce) {
    .player.active,.build-rise,.build-glow,.build-dust {
        animation: none
    }
    .build-glow {
        fill-opacity: .15
    }
    .build-dust {
        display: none
    }
}
.reward-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px
}
.reward-grid>div {
    border: 1px solid #9c8050;
    border-radius: 10px;
    padding: 10px;
    text-align: center
}
.reward-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px
}
.reward-step button {
    width: 42px
}
.reward-flight {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    transform: translate(-50%,-50%);
    background: #292217;
    color: #ffe4a0;
    border: 1px solid #d5ac69;
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: bold
}
.reward-hit {
    animation: rewardHit .8s ease-out
}
@keyframes rewardHit {
    50% {
        box-shadow: 0 0 20px #ffe49a;
        transform: scale(1.07)
    }
}
.battle-win,.battle-loss {
    fill: none;
    stroke-width: 9;
    animation: battlePulse .65s ease-in-out 3
}
.battle-win {
    stroke: #b8f58a
}
.battle-loss {
    stroke: #ff7760
}
.battle-pop {
    animation: battlePop 1.9s ease-out both
}
.capture-wave {
    opacity: .56;
    animation: captureWave 1.1s ease-out both
}
.capture-old {
    animation: captureOld 1.1s linear both
}
@keyframes captureWave {
    from {
        transform: scale(0)
    }
    to {
        transform: scale(1)
    }
}
@keyframes captureOld {
    0%,65% {
        opacity: 1
    }
    100% {
        opacity: 0
    }
}
@keyframes battlePulse {
    50% {
        stroke-width: 18;
        opacity: .5
    }
}
@keyframes battlePop {
    0% {
        opacity: 0;
        transform: translateY(12px)
    }
    15%,70% {
        opacity: 1
    }
    100% {
        opacity: 0;
        transform: translateY(-65px)
    }
}
.trade-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px
}
.trade-grid>div {
    padding: 8px;
    border: 1px solid #8a7047;
    border-radius: 8px
}
.trade-grid button {
    min-width: 36px;
    width: auto;
    display: inline-block
}
.trade-grid .res-icon {
    width: 26px;
    height: 26px
}
.dice:not(.rolling) {
    animation: none!important
}
.capture-wave {
    opacity: .30
}
.capture-old {
    pointer-events: none
}
/* Royal Edition: interface only; map and gameplay animations retained. */
:root {
    --royal-gold: #d9b774;
    --royal-muted: #a8a391;
    --royal-line: #756344;
    --royal-panel: #232923
}
body {
    font-family: system-ui,-apple-system,sans-serif;
    color: #f2e8d4
}
#game {
    max-width: 1800px
}
#game header {
    background: linear-gradient(180deg,#302a20,#171c18 65%,#22251d);
    border: 1px solid #8e754a;
    box-shadow: 0 4px 18px #0008,inset 0 1px #e8c78b55
}
#game header h1 {
    letter-spacing: 4px;
    text-shadow: 0 2px 6px #000
}
header small {
    letter-spacing: 1px;
    color: #c5b99e
}
.board .players {
    grid-template-columns: repeat(auto-fit,minmax(0,1fr));
    gap: 10px
}
.board .player {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--player-color);
    border-left: 4px solid var(--player-color);
    background: linear-gradient(120deg,#30362d,#171d19);
    border-radius: 9px;
    min-width: 0
}
.royal-shield {
    width: 42px;
    height: 48px;
    flex: none;
    filter: drop-shadow(0 3px 3px #0009);
    background: var(--player-color);
    clip-path: polygon(12% 9%,88% 9%,88% 55%,80% 75%,50% 98%,20% 75%,12% 55%)
}
.player-info {
    flex: 1;
    min-width: 0
}
.player-name {
    display: block;
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}
.player-info small {
    display: block;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}
.score-track {
    height: 4px;
    border-radius: 4px;
    background: #0007;
    margin-top: 6px;
    overflow: hidden
}
.score-track i {
    display: block;
    height: 100%;
    background: var(--player-color)
}
.board .player strong {
    font: bold 24px Georgia;
    color: #f2d69a;
    white-space: nowrap
}
.board .player strong small {
    font: 11px system-ui
}
.controlcol {
    padding: 10px;
    border: 1px solid #66573e;
    border-radius: 12px;
    background: linear-gradient(145deg,#282d25ee,#151a16ee);
    box-shadow: 0 6px 20px #0005
}
.section-label {
    font-size: 10px;
    letter-spacing: 1.6px;
    color: #c5aa78;
    font-weight: 800;
    margin: 8px 0 2px
}
.resource {
    background: radial-gradient(ellipse at 50% 15%,#4a4030,#242923 70%);
    border: 1px solid #756344;
    box-shadow: inset 0 1px #e8c78b33,0 3px 8px #0005
}
.resource .res-icon {
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 4px 3px #0008)
}
.resource b {
    font: bold 26px Georgia
}
.resource small {
    color: #d2c5a9
}
.actions button {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0,1fr);
    align-content: center;
    align-items: center;
    column-gap: 8px;
    min-height: 58px;
    background: linear-gradient(120deg,#3b382b,#242b23);
    border: 1px solid #81704f;
    box-shadow: inset 0 1px #d9b77433,0 3px 6px #0005
}
.actions button .action-art {
    grid-column: 1;
    grid-row: 1/span 3;
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 3px 3px #0008)
}
.action-name {
    grid-column: 2;
    font-weight: 750
}
.action-desc {
    grid-column: 2;
    font-size: 10px;
    color: #b9b29f
}
.actions button small {
    grid-column: 2;
    white-space: nowrap
}
.actions button:disabled {
    opacity: .55;
    filter: saturate(.55)
}
.actions button:not(:disabled):hover {
    border-color: #e4c583;
    background: linear-gradient(120deg,#50452f,#31392c)
}
.event {
    border-color: #88724c;
    background: linear-gradient(110deg,#3a3427,#222923);
    text-align: left;
    padding: 12px
}
.event b {
    font-family: Georgia,serif;
    color: #f1d49b;
    font-size: 18px
}
.event p {
    font-size: 13px;
    color: #e5ddcb
}
.panel:not(.map),dialog {
    background: linear-gradient(145deg,#30352c,#1b211c);
    border-color: #756344;
    box-shadow: inset 0 1px #d9b77422,0 3px 10px #0005
}
.chronicle .log {
    font-size: 12px
}
.chronicle>small {
    letter-spacing: 1.4px;
    color: #c5aa78
}
.gold.wide,.setup .gold {
    background: linear-gradient(#efd49b,#b58a46);
    border: 1px solid #f1d69d;
    color: #292219;
    box-shadow: inset 0 1px #fff3cc,0 4px 9px #0007;
    font-weight: 800;
    min-height: 42px
}
.footer {
    border-top: 1px solid #756344;
    padding-top: 5px
}
.footer button,.toolbar button,header button {
    background: linear-gradient(#38382c,#22271f);
    border-color: #756344
}
.setup {
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 15px 50px #0009
}
.setup h2,dialog h3 {
    font-family: Georgia,serif;
    color: #f0d39b;
    letter-spacing: .5px
}
.setup label {
    color: #e6d9bd
}
.setup fieldset {
    border-radius: 8px
}
.setup input,.setup select,dialog input,dialog select {
    background: #171d18;
    border-color: #81704f
}
dialog {
    border-radius: 14px;
    padding: 24px
}
dialog h3 {
    border-bottom: 1px solid #756344;
    padding-bottom: 12px
}
dialog button {
    background: linear-gradient(110deg,#3a382c,#252c24);
    border-color: #8b7651;
    padding: 12px;
    text-align: left
}
dialog .gold {
    text-align: center
}
.trade-grid>div,.reward-grid>div {
    background: #1b211c;
    border-color: #756344
}
.duel {
    border-color: #b38d55;
    background: radial-gradient(ellipse,#44372a,#1c211c);
    padding: 12px
}
.dice {
    background: radial-gradient(circle at 22% 15%,#fff9e6,#e4d1aa 68%,#b49a70);
    border: 1px solid #f6e5bc
}
.pip {
    background: #33291f
}
.menu-bg .setup {
    background: linear-gradient(145deg,#30352bf5,#151b17f5)
}
@media(min-width:1000px) and (min-height:750px) {
    .board .actions button {
        min-height: 72px
    }
    .board .resource {
        padding: 8px 2px
    }
    .board .controlcol {
        gap: 7px
    }
    .board .player {
        padding: 10px 12px
    }
}
@media(max-width:760px) {
    .board .players {
        gap: 5px;
        grid-template-columns: repeat(2,minmax(0,1fr))
    }
    .board .player {
        padding: 5px;
        gap: 5px
    }
    .royal-shield {
        width: 28px;
        height: 34px
    }
    .board .player strong {
        font-size: 19px
    }
    .player-info small {
        font-size: 9px
    }
    .controlcol {
        padding: 7px
    }
    .resource .res-icon {
        width: 32px;
        height: 32px
    }
    .actions button .action-art {
        width: 30px;
        height: 30px
    }
    .actions button {
        grid-template-columns: 30px minmax(0,1fr);
        gap: 4px;
        min-height: 50px
    }
    .action-desc {
        font-size: 9px
    }
    .setup {
        margin: 12px auto;
        padding: 15px
    }
}
@media(orientation:landscape) and (max-height:650px) {
    .board .players {
        grid-template-columns: repeat(auto-fit,minmax(0,1fr))
    }
    .board .player {
        padding: 3px 5px;
        gap: 4px
    }
    .royal-shield {
        width: 25px;
        height: 30px
    }
    .actions button .action-art {
        width: 25px;
        height: 25px
    }
    .actions button {
        grid-template-columns: 25px minmax(0,1fr);
        min-height: 38px
    }
    .action-desc {
        display: none
    }
    .resource .res-icon {
        width: 25px;
        height: 25px
    }
    .section-label {
        margin: 2px 0;
        font-size: 9px
    }
    .controlcol {
        padding: 5px
    }
}
/* Medieval Edition — ornamental interface, no map or gameplay changes. */
:root {
    --med-frame: url(assets/medieval/frame.svg);
    --med-leather: url(assets/medieval/leather.webp);
    --med-wood: url(assets/medieval/wood.webp);
    --med-paper: url(assets/medieval/parchment.webp)
}
body,#game,#game.expanded,#game:fullscreen {
    background: radial-gradient(ellipse at 45% 20%,#74502c22,transparent 65%),var(--med-leather) repeat;
    color: #f5e5c7
}
#game header,.controlcol,.panel:not(.map),.event,.board .player,.resource,.actions button,dialog,.menu-bg .setup {
    border-image: var(--med-frame) 43 / 15px / 0 stretch;
    border-style: solid;
    border-color: #96703d;
    border-width: 1px;
    border-radius: 4px
}
#game header {
    background: linear-gradient(0deg,#100b08bb,transparent 45%,#120c08aa),var(--med-wood);
    box-shadow: inset 0 0 22px #000b,0 5px 15px #0009
}
#game header h1 {
    color: #ffe8b7;
    text-shadow: 0 2px #68441d,0 4px 7px #000;
    letter-spacing: 5px
}
#game header h1 span {
    color: #e8b44e
}
.board .player {
    background: linear-gradient(105deg,color-mix(in srgb,var(--player-color) 45%,transparent),#1a120dd9 78%),var(--med-leather);
    border-left: 4px solid var(--player-color);
    box-shadow: inset 0 0 15px #0008,0 3px 6px #0008;
    padding-inline: 14px
}
.board .player.active {
    background: linear-gradient(105deg,color-mix(in srgb,var(--player-color) 65%,transparent),#25180dc9 90%),var(--med-leather)
}
.score-track {
    height: 5px;
    box-shadow: inset 0 1px 3px #000;
    background: #100b08
}
.score-track i {
    background: linear-gradient(90deg,var(--player-color),#f1ce84)
}
.controlcol {
    background: linear-gradient(180deg,#1b130dcc,#1c130bb3),url(assets/medieval/crest.svg) center 95%/min(65%,240px) auto no-repeat,var(--med-leather);
    box-shadow: inset 0 0 30px #000b,0 4px 12px #0008;
    padding: 12px
}
.event {
    background: linear-gradient(100deg,#3b2916b0,#1d140dcc),var(--med-paper);
    box-shadow: inset 0 0 12px #0009
}
.event b {
    color: #ffe2a2
}
.event p {
    color: #f4e3c2
}
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e5c58b;
    text-shadow: 0 1px 2px #000
}
.section-label:after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg,#c59b57,transparent)
}
.resource {
    background: radial-gradient(ellipse at 50% 20%,#ac783b55,#1a120de0 75%),var(--med-wood);
    box-shadow: inset 0 0 15px #000a,0 3px 7px #0009
}
.resource b {
    color: #ffe3a2;
    text-shadow: 0 2px 3px #000
}
.resource small {
    color: #e6d3b1
}
.actions button {
    background: linear-gradient(110deg,#5c4125a8,#1b140dd9),var(--med-wood);
    box-shadow: inset 0 0 12px #0008,0 3px 6px #0008;
    padding-inline: 12px
}
.actions button .action-art {
    filter: drop-shadow(0 3px 3px #000) drop-shadow(0 0 6px #d5a25a55)
}
.action-name {
    color: #ffe9bf;
    text-shadow: 0 1px 2px #000
}
.action-desc,.actions small {
    color: #d9c29d
}
.actions button:disabled {
    opacity: .62;
    filter: saturate(.6)
}
.actions button:not(:disabled):hover {
    background: linear-gradient(110deg,#a16e35a8,#362413d9),var(--med-wood)
}
.panel:not(.map),dialog {
    background: linear-gradient(110deg,#302012a8,#1b130ee8),var(--med-paper);
    box-shadow: inset 0 0 18px #0009,0 3px 9px #0007
}
.chronicle .log {
    color: #f1ddba
}
.chronicle>small {
    color: #e6c386
}
.legend {
    background: linear-gradient(90deg,transparent,#a4773533,transparent)
}
.gold.wide,.setup .gold {
    background: linear-gradient(180deg,#f9df9e,#c3954e 48%,#a36b2e 52%,#d9b36b);
    border: 2px solid #e8c17a;
    box-shadow: inset 0 0 0 2px #805223,0 4px 8px #000a;
    color: #26180b;
    text-shadow: 0 1px #f7d99b
}
.footer button,.toolbar button,header button,dialog button {
    background: linear-gradient(#62462799,#1e150dd9),var(--med-wood);
    border-color: #a17a43;
    color: #f4dfb6
}
.footer {
    border-color: #98703b
}
.menu-bg .setup {
    background: linear-gradient(145deg,#2c1e12d9,#160f0bef),var(--med-leather)
}
dialog::backdrop {
    background: #100a07dd
}
.trade-grid>div,.reward-grid>div {
    background: linear-gradient(#24180e99,#120d08aa),var(--med-leather);
    border-color: #a47b44
}
@media(max-width:760px) {
    .board .player {
        padding-inline: 7px
    }
    .controlcol {
        padding: 7px
    }
    .actions button {
        padding-inline: 6px
    }
    #game header h1 {
        letter-spacing: 2px
    }
}
@media(orientation:landscape) and (max-height:650px) {
    .board .player {
        padding-inline: 5px
    }
    .controlcol {
        padding: 5px
    }
    .actions button {
        padding-inline: 4px
    }
}
/* 0.7.9.1 — clean continuous surfaces, consistent spacing */
body,#game,#game.expanded,#game:fullscreen {
    background: radial-gradient(ellipse at 50% 0%,#392b1e 0%,#211a14 48%,#15120f 100%);
    background-repeat: no-repeat;
    background-size: cover;
    background-color: #15120f
}
#game header {
    background: linear-gradient(180deg,#35281b 0%,#241b13 48%,#19130e 100%);
    box-shadow: inset 0 1px 0 #b18b4844,inset 0 -1px 0 #0009,0 4px 12px #0007
}
.setup:not(.menu-bg .setup) {
    background: linear-gradient(145deg,#35291e,#211a14);
    border: 1px solid #80613a;
    box-shadow: 0 12px 35px #0007
}
.board .players {
    margin-bottom: 12px
}
#game.expanded .board .players,#game:fullscreen .board .players {
    margin-bottom: 7px
}
@media(max-width:760px) {
    .board .players {
        margin-bottom: 8px
    }
    #game.expanded .board .players,#game:fullscreen .board .players {
        margin-bottom: 5px
    }
}
@media(orientation:landscape) and (max-height:650px) {
    .board .players,#game.expanded .board .players,#game:fullscreen .board .players {
        margin-bottom: 4px
    }
}
/* 0.7.9.2 Medieval Polish */
#app.order-bg {
    min-height: calc(100dvh - 65px);
    padding: clamp(16px,4vh,48px) 12px;
    background: linear-gradient(#130e09a8,#130e09d9),url(assets/map.webp) center/cover no-repeat;
    overflow: auto;
}
#app.order-bg .setup {
    margin: 0 auto;
    background: linear-gradient(#21160ee8,#21160ee8),var(--med-leather) center/500px auto;
    border: 1px solid #b58b48;
    border-image: var(--med-frame) 43 / 22px / 0 stretch;
    border-radius: 4px;
    box-shadow: 0 12px 40px #000b,inset 0 0 24px #0008;
}
#app.order-bg .order-row {
    background: #21160eb0;
    min-height: 38px;
}
#game header {
    background: linear-gradient(#1b1009a0,#1b1009a0),var(--med-wood) center/650px auto repeat;
    border: 2px solid #b68b49;
    border-image: var(--med-frame) 43 / 23px / 0 stretch;
    box-shadow: inset 0 0 0 3px #24170d,inset 0 0 0 4px #a37a4166,inset 0 0 22px #0009,0 4px 12px #0008;
}
.board .controlcol .duel {
    background: linear-gradient(#281a10c4,#281a10c4),var(--med-paper) center/500px auto;
    border: 1px solid #a87c40;
    border-image: var(--med-frame) 43 / 17px / 0 stretch;
    border-radius: 4px;
    box-shadow: inset 0 0 18px #0009,0 3px 8px #0007;
    color: #f5e1b8;
}
.board .controlcol .duel small {
    color: #e2cba4;
}
.board .controlcol .duel strong {
    color: #ffe0a0;
}
.board .controlcol > * {
    flex-shrink: 0;
    min-width: 0;
}
.board .controlcol .event {
    min-height: 66px;
    height: auto;
    overflow-wrap: anywhere;
}
.board .controlcol .event p {
    margin: 4px 0 0;
}
.board .controlcol .duel>div {
    min-width: 0;
    overflow-wrap: anywhere;
}
#game.expanded .mapcol,#game:fullscreen .mapcol {
    grid-template-rows: minmax(0,1fr) auto minmax(48px,.24fr);
}
@media(orientation:portrait) and (max-width:760px) {
    #game.expanded .mapcol,#game:fullscreen .mapcol {
        grid-template-rows: minmax(0,1fr) auto 48px;
    }
}
@media(orientation:landscape) and (max-height:520px) {
    #game.expanded .mapcol,#game:fullscreen .mapcol {
        grid-template-rows: minmax(0,1fr) auto 40px;
    }
    .board .controlcol .event {
        min-height: 36px;
    }
    .board .controlcol .duel {
        padding: 5px;
    }
}
/* 0.7.9.3: darker page surface, original player panels */
body,#game,#game.expanded,#game:fullscreen {
    background: radial-gradient(ellipse at 50% 0%,#211910 0%,#17120e 48%,#100e0b 100%);
    background-repeat: no-repeat;
    background-size: cover;
    background-color: #100e0b;
}
/* 0.7.9.4 — fullscreen desktop: fit the map frame to its native 3:2 artwork. */
@supports (width: 1cqh) {
    @media (orientation:landscape) and (min-width:1000px) and (min-height:650px) {
        #game.expanded .board .layout,#game:fullscreen .board .layout {
            container-type: size;
            grid-template-columns: auto minmax(0,1fr);
        }
        #game.expanded .board .mapcol,#game:fullscreen .board .mapcol {
            width: min(calc(100cqw - 350px),calc((100cqh - 145px) * 1.5 + 4px));
            grid-template-rows: auto auto minmax(48px,1fr);
        }
        #game.expanded .board .map,#game:fullscreen .board .map {
            width: 100%;
            height: auto;
            aspect-ratio: auto;
            display: block;
        }
        #game.expanded .board .map svg,#game:fullscreen .board .map svg {
            display: block;
            width: 100%;
            height: auto;
            max-height: none;
            aspect-ratio: 3/2;
        }
    }
}
header small {
    background: transparent!important;
    box-shadow: none!important;
    border: 0!important
}
.main-menu button {
    display: block;
    width: 100%;
    margin: 12px 0;
    padding: 16px
}
.main-menu button:disabled {
    opacity: .42
}
.main-menu {
    text-align: center
}
.controlcol [data-action="intrigue"] {
    width: 100%;
    min-height: 32px;
    margin: 4px 0
}
/* 0.8.1 */
#game {
    display: flex;
    flex-direction: column
}
#game>header {
    flex: none
}
#game>#app.menu-bg,#game>#app.order-bg {
    flex: 1;
    min-height: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px,4vh,42px) 12px;
    box-sizing: border-box
}
#game:not(.expanded):not(:fullscreen)>#app.menu-bg,#game:not(.expanded):not(:fullscreen)>#app.order-bg {
    min-height: calc(100dvh - 65px)
}
#game>#app.menu-bg .setup,#game>#app.order-bg .setup {
    margin: auto;
    width: min(100%,560px);
    box-sizing: border-box;
    flex: none
}
.simple-setup h4 {
    margin: 12px 0 5px
}
.simple-setup .setup-options {
    display: flex;
    gap: 6px
}
.setup-options button {
    flex: 1;
    margin: 0
}
.setup-options .chosen {
    border-color: #f0c77c;
    background: #76522e;
    color: #fff0ca
}
.setup-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px;
    border: 1px solid #84623c;
    background: #20160eaa;
    margin-bottom: 6px;
    border-radius: 4px
}
.setup-slot img {
    width: 26px;
    height: 32px
}
.setup-slot input,.setup-slot b {
    flex: 1;
    min-width: 0;
    width: 0
}
.setup-slot select {
    width: auto;
    max-width: 90px
}
.setup-slot button {
    width: auto;
    margin: 0;
    padding: 7px;
    font-size: 12px
}
.simple-setup>#start,.simple-setup>#backMenu,.simple-setup>#load {
    width: 100%;
    margin-top: 8px
}
.tutorial-board {
    padding: 10px;
    display: grid;
    gap: 10px
}
.tutorial-layout {
    display: grid;
    grid-template-columns: minmax(0,3fr) minmax(260px,2fr);
    gap: 10px;
    align-items: start
}
.tutorial-layout .map svg {
    width: 100%;
    height: auto;
    display: block
}
.tutorial-layout .controlcol {
    padding: 14px
}
.tutorial-layout .resources {
    margin: 10px 0
}
.tutorial-layout .resource {
    min-width: 0
}
.tutorial-layout .resource img {
    width: 32px;
    height: 32px
}
.tutorial-layout .land.tutorial-target {
    stroke: #fff4a8;
    stroke-width: 9;
    cursor: pointer;
    filter: drop-shadow(0 0 8px #f7c64b)
}
.tutorial-layout .controlcol button {
    width: 100%;
    margin-top: 8px
}
.tutorial-layout .controlcol h2 {
    margin: 8px 0
}
.tutorial-layout .controlcol p {
    line-height: 1.5
}
.tutorial-layout .tutorial-feedback {
    color: #f7d58d
}
.tutorial-board .tutorial-score {
    display: flex;
    gap: 12px;
    justify-content: space-between
}
.tutorial-board .tutorial-score>div {
    flex: 1;
    padding: 10px;
    border: 1px solid #a87c40;
    background: #26190e
}
.tutorial-layout .map {
    height: auto;
    aspect-ratio: 3/2
}
.tutorial-layout .map svg {
    max-height: none!important
}
@media(max-width:760px) {
    .tutorial-layout {
        grid-template-columns: 1fr
    }
    .setup-slot {
        flex-wrap: wrap
    }
    .setup-slot input {
        min-width: 90px
    }
    .setup-slot button {
        font-size: 11px
    }
}
.tutorial-live .tutorial-guide {
    padding: 10px;
    border: 1px solid #aa8046;
    background: #24180f;
    flex: none
}
.tutorial-guide h3,.tutorial-guide p {
    margin: 6px 0
}
.tutorial-guide p {
    font-size: 13px;
    line-height: 1.35
}
.tutorial-guide .tutorial-feedback {
    color: #e8c580
}
.tutorial-live .tutorial-action-focus {
    outline: 2px solid #ffdc80;
    box-shadow: 0 0 12px #e6ad4b;
    opacity: 1
}
.tutorial-live .land.tutorial-target {
    stroke: #fff4a8;
    stroke-width: 9;
    cursor: pointer;
    filter: drop-shadow(0 0 8px #f7c64b)
}
.tutorial-live .controlcol {
    overflow: auto;
    min-height: 0
}
.mini-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 12px 0
}
.mini-grid img {
    width: 38px;
    height: 38px;
    object-fit: contain
}
.mini-grid button {
    width: auto;
    min-width: 48px;
    min-height: 48px;
    margin: 0
}
.mini-grid.nine,.mini-grid.pairs {
    display: grid;
    grid-template-columns: repeat(3,1fr)
}
.mini-grid.pairs {
    grid-template-columns: repeat(4,1fr)
}
.mini-track {
    position: relative;
    height: 24px;
    background: #1a110b;
    border: 1px solid #a87c40;
    margin: 20px 8px
}
.mini-track i {
    position: absolute;
    left: 38%;
    width: 24%;
    height: 100%;
    background: #c79b4d
}
.mini-track b {
    position: absolute;
    top: -4px;
    height: 32px;
    width: 5px;
    background: #fff;
    transform: translateX(-50%)
}
.mini-clock {
    color: #e8c67d;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    min-height: 1.4em
}
.final-screen {
    text-align: center;
    padding: 20px;
    background: radial-gradient(ellipse at top,#78532266,transparent 70%);
    border: 1px solid #a87c40;
    margin-bottom: 12px
}
.final-screen.lost {
    background: radial-gradient(ellipse at top,#71352a66,transparent 70%)
}
.final-screen svg {
    filter: drop-shadow(0 5px 8px #0008)
}
.final-screen h2 {
    color: #e5c27b
}
.final-screen .stat {
    text-align: left
}
.award-icon {
    display: inline-flex;
    vertical-align: middle;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 2px;
    border: 1px solid #a77c43;
    border-radius: 4px;
    background: #302010;
    font-size: 13px
}
.award-icon img {
    width: 17px;
    height: 17px;
    object-fit: contain
}
.spy-stock {
    display: grid;
    gap: 8px;
    margin: 12px 0
}
.spy-stock>div {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-bottom: 1px solid #795b36
}
.spy-stock img {
    width: 32px;
    height: 32px;
    object-fit: contain
}
.spy-stock b {
    margin-left: auto;
    color: #e5c27b;
    font-size: 1.2em
}
#rotateNotice {
    display: none
}
.archery-field {
    position: relative;
    height: 100px;
    border: 1px solid #a87c40;
    background: #21160d
}
.archery-field button {
    position: absolute;
    top: 15px;
    transform: translateX(-50%);
    height: 64px;
    font-size: 32px;
    text-align: center;
    padding: 0;
    margin: 0
}
.maze-grid {
    display: grid;
    grid-template-columns: repeat(var(--n),1fr);
    width: min(180px,45dvh);
    aspect-ratio: 1;
    margin: auto;
    background: #765333
}
.maze-grid span {
    display: grid;
    place-items: center;
    color: #ffdc80;
    font-size: 12px
}
.maze-grid .path {
    background: #21160d
}
.maze-controls {
    display: flex;
    justify-content: center;
    gap: 5px
}
.maze-controls button,.rune-grid button {
    width: auto;
    min-width: 40px;
    min-height: 36px;
    text-align: center;
    padding: 4px;
    margin: 0
}
.rune-grid {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    gap: 4px
}
.rune-grid button {
    font-size: 23px
}
#extraSymbol {
    text-align: center;
    font-size: 42px;
    height: 55px
}
#extraSymbol img {
    height: 48px;
    width: 48px
}
button {
    touch-action: manipulation
}
@media (pointer:coarse) and (orientation:portrait) and (max-width:900px) {
    #rotateNotice {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 99999;
        background: #1b130d;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        text-align: center;
        color: #efd29a;
        padding: 20px
    }
    #rotateNotice span {
        font-size: 72px
    }
    #game {
        visibility: hidden
    }
    body:has(dialog[open]) #game {
        visibility: hidden
    }
}
@media (pointer:coarse) and (orientation:landscape) and (max-height:600px) {
    html,body {
        height: 100%;
        overflow: hidden
    }
    #game,#game.expanded {
        width: 100%;
        max-width: none;
        height: 100dvh;
        min-height: 0;
        padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
        box-sizing: border-box
    }
    #game>header {
        height: 30px;
        min-height: 30px;
        padding: 2px 8px
    }
    #game>header h1 {
        font-size: 18px;
        margin: 0
    }
    #game>header button {
        font-size: 10px;
        padding: 3px 6px
    }
    #app {
        flex: 1;
        min-height: 0;
        overflow: auto
    }
    #game .board {
        height: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 3px;
        gap: 3px;
        box-sizing: border-box
    }
    #game .board .toolbar,#game .board .footer {
        flex: none;
        margin: 0;
        min-height: 0
    }
    #game .board .toolbar button,#game .board .footer button {
        padding: 3px 8px;
        min-height: 24px;
        font-size: 10px
    }
    #game .board .players {
        display: flex;
        flex: none;
        margin: 0;
        gap: 3px
    }
    #game .board .player {
        flex: 1;
        min-width: 0;
        padding: 3px;
        gap: 3px
    }
    #game .board .player .royal-shield {
        width: 20px;
        height: 24px
    }
    #game .board .player-name {
        font-size: 11px
    }
    #game .board .player small {
        font-size: 9px
    }
    #game .board .player strong {
        font-size: 17px
    }
    #game .board .layout {
        display: grid;
        grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
        flex: 1;
        min-height: 0;
        gap: 4px;
        margin: 0
    }
    #game .board .mapcol {
        width: auto;
        min-height: 0;
        display: grid;
        grid-template-rows: minmax(0,1fr) auto 34px;
        gap: 3px
    }
    #game .board .map {
        height: 100%;
        min-height: 0;
        aspect-ratio: auto;
        display: flex;
        align-items: center;
        justify-content: center
    }
    #game .board .map svg {
        width: 100%;
        height: 100%;
        max-height: 100%
    }
    #game .board .panel {
        padding: 3px;
        font-size: 10px
    }
    #game .board .chronicle {
        overflow: hidden;
        display: flex;
        flex-direction: column
    }
    #game .board .log {
        overflow: auto;
        min-height: 0;
        font-size: 10px
    }
    #game .board .controlcol {
        min-height: 0;
        overflow: auto;
        padding: 3px;
        gap: 3px
    }
    #game .board .controlcol .event {
        min-height: 0;
        padding: 3px;
        font-size: 10px
    }
    #game .board .controlcol .event p {
        margin: 0
    }
    #game .board .section-label {
        display: none
    }
    #game .board .resources {
        gap: 3px;
        margin: 0
    }
    #game .board .resource {
        padding: 2px;
        min-width: 0
    }
    #game .board .resource img {
        width: 19px;
        height: 19px
    }
    #game .board .resource small {
        font-size: 9px
    }
    #game .board .actions {
        grid-template-columns: repeat(4,minmax(0,1fr));
        gap: 3px
    }
    #game .board .actions button {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 44px;
        padding: 2px;
        gap: 1px;
        font-size: 9px
    }
    #game .board .actions .action-art {
        width: 23px;
        height: 23px
    }
    #game .board .actions .action-desc {
        display: none
    }
    #game .board .actions small {
        font-size: 9px
    }
    #game .board .actions small img {
        width: 12px;
        height: 12px
    }
    #game .board .controlcol .wide,#game .board .controlcol [data-action="intrigue"] {
        min-height: 28px;
        padding: 4px;
        margin: 0;
        font-size: 11px
    }
    dialog {
        max-height: 94dvh;
        max-width: 90vw;
        padding: 8px 14px;
        overflow: auto
    }
    dialog h3 {
        margin: 0 0 5px;
        padding: 4px;
        font-size: 15px
    }
    dialog p {
        margin: 4px 0
    }
    dialog button {
        padding: 5px 8px;
        margin: 3px 0
    }
    dialog .mini-grid {
        margin: 4px 0;
        gap: 4px
    }
    dialog .mini-grid button {
        min-height: 36px;
        min-width: 40px;
        margin: 0
    }
    dialog .mini-grid img {
        width: 26px;
        height: 26px
    }
    dialog .mini-grid.nine {
        grid-template-columns: repeat(3,1fr)
    }
    #game>#app.menu-bg,#game>#app.order-bg {
        min-height: 0!important;
        padding: 5px;
        overflow: auto;
        align-items: flex-start
    }
    #game .setup {
        padding: 8px
    }
    #game .main-menu button {
        padding: 8px;
        margin: 5px 0
    }
}
/* 0.8.6 portrait-first mobile */
.mobile-only {
    display: none
}
.trade-preview {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 4px;
    align-items: center;
    margin: 10px 0
}
.trade-preview>div {
    padding: 5px;
    border-bottom: 1px solid #80613d;
    text-align: center
}
.trade-preview>div:nth-child(3n+1) {
    text-align: left
}
.trade-preview img {
    width: 24px;
    height: 24px;
    vertical-align: middle
}
.tutorial-scroll-hint {
    position: absolute;
    bottom: 0;
    right: 8px;
    background: #a77c43;
    color: #17110c;
    padding: 5px 12px;
    border-radius: 6px;
    z-index: 4;
    cursor: pointer
}
.tutorial-scroll-hint[hidden] {
    display: none
}
.tutorial-live .layout {
    position: relative
}
.tutorial-guide p {
    font-size: 12px;
    margin: 4px 0
}
.tutorial-live .event {
    display: none
}
@media (pointer:coarse) and (max-width:760px) and (orientation:portrait) {
    html,body {
        height: auto;
        overflow: auto
    }
    #game,#game.expanded,#game:fullscreen {
        visibility: visible!important;
        width: 100%;
        max-width: none;
        min-height: 100dvh;
        height: auto;
        position: relative;
        inset: auto;
        padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        overflow: visible
    }
    body.game-expanded {
        overflow: auto
    }
    #game>header {
        position: relative;
        min-height: 32px;
        height: 32px;
        padding: 2px 5px
    }
    #game>header h1 {
        font-size: 19px;
        letter-spacing: 1px
    }
    #game>header small {
        font-size: 8px
    }
    #game>header button {
        font-size: 10px;
        padding: 4px
    }
    #app {
        overflow: visible;
        min-height: 0
    }
    #game .board {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        padding: 4px;
        gap: 4px;
        overflow: visible
    }
    #game .board .toolbar,#game .board .footer {
        margin: 0;
        gap: 3px
    }
    #game .board .toolbar button,#game .board .footer button {
        padding: 5px;
        font-size: 11px;
        min-height: 30px
    }
    #game .board .players {
        display: grid;
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 4px;
        margin: 0
    }
    #game .board .player {
        padding: 4px;
        gap: 3px;
        min-height: 38px
    }
    #game .board .royal-shield {
        width: 20px;
        height: 24px
    }
    #game .board .player-name {
        font-size: 12px
    }
    #game .board .player small {
        font-size: 9px
    }
    #game .board .player strong {
        font-size: 17px
    }
    #game .board .layout {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin: 0;
        overflow: visible
    }
    #game .board .mapcol {
        display: block;
        position: relative;
        width: 100%;
        min-height: 0
    }
    #game .board .map {
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 3/2;
        min-height: 0
    }
    #game .board .map svg {
        width: 100%;
        height: auto;
        max-height: none;
        display: block
    }
    #game .board .mapcol>.panel {
        margin: 2px 0;
        padding: 3px 6px;
        font-size: 11px
    }
    #game .board .mapcol>.chronicle {
        display: none
    }
    #game .board .controlcol {
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 4px;
        overflow: visible;
        min-height: 0
    }
    #game .board .event {
        min-height: 0;
        margin: 0;
        padding: 3px;
        font-size: 12px
    }
    #game .board .event p {
        margin: 0
    }
    #game .board .section-label {
        display: none
    }
    #game .board .resources {
        margin: 0;
        gap: 3px
    }
    #game .board .resource {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 3px;
        min-width: 0
    }
    #game .board .resource img {
        width: 23px;
        height: 23px
    }
    #game .board .resource b {
        font-size: 17px
    }
    #game .board .resource small {
        display: none
    }
    #game .board .actions {
        grid-template-columns: repeat(4,minmax(0,1fr));
        gap: 3px;
        margin: 0
    }
    #game .board .actions button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 52px;
        padding: 2px;
        gap: 0;
        font-size: 10px
    }
    #game .board .actions .action-art {
        width: 25px;
        height: 25px
    }
    #game .board .actions .action-desc {
        display: none
    }
    #game .board .actions small {
        font-size: 9px
    }
    #game .board .actions small img {
        width: 12px;
        height: 12px
    }
    #game .board .controlcol .wide,#game .board .controlcol [data-action="intrigue"] {
        min-height: 36px;
        margin: 0;
        padding: 5px;
        font-size: 12px
    }
    #game .board .dice {
        width: 26px;
        height: 26px;
        padding: 4px;
        gap: 2px;
        margin: 2px
    }
    .mobile-only {
        display: inline-block
    }
    .map-expand {
        position: absolute;
        right: 5px;
        top: 5px;
        z-index: 2;
        padding: 4px;
        font-size: 11px
    }
    #game .board .mapcol.map-zoomed {
        position: fixed;
        inset: 0;
        z-index: 100;
        background: #20160e;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: auto;
        padding: 4px
    }
    #game .board .mapcol.map-zoomed .map {
        overflow: auto;
        touch-action: pan-x pan-y;
        aspect-ratio: auto
    }
    #game .board .mapcol.map-zoomed svg {
        width: 170%;
        max-width: none
    }
    dialog {
        width: 96vw;
        max-width: 96vw;
        max-height: 92dvh;
        padding: 12px;
        overflow: auto
    }
    dialog button {
        min-height: 42px
    }
    #game .tutorial-live .tutorial-guide {
        padding: 5px
    }
    #game .tutorial-live .tutorial-guide h3 {
        margin: 3px 0;
        font-size: 14px
    }
    .tutorial-scroll-hint {
        display: none
    }
}
/* Мобилен интерфейс: компактни панели, без промяна на пропорциите на картата. */
@media (pointer:coarse) and (max-width:760px) and (orientation:portrait) {
    #game,#game.expanded {
        min-height: var(--screen-h,100dvh)
    }
    #game>header {
        height: 28px;
        min-height: 28px
    }
    #game .board {
        gap: 3px;
        padding: 3px;
        min-height: calc(var(--screen-h,100dvh) - 28px - env(safe-area-inset-bottom));
        box-sizing: border-box
    }
    #game .board .toolbar button {
        min-height: 24px;
        padding: 2px 5px
    }
    #game .board .player {
        min-height: 32px;
        padding: 3px
    }
    #game .board .mapcol>.panel:not(.chronicle) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        padding: 2px 4px;
        flex-wrap: wrap
    }
    #game .board .mapcol>.panel:not(.chronicle)>.row {
        gap: 5px;
        flex: 1;
        white-space: nowrap
    }
    #game .board .controlcol {
        padding: 3px;
        gap: 2px
    }
    #game .board .event {
        display: flex;
        align-items: center;
        gap: 6px;
        min-height: 26px;
        padding: 3px 5px
    }
    #game .board .event>b {
        font-size: 15px;
        white-space: nowrap
    }
    #game .board .event p {
        font-size: 11px;
        line-height: 1.15
    }
    #game .board .controlcol>.row {
        min-height: 24px
    }
    #game .board .dice {
        width: 22px;
        height: 22px;
        margin: 1px;
        padding: 3px
    }
    #game .board .resource {
        padding: 1px 3px
    }
    #game .board .actions button {
        min-height: 46px;
        padding: 1px
    }
    #game .board .controlcol .wide,#game .board .controlcol [data-action="intrigue"] {
        min-height: 32px;
        padding: 3px
    }
    #game .board .footer {
        margin-top: auto;
        display: grid;
        grid-template-columns: repeat(4,minmax(0,1fr));
        gap: 4px;
        padding-bottom: 2px
    }
    #game .board .footer button {
        min-height: 32px;
        width: 100%;
        padding: 3px
    }
    #game.compact-mobile .board .player {
        min-height: 28px;
        padding: 2px
    }
    #game.compact-mobile .board .actions button {
        min-height: 43px
    }
    #game.compact-mobile .board .event>b {
        font-size: 13px
    }
    #game.short-mobile .board .controlcol>.row small {
        font-size: 10px
    }
    #game.short-mobile .board .controlcol .wide,#game.short-mobile .board .controlcol [data-action="intrigue"] {
        min-height: 30px
    }
    #game .board .mapcol.map-zoomed {
        padding: env(safe-area-inset-top) 4px env(safe-area-inset-bottom)
    }
    #game .board .mapcol.map-zoomed .map-expand {
        top: calc(env(safe-area-inset-top) + 5px)
    }
}

/* 1.0.1 — общ визуален език за миниигрите */
dialog.mini-premium { border:2px solid #b89451; background:radial-gradient(ellipse at top,#594020,#21170f 65%); box-shadow:0 20px 70px #000b,inset 0 0 0 4px #2b1d12; }
.mini-premium h3 {text-align:center;color:#f5d894;letter-spacing:.04em;border-bottom:1px solid #a87c4066;padding-bottom:12px;}
.mini-premium p {text-align:center;}
.mini-premium .mini-clock {--remaining:100%;position:relative;padding:8px 8px 14px;background:#170f0a;border:1px solid #8a6536;border-radius:6px;overflow:hidden;text-align:center;}
.mini-clock:after {content:'';position:absolute;bottom:0;left:0;height:5px;width:var(--remaining);background:linear-gradient(90deg,#a8782d,#f9dc89);transition:width .08s linear;}
.mini-clock.urgent:after {background:#d65c48;}
.mini-premium .mini-grid button,.mini-premium .rune-grid button {background:linear-gradient(145deg,#624827,#2c1e12);border:1px solid #b38b4c;border-radius:7px;box-shadow:inset 0 1px #f4d18a33,0 3px 5px #0005;color:#f8e3b2;min-height:48px;touch-action:manipulation;}
.mini-premium .mini-grid button:active,.mini-premium .rune-grid button:active {transform:scale(.94);}
.mini-premium .mini-grid button.matched {background:#29462c;border-color:#8fbd75;opacity:1;}
.mini-premium .mini-grid button.revealed {border-color:#f8d67d;opacity:1;}
.mini-premium .mini-track {border-radius:8px;box-shadow:inset 0 2px 8px #000b;background:repeating-linear-gradient(90deg,#21160e 0 9%,#38291a 9% 10%);}
.mini-premium .mini-track i {background:linear-gradient(#f6d88c,#a97830);box-shadow:0 0 12px #f4c96866;}
.mini-premium .mini-track b {border-radius:3px;box-shadow:0 0 6px #fff8;}
.mini-premium .archery-field {height:112px;background:linear-gradient(90deg,transparent 49%,#e6c27a88 49% 51%,transparent 51%),linear-gradient(#4b3b24,#21170e);border-radius:8px;overflow:hidden;}
.mini-premium #targetShot {border-radius:50%;min-width:0;min-height:0;background:radial-gradient(circle,#e8c66c 0 15%,#8d332b 16% 34%,#eee0b5 35% 54%,#684b2d 55% 72%,#d4ae68 73%);color:transparent;border:2px solid #d5b675;}
.mini-premium .maze-grid {width:min(260px,43dvh);border:3px solid #b48b4e;gap:1px;background:#785b37;}
.mini-premium .maze-grid .path {background:#2a2015;}
.mini-premium .maze-controls {margin-top:10px;}
.mini-premium .maze-controls button {min-width:44px;min-height:44px;}
.mini-premium #extraSymbol {text-align:center;font-size:42px;padding:12px;background:#160e08;border:1px solid #a87c40;border-radius:8px;}
.mini-premium #extraSymbol img {width:54px;height:54px;object-fit:contain;}
.mini-intro,.mini-result {text-align:center;padding:18px 8px;background:#1a120b88;border:1px solid #a87c4066;border-radius:8px;margin:12px 0;}
.mini-intro span {color:#e6c27a;font-size:12px;letter-spacing:.12em;}
.mini-result strong {font-size:52px;color:#8bc783;}.mini-result.lost strong {color:#e38170;}
.mini-tools {display:flex;gap:8px;}.mini-tools button {flex:1;}
/* IQ 2.0 */
.iq2 { display:grid; gap:8px; min-width:0; }
.iq2 .iq-photo { display:block; width:100%; height:auto; max-height:min(28vh,240px); object-fit:contain; border-radius:8px; background:#20170f; }
.iq2 .iq-options { display:grid; gap:6px; }
.iq2 .iq-options button { margin:0; white-space:normal; }
.iq2 .iq-selected { outline:2px solid #e6bc69; background:#70502b; }
.iq2 .iq-clock { height:6px; background:#302218; border-radius:5px; overflow:hidden; }
.iq2 .iq-clock i { display:block; width:100%; height:100%; background:#d5ae63; }
dialog:has(.iq2) { max-height:90dvh; overflow-y:auto; box-sizing:border-box; }
/* Minigames Engine 2.0 */
.royal-mini{max-width:480px;margin:auto;text-align:center}.royal-mini button{touch-action:manipulation}.royal-mini small{display:block;font-size:.7rem}.royal-mini .recipe{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}.recipe span{padding:5px;border:1px solid #a77c43;border-radius:5px;background:#39291b;color:#f6dfa9}.cauldron{font-size:clamp(36px,8vh,68px);filter:drop-shadow(0 0 12px #a5b85d)}.deal{display:block;width:100%;margin:8px 0}.forge,.siege-field,.royal-range{position:relative;height:clamp(110px,23vh,190px);overflow:hidden;border:1px solid #987343;border-radius:10px;background:radial-gradient(ellipse,#614025,#20150e)}.forge #hammer{font-size:48px;position:absolute;left:48%;top:0;transition:transform .15s}.forge.struck #hammer{transform:translateY(35px) rotate(-35deg)}#metal{position:absolute;width:35%;height:13px;left:32%;bottom:32%;border-radius:4px;box-shadow:0 0 12px #e58b39}.anvil{position:absolute;bottom:5%;left:30%;width:40%;font-size:40px;color:#8e9296}#sparks{position:absolute;left:32%;bottom:35%;color:#ffe27a;font-size:32px;opacity:0;transition:opacity .15s}.heat-track{height:8px;background:#332217;margin:12px 0;border-radius:8px;overflow:hidden}.heat-track i{display:block;height:100%;background:linear-gradient(90deg,#9b3120,#ffd97c)}.lock-dial{position:relative;width:min(180px,30vh);aspect-ratio:1;margin:12px auto;border:7px ridge #a78045;border-radius:50%;box-shadow:inset 0 0 15px #110b06}.lock-dial span{position:absolute;inset:38%;border-radius:50%;background:#25190e;display:grid;place-items:center}#lockNeedle{position:absolute;inset:5%;border-radius:50%;z-index:1}#lockNeedle:before{content:'';position:absolute;left:calc(50% - 3px);top:0;width:6px;height:40%;background:#fff0c7;border-radius:3px}.royal-range #movingTarget{position:absolute;top:15%;width:58px;height:58px;transform:translateX(-50%);border-radius:50%;border:3px solid #b9985e;background:radial-gradient(circle,#e4bd5e 0 15%,#a63a2b 16% 35%,#e6d3a6 36% 55%,#745133 56%)}.crosshair{position:absolute;left:50%;top:27%;transform:translate(-50%,-50%);color:white;font-size:30px;text-shadow:0 1px 3px black}#flyingArrow{position:absolute;left:50%;bottom:0;transform:translateX(-50%);font-size:32px;color:#f5dc9b}#flyingArrow.fly{bottom:70%;transition:bottom .28s linear}.keep,#enemy{position:absolute;transform:translate(-50%,-50%);font-size:30px}.keep{left:50%;top:50%;font-size:40px}#enemy{filter:drop-shadow(0 0 5px #f55)}

/* 1.0.5: compact Minigames Lab presentation. */
.lab-mini{font-family:Georgia,serif;background:radial-gradient(ellipse at top,#45321f,#1c140e 80%);color:#e9d8b8;border:1px solid #8e6c3e;border-radius:12px;padding:12px;box-sizing:border-box;width:100%;max-width:480px}
.lab-mini p{font-size:14px;text-align:center;color:#edcc8c;margin:8px 0}.lab-mini button{font-family:inherit;color:#f4dfb4;background:linear-gradient(#62492c,#352517);border:1px solid #a17b45;border-radius:6px;cursor:pointer;min-height:44px}.lab-mini .mini-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-width:340px;margin:12px auto}.lab-mini .mini-grid button{min-width:0;font-size:24px;padding:6px}.lab-mini .mini-grid small{font-size:clamp(9px,2.4vw,12px)}.lab-mini .gold{display:block;width:100%;margin-top:12px}.lab-mini .lab-track{position:relative;height:30px;background:#100b07;border:1px solid #96703d;margin:18px 4px;border-radius:5px;overflow:visible}.lab-mini .lab-zone{position:absolute;height:100%;background:#b58a3d}.lab-mini .lab-track i{position:absolute;top:-5px;width:5px;height:40px;background:#fff2ce;transform:translateX(-50%)}.lab-mini .royal-range,.lab-mini .siege-field,.lab-mini .forge{background:#21190e;border:1px solid #72552d;border-radius:8px}.lab-mini .royal-range #movingTarget{padding:0;min-height:0;width:58px;height:58px;border-radius:50%;background:radial-gradient(circle,#e5b95e 0 13%,#a7432f 14% 30%,#e7d6a5 31% 49%,#75422a 50% 65%,#c9b181 66%);border:2px solid #8d6a37}.lab-mini .crosshair{pointer-events:none}.lab-mini .deal{padding:11px}.lab-mini .recipe span{background:#352517}.lab-mini #extraProgress{min-height:20px;font-weight:bold}.lab-mini .lock-dial{max-width:100%}

/* Тренировъчен режим и визуална обратна връзка */
.practice-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0;max-height:48vh;overflow:auto;}
.practice-list button {min-height:44px;font-size:14px;}
#memoryFlash span {display:grid;place-items:center;min-height:64px;border:1px solid #80613b;border-radius:8px;opacity:.35;transition:opacity .12s,background .12s,box-shadow .12s;}
#memoryFlash span.flash {opacity:1;background:#7b5729;box-shadow:0 0 18px #e4bb65;}
.mini-grid button.matched {box-shadow:inset 0 0 14px #d5ae59;}
.mini-grid button.revealed {animation:practiceFlip .22s ease-out;}
@keyframes practiceFlip {from{transform:rotateY(85deg)}to{transform:rotateY(0)}}
/* Minigames Engine 2.0 — обща визуална система */
.mg2{--gold:#e5bd70;--ink:#1c130e; color:#f1dfbd;background:radial-gradient(ellipse at top,#4c3824,#1b130e 80%);border:1px solid #95703f;border-radius:12px;padding:12px;max-width:560px;margin:auto;touch-action:manipulation;user-select:none;}
.mg2 *{box-sizing:border-box}.mg2-top{display:flex;justify-content:space-between;color:var(--gold);font-size:13px;text-transform:uppercase;letter-spacing:1px}.mg2-meter{height:6px;background:#100b08;border-radius:5px;margin:9px 0;overflow:hidden}.mg2-meter i{display:block;width:100%;height:100%;background:linear-gradient(90deg,#9a682e,#ffe5a0)}#mgStatus{text-align:center;min-height:26px;color:var(--gold);font-size:15px;margin:8px 0}.mg2 button{min-height:44px;border:1px solid #99713f;border-radius:7px;background:linear-gradient(#62492d,#302117);color:#f5e1b8;box-shadow:inset 0 1px #ffffff18,0 3px 6px #0005}.mg2 button:active{transform:scale(.97)}.mg2 button:disabled{opacity:.45}.mg2-grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:7px;margin:10px 0}.mg2-grid button{font-size:clamp(17px,4vw,27px);min-height:54px;padding:5px}.mg2-grid img{width:38px;height:38px;object-fit:contain}.mg2-grid small,.practice-list small{display:block;font-size:11px;color:#d9bd88}.mg2 .lit,.mg2 .matched{background:#356247!important;box-shadow:0 0 14px #e6c46c!important;opacity:1!important}.mg2 .flipped{animation:mgFlip .22s ease-out}@keyframes mgFlip{from{transform:rotateY(85deg)}to{transform:rotateY(0)}}.mg2-intro,.mg2-result{text-align:center;padding:18px 4px}.mg2-count{font-size:76px;text-align:center;color:var(--gold);padding:20px}.mg2-result strong{font-size:42px;color:var(--gold);letter-spacing:4px}.mg2 #mgExit{margin-top:12px;width:100%;font-size:12px;background:#21170f}.mg2-react{width:100%;height:120px;font-size:24px}.mg2-react.green{background:#267347}.mg2-react.red{background:#9e3029}.mg2-react.amber{background:#9b702a}.mg2-chests{height:145px;position:relative;background:radial-gradient(ellipse at bottom,#70502c,#21160f);border-radius:8px}.mg2-chests button{position:absolute;top:35%;width:18%;transform:translateX(-50%);transition:left .35s ease;padding:0;background:none;border:0;box-shadow:none}.mg2-chest{display:block;height:56px;border:3px solid #b68b49;border-radius:13px 13px 5px 5px;background:repeating-linear-gradient(0deg,#57341b 0 9px,#714b28 10px 12px);box-shadow:inset 0 0 0 4px #352113,0 8px 8px #0008;position:relative;color:#ffdd73;font-size:30px}.mg2-chest:after{content:'';position:absolute;left:40%;top:40%;width:20%;height:22%;background:#cba45c;border:1px solid #402c17}.mg2-chest.open{background:#e8bc52;box-shadow:0 0 22px #ffd36b}.mg2-word{min-height:48px;text-align:center;font-size:24px;letter-spacing:3px;background:#160e09;border:1px solid #84623a;padding:8px}.mg2-field{height:190px;position:relative;overflow:hidden;border:1px solid #8a693e;border-radius:9px;background:radial-gradient(ellipse at center,#59472e,#1b140d)}.mg2-coin{position:absolute!important;width:42px!important;height:42px;min-height:0!important;border-radius:50%!important;background:radial-gradient(circle,#fff0a1,#c08b28 65%,#77501b)!important;color:#523310!important;font-size:23px;animation:mgCoin .35s ease-out}.mg2-coin.fake{background:radial-gradient(circle,#aaa,#555)!important}.mg2-coin.rare{box-shadow:0 0 15px #fff3a1}.mg2-coin:active{transform:scale(.8)}@keyframes mgCoin{from{opacity:0;transform:scale(.4)}to{opacity:1;transform:scale(1)}}.mg2-track{height:20px;margin:15px 4px;position:relative;background:linear-gradient(#0d0906,#392819);border:1px solid #997444;border-radius:4px}.mg2-track b{position:absolute;height:100%;background:#cba34e}.mg2-track i{position:absolute;top:-5px;height:28px;width:4px;background:#fff2c8;box-shadow:0 0 6px #fff;transform:translateX(-50%)}.mg2-emblem{text-align:center;font-size:62px;color:#d9af60}.mg2-dial{width:154px;height:154px;margin:8px auto;border:10px ridge #ac884d;border-radius:50%;position:relative;box-shadow:0 5px 12px #0009,inset 0 0 0 6px #17110b}.mg2-dial i{position:absolute;left:calc(50% - 2px);top:6%;width:4px;height:44%;background:#fff0c5;transform-origin:50% 100%}.mg2-dial b{position:absolute;inset:38%;border-radius:50%;background:#6b4c29;text-align:center;color:#eac67e}.mg2-range{background:linear-gradient(#65704b,#303c27 55%,#6e5633 56%,#35251a)}#mgTarget{position:absolute;top:28%;width:76px;height:76px;transform:translateX(-50%);border:5px solid #6c4928;border-radius:50%;background:radial-gradient(circle,#f0c64f 0 13%,#a63e2c 14% 30%,#e9d8b3 31% 48%,#805233 49% 66%,#d1b583 67%);box-shadow:0 5px 8px #0008}.mg2-cross{position:absolute;left:50%;top:48%;transform:translate(-50%,-50%);color:white;font-size:28px;text-shadow:0 0 3px #000}#mgArrow{position:absolute;left:50%;bottom:-25px;font-size:40px;color:#e9d5a5}#mgArrow.fly{animation:mgArrow .3s linear}@keyframes mgArrow{to{bottom:60%;opacity:.3}}#mgShoot{touch-action:none;width:100%}.mg2-recipe{text-align:center;color:#e6c88c;padding:8px}.mg2-pot{width:130px;height:95px;margin:12px auto;background:linear-gradient(90deg,#16191b,#55595a,#151719);border:5px solid #72644c;border-radius:15px 15px 50% 50%;position:relative;box-shadow:0 10px 15px #0009}.mg2-pot i{position:absolute;top:0;left:0;width:100%;height:28px;border-radius:50%;background:#557d40;box-shadow:0 0 12px #95d45d}.mg2-pot b{position:absolute;top:-18px;left:20%;color:#e1e9b3;animation:mgBubble 1.2s infinite}@keyframes mgBubble{to{transform:translateY(-15px);opacity:0}}.mg2-pot.explode{animation:mgBlast .6s}@keyframes mgBlast{50%{box-shadow:0 0 55px 25px #e86b29;transform:scale(1.1)}}.mg2-forge{height:130px;position:relative;background:radial-gradient(ellipse at bottom,#a45325,#271a13 65%);overflow:hidden}.mg2-anvil{position:absolute;left:20%;bottom:10%;width:60%;height:35%;background:linear-gradient(#777b7b,#25282a);clip-path:polygon(0 0,100% 0,80% 30%,65% 30%,65% 70%,85% 100%,15% 100%,35% 70%,35% 30%,15% 30%)}#mgMetal{position:absolute;bottom:45%;left:50%;transform:translateX(-50%);height:12px;width:30%;border-radius:3px;box-shadow:0 0 12px #f8a63b}#mgHammer{position:absolute;top:5%;left:48%;font-size:55px;transform:rotate(-35deg);transform-origin:bottom left}.strike #mgHammer{animation:mgStrike .3s}.strike:after{content:'✦ ✧ ✦';position:absolute;left:35%;top:35%;color:#ffdc76;font-size:26px;animation:mgBubble .35s}@keyframes mgStrike{50%{transform:rotate(30deg) translateY(20px)}}.mg2-maze{display:grid;grid-template-columns:repeat(var(--n),1fr);max-width:300px;margin:auto;border:3px ridge #8b7654}.mg2-maze span{aspect-ratio:1;display:grid;place-items:center;font-size:16px}.mg2-maze .wall{background:repeating-linear-gradient(0deg,#4d4840 0 5px,#302c28 6px 7px);border:1px solid #28221d}.mg2-maze .path{background:#9b7950;color:#23190e}.mg2-maze .fog{background:#0b0806}.mg2-market button{display:flex;align-items:center;gap:12px;width:100%;margin:7px 0;padding:10px}.mg2-market img{width:40px}.mg2-keep,#mgEnemy{position:absolute;transform:translate(-50%,-50%);font-size:36px;color:#e7c58b;text-shadow:0 3px 4px #000}.mg2-keep{left:50%;top:50%;font-size:58px}.mg2-siege{background:repeating-linear-gradient(45deg,#393d25 0 20px,#41452c 20px 40px)}.mg2[data-game="14"] .mg2-grid button{background:linear-gradient(#66635a,#2e2c28);color:#e6c47b;text-shadow:0 0 7px #c19a55}.mg2 button.gold{width:100%;margin-top:6px}.practice-list button small{margin-top:4px}@media(max-height:650px){.mg2-field{height:150px}.mg2-grid button{min-height:42px}.mg2{padding:8px}.mg2-maze{max-width:240px}}

/* 1.1.1 — чужд ход: скриваме само контролите за активния владетел. */
.board.watching-turn .actions,.board.watching-turn .controlcol [data-action="end"],.board.watching-turn .controlcol [data-action="intrigue"],.board.watching-turn .controlcol [data-action="roll"]{display:none!important}
.watching-status{padding:10px;text-align:center;color:#e5c785;border:1px solid #80613b;border-radius:6px;background:#21180f;font-size:13px}
/* Мобилно приложение: safe area се прилага веднъж, извън заглавната лента. */
@media (pointer:coarse) and (max-width:760px), (pointer:coarse) and (orientation:landscape) and (max-height:600px){
 #game #full{display:none!important}
 #game,#game.expanded,#game:fullscreen{position:relative;inset:auto;display:flex;flex-direction:column;width:100%;max-width:none;height:auto;min-height:100dvh;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);box-sizing:border-box;overflow:visible}
 #game>header,#game.expanded>header{position:relative;top:auto;flex:none;height:auto;min-height:36px;padding:4px 6px;gap:4px}
 #game>header h1{font-size:clamp(17px,5vw,25px);white-space:nowrap;letter-spacing:0}
 #game>header button{min-height:32px;padding:4px 7px}
 #game #app{flex:1;min-height:0;display:flex;flex-direction:column;overflow:visible}
 #game .board,#game.expanded .board{flex:1;height:auto;min-height:0;overflow:visible}
 #game .board .footer{flex:none;margin-top:auto;padding:3px 0 0}
 #game .board .footer button{min-height:38px}
 html,body,body.game-expanded{height:auto;overflow-y:auto;overscroll-behavior-y:none}
 dialog{max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 16px);max-width:calc(100vw - 16px)}
}
@media (pointer:coarse) and (max-width:760px) and (orientation:portrait){
 #game .board .layout{flex:0 0 auto;min-height:0}
 #game .board .toolbar{flex-wrap:wrap;min-height:30px}
 #game .board .toolbar>div{display:flex;gap:3px;flex-shrink:0}
 #game .board .actions button{min-height:48px}
 #game .board .controlcol .wide{min-height:40px}
 #game .board .mapcol.map-zoomed{padding:env(safe-area-inset-top,0px) 4px env(safe-area-inset-bottom,0px)}
 #game .board .mapcol.map-zoomed .map-expand{top:calc(env(safe-area-inset-top,0px) + 5px)}
}

/* Royal Polish 1.1.2 */
.mission-strip{display:flex;justify-content:center;margin:4px 0 7px}.mission-strip button{width:100%;display:flex;align-items:center;justify-content:center;gap:7px;min-height:36px;color:#f1d38c}.mission-strip img,.inline-royal{width:30px;height:30px;object-fit:contain;vertical-align:middle}.royal-notice{position:fixed;z-index:9999;top:calc(env(safe-area-inset-top,0px) + 70px);left:50%;transform:translateX(-50%);width:min(90vw,440px);display:flex;align-items:center;gap:12px;padding:12px;background:linear-gradient(135deg,#4c321b,#21170e);border:2px solid #d5aa60;border-radius:10px;color:#ffe4a5;box-shadow:0 6px 25px #000b;pointer-events:none;animation:royalNotice 4.2s both}.royal-notice img{width:85px;height:72px;object-fit:cover;border-radius:5px}.royal-notice p{margin:5px 0;font-size:13px}.royal-turn{animation:royalTurn .85s ease-out!important}@keyframes royalTurn{0%,100%{filter:none}40%{filter:brightness(1.45);box-shadow:0 0 22px #edc46b}}@keyframes royalNotice{0%,100%{opacity:0;transform:translate(-50%,-12px)}10%,85%{opacity:1;transform:translate(-50%,0)}}#app.menu-bg{position:relative;isolation:isolate}#app.menu-bg:before{content:'';position:absolute;inset:0;pointer-events:none;z-index:-1;background:radial-gradient(ellipse at 30% 20%,#f8ce7533,transparent 55%),radial-gradient(circle at 70% 70%,#e6a94b22,transparent 35%);animation:royalLight 9s ease-in-out infinite alternate}@keyframes royalLight{from{opacity:.3;transform:scale(.97)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){.royal-turn,#app.menu-bg:before{animation:none!important}.royal-notice{animation:none}}

/* 1.1.3: compact mission controls, independent event dialog */
.mission-actions{display:flex;gap:6px;margin:6px 0;flex:none}.mission-actions button{flex:1;min-width:0;display:flex;align-items:center;justify-content:center;gap:5px;padding:5px;font-size:clamp(11px,2.8vw,15px)}.watching-turn .mission-actions{display:none!important}.world-event-window{box-sizing:border-box;width:min(92vw,460px);max-height:85dvh;overflow:auto;background:linear-gradient(#49321d,#20160e);color:#f5dba4;border:2px solid #c69b50;border-radius:10px;padding:16px;text-align:center;box-shadow:0 12px 50px #000b}.world-event-window::backdrop{background:#0009}.world-event-window img{display:block;width:100%;max-height:45dvh;object-fit:cover;border-radius:6px}.world-event-window button{width:100%;margin-top:8px}.world-event-window h3{margin:0 0 12px}.world-event-window p{margin:12px 0}

/* 1.1.4 — равни бутони и компактна статистика */
.mission-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}.mission-actions>button{width:100%!important;max-width:none!important;min-width:0!important;box-sizing:border-box;margin:0!important;height:48px;min-height:48px}.mission-actions>button:only-child{grid-column:1/-1}.player-detail{max-height:65dvh;overflow:auto}.detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.detail-grid>div{display:grid;justify-items:center;gap:3px;padding:8px 3px;border:1px solid #80613b;border-radius:6px;background:#24190e}.detail-grid img,.detail-award img{width:32px;height:32px;object-fit:contain}.detail-grid small{font-size:11px;text-align:center}.detail-grid strong{font-size:20px;color:#f1d38c}.detail-award{display:flex;align-items:center;gap:9px;padding:7px;border-bottom:1px solid #80613b}.detail-award small{display:block;font-size:12px}.detail-breakdown{display:grid;grid-template-columns:1fr 1fr;gap:5px}.detail-breakdown span{display:flex;justify-content:space-between;padding:4px 8px;background:#24190e}.player-detail h4{margin:12px 0 6px}.royal-notice{box-sizing:border-box}

.mission-actions .mission-completed{filter:grayscale(1);opacity:.65;}
.mg2-history{max-height:120px;overflow:auto;font-size:.85em}.mg2-property{font-size:.85em}.mg2-property .mg2-track{margin:5px 0 12px}.mg2-deal{display:flex;align-items:center;gap:5px;flex-wrap:wrap}.mg2-deal span{flex:1}.mg2-deal button{width:auto!important;padding:5px 8px}.mg2-grid small{display:block;font-size:.65em}.mg2-grid .res-icon{max-width:48px;max-height:48px}

/* 1.1.7 — центрирано лого и атмосфера само в главното меню */
#game>header{position:relative}
@media(min-width:701px){#game>header h1{position:absolute;left:50%;transform:translateX(-50%);margin:0;pointer-events:none}#game>header .header-actions{margin-left:auto}}
@media(max-width:700px){#game>header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center}#game>header h1{margin:0;justify-self:center;font-size:clamp(14px,4vw,23px)}#game>header .header-actions{justify-self:end}#game>header small{justify-self:start}}
#app.bq-atmosphere{position:relative;isolation:isolate;overflow:hidden}
#app.bq-atmosphere .main-menu{position:relative;z-index:2}
.bq-menu-effects{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:0}
.bq-menu-effects::before,.bq-menu-effects::after{content:'';position:absolute;inset:-15%;background:radial-gradient(ellipse at 20% 65%,#e6d9ba24,transparent 35%),radial-gradient(ellipse at 75% 30%,#e5d8b326,transparent 38%);animation:bqMist 23s ease-in-out infinite alternate;will-change:transform,opacity}
.bq-menu-effects::after{background:radial-gradient(ellipse at 55% 20%,#ffce7540,transparent 55%);animation:bqMist 15s ease-in-out infinite alternate-reverse}
@keyframes bqMist{from{transform:translate(-5%,2%) scale(1);opacity:.35}to{transform:translate(6%,-3%) scale(1.09);opacity:.9}}
.bq-menu-effects i{position:absolute;left:var(--x);top:var(--y);width:3px;height:3px;border-radius:50%;background:#ffe3a2;box-shadow:0 0 7px #ffca66;animation:bqSpark var(--duration) linear infinite;animation-delay:var(--delay)}
@keyframes bqSpark{0%{opacity:0;transform:translate(0,20px)}30%{opacity:.55}80%{opacity:.3}100%{opacity:0;transform:translate(24px,-75px)}}
#onlineGame .bq-online{display:flex;align-items:center;justify-content:center;gap:5px;margin-top:5px;font-size:11px;font-weight:400;color:#aaa}
#onlineGame .bq-online[data-live="true"]{color:#a7ce91}.bq-online::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}
@media(prefers-reduced-motion:reduce){.bq-menu-effects::before,.bq-menu-effects::after,.bq-menu-effects i{animation:none}.bq-menu-effects i{display:none}}

/* 1.1.8 — по-тъмна карта и по-видима атмосфера в менюто и настройките. */
#app.bq-atmosphere{overflow:auto}
#app.bq-atmosphere:before{animation:none;background:radial-gradient(ellipse at 50% 45%,#08060455,#080604a6);opacity:1;transform:none}
#app.bq-setup-atmosphere:before{background:radial-gradient(ellipse at 50% 45%,#08060488,#080604c4)}
#app.bq-atmosphere .simple-setup{position:relative;z-index:2}
.bq-menu-effects::before{background:radial-gradient(ellipse at 18% 68%,#e6d9ba66,transparent 36%),radial-gradient(ellipse at 76% 32%,#e5d8b350,transparent 40%);animation-duration:18s}
.bq-menu-effects::after{background:radial-gradient(ellipse at 58% 18%,#ffce7555,transparent 50%);animation-duration:12s}
@keyframes bqMist{from{transform:translate(-9%,3%) scale(1);opacity:.45}to{transform:translate(9%,-5%) scale(1.12);opacity:1}}
.bq-menu-effects i{width:4px;height:4px;box-shadow:0 0 9px 2px #ffca6688}
@keyframes bqSpark{0%{opacity:0;transform:translate(0,20px)}30%{opacity:.95}80%{opacity:.65}100%{opacity:0;transform:translate(36px,-95px)}}
@media(prefers-reduced-motion:reduce){.bq-menu-effects::before,.bq-menu-effects::after{animation:none;opacity:.5}}

/* 1.1.9 — портретна композиция и едноредови настройки на владетелите. */
@media (max-width:760px) {
  #game .simple-setup .setup-slot {display:flex;flex-wrap:nowrap;align-items:center;gap:4px;padding:5px;min-width:0;box-sizing:border-box}
  #game .simple-setup .setup-slot img {flex:0 0 20px;width:20px;height:26px;object-fit:contain}
  #game .simple-setup .setup-slot input {flex:1 1 0;min-width:0;width:0;margin:0;padding:5px;font-size:13px;height:36px;box-sizing:border-box}
  #game .simple-setup .setup-slot select {flex:0 1 76px;width:76px;min-width:0;max-width:76px;margin:0;padding:3px;font-size:12px;height:36px;box-sizing:border-box}
  #game .simple-setup .setup-slot b {flex:1 1 0;min-width:0;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #game .simple-setup .setup-slot button {flex:0 0 36px;width:36px;min-width:0;max-width:36px;height:36px;margin:0;padding:0;box-sizing:border-box;font-size:16px}
  #game .simple-setup .setup-slot [data-toggle] {font-size:0}
  #game .simple-setup .setup-slot [data-toggle]::after {content:'';display:block;width:22px;height:22px;margin:auto;background:#e2c18b;mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3Cpath d='M4 21v-2a8 8 0 0 1 16 0v2'/%3E%3C/svg%3E") center/contain no-repeat;}
  #game .simple-setup .setup-slot:has(b) [data-toggle]::after {mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='7' width='16' height='13' rx='3'/%3E%3Cpath d='M12 7V3m-2 0h4M1 12v4m22-4v4M9 16h6'/%3E%3Ccircle cx='8.5' cy='12' r='1'/%3E%3Ccircle cx='15.5' cy='12' r='1'/%3E%3C/svg%3E")}
}
@media (max-width:760px) and (orientation:portrait) {
  /* По-широк изглед на картата в горната част; мек преход към тъмния фон. */
  #game>#app.menu-bg.bq-atmosphere {
    background-image:linear-gradient(180deg,#100d0922 0%,#100d0922 20%,#100d09dd 46%,#100d0999 70%,#100d0944 100%),url(assets/map.webp),url(assets/map.webp);
    background-size:100% 100%,150% auto,cover;
    background-position:center,65% top,65% center;
    background-repeat:no-repeat;
  }
  #game>#app.menu-bg.bq-setup-atmosphere:before {background:radial-gradient(ellipse at 50% 40%,#08060466,#080604b0)}
  #game>#app.bq-atmosphere .bq-menu-effects::before {opacity:.65}
}

/* 1.1.10 — един скрол контейнер, без излишна височина от safe area. */
@media (max-width:760px) {
 html:has(#app.bq-atmosphere),body:has(#app.bq-atmosphere){height:100%;margin:0;overflow:hidden;overscroll-behavior:none}
 #game:has(>#app.bq-atmosphere){height:100dvh;min-height:0;max-height:100dvh;box-sizing:border-box;margin:0;overflow:hidden}
 #game>#app.menu-bg.bq-atmosphere{flex:1 1 0;min-height:0!important;overflow:hidden;padding:8px;align-items:stretch;justify-content:center}
 #game>#app.menu-bg.bq-setup-atmosphere{overflow-y:auto;overflow-x:hidden;align-items:flex-start;overscroll-behavior:contain}
 #game>#app.bq-atmosphere .setup{max-width:100%;margin:auto;padding:16px;flex-shrink:0}
 #game>#app.bq-setup-atmosphere .simple-setup{padding:12px 16px;margin:0 auto}
 #game .simple-setup h2{margin:8px 0 10px;font-size:clamp(20px,5.5vw,28px)}
 #game .simple-setup p{margin:8px 0}
 #game .simple-setup h4{margin:8px 0 4px}
 #game .simple-setup .setup-slot{margin-bottom:4px}
 #game .simple-setup>#start,#game .simple-setup>#backMenu,#game .simple-setup>#load{margin-top:5px;padding:8px;min-height:36px}
 #game .simple-setup .setup-options button{padding:7px 4px;min-height:36px}
 #game>#app.bq-atmosphere .bq-menu-effects{inset:0;overflow:hidden;contain:strict}
}
@media(max-width:760px) and (max-height:500px){#game>#app.menu-bg.bq-atmosphere{overflow-y:auto;align-items:flex-start}}

/* 1.1.11 — мобилна хроника като чат, с неподвижна заглавна лента. */
@media(max-width:760px){
 dialog.bq-chronicle[open]{display:flex;flex-direction:column;box-sizing:border-box;width:min(94vw,480px);height:min(72dvh,620px);max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px);overflow:hidden;padding:12px;gap:8px}
 .bq-chronicle-head{display:flex;align-items:center;justify-content:space-between;flex:none;border-bottom:1px solid #80613c;padding-bottom:8px}
 dialog.bq-chronicle .bq-chronicle-head h3{margin:0;padding:0;text-align:left;font-size:19px}
 dialog.bq-chronicle .bq-chronicle-head button{width:44px;min-width:44px;height:44px;margin:0;padding:0;font-size:24px}
 .bq-chronicle-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;text-align:left}
 .bq-chronicle-entry{padding:9px 5px;border-bottom:1px solid #80613c44;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
}

/* Мултиплеър 2.0 — адаптивно лоби */
.mp-shell{max-width:920px;margin:0 auto;padding:18px;display:grid;gap:12px;color:#ead9b5;text-align:left;overflow:auto;max-height:100%;box-sizing:border-box}.mp-shell h2,.mp-shell h3{margin:0;color:#e8c77d}.mp-heading,.mp-line{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.mp-heading span,.mp-muted,.mp-shell small{color:#b4ad9e;font-size:12px}.mp-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mp-panel{background:linear-gradient(145deg,#222b36,#141b24);border:1px solid #75603b;border-radius:12px;padding:14px;display:grid;gap:10px;align-content:start;min-width:0}.mp-panel summary{cursor:pointer;color:#e8c77d;font-weight:bold;margin-bottom:8px}.mp-shell label{display:grid;gap:5px;font-size:13px}.mp-shell input:not([type=checkbox]),.mp-shell select{width:100%;min-width:0;box-sizing:border-box;background:#101722;color:#eee0c2;border:1px solid #66583e;border-radius:7px;padding:9px;font-size:16px}.mp-shell .mp-check{display:flex;align-items:center;gap:8px}.mp-shell button{min-height:36px;border-radius:7px;padding:7px 12px}.mp-shell .mp-primary{background:linear-gradient(#99743a,#63451f);color:#fff0c7;font-weight:bold}.mp-room,.mp-player{display:flex;justify-content:space-between;align-items:center;gap:10px;background:#28323e;border:1px solid #514a3b;border-radius:8px;padding:10px;margin-top:7px}.mp-room>div,.mp-player>div{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}.mp-player>div{flex:1}.mp-dot{width:15px;height:15px;border-radius:50%;flex:none}.mp-empty{border:1px dashed #71654d;border-radius:8px;padding:12px;color:#aaa395}.mp-shell #netChatLog{white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto;height:160px;background:#101722;padding:10px;border-radius:7px;font-size:13px}.mp-shell #netError{color:#ff9b88;margin:0}.mp-shell button:disabled{opacity:.45}.mp-shell #netRooms{max-height:360px;overflow:auto}@media(max-width:600px){.mp-shell{padding:10px;gap:8px}.mp-shell>.mp-grid{grid-template-columns:1fr}.mp-panel{padding:10px}.mp-heading h2{font-size:20px}.mp-shell #netRooms{max-height:none}}

/* 1.1.32 mobile performance */
@media (hover:none) and (pointer:coarse){.player.active{animation:none}.reward-flight{will-change:transform}}
.bq-no-motion .board *, .bq-no-motion .royal-notice, .bq-no-motion .reward-flight{animation:none!important;transition:none!important}

#bqPerfDialog{width:min(94vw,620px);max-height:85dvh;background:#21180f;color:#f1dfb8;border:1px solid #a68b53;border-radius:12px;padding:14px;overflow:auto}#bqPerfDialog::backdrop{background:#0009}#bqPerfDialog header{display:flex;justify-content:space-between;align-items:center;gap:8px;position:static;background:none;padding:0}#bqPerfDialog pre{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.5 system-ui;margin:12px 0;user-select:text}#bqPerfDialog button{width:auto;margin:4px 0;padding:8px 12px}

.bq-online-dialog{width:min(92vw,480px);max-height:85dvh;overflow:auto;background:#21180f;color:#f1dfb8;border:1px solid #a68b53;border-radius:12px;padding:14px;box-shadow:0 12px 40px #0009}.bq-online-dialog::backdrop{background:#0009}.bq-online-dialog header{display:flex;align-items:center;justify-content:space-between;position:static;background:none;padding:0;gap:8px}.bq-online-dialog header button{width:auto;margin:0}.bq-chat-log{height:min(38dvh,240px);overflow:auto;overscroll-behavior:contain;background:#130e09;border:1px solid #705936;border-radius:7px;padding:10px;margin:10px 0;overflow-wrap:anywhere;white-space:pre-wrap}.bq-chat-log div{padding:4px 0;border-bottom:1px solid #ffffff15}.bq-chat-log strong{color:#e6c77e}.bq-online-dialog form,.bq-dialog-actions{display:flex;gap:8px;align-items:center}.bq-online-dialog form input{flex:1;min-width:0;margin:0;font-size:16px}.bq-online-dialog form button,.bq-dialog-actions button{width:auto;margin:0}.bq-dialog-error{color:#ff998b;margin:6px 0 0}.bq-dialog-error:empty{display:none}

/* 1.1.36 — кралско мултиплеър лоби; запазена подредба и функционалност. */
#app:has(.mp-shell){background:linear-gradient(145deg,#160e09d9,#21160ce8),var(--med-leather);}
.mp-shell{width:100%;color:#f0dfbd;gap:14px;}
.mp-shell h2,.mp-shell h3,.mp-panel summary{font-family:Georgia,serif;color:#f1d18b;text-shadow:0 2px 3px #000;}
.mp-heading{padding:12px 15px;background:linear-gradient(#3c2818b8,#150d08e8),var(--med-wood);border:1px solid #a17a43;border-image:var(--med-frame) 43 / 16px / 0 stretch;}
.mp-heading h2{font-size:clamp(20px,4vw,30px);letter-spacing:.5px;}
.mp-panel{background:linear-gradient(145deg,#382619cf,#170f0be8),var(--med-leather);border:1px solid #9a7642;border-image:var(--med-frame) 43 / 17px / 0 stretch;border-radius:4px;padding:17px;box-shadow:inset 0 0 18px #0006,0 3px 8px #0005;}
.mp-panel summary{padding-bottom:8px;border-bottom:1px solid #b18a4644;}
.mp-shell label{color:#e1c99e;}
.mp-shell input:not([type=checkbox]),.mp-shell select{background:#180f0a;color:#f4e3bf;border:1px solid #8e6a3d;border-radius:4px;box-shadow:inset 0 2px 5px #0006;}
.mp-shell input::placeholder{color:#aa9578;}
.mp-shell input:focus,.mp-shell select:focus{outline:2px solid #d5ad63;outline-offset:1px;}
.mp-shell input[type=checkbox]{accent-color:#b9914f;}
.mp-shell button{background:linear-gradient(#674a2b99,#21150ce8),var(--med-wood);border:1px solid #a17a43;border-radius:4px;color:#f4dfb6;box-shadow:inset 0 1px #e6c58a26,0 2px 4px #0005;}
.mp-shell .mp-primary,.mp-shell button.gold{background:linear-gradient(#e9ca86,#a47735);color:#25170b;border-color:#e0bb70;text-shadow:none;}
.mp-room,.mp-player{background:linear-gradient(110deg,#49321e99,#1b120ce8),var(--med-leather);border:1px solid #80613b;border-radius:4px;box-shadow:inset 0 0 8px #0005;}
.mp-room strong,.mp-player strong{color:#f4d99e;}
.mp-dot{border:1px solid #e8c98c;box-shadow:0 0 0 2px #160e09;}
.mp-empty{border-color:#95764c;color:#bba88a;background:#160e0955;border-radius:4px;}
.mp-shell small,.mp-muted,.mp-heading span{color:#c6b28d;}
.mp-shell #netChatLog{background:#140d09;border:1px solid #785b36;border-radius:4px;color:#e8d5b1;}
.mp-shell #netError{color:#ff968a;}
#onlineGame .bq-online[data-live="false"]{color:#ff7770;font-weight:600;}
#onlineGame:disabled{opacity:1;cursor:default;color:#a89a82;filter:none;}
#onlineGame:disabled .bq-online{opacity:1;}
@media(max-width:600px){.mp-shell{padding:10px;gap:9px;}.mp-panel{padding:13px;}.mp-heading{padding:10px;gap:7px;}.mp-shell button{min-height:40px;}.mp-room,.mp-player{padding:9px;}}

/* 1.1.37 — Онлайн контроли и четим бутон за вход. */
.mp-room>div:first-child{flex:1;min-width:0}
.mp-room>div:last-child{flex:0 0 auto;min-width:76px;text-align:center;overflow-wrap:normal}
.mp-room button[data-join]{min-width:76px;width:auto;white-space:nowrap;overflow-wrap:normal;word-break:normal;padding-inline:12px}
#game .board .net-toolbar{display:flex;align-items:center;justify-content:space-between;gap:4px 8px}
#game .board .net-toolbar #netTimer{margin-left:auto;text-align:right;white-space:nowrap;flex-shrink:0}
#game .board .net-footer button[data-net-control]{white-space:nowrap;min-width:0}
@media(max-width:760px){
 #game .board .net-toolbar{flex-wrap:wrap}
 #game .board .net-toolbar #netTimer{font-size:clamp(11px,3.4vw,15px)}
 #game .board .net-footer{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 #game .board .net-footer button{font-size:clamp(10px,3vw,13px);padding-inline:3px}
 #game .board .net-footer button[data-net-control=rematch]{grid-column:1/-1}
}
