:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #171a1f;
    --secondary: #727984;
    --line: #e7e9ee;
    --brand: #ff7a1a;
    --brand-weak: #fff2e8;
    --pressed: #f0f2f5;
    --shadow: 0 8px 22px rgba(23, 26, 31, .06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body {
    overflow-x: hidden;
}

button {
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: none;
    font: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    width: min(100%, 460px);
    min-height: 100svh;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
}

.page {
    display: none;
    min-height: 100svh;
    padding: max(12px, env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
}

.page.active {
    display: block;
}

.topbar {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.title-wrap {
    min-width: 0;
}

.title {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 750;
    letter-spacing: 0;
}

.subtitle {
    margin: 3px 0 0;
    color: var(--secondary);
    font-size: 13px;
    line-height: 1.35;
}

.icon-btn {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
}

.icon-btn:active,
.game:active,
.tab:active,
.primary-btn:active {
    background-color: var(--pressed);
}

svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.content {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.game {
    min-height: 82px;
    padding: 12px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.app-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
}

.app-icon.snake {
    background: linear-gradient(145deg, #28bb78, #0d8b58);
}

.app-icon.tetris {
    background: linear-gradient(145deg, #4388ff, #245ad6);
}

.app-icon.gomoku {
    background: linear-gradient(145deg, #24272d, #0d0f12);
}

.app-icon.minesweeper {
    background: linear-gradient(145deg, #f05f57, #b6282f);
}

.game-main {
    min-width: 0;
}

.game-name {
    margin: 0;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-meta {
    margin: 5px 0 0;
    color: var(--secondary);
    font-size: 13px;
    line-height: 1.35;
}

.primary-btn {
    min-width: 58px;
    height: 34px;
    padding: 0 14px;
    border-radius: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--brand);
    font-size: 14px;
    font-weight: 700;
}

.profile-card {
    margin-top: 12px;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.avatar {
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--brand);
    font-size: 22px;
    font-weight: 800;
}

.profile-info {
    min-width: 0;
}

.profile-name {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 700;
}

.profile-state {
    margin: 5px 0 0;
    color: var(--secondary);
    font-size: 13px;
    line-height: 1.35;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 20;
    width: min(100%, 460px);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 7px 12px max(7px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.tab {
    height: 56px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    color: #818894;
    font-size: 12px;
    font-weight: 650;
}

.tab.active {
    color: var(--brand);
    background: var(--brand-weak);
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

@media (min-width: 720px) {
    body {
        background: #eceff3;
    }

    .app {
        min-height: calc(100svh - 40px);
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: 28px;
        overflow: hidden;
        box-shadow: 0 18px 50px rgba(23, 26, 31, .12);
    }

    .bottom-nav {
        border-radius: 0 0 28px 28px;
    }
}

@media (max-width: 340px) {
    .page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .game {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: 10px;
    }

    .app-icon {
        width: 52px;
        height: 52px;
    }

    .primary-btn {
        min-width: 52px;
        padding: 0 12px;
    }
}
