/* 字体不走 Google Fonts（局域网/无外网环境拉不到），直接用系统字体栈 */

* {
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    box-sizing: border-box;
    user-select: none;
}


body {
    /* 黑边做成主题装饰：letterbox 区域用与菜单一致的地牢渐变，不再是纯黑 */
    background: linear-gradient(180deg, #17100a, #2b1d0e 45%, #4a3413);
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#canvas {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    /* display: none; */
}

/* 显示模式切换（左上角 ⛶ 按钮）：适应(contain，默认) / 铺满拉伸(fill) / 铺满裁切(cover) */
#canvas.fit-fill,
#canvas.fit-cover {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}
#canvas.fit-fill { object-fit: fill; }
#canvas.fit-cover { object-fit: cover; }

#fit-bar {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
    z-index: 300;
    display: flex;
}
#fit-bar > * + * { margin-left: 8px; }

#fit-bar button {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #e7e5e4;
    background: rgba(12, 8, 4, 0.55);
    border: 2px solid rgba(251, 191, 36, 0.4);
    border-radius: 999px;
    opacity: 0.75;
    cursor: pointer;
}

/* 昵称输入浮层（手机没有物理键盘，canvas 键盘输入不可用）。
   背景近实心：用户反馈半透明时画布上的字会透过浮层显示 */
#fw-nickname-wrap {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(18, 12, 5, 0.97);
}
#fw-nickname-wrap > * + * { margin-top: 16px; }

#fw-nickname-wrap .fw-nickname-title {
    color: #fcd34d;
    font-size: 22px;
    font-weight: 700;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#fw-nickname-input {
    padding: 12px 16px;
    font-size: 18px;
    border-radius: 12px;
    border: none;
    outline: none;
    width: min(70vw, 300px);
    text-align: center;
    user-select: text;
    -webkit-user-select: text;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

#fw-nickname-err {
    min-height: 22px;
    font-size: 15px;
    color: #fca5a5;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

#fw-nickname-wrap button {
    padding: 12px 40px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 999px;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 手机直连配对浮层（风格对齐昵称浮层）。
   兼容老 WebView（安卓 8 没更新系统的）：不用 inset（Chrome 87+）和 flex gap（84+），
   用四边长写法 + 相邻兄弟 margin */
#fw-p2p-wrap {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 510;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(18, 12, 5, 0.97);
    padding: 16px;
}
#fw-p2p-wrap > * + * { margin-top: 14px; }
#fw-p2p-wrap .fw-p2p-title {
    color: #fcd34d;
    font-size: 22px;
    font-weight: 700;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
#fw-p2p-wrap .fw-p2p-hint {
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    text-align: center;
    max-width: 86vw;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#fw-p2p-wrap .fw-p2p-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}
#fw-p2p-wrap .fw-p2p-panel > * + * { margin-top: 12px; }
#fw-p2p-wrap .fw-p2p-codelabel { color: #fcd34d; font-size: 15px; text-align: center; }
#fw-p2p-wrap .fw-p2p-code {
    font-size: 64px;
    font-weight: 800;
    letter-spacing: 14px;
    padding-left: 14px; /* 补掉 letter-spacing 尾部空隙，视觉居中 */
    color: #fff;
    text-shadow: 0 4px 18px rgba(251, 191, 36, 0.55);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
#fw-p2p-wrap .fw-p2p-input {
    padding: 14px 16px;
    font-size: 34px;
    letter-spacing: 10px;
    text-align: center;
    width: min(58vw, 250px);
    border-radius: 14px;
    border: none;
    outline: none;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    user-select: text;
    -webkit-user-select: text;
}
#fw-p2p-wrap .fw-p2p-join {
    padding: 12px 40px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 999px;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #10b981);
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#fw-p2p-wrap .fw-p2p-share {
    padding: 12px 36px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 999px;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#fw-p2p-wrap .fw-p2p-status {
    min-height: 22px;
    font-size: 15px;
    color: #fdba74;
    text-align: center;
    max-width: 84vw;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#fw-p2p-wrap .fw-p2p-back {
    padding: 10px 26px;
    font-size: 15px;
    border-radius: 999px;
    border: 1.5px solid rgba(251, 191, 36, 0.5);
    color: #fcd34d;
    background: transparent;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 竖屏玩手机时的横屏引导（只对触摸设备显示，JS 控制隐藏） */
#rotate-hint {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    color: #fff;
    font-size: 18px;
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#rotate-hint > * + * { margin-top: 12px; }
#rotate-hint[hidden] { display: none; }
#rotate-hint .rh-icon {
    font-size: 56px;
    animation: rh-spin 2.4s ease-in-out infinite;
}
@keyframes rh-spin {
    0%, 100% { transform: rotate(-90deg); }
    50% { transform: rotate(90deg); }
}

