* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

:root {
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Trebuchet MS", "Arial Rounded MT Bold", "Segoe UI", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
    --sky-top: #7fd6ff;
    --sky-mid: #ecfbff;
    --sky-bottom: #fff0bd;
    --ink: #17314c;
    --ink-soft: rgba(23, 49, 76, 0.72);
    --panel: rgba(255, 255, 255, 0.72);
    --panel-line: rgba(95, 151, 206, 0.16);
    --shadow: rgba(72, 121, 172, 0.18);
    --blue: #4f92ff;
    --blue-deep: #2364d9;
    --cyan: #69e2ff;
    --gold: #f9c44f;
    --gold-soft: rgba(255, 247, 221, 0.94);
    --shard: #ff9d5b;
    --shard-soft: rgba(255, 241, 228, 0.94);
    --green: #28b473;
    --danger: #ec5d73;
    --blur: blur(18px);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.84), transparent 26%),
        linear-gradient(180deg, #77d4ff 0%, #ddf7ff 42%, #fff2c5 100%);
    font-family: var(--font-sans);
    color: var(--ink);
    overscroll-behavior: none;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

#app-shell {
    width: 100vw;
    height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(12px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(12px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 12% 14%, rgba(255, 255, 255, 0.7), transparent 20%),
        radial-gradient(circle at 86% 18%, rgba(255, 255, 255, 0.45), transparent 20%),
        linear-gradient(180deg, #7ad4ff 0%, #dff8ff 44%, #fff1bd 100%);
}

#game-wrapper {
    position: relative;
    width: min(100%, 480px, calc((100dvh - 24px) * 0.48));
    height: min(calc(100dvh - 24px), 100%, 980px);
    aspect-ratio: 9 / 19.5;
    overflow: hidden;
    border-radius: 30px;
    background: linear-gradient(180deg, var(--sky-top), var(--sky-mid) 55%, var(--sky-bottom));
    box-shadow:
        0 24px 60px rgba(70, 120, 168, 0.22),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    touch-action: manipulation;
}

#gameCanvas,
.scene-vignette {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#gameCanvas {
    z-index: 1;
    display: block;
    touch-action: none;
}

.scene-vignette {
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(circle at 22% 16%, rgba(255, 255, 255, 0.38), transparent 18%),
        radial-gradient(circle at 84% 18%, rgba(255, 255, 255, 0.28), transparent 16%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%, transparent 82%, rgba(255, 186, 80, 0.12));
}

.screen,
.modal-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.screen.hidden,
.modal-overlay.hidden,
.hidden {
    opacity: 0;
    pointer-events: none;
}

.screen.hidden,
.modal-overlay.hidden {
    transform: translateY(10px);
}

.back-icon-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 22;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 15px;
    box-shadow: 0 12px 22px var(--shadow);
}

.fullscreen-panel,
.panel-screen,
#gameOverScreen {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding:
        calc(82px + env(safe-area-inset-top))
        calc(14px + env(safe-area-inset-right))
        calc(14px + env(safe-area-inset-bottom))
        calc(14px + env(safe-area-inset-left));
}

.welcome-inner,
.panel-inner,
.gameover-panel,
.modal-panel {
    width: 100%;
    border-radius: var(--radius-xl);
    background: var(--panel);
    backdrop-filter: var(--blur);
    border: 1px solid rgba(255, 255, 255, 0.26);
    box-shadow: 0 18px 44px var(--shadow);
}

.welcome-inner {
    padding: 28px 22px;
    text-align: center;
}

.welcome-kicker,
.hero-kicker,
.shop-kicker,
.go-kicker,
.mode-tag,
.hint-left,
.hint-right,
.panel-subcopy {
    font-family: var(--font-mono);
    letter-spacing: 0.35px;
}

.welcome-kicker,
.shop-kicker,
.go-kicker {
    font-size: 10px;
    color: rgba(23, 49, 76, 0.56);
}

.game-title-big,
.game-title-card,
.panel-title-big,
.go-title {
    font-family: var(--font-display);
    line-height: 1.22;
}

.game-title-big {
    margin-top: 12px;
    font-size: clamp(34px, 10vw, 52px);
    color: #ffffff;
    text-shadow:
        0 4px 0 #3b86f4,
        0 10px 0 #2357bd,
        0 18px 24px rgba(51, 107, 183, 0.24);
}

.welcome-sub {
    margin-top: 18px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.6;
}

.name-input,
.search-input {
    width: 100%;
    border: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    outline: 0;
}

.name-input,
.search-input {
    height: 52px;
    margin-top: 22px;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 600;
}

.play-btn,
.ghost-btn,
.search-btn,
.skin-action,
.tab-btn,
.nav-item,
.profile-mini-btn,
.social-btn,
.avatar-cam-btn,
.icon-btn,
.edit-btn {
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.play-btn:hover,
.ghost-btn:hover,
.search-btn:hover,
.skin-action:hover,
.tab-btn:hover,
.nav-item:hover,
.profile-mini-btn:hover,
.social-btn:hover,
.avatar-cam-btn:hover,
.icon-btn:hover,
.edit-btn:hover {
    transform: translateY(-1px);
}

.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    padding: 14px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff, #94d7ff 55%, #7fbeff);
    color: #1f62bc;
    box-shadow: 0 14px 26px rgba(68, 130, 212, 0.22);
    font-size: 16px;
    font-weight: 800;
}

.main-play {
    width: 100%;
    margin-top: 14px;
}

.divider-or {
    margin: 18px 0 14px;
    color: rgba(23, 49, 76, 0.5);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.social-login-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.social-btn {
    min-height: 46px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(96, 143, 191, 0.12);
}

.fb-btn {
    color: #2767db;
}

.tt-btn {
    color: #0f1d30;
}

.ig-btn {
    color: #c34f8c;
}

.home-screen {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding:
        calc(18px + env(safe-area-inset-top))
        calc(18px + env(safe-area-inset-right))
        calc(18px + env(safe-area-inset-bottom))
        calc(18px + env(safe-area-inset-left));
}

.home-topbar,
.panel-header,
.profile-name-row,
.search-row,
.go-btns,
.play-row,
.inventory-spotlight,
.shop-res-row,
.inventory-stats,
.topbar-icons {
    display: flex;
    align-items: center;
}

.home-topbar,
.panel-header {
    justify-content: space-between;
    gap: 12px;
}

.profile-mini-btn {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 22px;
    background: var(--panel);
    backdrop-filter: var(--blur);
    box-shadow: 0 14px 26px var(--shadow);
}

.mini-avatar-wrap,
.profile-avatar-ring {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(177, 225, 255, 0.78));
}

.mini-avatar-wrap {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
}

.mini-avatar-wrap canvas,
.mini-avatar-img,
.profile-avatar-ring canvas,
.profile-user-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.profile-mini-info {
    display: grid;
    gap: 4px;
    min-width: 0;
    text-align: left;
}

.mini-username {
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-level {
    color: rgba(23, 49, 76, 0.58);
    font-size: 12px;
    font-weight: 700;
}

.topbar-icons {
    gap: 8px;
}

.icon-btn,
.edit-btn,
.avatar-cam-btn,
.search-btn,
.modal-close {
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    box-shadow: 0 10px 18px rgba(95, 145, 194, 0.12);
}

.icon-btn {
    position: relative;
}

.icon-btn,
.edit-btn,
.avatar-cam-btn,
.modal-close {
    width: 40px;
    height: 40px;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.notif-badge {
    position: absolute;
    top: -3px;
    right: -4px;
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
}

.hero-card,
.inventory-spotlight,
.panel-inner,
.gameover-panel,
.profile-panel {
    background: var(--panel);
    backdrop-filter: var(--blur);
}

.shop-res-row,
.inventory-stats,
.play-row,
.go-btns {
    gap: 10px;
}

.res-pill {
    min-height: 60px;
    padding: 10px 12px;
    border-radius: 20px;
    box-shadow: 0 12px 22px rgba(98, 148, 198, 0.14);
    display: flex;
    align-items: center;
    gap: 8px;
}

.res-pill strong {
    font-size: 19px;
    font-weight: 900;
}

.gold-pill {
    background: var(--gold-soft);
}

.diamond-pill {
    background: var(--shard-soft);
}

.compact {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 16px;
    box-shadow: none;
}

.compact strong {
    font-size: 16px;
}

.hero-card {
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    padding: 22px 20px;
    border-radius: var(--radius-xl);
    box-shadow: 0 18px 30px var(--shadow);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -34px;
    bottom: -32px;
    width: 170px;
    height: 170px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 229, 147, 0.42), rgba(255, 229, 147, 0));
}

.hero-text,
.inventory-copy {
    position: relative;
    z-index: 1;
}

.hero-text {
    max-width: 58%;
}

.hero-kicker {
    font-size: 10px;
    color: rgba(23, 49, 76, 0.56);
}

.game-title-card {
    margin-top: 12px;
    font-size: clamp(18px, 5vw, 26px);
    color: var(--ink);
}

.hero-sub,
.inventory-text,
.panel-subcopy {
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.6;
}

.hero-preview,
.inventory-preview {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

#menuSceneCanvas,
#shopPreviewCanvas {
    width: 130px;
    height: 130px;
}

#shopPreviewCanvas {
    width: 120px;
    height: 120px;
}

.play-row {
    justify-content: stretch;
}

.play-row .play-btn {
    flex: 1;
}

.offline-btn {
    background: linear-gradient(135deg, #ffffff, #9ad9ff 60%, #7cb4ff);
}

.online-btn {
    background: linear-gradient(135deg, #fff8eb, #ffd7a8 58%, #ffb26c);
    color: #a9571f;
}

.bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.nav-item,
.tab-btn,
.ghost-btn,
.search-btn,
.skin-action {
    border-radius: 18px;
}

.nav-item,
.ghost-btn,
.tab-btn {
    min-height: 54px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--ink);
    box-shadow: 0 12px 20px rgba(97, 147, 196, 0.12);
}

.nav-item {
    display: grid;
    place-items: center;
    gap: 6px;
    padding: 10px;
    font-size: 12px;
    font-weight: 800;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.panel-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 100%;
    padding: 18px;
    overflow: hidden;
}

.panel-header {
    align-items: flex-start;
    gap: 14px;
}

.panel-title-block {
    min-width: 0;
    flex: 1;
}

.leaderboard-header {
    display: grid;
    gap: 14px;
}

.panel-title-big {
    font-size: 17px;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.panel-subcopy {
    margin-top: 6px;
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.55;
    letter-spacing: 0;
}

.tab-row {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: inset 0 0 0 1px rgba(91, 145, 198, 0.08);
}

.tab-btn {
    min-height: 36px;
    padding: 0 12px;
    background: transparent;
    color: rgba(23, 49, 76, 0.68);
    font-size: 12px;
    font-weight: 800;
    box-shadow: none;
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(111, 214, 255, 0.92), rgba(79, 146, 255, 0.9));
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(73, 134, 216, 0.18);
}

.lb-list,
.friends-list,
.shop-grid {
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.lb-list {
    display: grid;
    gap: 10px;
}

.lb-item,
.friend-card,
.search-result-card,
.skin-card,
.block-card {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(95, 151, 206, 0.1);
    box-shadow: 0 12px 22px rgba(99, 149, 199, 0.12);
}

.lb-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 13px;
    border-radius: 18px;
}

.lb-item.player-row {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(208, 239, 255, 0.92));
    border-color: rgba(88, 151, 220, 0.22);
}

.rank-chip {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(236, 247, 255, 0.94);
    color: #2660c0;
    font-size: 12px;
    font-weight: 900;
}

.rank-chip.top-three {
    background: linear-gradient(135deg, #ffe89a, #ffbd61);
    color: #7f4b14;
}

.lb-main,
.friend-main {
    min-width: 0;
}

.lb-name,
.friend-name,
.skin-name,
.inventory-title,
.profile-username {
    color: var(--ink);
    font-weight: 900;
}

.lb-name,
.friend-name {
    font-size: 14px;
    line-height: 1.3;
}

.lb-sub,
.friend-sub,
.skin-price,
.skin-progress {
    color: rgba(23, 49, 76, 0.6);
    font-size: 11px;
    line-height: 1.45;
}

.lb-score,
.friend-score {
    font-size: 15px;
    font-weight: 900;
    color: var(--ink);
    text-align: right;
}

.search-row {
    width: min(100%, 240px);
    gap: 10px;
}

.search-input {
    margin-top: 0;
}

.search-btn {
    flex: 0 0 auto;
    min-width: 64px;
    height: 46px;
    padding: 0 14px;
    background: linear-gradient(135deg, #ffffff, #a0daff 54%, #7eb9ff);
    color: #1d63c1;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(95, 146, 196, 0.14);
}

.search-result-wrap,
.friends-list {
    display: grid;
    gap: 10px;
}

.search-result-card,
.friend-card {
    padding: 14px;
    border-radius: 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.friend-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.friend-main {
    display: grid;
    gap: 6px;
}

.friend-name {
    font-size: 15px;
    font-weight: 800;
}

.friend-sub {
    color: rgba(23, 49, 76, 0.66);
    font-size: 12px;
    line-height: 1.5;
}

.friend-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.friend-flag {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: rgba(23, 49, 76, 0.76);
    font-size: 10px;
    font-weight: 800;
}

.friend-flag.following {
    background: rgba(137, 214, 255, 0.2);
    color: #165697;
}

.friend-flag.follower {
    background: rgba(255, 196, 128, 0.22);
    color: #8a4c19;
}

.friend-flag.friend {
    background: rgba(40, 180, 115, 0.18);
    color: #17754b;
}

.mini-action {
    min-width: 68px;
    height: 34px;
    padding: 0 11px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff, #a7ddff 54%, #83beff);
    color: #1e60bb;
    font-size: 11px;
    font-weight: 800;
}

.mini-action.ghost {
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
}

.inventory-spotlight {
    gap: 16px;
    padding: 18px;
    border-radius: 26px;
    box-shadow: 0 14px 26px rgba(96, 145, 194, 0.12);
}

.inventory-copy {
    display: grid;
    gap: 8px;
}

.inventory-title {
    font-size: 18px;
}

.inventory-text {
    margin-top: 0;
}

.inventory-stats {
    flex-wrap: wrap;
}

.inventory-stats span {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: rgba(23, 49, 76, 0.78);
    font-size: 12px;
    font-weight: 700;
}

.shop-tabs {
    width: fit-content;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.skin-card,
.block-card {
    padding: 14px;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skin-card.selected,
.block-card.selected {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(214, 241, 255, 0.96));
    border-color: rgba(78, 145, 228, 0.26);
    box-shadow:
        inset 0 0 0 1px rgba(83, 144, 220, 0.12),
        0 16px 24px rgba(94, 145, 194, 0.18);
}

.skin-card canvas,
.block-card canvas {
    width: 92px;
    height: 92px;
    margin: 0 auto;
    image-rendering: pixelated;
}

.skin-meta {
    display: grid;
    gap: 4px;
}

.skin-name {
    font-size: 15px;
}

.skin-action {
    min-height: 42px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #91deff, #76b5ff);
    color: #184f99;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 12px 18px rgba(86, 137, 214, 0.16);
}

.skin-action.owned {
    background: rgba(40, 180, 115, 0.16);
    color: #17754b;
    box-shadow: none;
}

.skin-action.locked {
    background: rgba(255, 183, 110, 0.18);
    color: #97501c;
    box-shadow: none;
}

.skin-action:disabled {
    cursor: default;
    opacity: 0.92;
}

.modal-overlay {
    z-index: 30;
    display: grid;
    place-items: center;
    padding:
        calc(16px + env(safe-area-inset-top))
        calc(16px + env(safe-area-inset-right))
        calc(16px + env(safe-area-inset-bottom))
        calc(16px + env(safe-area-inset-left));
    background: rgba(22, 43, 67, 0.28);
    backdrop-filter: blur(10px);
}

.modal-panel {
    position: relative;
    max-width: 420px;
    padding: 22px;
}

.profile-panel {
    display: grid;
    gap: 16px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
}

.profile-avatar-ring {
    width: 92px;
    height: 92px;
    padding: 8px;
    border-radius: 30px;
    box-shadow: inset 0 0 0 1px rgba(96, 149, 202, 0.14);
}

.profile-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.profile-avatar-shell {
    position: relative;
    flex: 0 0 auto;
}

.profile-avatar-ring canvas,
.profile-user-img {
    width: 100%;
    height: 100%;
}

.profile-identity {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 8px;
    padding-top: 4px;
}

.profile-name-row {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 10px;
}

.profile-name-stack {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 4px;
}

.profile-username {
    font-size: 24px;
    line-height: 1.08;
}

.profile-uid {
    text-align: left;
    color: rgba(23, 49, 76, 0.58);
    font-size: 12px;
    font-weight: 700;
}

.profile-name-meta {
    color: rgba(23, 49, 76, 0.62);
    font-size: 12px;
    line-height: 1.55;
}

.profile-bio-wrap {
    margin-top: 14px;
    padding: 0 16px;
}

.profile-bio-input,
.profile-bio-display {
    width: 100%;
    min-height: 56px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    border: 0;
    outline: 0;
    resize: none;
}

.profile-bio-display {
    background: transparent;
    padding: 0;
    min-height: auto;
    font-style: italic;
    color: rgba(23, 49, 76, 0.7);
}

.profile-character-stage {
    min-height: 170px;
    border-radius: 26px;
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.8), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(223, 245, 255, 0.62));
    overflow: hidden;
    display: grid;
    place-items: center;
}

#profileCharacterCanvas {
    width: 100%;
    max-width: 260px;
    height: auto;
}

.profile-social-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.profile-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(95, 145, 194, 0.12);
}

.profile-social-btn.ghost {
    opacity: 0.56;
    box-shadow: none;
}

.profile-social-btn.linked {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(183, 229, 255, 0.92));
}

.profile-social-btn.fb-link {
    color: #2767db;
}

.profile-social-btn.tt-link {
    color: #0f1d30;
}

.profile-social-btn.ig-link {
    color: #c34f8c;
}

.avatar-cam-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
}

#gameOverScreen {
    z-index: 16;
}

.gameover-panel {
    padding: 24px 22px;
}

.go-kicker {
    text-align: center;
}

.go-title {
    margin-top: 12px;
    font-size: 22px;
    color: var(--ink);
    text-align: center;
}

.go-stats {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.go-stat {
    padding: 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
}

.go-label {
    color: rgba(23, 49, 76, 0.56);
    font-size: 12px;
    font-weight: 700;
}

.go-stat strong {
    display: block;
    margin-top: 8px;
    font-size: 22px;
    font-weight: 900;
}

.xp-col {
    grid-column: span 2;
}

.new-record {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 230, 133, 0.26);
    color: #8a5a11;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
}

.go-btns {
    margin-top: 16px;
}

.go-btns > * {
    flex: 1;
}

.ghost-btn,
.compact-play {
    min-height: 52px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 800;
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.74);
    color: var(--ink);
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding:
        calc(18px + env(safe-area-inset-top))
        calc(18px + env(safe-area-inset-right))
        18px
        calc(18px + env(safe-area-inset-left));
}

.hud-left,
.hud-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-hud {
    font-family: var(--font-mono);
    font-size: clamp(20px, 7vw, 34px);
    color: #ffffff;
    text-shadow: 0 4px 0 var(--blue), 0 10px 18px rgba(76, 144, 216, 0.26);
}

.score-hud.bump {
    transform: scale(1.06);
}

.mode-tag {
    display: inline-flex;
    width: fit-content;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font-size: 9px;
}

.hud-sub {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 2px 12px rgba(36, 77, 122, 0.24);
}

.next-move-hud {
    display: inline-flex;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(16, 41, 68, 0.24);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    text-shadow: 0 2px 12px rgba(36, 77, 122, 0.24);
}

.overtake-hud {
    display: inline-flex;
    width: fit-content;
    max-width: min(82vw, 280px);
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 246, 218, 0.92);
    color: #7f4b16;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    box-shadow: 0 12px 20px rgba(120, 91, 42, 0.14);
}

.lives-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    color: #eb5872;
    font-size: 20px;
    box-shadow: 0 12px 22px rgba(103, 151, 198, 0.16);
}

.reward-toast {
    position: absolute;
    top: 94px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 18;
    max-width: calc(100% - 40px);
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #176f4c;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 12px 22px rgba(103, 160, 210, 0.22);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.reward-toast.hidden {
    transform: translateX(-50%) translateY(-8px);
}

.controls-hint {
    position: absolute;
    left: calc(14px + env(safe-area-inset-left));
    right: calc(14px + env(safe-area-inset-right));
    bottom: calc(88px + env(safe-area-inset-bottom));
    z-index: 8;
    display: flex;
    justify-content: space-between;
}

.hint-left,
.hint-right {
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font-size: 9px;
}

.hint-left.active,
.hint-right.active {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 18px rgba(93, 144, 194, 0.2);
}

.touch-controls {
    position: absolute;
    left: calc(14px + env(safe-area-inset-left));
    right: calc(14px + env(safe-area-inset-right));
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 9;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.touch-control-btn {
    min-height: 62px;
    border-radius: 20px;
    backdrop-filter: var(--blur);
    box-shadow: 0 14px 24px rgba(64, 117, 169, 0.2);
    font-size: 16px;
    font-weight: 900;
}

.touch-control-btn.left-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(166, 230, 255, 0.92));
    color: #17549f;
}

.touch-control-btn.right-btn {
    background: linear-gradient(135deg, rgba(255, 250, 236, 0.94), rgba(255, 213, 151, 0.94));
    color: #93501d;
}

.touch-control-btn:active {
    transform: scale(0.98);
}

.daily-title {
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}

.notif-panel {
    display: grid;
    gap: 12px;
    width: min(100%, 408px);
    max-height: min(78vh, 680px);
}

.notif-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.notif-title-wrap {
    min-width: 0;
    flex: 1;
}

.notif-summary {
    color: var(--ink-soft);
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.6;
}

.notif-feed {
    display: grid;
    gap: 9px;
    overflow: auto;
    padding-right: 2px;
}

.notif-item,
.notif-empty {
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(95, 151, 206, 0.12);
    box-shadow: 0 12px 22px rgba(99, 149, 199, 0.1);
}

.notif-item {
    display: grid;
    gap: 8px;
}

.notif-topline,
.notif-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.notif-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.notif-pill {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #1f63bf;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notif-time {
    color: rgba(23, 49, 76, 0.46);
    font-size: 10px;
    font-weight: 700;
}

.notif-title {
    font-size: 14px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1.35;
}

.notif-text {
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.55;
}

.notif-empty {
    color: rgba(23, 49, 76, 0.62);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

@media (display-mode: standalone) {
    #app-shell {
        padding: 0;
    }

    #game-wrapper {
        width: 100vw;
        width: 100svw;
        width: 100dvw;
        height: 100vh;
        height: 100svh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}

@media (min-width: 900px) {
    #game-wrapper {
        width: min(460px, calc((100dvh - 32px) * 0.5));
        height: min(calc(100dvh - 32px), 960px);
    }
}

@media (max-width: 420px) {
    #game-wrapper {
        width: 100vw;
        height: 100vh;
        height: 100svh;
        height: 100dvh;
        border-radius: 0;
    }

    .play-row,
    .go-btns,
    .social-login-row,
    .shop-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .hero-card,
    .inventory-spotlight,
    .panel-header,
    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-text {
        max-width: none;
    }

    .tab-row {
        width: 100%;
        justify-content: stretch;
    }

    .tab-btn {
        flex: 1;
    }

    .search-row {
        width: 100%;
    }

    .controls-hint {
        bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .search-result-card,
    .friend-card,
    .lb-item {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .lb-score,
    .friend-score {
        text-align: left;
    }
}

/* 2026-04 refresh: streamlined HUD, room lobby, and simpler result screen */

.back-icon-btn {
    display: none !important;
}

.panel-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.panel-home-btn {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(96, 145, 196, 0.14);
}

.room-panel {
    padding: 22px 20px;
}

.room-hub,
.room-lobby {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.room-main-btn {
    min-height: 56px;
}

.room-join-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.room-code-input {
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    text-align: center;
}

.room-helper {
    color: rgba(23, 49, 76, 0.62);
    font-size: 13px;
    line-height: 1.6;
}

.room-code-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.78);
}

.room-code-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(23, 49, 76, 0.56);
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.room-code-value {
    font-family: var(--font-display);
    font-size: clamp(24px, 7vw, 34px);
    color: var(--blue-deep);
    letter-spacing: 3px;
}

.room-copy-btn {
    width: fit-content;
    min-height: 40px;
    padding: 0 14px;
}

.room-status-text {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.6;
}

.room-player-list {
    display: grid;
    gap: 10px;
}

.room-player-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
}

.room-player-avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(244, 250, 255, 0.94), rgba(222, 239, 255, 0.94));
    display: grid;
    place-items: center;
    overflow: hidden;
}

.room-player-avatar canvas,
.room-player-avatar img {
    width: 54px;
    height: 54px;
}

.room-player-avatar span {
    font-size: 22px;
    font-weight: 900;
    color: var(--blue-deep);
}

.room-player-meta {
    min-width: 0;
}

.room-player-name {
    font-size: 17px;
    font-weight: 900;
    color: var(--ink);
}

.room-player-sub {
    margin-top: 3px;
    color: rgba(23, 49, 76, 0.62);
    font-size: 12px;
}

.room-player-badge {
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(82, 146, 255, 0.12);
    color: var(--blue-deep);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.room-player-badge.waiting {
    background: rgba(255, 207, 111, 0.2);
    color: #9a620f;
}

.room-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.gameover-panel {
    padding: 28px 22px;
}

.go-title {
    margin-top: 10px;
}

.go-score-wrap {
    margin-top: 18px;
    padding: 24px 18px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.82);
    text-align: center;
}

.go-score-value {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(52px, 18vw, 86px);
    line-height: 1;
    color: var(--ink);
}

.go-best-line {
    margin-top: 10px;
    color: rgba(23, 49, 76, 0.62);
    font-size: 14px;
    font-weight: 700;
}

#hud {
    align-items: flex-start;
    padding:
        calc(14px + env(safe-area-inset-top))
        calc(14px + env(safe-area-inset-right))
        18px
        calc(14px + env(safe-area-inset-left));
}

.score-hud {
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(14px);
    font-family: var(--font-display);
    font-size: clamp(20px, 6vw, 30px);
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 2px 14px rgba(30, 74, 121, 0.24);
}

.hud-right {
    align-items: flex-end;
}

.rival-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: min(76vw, 204px);
    padding: 10px 12px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 28px rgba(79, 128, 173, 0.16);
}

.rival-avatar-wrap {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(240, 248, 255, 0.96), rgba(220, 236, 255, 0.96));
    display: grid;
    place-items: center;
    overflow: hidden;
}

.rival-avatar-wrap canvas,
.rival-avatar-wrap img {
    width: 52px;
    height: 52px;
}

.rival-copy {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "rank score"
        "name score";
    column-gap: 8px;
    align-items: center;
}

.rival-rank {
    grid-area: rank;
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(23, 49, 76, 0.52);
    text-transform: uppercase;
}

.rival-name {
    grid-area: name;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 900;
    color: var(--ink);
}

.rival-score {
    grid-area: score;
    font-size: 28px;
    line-height: 1;
    font-weight: 900;
    color: var(--ink);
}

.controls-hint {
    display: none !important;
}

@media (max-width: 480px) {
    .panel-tools {
        width: 100%;
        justify-content: space-between;
    }

    .room-player-card {
        grid-template-columns: 46px minmax(0, 1fr);
    }

    .room-player-badge {
        grid-column: span 2;
        width: fit-content;
    }

    .rival-card {
        min-width: min(74vw, 188px);
        padding: 9px 10px;
    }

    .rival-score {
        font-size: 24px;
    }
}

