/* В Tinkumo нет общей переменной наведения на второстепенные кнопки */
:root { --secondary_button_hover: #f2f4f5; }

/* Город Образавра: игровое поле на всю высоту под навигацией */

.city {
    --city_sky_top: #a9dcff;
    --city_sky_bottom: #e8f6ff;
    --city_cloud: rgba(255, 255, 255, .85);
    position: fixed;
    /* --city_subnav — полоса меню ученика Tinkumo под шапкой (ставит city.js) */
    inset: calc(var(--nav_height) + var(--city_subnav, 0px)) 0 0;
    overflow: hidden;
    background: linear-gradient(180deg, var(--city_sky_top) 0%, var(--city_sky_bottom) 70%);
    color: var(--main);
    user-select: none;
    -webkit-user-select: none;
}

.darkmode .city {
    --city_sky_top: #0d1f30;
    --city_sky_bottom: #1d3447;
    --city_cloud: rgba(255, 255, 255, .07);
}

.city_defs {
    position: absolute;
}

.city_cloud {
    position: absolute;
    height: 34px;
    border-radius: 40px;
    background: var(--city_cloud);
    animation: city_drift linear infinite;
}

.city_cloud::before,
.city_cloud::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: inherit;
}

.city_cloud::before { left: 14%; top: -62%; width: 46%; height: 150%; }
.city_cloud::after { right: 16%; top: -40%; width: 34%; height: 120%; }

@keyframes city_drift {
    from { transform: translateX(-30vw); }
    to { transform: translateX(130vw); }
}

.city_stage {
    position: absolute;
    inset: 0;
    touch-action: none;
    cursor: grab;
}

.city_stage.dragging { cursor: grabbing; }
.city_stage.placing { cursor: crosshair; }

.city_canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.city_canvas[hidden] { display: none; }

.city_world {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    overflow: visible;
    transform-origin: 0 0;
    will-change: transform;
}

.city_world .tap { cursor: pointer; }
.city_bob { animation: city_bob 1.4s ease-in-out infinite; }
#city_bubbles.calm .city_bob { animation: none; }
/* До занятий готовое видно, но собрать нельзя */
#city_bubbles.locked { opacity: .5; }
.city_hop { animation: city_hop 3.2s ease-in-out infinite; }
.city_hl { animation: city_pulse 1.2s ease-in-out infinite; }

@keyframes city_bob { 50% { transform: translateY(-6px); } }
@keyframes city_hop { 0%, 80%, 100% { transform: translateY(0); } 86% { transform: translateY(-7px); } 92% { transform: translateY(0); } }
@keyframes city_pulse { 50% { opacity: .55; } }

.city_svgt {
    font-family: var(--main_font);
    font-weight: var(--main_boldest_weight);
    font-size: 13px;
    fill: #fff;
    paint-order: stroke;
    stroke: rgba(32, 33, 36, .55);
    stroke-width: 3px;
}

/* Верхняя панель */

.city_hud {
    position: absolute;
    top: 12px;
    left: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}

.city_hud > * { pointer-events: auto; }

.city_title {
    min-width: 0;
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.city_title button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 12px 6px 14px;
    border: var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--main);
    font: inherit;
    font-family: var(--header_font);
    font-weight: var(--header_weight);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s;
}

.city_title button:hover { background: var(--secondary_button_hover); }

.city_title span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.city_title svg {
    flex: none;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--secondary);
    stroke-width: 2;
    stroke-linejoin: round;
}

.city_res {
    display: flex;
    gap: 6px;
}

.city_pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 62px;
    padding: 4px 12px 4px 5px;
    border: var(--border);
    border-radius: 999px;
    background: var(--white);
    font-weight: var(--main_boldest_weight);
    font-size: 16px;
}

.city_pill img,
.city_pill svg {
    flex: none;
    width: 26px;
    height: 26px;
}

.city_pill b i {
    color: var(--secondary);
    font-style: normal;
    font-weight: var(--main_bolder_weight);
    font-size: 13px;
}

.city_pill.bump { animation: city_bump .4s; }

@keyframes city_bump { 40% { transform: scale(1.14); } }

.city_banner {
    position: absolute;
    top: 62px;
    left: 50%;
    z-index: 6;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 16px;
    border: var(--border);
    border-radius: 999px;
    background: var(--white);
    font-weight: var(--main_bolder_weight);
    white-space: nowrap;
    transform: translateX(-50%);
}

.city_banner.on { display: flex; }

.city_banner button {
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--secondary_background);
    color: var(--secondary);
    font: inherit;
    cursor: pointer;
    transition: background-color .2s;
}

.city_banner button:hover { background: var(--secondary_button_hover); }

/* Плашка над кнопками: собирать можно после занятий */
.city_study {
    position: absolute;
    left: 50%;
    bottom: 82px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 6px 6px 6px 12px;
    border: var(--border);
    border-radius: 24px;
    background: var(--white);
    font-weight: var(--main_bolder_weight);
    line-height: 1.25;
    transform: translateX(-50%);
}

.city_study[hidden] { display: none; }
.city_study img { width: 24px; height: 24px; flex: none; }
.city_study .btn { flex: none; padding: 8px 16px; }

/* До занятий только смотреть: кнопки действий и карточки построек бледные */
.city_view_only .city_sheet .city_acts .btn,
.city_view_only .city_sheet .city_toggle,
.city_view_only .city_card { opacity: .5; }

/* То же в окне постройки и в меню */
.city_lock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    font-weight: var(--main_bolder_weight);
}

.city_lock img { width: 22px; height: 22px; }

.city_dock {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 20px;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
}

.city_dock > * { pointer-events: auto; }

.city_dock .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.city_dock .btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.city_dock [hidden],
.city_dock[hidden],
.city_res[hidden] { display: none; }

/* Нижняя шторка */

.city_sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    transform: translateY(calc(100% + 40px));
    transition: transform .26s ease;
    pointer-events: none;
}

.city_sheet.open { transform: none; }

.city_sheet_card {
    position: relative;
    width: 100%;
    max-width: 820px;
    max-height: 72%;
    overflow: auto;
    padding: 18px 16px 22px;
    border: var(--border);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: var(--white);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
    pointer-events: auto;
}

.city_sheet { max-height: 100%; }

.city_x {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--secondary_background);
    color: var(--secondary);
    cursor: pointer;
    transition: background-color .2s;
}

.city_x:hover { background: var(--secondary_button_hover); }

.city_edit {
    position: absolute;
    top: 12px;
    right: 52px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--secondary_background);
    color: var(--secondary);
    cursor: pointer;
    transition: background-color .2s;
}

.city_edit:hover { background: var(--secondary_button_hover); }
.city_edit.on { background: var(--lightblue); color: var(--accent); }

.city_edit svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linejoin: round;
}

.city_head.wide { padding-right: 76px; }

.city_x svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.city_sheet h3 {
    margin: 0 0 4px;
    padding-right: 40px;
    font-size: 20px;
}

.city_sheet h4 {
    margin: 16px 0 0;
    font-size: 16px;
}

.city_head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 36px;
}

.city_head .city_thumb {
    flex: none;
    width: 92px;
    height: 138px;
}

.city_head p,
.city_note {
    margin: 0;
    color: var(--secondary);
    line-height: 1.4;
}

.city_note {
    margin-top: 6px;
    font-size: 14px;
}

.city_note a { color: var(--accent); }

.city_status {
    margin-top: 14px;
    font-weight: var(--main_bolder_weight);
}

.city_status > svg {
    width: 20px;
    height: 20px;
    vertical-align: -5px;
}

.city_status .sub {
    color: var(--secondary);
    font-weight: var(--main_weight);
}

.city_pbar {
    height: 10px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--lightgray);
}

.city_pbar i {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: var(--green);
}

.city_pbar.up i { background: var(--lighter_accent); }

.city_level {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-weight: var(--main_bolder_weight);
}

.city_dots {
    display: inline-flex;
    gap: 4px;
}

.city_dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--lightgray);
}

.city_dots i.on { background: var(--accent); }

.city_fx {
    margin-top: 6px;
    line-height: 1.4;
}

.city_fx .sub { color: var(--secondary); }

.city_next {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.city_next .city_thumb {
    flex: none;
    width: 56px;
    height: 84px;
}

.city_acts .city_costs,
.city_acts .city_tag { align-self: center; }

.city_manage .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.city_manage .city_chip { color: var(--main); }

.city_trade {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.city_trade > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 110px;
    font-weight: var(--main_boldest_weight);
}

.city_trade svg {
    width: 22px;
    height: 22px;
}

.city_trade .btn { padding: 8px 14px; }

/* Рынок: что отдать и что взять */
.city_pick {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.city_pick > span {
    min-width: 64px;
    color: var(--secondary);
    font-size: 14px;
}

.city_pick button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: var(--border);
    border-radius: 12px;
    background: var(--white);
    cursor: pointer;
}

.city_pick button svg { width: 26px; height: 26px; }
.city_pick button.on { border: 2px solid var(--blue3); background: var(--secondary_background); }

/* Выбор страны флага */
.city_flag_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.city_flag {
    display: grid;
    place-items: center;
    padding: 6px;
    border: var(--border);
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
}

.city_flag svg { width: 100%; max-width: 36px; height: auto; display: block; }
.city_flag.on { border: 2px solid var(--blue3); background: var(--secondary_background); }

/* Пристань: заказы */
.city_order {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border: var(--border);
    border-radius: 14px;
    font-weight: var(--main_bolder_weight);
}

.city_order.wait { color: var(--secondary); }

/* Задания дня в окне ратуши */
.city_quest {
    margin-top: 10px;
    padding: 10px 12px;
    border: var(--border);
    border-radius: 14px;
}

.city_quest.done { border-color: #32bf4c; }
.city_quest.got { opacity: .6; }
.city_quest_t { font-weight: var(--main_boldest_weight); }
.city_quest .city_pbar { margin: 8px 0 6px; }
.city_quest_row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.city_quest_row .btn, .city_quest_row .city_tag { margin-left: auto; }
.city_quest_row .btn { padding: 8px 14px; }
.city_order_acts { display: flex; gap: 6px; margin-left: auto; }
.city_order .btn { padding: 8px 14px; }

.city_skip {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: var(--border);
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
}

.city_skip svg {
    width: 16px;
    height: 16px;
    stroke: var(--secondary);
    stroke-width: 2.4;
    stroke-linecap: round;
}

/* Пекарня и плавильня: переключатель автозапуска */
.city_toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--main);
    font: inherit;
    font-weight: var(--main_bolder_weight);
    cursor: pointer;
}

.city_toggle i {
    position: relative;
    flex: none;
    width: 44px;
    height: 26px;
    border-radius: 13px;
    background: var(--lightgray);
    transition: background .2s;
}

.city_toggle i::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .2s;
}

.city_toggle.on i { background: var(--green); }
.city_toggle.on i::after { transform: translateX(18px); }

.city_rename {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.city_input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--main);
    font: inherit;
}

.city_input:focus {
    border-color: var(--blue3);
    outline: none;
}

.city_acts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.city_cards {
    display: flex;
    gap: 10px;
    margin: 10px -16px 0;
    padding: 2px 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* Карточка прилипает к краю с тем же отступом, что и у ряда без прокрутки */
    scroll-padding: 0 16px;
}

.city_card {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 140px;
    padding: 8px 8px 10px;
    border: var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--main);
    font: inherit;
    text-align: center;
    scroll-snap-align: start;
    cursor: pointer;
    transition: background-color .2s;
}

.city_card:hover { background: var(--secondary_button_hover); }
.city_card.lock,
.city_card.done { opacity: .55; }

.city_card .city_thumb {
    width: 104px;
    height: 136px;
}

.city_card b {
    font-size: 14px;
    font-weight: var(--main_boldest_weight);
}

.city_card .eff {
    min-height: 32px;
    color: var(--secondary);
    font-size: 12px;
    line-height: 1.3;
}

.city_costs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 13px;
    font-weight: var(--main_boldest_weight);
}

.city_chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px 1px 2px;
    border-radius: 999px;
    background: var(--secondary_background);
}

.city_chip img,
.city_chip svg {
    width: 18px;
    height: 18px;
}

.city_chip.short { color: var(--red); }

.city_tag {
    color: var(--secondary);
    font-size: 13px;
    font-weight: var(--main_bolder_weight);
}

/* Для гостей */

.city_guest {
    position: absolute;
    inset: 0;
    z-index: 15;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 16px 24px;
}

.city_guest[hidden] { display: none; }

.city_guest_card {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    border: var(--border);
    border-radius: 24px;
    background: var(--white);
    text-align: center;
}

.city_guest_card h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.city_guest_card p {
    margin: 0;
    color: var(--secondary);
    line-height: 1.45;
}

.city_guest_btns {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.city_toast {
    position: absolute;
    top: 64px;
    left: 50%;
    z-index: 30;
    max-width: calc(100% - 32px);
    padding: 9px 16px;
    border-radius: 999px;
    background: #202124;
    color: #fff;
    font-weight: var(--main_bolder_weight);
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, -10px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}

.city_toast.on {
    opacity: 1;
    transform: translate(-50%, 0);
}

.city_fly {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    width: 28px;
    height: 28px;
    pointer-events: none;
}

.city_fly img,
.city_fly svg {
    width: 100%;
    height: 100%;
}

.city_plus {
    position: fixed;
    z-index: 41;
    color: #fff;
    font-weight: var(--main_boldest_weight);
    font-size: 20px;
    white-space: nowrap;
    text-shadow: 0 2px 0 #1a7f2c, 2px 0 0 #1a7f2c, -2px 0 0 #1a7f2c, 0 -2px 0 #1a7f2c, 0 4px 6px rgba(0, 0, 0, .25);
    pointer-events: none;
    animation: city_rise 1s forwards;
}

@keyframes city_rise { to { transform: translateY(-40px); opacity: 0; } }

.city_spark {
    position: fixed;
    z-index: 41;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    pointer-events: none;
    animation: city_spark .8s ease-out forwards;
}

@keyframes city_spark { to { transform: translate(var(--dx), var(--dy)) rotate(200deg) scale(.4); opacity: 0; } }

@media (max-width: 639px) {
    .city_hud {
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .city_title { width: 100%; font-size: 15px; }
    .city_res { margin-left: auto; }
    .city_banner { top: 140px; }
    .city_toast { top: 140px; }
    .city_pill {
        min-width: 0;
        padding-right: 10px;
        font-size: 15px;
    }
    .city_pill img,
    .city_pill svg { width: 22px; height: 22px; }
    /* Семь счетчиков в две строки справа: вместимость видна в окнах складов */
    .city_res { flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
    .city_pill { gap: 3px; padding: 3px 8px 3px 3px; font-size: 14px; }
    .city_pill b i { display: none; }
    .city_dock .btn { padding: 12px 16px; }
}

/* Управление городом: кнопка под названием, панель слева — производство по ресурсам и реестр построек */

.city_left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.city_panel_btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 10px;
    border: var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--main);
    font: inherit;
    font-size: 15px;
    font-weight: var(--main_bolder_weight);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s;
}

.city_panel_btn:hover,
.city_panel_btn[aria-expanded="true"] { background: var(--secondary_button_hover); }
.city_panel_btn[hidden] { display: none; }

.city_panel_btn svg {
    flex: none;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.4;
    stroke-linecap: round;
}

.city_panel {
    position: absolute;
    top: var(--city_panel_top, 104px);
    left: 16px;
    bottom: 16px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    width: 400px;
    max-width: calc(100% - 32px);
    overflow: hidden;
    border: var(--border);
    border-radius: 24px;
    background: var(--white);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-12px);
    transition: opacity .2s, transform .2s, visibility .2s;
}

.city_panel.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.city_panel_head {
    position: relative;
    flex: none;
    padding: 16px 16px 2px;
}

.city_panel_head h2 {
    margin: 0;
    padding-right: 40px;
    font-size: 20px;
}

.city_panel_body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0 16px 18px;
}

.city_panel h4 {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 18px 0 8px;
    font-size: 16px;
}

.city_panel h4 span {
    color: var(--secondary);
    font-size: 14px;
    font-weight: var(--main_bolder_weight);
}

/* Группы построек в реестре */
.city_panel h5 {
    margin: 14px 0 2px;
    color: var(--secondary);
    font-size: 12px;
    font-weight: var(--main_boldest_weight);
    letter-spacing: .03em;
    text-transform: uppercase;
}

.city_panel h5 span { margin-left: 2px; }
.city_panel_speed { margin: -4px 0 8px; font-size: 12px; }

.city_panel_collect {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 6px 6px 6px 12px;
    border-radius: 16px;
    background: var(--secondary_background);
    font-weight: var(--main_bolder_weight);
}

.city_panel_collect .btn,
.city_reg_row > .btn { flex: none; padding: 6px 14px; font-size: 13px; }
.city_reg_row > .btn.secondary { padding: 5px 12px; }

/* Ресурсы: добыча минус расход за час, запас на складах */
.city_flow {
    display: grid;
    gap: 6px;
}

.city_flow_row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas: "i n r" "i s h" ". f f";
    column-gap: 10px;
    align-items: center;
    padding: 8px 12px 10px 10px;
    border-radius: 16px;
    background: var(--secondary_background);
}

.city_flow_row > svg {
    grid-area: i;
    align-self: start;
    width: 28px;
    height: 28px;
    margin-top: 2px;
}

.city_flow_name { grid-area: n; font-weight: var(--main_boldest_weight); }

.city_flow_rate {
    grid-area: r;
    justify-self: end;
    font-weight: var(--main_boldest_weight);
    white-space: nowrap;
}

.city_flow_rate small {
    color: var(--secondary);
    font-size: 12px;
    font-weight: var(--main_bolder_weight);
}

.city_flow_rate .plus { color: var(--green); }
.city_flow_rate .minus { color: var(--red); }

.city_flow_src {
    grid-area: s;
    display: flex;
    flex-wrap: wrap;
    gap: 0 8px;
    color: var(--secondary);
    font-size: 12px;
    line-height: 1.4;
}

.city_flow_src .use { color: var(--red); }

.city_flow_have {
    grid-area: h;
    align-self: start;
    justify-self: end;
    color: var(--secondary);
    font-size: 12px;
    font-weight: var(--main_bolder_weight);
    line-height: 1.4;
    white-space: nowrap;
}

.city_flow_fill {
    grid-area: f;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.city_flow_bar {
    flex: 1;
    height: 6px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--white);
}

.city_flow_bar i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--green);
}

.city_flow_bar.full i { background: #f2a900; }

.city_flow_note {
    flex: none;
    color: var(--secondary);
    font-size: 12px;
    white-space: nowrap;
}

.city_flow_note.warn { color: #c27a00; }
.darkmode .city_flow_note.warn { color: #ffc800; }

/* Реестр построек */
.city_seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--secondary_background);
}

.city_seg button {
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--secondary);
    font: inherit;
    font-size: 14px;
    font-weight: var(--main_bolder_weight);
    cursor: pointer;
}

.city_seg button.on {
    background: var(--white);
    color: var(--main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
}

.city_seg button span { color: var(--secondary); }

.city_reg_row {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    grid-template-areas: "p m a" "p c c";
    column-gap: 10px;
    align-items: center;
    margin: 0 -8px;
    padding: 6px 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color .2s;
}

.city_reg_row:hover { background: var(--secondary_button_hover); }
.city_reg_row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.city_reg_img {
    grid-area: p;
    align-self: start;
    width: 50px;
    height: 64px;
    object-fit: contain;
}

.city_reg_row > .btn {
    grid-area: a;
    align-self: start;
    margin-top: 2px;
}

.city_reg_img.site { opacity: .45; }

.city_reg_main {
    grid-area: m;
    min-width: 0;
}

.city_reg_main b { font-weight: var(--main_boldest_weight); }

.city_reg_lv {
    margin-left: 2px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: var(--main_bolder_weight);
    white-space: nowrap;
}

.city_reg_ready {
    margin-left: 2px;
    white-space: nowrap;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: var(--main_boldest_weight);
    vertical-align: 1px;
}

.city_reg_fx {
    margin-top: 1px;
    color: var(--secondary);
    font-size: 13px;
    line-height: 1.35;
}

.city_reg_fx .city_pbar {
    height: 6px;
    margin-top: 5px;
}

.city_reg_fx .city_chip {
    color: var(--main);
    font-size: 12px;
    font-weight: var(--main_boldest_weight);
    white-space: nowrap;
}

.city_reg_fx .city_chip svg { width: 16px; height: 16px; }

.city_reg_up {
    grid-area: c;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 5px 0 2px;
}

.city_reg_up .city_costs {
    justify-content: flex-start;
    margin: 0;
}

.city_reg_decor {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    font-weight: var(--main_bolder_weight);
}

.city_reg_decor .city_chip { padding: 2px 9px; }

.city_view_only .city_panel_collect .btn,
.city_view_only .city_reg_row > .btn { opacity: .5; }

@media (max-width: 639px) {
    /* Кнопка — значок во втором ряду шапки, слева от счетчиков; панель — во весь экран */
    .city_left { display: contents; }
    .city_panel_btn { padding: 7px; }
    .city_panel_btn span { display: none; }
    .city_hud .city_res { flex: 1 1 0; min-width: 0; }
    .city_panel {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-width: none;
        transform: translateY(-12px);
    }
}
