/* Feldherr: Aufstellung, Brett, Seitenleiste. Farben aus den Paletten in app.css (.app.theme-*). */

.st-game {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.st-main { flex: 0 0 auto; position: relative; padding: .6rem; }
.st-side { flex: 0 0 auto; padding: 0 .6rem .6rem; }
.st-side .card { margin-bottom: .6rem; }

@media (min-width: 960px) {
    .st-game { flex-direction: row; overflow: hidden; }
    .st-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; overflow-y: auto; padding: .8rem; }
    .st-side { flex: 0 0 360px; overflow-y: auto; padding: .8rem .8rem .8rem 0; }
}

.st-status {
    display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center;
    width: 100%; max-width: min(100%, 78vh);
    padding: .4rem .2rem; font-size: .95rem;
}

/* --- Brett --------------------------------------------------------------- */

.st-board {
    display: grid;
    grid-template-columns: repeat(var(--cols, 10), 1fr);
    gap: 2px;
    width: 100%;
    max-width: min(100%, 78vh);
    aspect-ratio: 1;
    padding: 4px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface-3) 70%, #000 30%);
    box-shadow: var(--shadow);
}
.st-board-setup { aspect-ratio: 10 / 4; }

.st-cell {
    display: flex; align-items: center; justify-content: center;
    margin: 0; padding: 0; min-height: 0;
    border: 0; border-radius: 4px;
    background: color-mix(in srgb, var(--accent-2) 22%, var(--surface) 78%);
    color: var(--ink);
    cursor: default;
    position: relative;
    aspect-ratio: 1;
}
.st-cell:nth-child(odd) { background: color-mix(in srgb, var(--accent-2) 30%, var(--surface) 70%); }
.st-cell.lake { background: color-mix(in srgb, var(--accent) 45%, #0b2540 55%); cursor: not-allowed; opacity: 1; }
.st-cell.lake::after { content: "≈"; color: rgba(255,255,255,.45); font-size: 1.2em; }
.st-cell.pickable { cursor: pointer; }
.st-cell.pickable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-cell.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.st-cell.target { cursor: pointer; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 80%, transparent); }
.st-cell.target::before { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: var(--accent); opacity: .85; }
.st-cell.target.attack::before { display: none; }
.st-cell.target.attack { box-shadow: inset 0 0 0 3px var(--error); }
.st-cell.last { background: color-mix(in srgb, var(--accent) 25%, var(--surface) 75%); }
.st-cell.empty.target { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }

.st-piece {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
    width: 86%; height: 86%;
    border-radius: 6px;
    font-weight: 800;
    font-size: clamp(.8rem, 2.6vmin, 1.4rem);
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
    box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.18);
    user-select: none;
    overflow: hidden;
}
/* Der Rangname steht unter der Zahl, sobald ein Feld breit genug ist; auf dem Handy bleibt er im Tooltip
   und in der Stückliste (dort steht Zahl neben Name). */
.st-piece .st-name {
    display: none;
    font-size: clamp(.45rem, 1.1vmin, .62rem);
    font-weight: 600;
    letter-spacing: .01em;
    opacity: .92;
    max-width: 96%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-top: .12em;
}
@media (min-width: 640px) {
    .st-piece .st-name { display: block; }
}
.st-piece.foe:not(.revealed) .st-name { display: none; }
/* Seitenfarben: die gewählte Farbe (Farbwahl der Plattform) kommt als --st-c0/--st-c1 samt dunkler Schrift von der
   Tabelle; ohne Wahl (Räume von vor der Farbwahl) bleibt es bei Rot und Blau. Eigene Steine tragen ihre Seite, so
   sieht auch Blau seine Steine blau. */
.st-piece.side-0, .st-dot.side-0, .st-list th.side-0 { background: var(--st-c0, #b8382f); color: var(--st-ink0, #fff); text-shadow: var(--st-shadow0, 0 1px 2px rgba(0,0,0,.5)); }
.st-piece.side-1, .st-dot.side-1, .st-list th.side-1 { background: var(--st-c1, #2f5fb3); color: var(--st-ink1, #fff); text-shadow: var(--st-shadow1, 0 1px 2px rgba(0,0,0,.5)); }
.st-piece.foe:not(.revealed) { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 4px, transparent 4px 8px); }
.st-piece.foe:not(.revealed)::after { content: "?"; opacity: .7; }
.st-piece.foe:not(.revealed) { flex-direction: row; }
.st-piece.foe.moved:not(.revealed)::after { content: "?"; opacity: .9; }
.st-piece.foe.moved:not(.revealed) { box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.5); }
.st-piece.revealed { box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 2px #ffd166; }
.st-piece.big { width: 64px; height: 64px; font-size: 2rem; border-radius: 10px; }
.st-piece.big .st-name, .st-piece.tiny .st-name { display: none; }
.st-piece.tiny { width: 1.4em; height: 1.4em; font-size: .75rem; border-radius: 4px; margin-right: .3rem; }
.st-list th.side-0, .st-list th.side-1 { border-radius: 4px; padding: .2rem .4rem; }

/* --- Aufstellung --------------------------------------------------------- */

.st-setup { width: 100%; max-width: min(100%, 78vh); display: flex; flex-direction: column; gap: .6rem; }
.st-setup-head { display: flex; flex-direction: column; gap: .2rem; }
.st-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .35rem; }
.st-tray-item {
    display: flex; align-items: center; gap: .4rem;
    margin: 0; padding: .3rem .5rem; min-height: 44px;
    font-size: .85rem;
}
.st-tray-item .st-piece { width: 30px; height: 30px; font-size: .95rem; flex: 0 0 auto; }
.st-tray-item .st-piece .st-name { display: none; }
.st-tray-item .st-tray-name { flex: 1 1 auto; text-align: left; white-space: normal; line-height: 1.1; }
.st-tray-item b { flex: 0 0 auto; min-width: 1.4em; text-align: right; }
.st-tray-item.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.st-tray-item.empty { opacity: .35; }
.st-setup-actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.st-setup-actions .primary { margin-left: auto; }
.st-wait { max-width: 480px; margin: 1rem auto; }

/* --- Seitenleiste ---------------------------------------------------------- */

.st-seats { list-style: none; padding: 0; margin: 0; }
.st-seats li { display: flex; align-items: center; gap: .4rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.st-seats li:first-child { border-top: 0; }
.st-seats li.active .pname { font-weight: 700; }
.st-seats li.active::after { content: "am Zug"; margin-left: auto; font-size: .7rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.st-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.st-list { width: 100%; border-collapse: collapse; font-size: .85rem; }
.st-list th, .st-list td { padding: .15rem .3rem; text-align: left; border-bottom: 1px solid var(--line); }
.st-list tbody th { font-weight: 500; white-space: nowrap; }
.st-list td.num { text-align: right; font-variant-numeric: tabular-nums; }
.st-list td.gone { color: var(--muted); text-decoration: line-through; }
.st-log ul { list-style: none; padding: 0; margin: 0; font-size: .85rem; max-height: 40vh; overflow-y: auto; }
.st-log li { padding: .2rem 0; border-top: 1px solid var(--line); }
.st-log li:first-child { border-top: 0; }
.st-log li .muted { display: inline-block; min-width: 2.2em; }

/* --- Aufdeck-Moment ---------------------------------------------------------- */

.st-flash {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    animation: st-flash 2.8s ease-out forwards;
}
.st-flash-inner {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: .8rem 1rem; align-items: center;
    padding: 1rem 1.4rem; border-radius: 14px;
    background: rgba(8, 13, 28, .92); color: #fff;
    box-shadow: 0 8px 30px rgba(0,0,0,.6);
    text-align: center; font-size: .9rem;
}
.st-flash-side { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.st-flash-vs { font-size: 1.6rem; }
.st-flash-verdict { grid-column: 1 / -1; font-weight: 800; font-size: 1.15rem; }
.st-flash.flag .st-flash-verdict { color: #ffd166; }
@keyframes st-flash {
    0% { opacity: 0; transform: scale(.9); }
    10% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .st-flash { animation: none; opacity: 0; } }
