:root {
    --green: #2e7d32;
    --board: #f4ecd8;
    --ink: #1b2a1f;
    --gold: #c9a227;
    --panel: #fffdf5;
    --line: #0a3d1f;
    --wood: #5e3c1d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: radial-gradient(circle at 50% 0%, #2a5238 0%, #15301f 55%, #0a1c12 100%);
    color: #16241a;
    min-height: 100vh;
    padding: 16px;
}

h1 {
    color: #f3e9c6;
    text-align: center;
    margin: 4px 0 14px;
    font-size: 28px;
    letter-spacing: 3px;
    text-shadow: 0 2px 6px #000, 0 0 18px rgba(201, 162, 39, .4);
}

.wrap {
    display: flex;
    gap: 18px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ---------- BOARD ---------- */
#board {
    width: 760px;
    height: 760px;
    display: grid;
    grid-template-columns:repeat(11, 1fr);
    grid-template-rows:repeat(11, 1fr);
    background: linear-gradient(135deg, #f8f0db, #ece0c1);
    border: 15px solid var(--wood);
    border-image: repeating-linear-gradient(42deg, #7a4f28, #7a4f28 9px, #5e3c1d 9px, #5e3c1d 18px) 15;
    box-shadow: 0 0 0 2px #2e1d0d, 0 22px 55px rgba(0, 0, 0, .6);
    position: relative;
    flex: 0 0 auto;
}

.cell {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    font-size: 9px;
    line-height: 1.05;
    border: 1px solid rgba(94, 60, 29, .22);
    background: linear-gradient(180deg, #fffdf6, #f0e7d0);
}

.cell:hover {
    filter: brightness(1.05);
    outline: 2px solid var(--gold);
    outline-offset: -2px;
    z-index: 6;
}

.cell.owned-0 {
    box-shadow: inset 0 0 0 3px #e53935;
}

.cell.owned-1 {
    box-shadow: inset 0 0 0 3px #1e88e5;
}

.cell.owned-2 {
    box-shadow: inset 0 0 0 3px #8e24aa;
}

.cell.owned-3 {
    box-shadow: inset 0 0 0 3px #fb8c00;
}

.cell.owned-4 {
    box-shadow: inset 0 0 0 3px #00897b;
}

.cell.owned-5 {
    box-shadow: inset 0 0 0 3px #5d4037;
}

/* otočná "tvář" pole – popisky míří ke středu jako na skutečné desce */
.cell .face {
    position: absolute;
    inset: 0;
    padding: 2px;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.cell.edge-top .face {
    transform: rotate(180deg);
}

.cell.edge-left .face {
    transform: rotate(90deg);
}

.cell.edge-right .face {
    transform: rotate(-90deg);
}

.colorbar {
    height: 16px;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, .4);
    border-radius: 1px;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, .55), inset 0 -3px 4px rgba(0, 0, 0, .28);
}

.nm {
    font-weight: 700;
    padding: 1px 2px;
    flex: 1;
    color: #2a2418;
    text-align: center;
    overflow: hidden;
}

.pr {
    padding: 0 2px 1px;
    font-size: 8px;
    color: #6b5527;
    text-align: center;
    font-weight: 700;
}

.icon {
    font-size: 17px;
    text-align: center;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}

/* zvýraznění pole, kde hráč právě stojí */
.cell.active-field {
    overflow: visible;
    z-index: 8;
}

.cell.active-field::before {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: 9;
    pointer-events: none;
    border-radius: 2px;
    box-shadow: inset 0 0 0 3px var(--gold), 0 0 16px 4px rgba(255, 213, 79, .85);
    animation: glow 1.15s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: inset 0 0 0 3px rgba(201, 162, 39, .75), 0 0 10px 2px rgba(255, 213, 79, .5);
    }
    50% {
        box-shadow: inset 0 0 0 4px #ffe082, 0 0 22px 7px rgba(255, 213, 79, 1);
    }
}

/* koňská silueta v rozích (jemný vodoznak) */
.corner-horse {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    opacity: .09;
    filter: grayscale(1);
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.cell.corner {
    background: radial-gradient(circle at 50% 38%, #fff8e2, #e6d8b2);
}

.cell.corner .face {
    transform: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3px;
}

.cell.corner .icon {
    font-size: 28px;
}

.cell.corner .nm {
    flex: 0;
    font-size: 9px;
    line-height: 1.1;
}

.houses {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 10px;
    z-index: 2;
    color: #0a3d1f;
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(255, 255, 255, .6);
}

.mort {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 8px;
    z-index: 2;
    color: #fff;
    font-weight: 800;
    background: #b71c1c;
    padding: 0 3px;
    border-radius: 3px;
}

/* žetony hráčů – lesklé 3D s iniciálou */
.tokens {
    position: absolute;
    bottom: 2px;
    left: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 92%;
    z-index: 3;
}

.token {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, .85);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .55), inset 0 -2px 3px rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .75);
    transition: background .1s;
}

.token::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.token.hop {
    animation: hop .14s ease;
    z-index: 7;
    box-shadow: 0 4px 9px rgba(0, 0, 0, .6);
}

@keyframes hop {
    0% {
        transform: translateY(0) scale(1)
    }
    45% {
        transform: translateY(-10px) scale(1.35)
    }
    100% {
        transform: translateY(0) scale(1)
    }
}

/* střed – zelený filc */
#center {
    grid-column: 2/11;
    grid-row: 2/11;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px;
    background: radial-gradient(circle at 50% 36%, #2f8050 0%, #1d5135 62%, #143a26 100%);
    box-shadow: inset 0 0 70px rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(255, 255, 255, .06), inset 0 0 0 6px rgba(0, 0, 0, .18);
}

.felt-horse {
    position: absolute;
    bottom: -10px;
    right: 6px;
    font-size: 240px;
    line-height: 1;
    opacity: .10;
    filter: grayscale(1) brightness(1.7);
    pointer-events: none;
    user-select: none;
    transform: rotate(-8deg);
    z-index: 0;
}

#center .logo, #center .sub, #center #dice {
    position: relative;
    z-index: 1;
}

#center .logo {
    font-size: 48px;
    font-weight: 900;
    color: #f3e9c6;
    letter-spacing: 3px;
    transform: rotate(-6deg);
    text-shadow: 2px 3px 0 #0c2a18, 0 0 20px rgba(0, 0, 0, .45);
}

#center .sub {
    color: #d4ecd8;
    font-weight: 700;
    letter-spacing: 8px;
    font-size: 13px;
    text-shadow: 0 1px 3px #000;
}

#dice {
    display: flex;
    gap: 16px;
}

.die {
    width: 56px;
    height: 56px;
    background: linear-gradient(160deg, #fff, #e6e6e6);
    border: 1px solid #b9c9bd;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #222;
    box-shadow: 0 5px 0 #9fb0a4, 0 7px 12px rgba(0, 0, 0, .4);
}

.die.roll {
    animation: shake .5s;
}

@keyframes shake {
    0%, 100% {
        transform: translateY(0)
    }
    25% {
        transform: translateY(-9px) rotate(-10deg)
    }
    75% {
        transform: translateY(-5px) rotate(10deg)
    }
}

/* ---------- SIDE PANEL ---------- */
#panel {
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--panel);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}

.card h2 {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--green);
    border-bottom: 2px solid #e3dcc0;
    padding-bottom: 4px;
}

.players .p {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: #f6f3e4;
}

.players .p.active {
    outline: 3px solid var(--gold);
    background: #fff8e1;
}

.players .p.dead {
    opacity: .45;
    text-decoration: line-through;
}

.swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: relative;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .85);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .5), inset 0 -2px 3px rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .7);
}

.swatch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%);
}

.pname {
    font-weight: 700;
    flex: 1;
    font-size: 13px;
}

.pcash {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: #1b5e20;
    font-size: 13px;
}

.ptag {
    font-size: 10px;
    background: #37474f;
    color: #fff;
    padding: 1px 5px;
    border-radius: 8px;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 9px 12px;
    font-weight: 700;
    font-size: 13px;
    background: var(--green);
    color: #fff;
    box-shadow: 0 3px 0 #1b5e20;
}

button:hover {
    filter: brightness(1.08);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #1b5e20;
}

button:disabled {
    background: #9e9e9e;
    box-shadow: 0 3px 0 #6d6d6d;
    cursor: not-allowed;
    opacity: .7;
}

button.alt {
    background: #1565c0;
    box-shadow: 0 3px 0 #0d47a1;
}

button.warn {
    background: #c62828;
    box-shadow: 0 3px 0 #8e0000;
}

button.ghost {
    background: #eceadb;
    color: #333;
    box-shadow: 0 3px 0 #c9c5af;
}

.btnrow {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#log {
    height: 190px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.5;
    background: #1c2b20;
    color: #d7ead9;
    padding: 8px 10px;
    border-radius: 8px;
}

#log .e {
    margin-bottom: 3px;
}

#log .gold {
    color: #ffd54f;
}

#log .red {
    color: #ff8a80;
}

#log .blue {
    color: #90caf9;
}

.hint {
    font-size: 12px;
    color: #555;
    min-height: 18px;
}

/* setup + modal overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal {
    background: var(--panel);
    border-radius: 12px;
    padding: 22px;
    width: 440px;
    max-width: 92vw;
    max-height: 88vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.modal h2 {
    margin: 0 0 12px;
    color: var(--green);
}

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

select, input[type=number], input[type=text] {
    padding: 7px 9px;
    border: 2px solid #cfc9aa;
    border-radius: 7px;
    font-family: inherit;
    font-size: 13px;
    flex: 1;
}

.seatRow {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 6px 0;
}

.seatRow .sw {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 2px #000;
}

.propItem {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 7px;
    background: #f6f3e4;
    margin-bottom: 5px;
    font-size: 12px;
}

.propItem .pn {
    flex: 1;
    font-weight: 700;
}

.propItem button {
    padding: 5px 8px;
    font-size: 11px;
}

.grpDot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #333;
    flex: 0 0 auto;
}

.center {
    text-align: center;
}

.small {
    font-size: 11px;
    color: #666;
}

#footer {
    text-align: center;
    margin: 22px auto 6px;
    color: #cfe0d2;
    font-size: 12px;
    letter-spacing: .5px;
    text-shadow: 0 1px 3px #000;
}

#footer a {
    color: #ffd54f;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

/* karta Náhoda / Finance (lightbox) */
.gamecard {
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid var(--accent);
    background: linear-gradient(180deg, #fffef9, #f1e9d4);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
    text-align: center;
    animation: cardIn .42s cubic-bezier(.2, 1.25, .4, 1);
}

.gc-head {
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    letter-spacing: 3px;
    padding: 9px;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.gc-body {
    padding: 6px 18px 18px;
    position: relative;
}

.gc-body::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px dashed var(--accent);
    opacity: .35;
    border-radius: 10px;
    pointer-events: none;
}

.gc-icon {
    font-size: 58px;
    margin: 14px 0 6px;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .28));
}

.gc-text {
    font-size: 17px;
    font-weight: 600;
    color: #2a2418;
    padding: 2px 6px 6px;
    line-height: 1.35;
    position: relative;
}

.gc-eff {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}

@keyframes cardIn {
    0% {
        transform: scale(.55) rotate(-7deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}
