:root {
    --bg: #101426;
    --panel: #222942;
    --panel-light: #303a59;
    --border: #536183;

    --text: #ffffff;
    --muted: #aeb7d0;

    --yellow: #ffd34e;
    --yellow-dark: #98701c;

    --green: #5edc8a;
    --green-dark: #287748;

    --red: #ff6a75;
    --red-dark: #8d3038;

    --blue: #77a6ff;
    --blue-dark: #345890;

    --shadow: 0 7px 0 #080b16;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    color: var(--text);
    background: var(--bg);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;

    background:
        radial-gradient(
            circle at top,
            #3e496b 0,
            #171b30 40%,
            #0d1020 100%
        );
}

button {
    font: inherit;
}

.game-shell {
    width: min(100%, 480px);
    min-height: 100vh;
    margin: 0 auto;
}

.screen {
    min-height: 100vh;
    padding:
        max(18px, env(safe-area-inset-top))
        14px
        max(22px, env(safe-area-inset-bottom));
}

.is-hidden {
    display: none !important;
}

.eyebrow {
    margin: 0 0 8px;

    color: var(--yellow);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

/* Загрузка */

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.loading-logo {
    width: 92px;
    height: 92px;

    display: grid;
    place-items: center;

    background: #f7f8ff;
    border: 4px solid #8aa7ff;
    border-radius: 24px;

    font-size: 49px;

    box-shadow:
        0 8px 0 #3c559d,
        0 20px 36px rgba(0, 0, 0, 0.35);
}

.loading-screen .eyebrow {
    margin-top: 28px;
}

.loading-screen h1 {
    margin: 0;

    font-size: 34px;
    line-height: 1.05;
}

.loading-message {
    margin: 18px 0 0;

    color: var(--muted);
}

.loading-bar {
    width: 240px;
    height: 13px;
    margin-top: 22px;
    padding: 2px;

    overflow: hidden;

    background: #060914;
    border: 2px solid var(--border);
    border-radius: 7px;
}

.loading-bar__fill {
    width: 42%;
    height: 100%;

    background: var(--yellow);
    border-radius: 3px;

    animation: loading 1.05s infinite ease-in-out;
}

@keyframes loading {
    from {
        transform: translateX(-110%);
    }

    to {
        transform: translateX(250%);
    }
}

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

.topbar {
    min-height: 58px;
    padding: 10px 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 15px;

    box-shadow: 0 5px 0 #080b17;
}

.topbar__label {
    display: block;
    margin-bottom: 2px;

    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.topbar strong {
    font-size: 14px;
}

.topbar__conditions {
    display: flex;
    align-items: flex-end;
    flex-direction: column;

    color: #dfe5f7;
    font-size: 10px;
    font-weight: 700;
}

/* Двор */

.courtyard-scene {
    position: relative;

    height: 310px;
    margin-top: 13px;

    overflow: hidden;

    background: #929cc1;
    border: 3px solid #e8ecff;
    border-radius: 19px;

    box-shadow: var(--shadow);
}

.courtyard-scene__image {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
    object-position: center;

    image-rendering: auto;
}

.courtyard-scene__shade {
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            180deg,
            transparent 52%,
            rgba(6, 8, 16, 0.76) 100%
        );
}

.location-title {
    position: absolute;
    right: 14px;
    bottom: 13px;
    left: 14px;

    display: flex;
    flex-direction: column;
}

.location-title span {
    color: var(--yellow);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.location-title strong {
    margin-top: 3px;

    font-size: 17px;
    text-shadow: 0 2px 0 #000000;
}

.player-strip {
    margin-top: 14px;
    padding: 11px;

    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;

    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 15px;

    box-shadow: 0 5px 0 #080b17;
}

.player-strip__avatar {
    width: 45px;
    height: 45px;

    display: grid;
    place-items: center;

    color: #171b2f;
    background: var(--yellow);
    border: 3px solid #ffffff;
    border-radius: 10px;

    font-size: 21px;
    font-weight: 900;

    box-shadow: 0 4px 0 var(--yellow-dark);
}

.player-strip__identity {
    min-width: 0;
}

.player-strip__identity span,
.player-strip__resource span {
    display: block;

    color: var(--muted);
    font-size: 9px;
}

.player-strip__identity strong {
    display: block;
    overflow: hidden;

    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-strip__resource {
    text-align: center;
}

.player-strip__resource strong {
    display: block;
    margin-top: 2px;

    color: var(--yellow);
    font-size: 17px;
}

.lekha-card {
    margin-top: 14px;
    padding: 13px;

    display: flex;
    align-items: flex-start;
    gap: 12px;

    background: #2b3148;
    border: 2px solid #6d7796;
    border-radius: 16px;

    box-shadow: 0 6px 0 #090b16;
}

.lekha-avatar {
    width: 59px;
    height: 69px;
    flex: 0 0 auto;

    display: grid;
    place-items: center;

    color: #ffffff;
    background:
        linear-gradient(
            145deg,
            #965341,
            #4d2a29
        );

    border: 3px solid #d9dcec;
    border-radius: 11px;

    font-size: 29px;
    font-weight: 900;

    box-shadow: 0 4px 0 #351917;
}

.lekha-card__body {
    min-width: 0;
    flex: 1;
}

.lekha-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.lekha-card__role {
    color: var(--yellow);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.lekha-card h2 {
    margin: 2px 0 0;

    font-size: 18px;
}

.lekha-card__status {
    padding: 4px 7px;

    color: #15251a;
    background: var(--green);
    border-radius: 6px;

    font-size: 9px;
    font-weight: 900;
}

.lekha-card p {
    margin: 10px 0 0;

    color: #e5e8f3;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.game-button {
    width: 100%;
    min-height: 56px;
    padding: 13px 17px;

    border: 0;
    border-radius: 15px;

    font-weight: 900;

    transition:
        transform 70ms ease,
        box-shadow 70ms ease;
}

.game-button:not(:disabled):active {
    transform: translateY(6px);
    box-shadow: none;
}

.game-button--primary {
    margin-top: 16px;

    color: #171b2f;
    background: var(--yellow);

    box-shadow: 0 7px 0 var(--yellow-dark);
}

.game-button:disabled {
    opacity: 0.55;
}

.courtyard-info {
    margin-top: 15px;
    padding: 11px;

    display: flex;
    justify-content: space-between;
    gap: 8px;

    color: var(--muted);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 11px;

    font-size: 10px;
    font-weight: 700;
}

.version-label {
    margin: 19px 0 0;

    color: #68718b;
    font-size: 10px;
    text-align: center;
}

/* Матч */

.match-header {
    min-height: 76px;
    padding: 10px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;

    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 5px 0 #080b17;
}

.match-player {
    min-width: 0;
}

.match-player--user {
    text-align: right;
}

.match-player__label {
    display: block;
    margin-bottom: 3px;

    color: var(--muted);
    font-size: 8px;
    text-transform: uppercase;
}

.match-player strong {
    display: block;
    overflow: hidden;

    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scoreboard {
    min-width: 102px;
    padding: 7px 11px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    background: #080b17;
    border: 3px solid #e3e8ff;
    border-radius: 11px;

    box-shadow: 0 4px 0 #000000;
}

.scoreboard strong {
    min-width: 25px;

    color: var(--yellow);
    font-size: 29px;
    text-align: center;
}

.scoreboard span {
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
}

.match-scene {
    position: relative;

    height: 280px;
    margin-top: 14px;

    overflow: hidden;

    background: #8292af;
    border: 3px solid #e8ecff;
    border-radius: 19px;

    box-shadow: var(--shadow);
}

.match-scene__background {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    filter:
        saturate(0.75)
        brightness(0.72);
}

.match-scene__overlay {
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            180deg,
            rgba(20, 24, 40, 0.2),
            rgba(7, 9, 17, 0.55)
        );
}

.simple-table {
    position: absolute;
    right: 68px;
    bottom: 61px;
    left: 68px;

    height: 81px;

    background: #2d7f7a;
    border: 4px solid #f2f5ff;
    border-radius: 4px;

    transform: perspective(260px) rotateX(55deg);
    transform-origin: bottom;

    box-shadow: 0 11px 0 #090b13;
}

.simple-table__line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;

    width: 3px;

    background: #ffffff;
}

.simple-table__net {
    position: absolute;
    top: -17px;
    right: -3px;
    left: -3px;

    height: 18px;

    background:
        repeating-linear-gradient(
            90deg,
            #ffffff 0,
            #ffffff 2px,
            transparent 2px,
            transparent 7px
        );

    border-top: 3px solid #ffffff;
    border-bottom: 3px solid #ffffff;
}

.simple-ball {
    position: absolute;
    top: 27px;
    left: 50%;

    width: 11px;
    height: 11px;

    background: #ffffff;
    border-radius: 50%;

    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);

    transform: translateX(-50%);
}

.simple-ball.is-moving {
    animation: ball-move 360ms ease-in-out;
}

@keyframes ball-move {
    0% {
        transform: translate(-75px, 14px);
    }

    50% {
        transform: translate(0, -14px);
    }

    100% {
        transform: translate(75px, 14px);
    }
}

.fighter {
    position: absolute;
    bottom: 47px;

    width: 63px;
    height: 112px;
}

.fighter--lekha {
    left: 18px;
}

.fighter--player {
    right: 18px;
}

.fighter__head {
    position: relative;
    z-index: 2;

    width: 46px;
    height: 46px;
    margin: 0 auto;

    display: grid;
    place-items: center;

    border: 3px solid #f4f5ff;
    border-radius: 10px;

    font-size: 21px;
    font-weight: 900;
}

.fighter--lekha .fighter__head {
    background: #8f5141;
}

.fighter--player .fighter__head {
    color: #171b2f;
    background: var(--yellow);
}

.fighter__body {
    width: 55px;
    height: 69px;
    margin: -3px auto 0;

    background: #3a466c;
    border: 3px solid #f4f5ff;
    border-radius: 11px 11px 6px 6px;
}

.fighter--lekha .fighter__body {
    background: #51545e;
}

.fighter__racket {
    position: absolute;
    top: 49px;

    width: 24px;
    height: 32px;

    background: #b3453c;
    border: 3px solid #f3e3d3;
    border-radius: 50%;
}

.fighter__racket::after {
    content: "";

    position: absolute;
    bottom: -17px;
    left: 8px;

    width: 5px;
    height: 20px;

    background: #b28052;
    border-radius: 3px;
}

.fighter--lekha .fighter__racket {
    right: -4px;
}

.fighter--player .fighter__racket {
    left: -4px;
}

.rally-panel {
    margin-top: 14px;
    padding: 14px;

    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 15px;

    box-shadow: 0 5px 0 #080b17;
}

.rally-panel__topline {
    display: flex;
    justify-content: space-between;
    gap: 10px;

    color: var(--yellow);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.rally-panel p {
    min-height: 59px;
    margin: 12px 0 0;

    color: #f1f3fb;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
}

.match-actions {
    margin-top: 14px;

    display: grid;
    gap: 10px;
}

.action-button {
    min-height: 62px;
    padding: 10px 13px;

    display: flex;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;

    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.36);
    border-radius: 14px;

    text-align: left;

    transition:
        transform 70ms ease,
        box-shadow 70ms ease;
}

.action-button:active {
    transform: translateY(5px);
    box-shadow: none;
}

.action-button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.action-button strong {
    font-size: 15px;
}

.action-button small {
    margin-top: 4px;

    color: rgba(255, 255, 255, 0.78);
    font-size: 10px;
}

.action-button--safe {
    background: var(--blue);
    box-shadow: 0 6px 0 var(--blue-dark);
}

.action-button--attack {
    background: var(--red);
    box-shadow: 0 6px 0 var(--red-dark);
}

.action-button--chop {
    background: var(--green);
    box-shadow: 0 6px 0 var(--green-dark);
}

.match-hint {
    margin: 18px 0 0;

    color: #747e9a;
    font-size: 10px;
    text-align: center;
}

/* Результат */

.result-screen {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;

    text-align: center;
}

.result-emblem {
    width: 94px;
    height: 94px;
    margin: 0 auto 25px;

    display: grid;
    place-items: center;

    background: var(--yellow);
    border: 5px solid #ffffff;
    border-radius: 24px;

    font-size: 48px;

    box-shadow: 0 8px 0 var(--yellow-dark);
}

.result-emblem.result-emblem--loss {
    background: var(--red);
    box-shadow: 0 8px 0 var(--red-dark);
}

.result-screen h1 {
    margin: 0;

    font-size: 39px;
}

.result-score {
    margin: 12px 0 0;

    color: var(--yellow);
    font-size: 32px;
    font-weight: 900;
}

.result-message-card,
.rewards-card {
    margin-top: 20px;
    padding: 15px;

    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 15px;

    box-shadow: 0 5px 0 #080b17;

    text-align: left;
}

.result-message-card span {
    color: var(--yellow);
    font-size: 11px;
    font-weight: 900;
}

.result-message-card p {
    margin: 8px 0 0;

    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
}

.rewards-card h2 {
    margin: 0 0 12px;

    font-size: 17px;
}

.reward-row {
    padding: 10px 0;

    display: flex;
    justify-content: space-between;

    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-row strong {
    color: var(--yellow);
}

/* Ошибка */

.error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.error-icon {
    width: 75px;
    height: 75px;

    display: grid;
    place-items: center;

    background: var(--red);
    border: 4px solid #ffffff;
    border-radius: 19px;

    font-size: 40px;
    font-weight: 900;

    box-shadow: 0 7px 0 var(--red-dark);
}

.error-screen h1 {
    margin: 24px 0 0;
}

.error-screen p {
    color: var(--muted);
    line-height: 1.5;
}

@media (max-width: 370px) {
    .courtyard-scene {
        height: 275px;
    }

    .player-strip {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .player-strip__resource:last-child {
        display: none;
    }

    .simple-table {
        right: 61px;
        left: 61px;
    }
}