/* Process Chart Game — оформление в одном стиле с agile.iowasolutions.kz.
   Разметка осталась от старого движка (ul#masterList > div#mixed/div.pane > ul > li),
   поэтому сетка строится на самом #masterList, а карточки — это li. */

:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --ink: #1d2733;
    --muted: #6a7a8c;
    --line: #d5dfea;
    --brand: #0f4c81;
    --brand-soft: #e6eef7;
    --accent: #1a9e8f;
    --warn: #c2410c;
    --err: #d64545;
    --ok: #2f9e44;
    --card: #f4f8fc;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 40, 70, .08), 0 6px 18px rgba(20, 40, 70, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
    max-width: 1480px;
    margin: 0 auto;
    padding: 16px 18px 40px;
}

/* ---------- шапка ---------- */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding: 6px 0 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.brand .mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .5px;
}

.brand h1 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
}

.brand p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.lang {
    display: inline-flex;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 9px;
    overflow: hidden;
}

.lang button {
    font: inherit;
    cursor: pointer;
    border: 0;
    background: none;
    color: var(--ink);
    padding: 8px 14px;
    transition: background .15s, color .15s;
}

.lang button + button { border-left: 1px solid var(--line); }
.lang button:hover { background: var(--brand-soft); }
.lang button.on { background: var(--brand); color: #fff; }

/* ---------- панель кнопок ---------- */
.bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.btn {
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    border-radius: 8px;
    padding: 8px 13px;
    transition: background .15s, border-color .15s, color .15s;
    display: inline-block;
}

.btn:hover { border-color: var(--brand); text-decoration: none; }

.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn.primary:hover { background: #0c3d68; }

#r {
    margin-left: auto;
    font-size: 13.5px;
    color: var(--muted);
}

#r strong { color: var(--ink); }

/* ---------- поле игры ---------- */
#masterList {
    display: grid;
    grid-template-columns: 300px repeat(5, minmax(190px, 1fr));
    gap: 12px;
    align-items: start;
    list-style: none;
    margin: 0;
    padding: 0;
}

#mixed, .pane {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 150px;
    width: auto;
    margin: 0;
}

#mixed {
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 24px);
}

.containerTitle {
    display: block;
    padding: 11px 12px;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    font-size: 14.5px;
    text-align: left;
    cursor: default;
}

#mixed .containerTitle { background: #37475a; }

#masterList ul {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    min-height: 80px;
}

#mixed ul { padding-bottom: 14px; }

/* ---------- карточки ---------- */
#masterList li {
    background: var(--card);
    border: 1px solid #cdd9e6;
    border-left: 3px solid var(--brand);
    border-radius: 8px;
    padding: 8px 10px;
    margin: 0;
    font-size: 13px;
    line-height: 1.38;
    cursor: grab;
    list-style: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#masterList li:hover { background: #fff; }

#masterList li.unmovable {
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    font-size: 1px;
    min-height: 0;
}

#masterList li span { font-weight: 600; }

.bullet {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 6px;
    border-radius: 20px;
    background: #fde8d6;
    color: var(--warn);
    font-size: 11.5px;
    font-weight: 700;
}

.correct {
    display: block;
    padding-top: 5px;
    margin-top: 5px;
    border-top: 1px dotted #c9a3a3;
    font-size: 12px;
    color: #9c2b2b;
}

/* ---------- правила ---------- */
details.about {
    display: block;
    max-width: 100%;
    margin: 0 0 12px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    line-height: 1.5;
}

details.about summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand);
    font-size: 14px;
    list-style: none;
}

details.about summary::-webkit-details-marker { display: none; }

details.about summary::before {
    content: "\25B8";
    display: inline-block;
    margin-right: 7px;
    transition: transform .15s;
}

details.about[open] summary::before { transform: rotate(90deg); }

details.about .aboutBody { margin: 10px 0 2px; }

details.about p { margin: 0 0 8px; font-size: 13.5px; }
details.about p.strongLine { font-weight: 600; margin-bottom: 3px; }
details.about p.origin { color: var(--brand); }
details.about p.fineprint { font-size: 12px; color: var(--muted); margin-bottom: 0; }
details.about ol { margin: 0 0 10px; padding-left: 22px; }

details.about li {
    list-style-type: decimal;
    border: 0;
    background: none;
    cursor: default;
    margin: 0;
    padding: 2px 0;
    font-size: 13.5px;
}

p.credit {
    max-width: 100%;
    margin: 0 auto 6px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

p.crosslink {
    margin: 0 0 12px;
    padding: 9px 14px;
    border: 1px solid #cfe3d6;
    border-radius: var(--radius);
    background: #f2f9f5;
    font-size: 13px;
    text-align: center;
}

p.crosslink a { font-weight: 600; }

/* ---------- режим «на баллы» ---------- */
#scoreBar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    font-size: 13.5px;
}

#scoreToggle {
    font-weight: 600;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 12px;
}

#scoreToggle:hover { border-color: var(--brand); text-decoration: none; }

#scoreBox {
    display: none;
    padding: 3px 11px;
    border-radius: 20px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

#scoreBox.low { background: #fdeaea; color: var(--err); }

#scoreNote.good { color: #1f6b2c; }
#scoreNote.bad { color: #9c2b2b; }


/* ---------- победный экран ---------- */
.winBox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(16, 30, 48, .55);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.winCard {
    max-width: 420px;
    width: 100%;
    background: var(--panel);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(10, 25, 45, .35);
    padding: 26px 24px 22px;
    text-align: center;
    animation: winPop .35s ease;
}

@keyframes winPop {
    from { transform: scale(.9) translateY(12px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.winPhoto {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--brand-soft);
    box-shadow: 0 6px 18px rgba(15, 76, 129, .25);
}

.winTitle { margin: 12px 0 6px; font-size: 21px; color: var(--brand); }
.winText { margin: 0 0 12px; font-size: 14px; }
.winByErnar { margin: 0 0 10px; font-size: 14.5px; line-height: 1.5; font-style: italic; }
.winSign { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); }

/* ---------- подсказка к карточке ---------- */
#cardTip {
    position: fixed;
    z-index: 9999;
    max-width: 330px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 8px 24px rgba(20, 40, 70, .18);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--ink);
    pointer-events: none;
}

#cardTip b {
    display: block;
    color: var(--brand);
    font-size: 13px;
    margin-bottom: 5px;
}

#cardTip p { margin: 0 0 6px; }

#cardTip .tools {
    display: block;
    padding-top: 5px;
    border-top: 1px dotted var(--line);
    color: var(--muted);
}

/* ---------- подвал и мелочи ---------- */
small {
    display: block;
    margin: 10px 0;
    padding: 10px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--muted);
}

hr { display: none; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
    #masterList { grid-template-columns: repeat(3, minmax(200px, 1fr)); }
    #mixed {
        grid-column: 1 / -1;
        position: static;
        max-height: 340px;
    }
}

@media (max-width: 720px) {
    .wrap { padding: 12px 12px 32px; }
    #masterList { grid-template-columns: 1fr; }
    #mixed { max-height: 300px; }
    .brand h1 { font-size: 17px; }
    .bar { position: sticky; top: 0; z-index: 20; }
}
