* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #1a1025;
    display: flex;
    flex-direction: column;
    /* stretch：避免 iframe 子页 .game-container 被压到约 320px */
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    width: 100%;
}

/* 首页：不用 body flex 收缩子项，避免进入游戏后 #games 随 iframe 缩到约 320px */
body.index-page-body {
    display: block;
    width: 100%;
    margin: 0;
    min-height: 100vh;
}

body.index-page-body > .app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: min(600px, 100%);
    margin-left: auto;
    margin-right: auto;
    min-height: 100vh;
    flex-shrink: 0;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    body.index-page-body > .app-container {
        max-width: min(720px, 92vw);
    }
}

@media (min-width: 1200px) {
    body.index-page-body > .app-container {
        max-width: min(840px, 88vw);
    }
}

/* 首页游戏外壳：始终与 .app-container 同宽 */
#games.game-container,
.app-container > .game-container#games {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    align-items: stretch !important;
    align-self: stretch !important;
    flex-shrink: 0 !important;
    box-sizing: border-box;
}

/* 首页进入游戏：外壳去 padding/圆角，iframe 与容器边缘对齐 */
.app-container > .game-container#games.is-playing {
    flex: 1 1 auto;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    overflow: hidden;
}

.app-container > .game-container#games.is-playing > .game-content {
    display: none !important;
}

.app-container > .game-container#games > #gameFrame {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    display: none;
    flex: 0 0 auto;
    height: 0;
    min-height: 0;
    overflow: hidden;
}

.app-container > .game-container#games.is-playing > #gameFrame {
    display: block;
    flex: 1 1 auto;
    flex-shrink: 0;
    height: calc(100vh - 120px);
    min-height: calc(100vh - 120px);
    overflow: visible;
}

/* In-game: hide homepage SEO chrome so iframe uses full viewport above bottom nav */
.app-container.is-playing .home-hero,
.app-container.is-playing #siteSlogan,
.app-container.is-playing .home-guide-link {
    display: none !important;
}

/* Floating share FAB — always on-screen (above bottom nav on homepage) */
.save-link-fab {
    position: fixed;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.save-link-fab--index {
    /* Sit above fixed .nav-bar (~56–68px) */
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.save-link-fab > * {
    pointer-events: auto;
}

.save-link-fab__btn {
    appearance: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(145deg, #8a5cb8 0%, #c45a8a 100%);
    box-shadow: 0 4px 16px rgba(42, 26, 56, 0.28);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.save-link-fab__btn:hover,
.save-link-fab.is-open .save-link-fab__btn {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(42, 26, 56, 0.34);
}

.save-link-fab__btn:active {
    transform: scale(0.96);
}

.save-link-fab__icon {
    display: block;
}

.save-link-fab__tip {
    max-width: min(220px, calc(100vw - 80px));
    padding: 0.55rem 0.65rem 0.55rem 0.75rem;
    border-radius: 12px;
    background: #2a1a38;
    color: #eee5f0;
    font-size: 0.78rem;
    line-height: 1.35;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    display: none;
    align-items: flex-start;
    gap: 0.35rem;
    position: relative;
}

.save-link-fab__tip.is-visible {
    display: flex !important;
    animation: save-link-tip-in 0.28s ease;
}

.save-link-fab__tip::after {
    content: '';
    position: absolute;
    right: 16px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: #2a1a38;
    transform: rotate(45deg);
}

.save-link-fab__tip-text {
    flex: 1;
}

.save-link-fab__tip-close {
    appearance: none;
    border: none;
    background: transparent;
    color: #b0a0ba;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.save-link-fab__menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 132px;
    padding: 6px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(118, 75, 162, 0.16);
    box-shadow: 0 8px 24px rgba(42, 26, 56, 0.16);
    animation: save-link-tip-in 0.2s ease;
}

.save-link-fab__menu[hidden] {
    display: none !important;
}

.save-link-fab__action {
    appearance: none;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #3d2454;
    cursor: pointer;
}

.save-link-fab__action:hover {
    background: rgba(118, 75, 162, 0.08);
}

.save-link-fab__action--mute {
    color: #8a7a9a;
    font-weight: 500;
    font-size: 0.75rem;
}

.save-link-fab--game .save-link-fab__menu {
    background: #2a1a38;
    border-color: rgba(255, 255, 255, 0.12);
}

.save-link-fab--game .save-link-fab__action {
    color: #eee5f0;
}

.save-link-fab--game .save-link-fab__action:hover {
    background: rgba(255, 255, 255, 0.08);
}

.save-link-fab--game .save-link-fab__action--mute {
    color: #a090b0;
}

@keyframes save-link-tip-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.save-link-toast {
    position: fixed;
    left: 50%;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(8px);
    z-index: 2000;
    max-width: min(90vw, 360px);
    padding: 0.7rem 1rem;
    border-radius: 10px;
    background: #2a1a38;
    color: #eee5f0;
    font-size: 0.85rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.save-link-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Legacy footer bar removed — keep rule inert if old HTML cached */
.save-link-bar {
    display: none !important;
}

.main-container {
    width: 100%;
    margin: 0 auto;
    background: linear-gradient(180deg, #1a1025 0%, #2a1a38 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: min(600px, 100%);
    margin: 0 auto;
    background-color: #fff;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* PC / 平板：放宽主内容区（手机仍约满屏宽） */
@media (min-width: 768px) {
    .app-container {
        max-width: min(720px, 92vw);
    }
}

@media (min-width: 1200px) {
    .app-container {
        max-width: min(840px, 88vw);
    }
}

/* Legal menu — ⋮ in tab bar; panel is position:fixed + JS placement (see index.html) */
.nav-bar .site-legal-menu {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    margin: 0;
    padding: 0 max(2px, env(safe-area-inset-right, 0px)) 0 2px;
}

.nav-bar .site-legal-menu__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-width: 0;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 0 3px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    color: #b0a0ba;
    font-size: 18px;
    line-height: 1;
    letter-spacing: 0;
    -webkit-tap-highlight-color: transparent;
}

.nav-bar .site-legal-menu__toggle:hover {
    color: #555;
    background: rgba(0, 0, 0, 0.05);
}

.nav-bar .site-legal-menu__toggle:active {
    color: #333;
}

.nav-bar .site-legal-menu__toggle[aria-expanded="true"] {
    color: #2196f3;
    border-color: rgba(33, 150, 243, 0.25);
    background: rgba(33, 150, 243, 0.06);
}

.nav-bar .site-legal-menu__toggle-icon {
    display: block;
    transform: translateY(-1px);
    user-select: none;
}

.nav-bar .site-legal-menu__panel {
    position: fixed;
    z-index: 900;
    left: auto;
    top: auto;
    margin: 0;
    min-width: 168px;
    max-width: min(240px, 72vw);
    padding: 6px 0;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.nav-bar .site-legal-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-bar .site-legal-menu__list li {
    margin: 0;
}

.nav-bar .site-legal-menu__list a {
    display: block;
    padding: 12px 16px;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-bar .site-legal-menu__list a:hover {
    background: #f5f5f5;
}

.nav-bar .site-legal-menu__list a:active {
    background: #eee;
}

.app-container > .game-container {
    /* 宽度固定为 app 内容区，不随「模式列表 / iframe」切换而收缩 */
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    flex: 0 1 auto;
    flex-shrink: 0;
    margin: 0;
    align-items: stretch;
    align-self: stretch;
    padding-bottom: 68px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.app-container > .game-container > .game-content {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.app-container > .game-container > #gameFrame {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    display: block;
    flex-shrink: 0;
}

.nav-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 6px 0 max(6px, env(safe-area-inset-bottom, 0px)) 8px;
    background-color: #2a1a38;
    border-top: 1px solid #3a2a48;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    overflow: visible;
}

.nav-bar > .nav-item {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
}

.nav-bar a.nav-item,
.nav-bar a.nav-item:link,
.nav-bar a.nav-item:visited,
.nav-bar a.nav-item:hover,
.nav-bar a.nav-item:focus,
.nav-bar a.nav-item:active,
.nav-bar a.nav-item .nav-text {
    text-decoration: none;
}

.nav-bar a.nav-item:link,
.nav-bar a.nav-item:visited {
    color: #666;
}

.nav-bar a.nav-item.active,
.nav-bar a.nav-item.active:link,
.nav-bar a.nav-item.active:visited,
.nav-bar a.nav-item.active:hover,
.nav-bar a.nav-item.active:focus {
    color: #2196F3;
}

.nav-item.active {
    color: #2196F3;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 12px;
}

.content-area {
    flex: 1;
    padding: 10px;
    padding-bottom: 60px; /* 为底部导航留出空间 */
    background-color: #f5f5f5;
    overflow: hidden;
}

#gameFrame {
    width: 100%;
    border: none;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    min-width: 0;
    margin: 0;
    padding: 0;
    display: block;
    vertical-align: top;
}

/* 在 index 内以 iframe 打开时：子页占满父级宽度，避免 body flex 收缩 */
html.embed-in-parent,
html.embed-in-parent body {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

html.embed-in-parent body {
    display: block;
    width: 100%;
    min-width: 100%;
    min-height: 100%;
}

html.embed-in-parent .game-container,
html.embed-in-parent .profile-container,
html.embed-in-parent .profile-page-shell {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box;
}

html.embed-in-parent body.game-page-body > .game-container {
    background: transparent;
}

/* 游戏子页（iframe 内或单独打开） */
body.game-page-body {
    display: block;
    width: 100%;
    margin: 0;
}

body.game-page-body > .game-container {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

/* 游戏页底部 SEO 说明（短描述 + 扩展正文） */
.game-desc {
    max-width: 420px;
    margin: 1rem auto;
    padding: 0 1rem;
    font-size: 0.85rem;
    color: #b0a0ba;
    text-align: center;
    line-height: 1.6;
}

.game-desc-detail {
    margin-top: 0.5rem;
    text-align: left;
}

.game-desc-detail__summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: #c8b8d8;
    text-align: center;
    list-style: none;
    user-select: none;
    padding: 0.25rem 0;
}

.game-desc-detail__summary::-webkit-details-marker {
    display: none;
}

.game-desc-detail__summary::marker {
    content: '';
}

.game-desc-detail__summary::after {
    content: ' ▾';
    font-size: 0.7rem;
    opacity: 0.85;
}

.game-desc-detail[open] .game-desc-detail__summary::after {
    content: ' ▴';
}

.game-desc-detail__body {
    margin-top: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(176, 160, 186, 0.25);
}

.game-desc-detail h1 {
    font-size: 1rem;
    font-weight: 600;
    color: #eee5f0;
    margin: 0 0 0.5rem;
    text-align: center;
    line-height: 1.4;
}

.game-desc-detail h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #d8c8e0;
    margin: 0.75rem 0 0.35rem;
}

.game-desc-detail p {
    margin: 0 0 0.55rem;
}

.game-desc-detail ul {
    margin: 0 0 0.55rem;
    padding-left: 1.15rem;
}

.game-desc-detail li {
    margin-bottom: 0.25rem;
}

.game-desc-links {
    list-style: none;
    margin: 0 0 0.55rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    justify-content: center;
}

.game-desc-links a {
    color: #c8b8d8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.game-desc-links a:hover {
    color: #eee5f0;
}

/* Homepage — hero (SEO H1, editorial band — not a card) */
.home-hero {
    margin: 0;
    padding: 0.95rem 1.15rem 0.85rem;
    text-align: center;
    background:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(118, 75, 162, 0.11) 0%, transparent 55%),
        linear-gradient(180deg, rgba(244, 238, 252, 0.65) 0%, rgba(255, 255, 255, 0) 100%);
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid rgba(118, 75, 162, 0.1);
    position: relative;
    overflow: hidden;
}

.home-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #764ba2 18%, #c45a8a 50%, #d4a574 82%, transparent 100%);
    opacity: 0.9;
}

.home-hero::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(196, 90, 138, 0.35), transparent);
    pointer-events: none;
}

.home-hero__title {
    font-size: clamp(1.15rem, 3.8vw, 1.48rem);
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: -0.025em;
    margin: 0.1rem 0 0.45rem;
    background: linear-gradient(135deg, #2a1a38 0%, #5c3478 38%, #a84d7a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #2a1a38;
}

.home-hero__intro {
    font-size: clamp(0.78rem, 2.5vw, 0.88rem);
    line-height: 1.5;
    color: #6e5e7e;
    margin: 0 auto;
    max-width: 32em;
    opacity: 0.92;
}

@media (max-width: 480px) {
    .home-hero {
        padding: 0.8rem 0.95rem 0.7rem;
    }

    .home-hero__title {
        margin-bottom: 0.35rem;
    }
}

/* Homepage mode picker — layered tiles + caption (not uniform rounded cards) */
.app-container > .game-container#games .difficulty-container {
    margin: 0;
    padding: 1rem 1rem 0.75rem;
}

.app-container > .game-container#games .difficulty-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #8a6a9a;
    margin: 0 0 0.85rem;
    line-height: 1.3;
    text-align: center;
}

.app-container > .game-container#games .difficulty-section-title::before,
.app-container > .game-container#games .difficulty-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(118, 75, 162, 0.22), transparent);
}

.app-container > .game-container#games .difficulty-option {
    margin: 0.65rem 0;
    padding: 14px 16px;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow:
        0 4px 16px rgba(42, 26, 56, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.app-container > .game-container#games .difficulty-option:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow:
        0 8px 22px rgba(42, 26, 56, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.app-container > .game-container#games .difficulty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35);
    font-size: 26px;
}

.app-container > .game-container#games .start-button {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(42, 26, 56, 0.08);
}

.app-container > .game-container#games .game-play-summary {
    position: relative;
    margin: 0.85rem 0 0;
    padding: 0.5rem 0 0.5rem 0.9rem;
    border-radius: 0;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.82rem;
    line-height: 1.58;
    color: #756585;
}

.app-container > .game-container#games .game-play-summary::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, #764ba2 0%, #c45a8a 100%);
    opacity: 0.75;
}

.home-game-grid {
    max-width: 640px;
    margin: 0 auto 0.75rem;
    padding: 0 1rem;
}

.home-game-grid__heading {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a7a9a;
    text-align: center;
    margin: 0.75rem 0 0.6rem;
}

.home-game-grid__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.home-game-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f4fc 0%, #f0eaf8 100%);
    border: 1px solid rgba(118, 75, 162, 0.14);
    text-decoration: none;
    color: inherit;
    min-height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42, 26, 56, 0.08);
}

.home-game-card__icon {
    font-size: 1.35rem;
    line-height: 1;
}

.home-game-card__name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #2a1a38;
}

.home-game-card__desc {
    font-size: 0.72rem;
    line-height: 1.45;
    color: #6a5a7a;
}

.home-guide-link {
    text-align: center;
    margin: 0.65rem 0 0.25rem;
    font-size: 0.82rem;
}

.home-guide-link a {
    color: #7b5ea8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.home-guide-link a:hover {
    color: #5a4088;
}

.difficulty-section-title {
    font-size: clamp(17px, 4.2vw, 22px);
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
    word-break: break-word;
}

/* Non-home pages keep default section title; homepage overrides in #games block above */

@media (max-width: 360px) {
    .home-game-grid__list {
        grid-template-columns: 1fr;
    }
}

/* Homepage — blog internal links (SEO + discovery) */
.home-blog-links {
    max-width: 640px;
    margin: 0 auto 1.25rem;
    padding: 0 1rem 0.5rem;
    text-align: center;
}

.home-blog-links__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #d8c8e0;
    margin: 0 0 0.6rem;
}

.home-blog-links__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    justify-content: center;
}

.home-blog-links__list a {
    font-size: 0.85rem;
    color: #c8b8d8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.home-blog-links__list a:hover {
    color: #eee5f0;
}

/* Profile — anniversary widget */
.profile-page-body .anniversary-widget {
    margin: 0;
}

.profile-page-body .anniversary-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-page-body .anniversary-prompt {
    width: 100%;
    margin: 0 0 8px;
    font-size: 15px;
    color: #555;
    line-height: 1.5;
}

.profile-page-body .anniversary-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.profile-page-body .anniversary-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.profile-page-body .anniversary-text {
    font-size: 16px;
    line-height: 1.4;
    color: #333;
}

.profile-page-body .anniversary-text strong {
    font-size: 22px;
    color: #d63384;
}

.profile-page-body .anniversary-milestone {
    font-size: 13px;
    color: #8a5a9a;
    background: #f5eef8;
    padding: 4px 10px;
    border-radius: 12px;
}

.profile-page-body .anniversary-date-input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    flex: 1 1 160px;
    min-width: 0;
}

.profile-page-body .anniversary-set-btn {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.profile-page-body .anniversary-set-btn:hover {
    opacity: 0.9;
}

.profile-page-body .anniversary-change-link {
    font-size: 14px;
    color: #7c6aa0;
    text-decoration: none;
}

.profile-page-body .anniversary-change-link:hover {
    color: #d63384;
}

.profile-page-body .anniversary-mini-btn {
    background: #f5f5f5;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    line-height: 1;
}

.profile-page-body .anniversary-mini-btn:hover {
    background: #eee;
    color: #d63384;
}

.profile-page-body .anniversary-hide-link {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 0;
    border: none;
    background: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}

.profile-page-body .anniversary-hide-link:hover {
    color: #666;
}

/* Profile 页（iframe 内或独立打开）与首页 .app-container 同宽 */
body.profile-page-body {
    margin: 0;
    width: 100%;
    min-height: 100vh;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    /* stretch：子项占满宽度；勿用 center（会按内容缩到约 320px） */
    align-items: stretch;
}

body.profile-page-body > .profile-page-shell {
    width: 100%;
    max-width: min(600px, 100%);
    min-width: 100%;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
    align-self: stretch;
    box-sizing: border-box;
}

html.embed-in-parent body.profile-page-body {
    display: block;
    width: 100%;
}

html.embed-in-parent body.profile-page-body > .profile-page-shell {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    margin: 0;
}

@media (min-width: 768px) {
    body.profile-page-body > .profile-page-shell {
        max-width: min(720px, 92vw);
    }
}

@media (min-width: 1200px) {
    body.profile-page-body > .profile-page-shell {
        max-width: min(840px, 88vw);
    }
}

.permission-modal-message {
    white-space: pre-line;
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* 个人资料页面样式（profile.html 内层；勿限制宽度） */
.profile-page-body .profile-container {
    width: 100%;
    max-width: 100%;
    background-color: transparent;
    border-radius: 0;
    padding: 12px 10px 20px;
    box-shadow: none;
    box-sizing: border-box;
}

.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.avatar {
    width: 80px;
    height: 80px;
    background-color: #1a1025;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 15px;
}

.profile-header h2 {
    color: #333;
    margin: 0;
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #2a1a38;
    border-radius: 5px;
}

.profile-item .label {
    color: #666;
}

.profile-item .value {
    color: #2196F3;
    font-weight: bold;
}

/* 飞行棋骰子样式 */
.game-board .dice-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    background-color: transparent;
    z-index: 100;
}



.game-board .dice-container:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* 掷骰子页面的骰子样式 */
.dice-game-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
}

.dice-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    position: relative;
}

.dice-container {
    perspective: 800px;
    width: 120px;
    height: 120px;
    position: relative;
}

.dice-container:nth-child(2) {
    z-index: 2;
}

.dice-container:nth-child(1) {
    z-index: 1;
}

.dice {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    transform: rotateX(15deg) rotateY(15deg);
}

/* 修改hover效果 */
.dice-container:nth-child(1):hover .dice,
.dice-container:nth-child(2):hover .dice {
    transform: rotateX(30deg) rotateY(30deg);
}

/* 修改骰子面的位置 */
.front  { transform: translateZ(60px); }
.back   { transform: translateZ(-60px) rotateY(180deg); }
.right  { transform: translateX(60px) rotateY(90deg); }
.left   { transform: translateX(-60px) rotateY(-90deg); }
.top    { transform: translateY(-60px) rotateX(90deg); }
.bottom { transform: translateY(60px) rotateX(-90deg); }

.dice-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgb(28, 245, 194);
    border: 2px solid #a4ddec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    backface-visibility: visible;
    background: linear-gradient(145deg, #2adaa8, #e6e6e6);
    box-shadow: 0 0 10px rgba(108, 199, 201, 0.1);
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0.8; /* 透明度 */
    border-radius: 15px;
}

.face::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0,0,0,0.1), rgba(0,0,0,0));
    pointer-events: none;
}

.dice-container:hover .dice {
    transform: rotateX(30deg) rotateY(30deg);
}

/* 骰子动画类 */
.rolling {
    animation: roll 1s linear infinite;
}

@keyframes roll {
    0% { transform: rotateX(0) rotateY(0) rotateZ(0); }
    100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }
}

.dice-result {
    text-align: center;
    margin-top: 2rem;
    min-height: 2rem;
}

/* 骰子结果框：参考扫雷弹窗样式；无消息时全透明 */
.dice-result-box {
    display: inline-block;
    background-color: transparent;
    color: transparent;
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: none;
    min-width: 200px;
    margin-top: 1rem;
    transition: background-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

/* 有内容时显示深色信息框，并保证至少两行高度以便单行时可居中 */
.dice-result-box:has(#diceResultText:not(:empty)) {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 2.7em;
}

.dice-result-text {
    font-size: 18px;
    line-height: 1.35;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 320px;
    display: inline-block;
    text-align: center;
    height: 2.7em;
    overflow: hidden;
}

/* 仅一行时：父级在整块结果框内上下居中，子元素高度收缩为一行 */
.dice-result-box:has(.dice-result-text.single-line) {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dice-result-text.single-line {
    height: auto;
}

#rollFunDice {
    display: block;
    margin: 20px auto;
    padding: 10px 30px;
    font-size: 18px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#rollFunDice:hover {
    background-color: #45a049;
}

#rollFunDice:active {
    transform: scale(0.98);
}

/* 调整现有游戏容器的样式 */
.game-container {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    background-color: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    align-self: stretch;
    left: 0;
    right: 0;
}

/* 响应式调整 */
/* @media (max-width: 480px) { */
@media (max-width: 480px) {
    .nav-text {
        display: none;
    }
    
    .nav-item {
        padding: 8px;
    }
    
    .nav-icon {
        font-size: 28px;
    }
    
    .content-area {
        flex: 1;
        padding: 10px;
        padding-bottom: 60px;
        overflow: hidden;
        background-color: #f5f5f5;
        min-width: 300px;
    }
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 20px;
    /* background-color: #f0f0f088; */

    border-radius: 10px;
}

.current-player-avatar {
    height: 28px;
    width: auto;
    vertical-align: middle;
    object-fit: contain;
}

.game-board {
    position: relative;
    width: 100%;
    height: 400px;
    margin-bottom: 20px;
}

#gameBoard {
    width: 100%;
    height: 100%;
    border: 2px solid #5c4a78;
    border-radius: 5px;
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* 主操作按钮（开始新游戏/掷骰子）不拉伸，保持内容宽度 */
.game-controls > button:not(.feedback-trigger-btn) {
    flex: 0 1 auto;
}

/* 反馈按钮靠右，不占主视野 */
.game-controls > .feedback-trigger-btn {
    margin-left: auto;
    flex: 0 0 auto;
}

button {
    flex: 1;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* #endGame {
    background-color: #f44336;
}

#endGame:hover {
    background-color: #da190b;
} */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.modal-content p {
    margin-bottom: 20px;
    font-size: 18px;
}

.modal-content .event-modal-text {
    margin-bottom: 20px;
    font-size: 18px;
}

.event-message-with-player {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: left;
    max-width: 100%;
}

.event-message-with-player .event-player-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.event-message-with-player .event-message-colon {
    flex-shrink: 0;
}

.event-message-with-player .event-message-text {
    line-height: 1.4;
    min-width: 0;
}




.qr-code-container {
    margin-top: 20px;
    text-align: center;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.qr-code-text {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

#qrcode {
    display: inline-block;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.game-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.game-btn {
    padding: 10px 20px;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    background-color: #1a1025;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-btn.active {
    background-color: #4CAF50;
    color: white;
}



.game-switcher {
    margin-top: 20px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #3a2a48;
}

.switch-btn {
    background-color: #2196F3;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.switch-btn:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
} 