/* ============================================
 * H5 Game 主题 — 主样式
 *
 * 设计语言: 拼多多风 H5
 *   - 高饱和红 + 黄 强调色
 *   - 大圆角按钮 / 卡片
 *   - 渐变 + 微阴影
 *   - 8pt 栅格间距
 *
 * 移动端优先,mq 升序渐进
 * ============================================ */

:root {
    --h5game-primary:    #E02D2D;
    --h5game-primary-dark: #B71C1C;
    --h5game-primary-light: #FF4D4D;
    --h5game-accent:     #FFD600;
    --h5game-success:    #2EC27E;
    --h5game-warning:    #FF9500;
    --h5game-danger:     #DC3545;

    --h5game-text:       #1A1A1A;
    --h5game-text-soft:  #666666;
    --h5game-text-mute:  #999999;
    --h5game-bg:         #FFFFFF;
    --h5game-bg-soft:    #F7F8FA;
    --h5game-border:     #EEEEEE;

    --h5game-radius-sm:  8px;
    --h5game-radius-md:  12px;
    --h5game-radius-lg:  24px;
    --h5game-radius-pill: 999px;

    --h5game-shadow-sm:  0 2px 6px rgba(0,0,0,.06);
    --h5game-shadow-md:  0 4px 12px rgba(224,45,45,.15);
    --h5game-shadow-lg:  0 8px 24px rgba(224,45,45,.20);

    --h5game-grad-primary: linear-gradient(135deg, #FF4D4D, #E02D2D);
    --h5game-grad-warm:    linear-gradient(135deg, #FF6B35, #FF9F1C);
    --h5game-grad-cool:    linear-gradient(135deg, #6B5BFF, #4E8CFF);
    --h5game-grad-green:   linear-gradient(135deg, #2EC27E, #26A65B);
    --h5game-grad-pink:    linear-gradient(135deg, #FF1493, #C71585);

    --h5game-safe-top:    env(safe-area-inset-top, 0);
    --h5game-safe-bottom: env(safe-area-inset-bottom, 0);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.h5game-body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
                 "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--h5game-text);
    background: var(--h5game-bg-soft);
    min-height: 100vh;
    overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea, select { font: inherit; }

/* === Layout === */
.h5game-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 720px;
    margin: 0 auto;
    background: var(--h5game-bg);
    box-shadow: 0 0 0 1px rgba(0,0,0,.04);
}

.h5game-main {
    flex: 1;
    padding: 16px;
}

/* === Header === */
.h5game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--h5game-safe-top) + 12px) 16px 12px;
    background: linear-gradient(180deg, var(--h5game-primary), var(--h5game-primary-dark));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
}
.h5game-logo {
    display: flex;
    align-items: center;
    color: #fff;
}
.h5game-logo img { max-height: 36px; }
.h5game-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}
.h5game-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.h5game-balance-chip {
    background: rgba(255,255,255,.18);
    color: #fff;
    border-radius: var(--h5game-radius-pill);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}
.h5game-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.18);
    color: #fff;
    border-radius: var(--h5game-radius-pill);
    font-size: 18px;
}

/* === Buttons === */
.h5game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--h5game-radius-lg);
    font-weight: 600;
    font-size: 15px;
    transition: transform .08s, filter .12s, box-shadow .12s;
    user-select: none;
}
.h5game-btn:active { transform: scale(.96); filter: brightness(.92); }
.h5game-btn-primary {
    background: var(--h5game-grad-primary);
    color: #fff;
    box-shadow: var(--h5game-shadow-md);
}
.h5game-btn-accent {
    background: var(--h5game-accent);
    color: var(--h5game-text);
}
.h5game-btn-ghost {
    background: transparent;
    color: var(--h5game-primary);
    border: 1px solid var(--h5game-primary);
}
.h5game-btn-header-ghost {
    background: rgba(255,255,255,.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
}
.h5game-btn-header-ghost:hover {
    background: rgba(255,255,255,.28);
}
.h5game-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}
.h5game-btn-lg {
    padding: 14px 24px;
    font-size: 17px;
}
.h5game-btn-block { display: flex; width: 100%; }

/* === Cards === */
.h5game-card {
    background: var(--h5game-bg);
    border-radius: var(--h5game-radius-md);
    padding: 16px;
    box-shadow: var(--h5game-shadow-sm);
    margin-bottom: 12px;
}
.h5game-card-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
}
.h5game-card-excerpt {
    color: var(--h5game-text-soft);
    font-size: 14px;
}

/* === Front page === */
.h5game-front-page { padding-bottom: 24px; }

.h5game-banner {
    background: var(--h5game-grad-primary);
    border-radius: var(--h5game-radius-lg);
    padding: 28px 20px;
    color: #fff;
    margin-bottom: 16px;
    box-shadow: var(--h5game-shadow-lg);
    text-align: center;
}
.h5game-banner h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.h5game-banner p  { margin: 0; font-size: 14px; opacity: .92; }

.h5game-wallet-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #FFF7E5, #FFE9A8);
    border-radius: var(--h5game-radius-md);
    padding: 16px;
    margin-bottom: 20px;
}
.h5game-wallet-label {
    color: var(--h5game-text-soft);
    font-size: 13px;
}
.h5game-wallet-balance {
    font-size: 24px;
    font-weight: 800;
    color: var(--h5game-primary);
    font-family: -apple-system, "DIN Alternate", sans-serif;
}

.h5game-section-title {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 700;
}

.h5game-game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.h5game-game-tile {
    background: var(--h5game-bg);
    border-radius: var(--h5game-radius-md);
    padding: 16px;
    box-shadow: var(--h5game-shadow-sm);
    text-align: center;
    transition: transform .12s, box-shadow .12s;
}
.h5game-game-tile:active {
    transform: scale(.97);
    box-shadow: var(--h5game-shadow-md);
}
.h5game-game-tile-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    margin: 0 auto 10px;
    box-shadow: var(--h5game-shadow-md);
}
.h5game-game-tile-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--h5game-text);
}
.h5game-game-tile-tag {
    margin-top: 4px;
    font-size: 12px;
    color: var(--h5game-text-mute);
}

.h5game-info-card {
    background: #FFFBF0;
    border-left: 3px solid var(--h5game-accent);
    border-radius: var(--h5game-radius-sm);
    padding: 14px 16px;
}
.h5game-info-card h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--h5game-text);
}
.h5game-info-card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--h5game-text-soft);
    font-size: 13px;
    line-height: 1.7;
}

/* === Empty / utility === */
.h5game-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--h5game-text-mute);
}

/* === Footer === */
.h5game-footer {
    text-align: center;
    padding: 20px 16px calc(20px + var(--h5game-safe-bottom));
    color: var(--h5game-text-mute);
    font-size: 12px;
}
.h5game-footer-nav { margin-bottom: 8px; }
.h5game-footer-menu {
    display: flex;
    justify-content: center;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.h5game-footer-menu a { color: var(--h5game-text-soft); }
.h5game-copyright { margin: 4px 0; }
.h5game-disclaimer {
    margin: 6px 0 0;
    font-size: 11px;
    opacity: .8;
    line-height: 1.6;
}

/* === Forms === */
.h5game-form-row { margin-bottom: 14px; }
.h5game-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--h5game-text-soft);
}
.h5game-input,
.h5game-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--h5game-bg-soft);
    border: 1px solid var(--h5game-border);
    border-radius: var(--h5game-radius-md);
    font-size: 15px;
    color: var(--h5game-text);
    transition: border-color .15s;
}
.h5game-input:focus,
.h5game-textarea:focus {
    outline: none;
    border-color: var(--h5game-primary-light);
}
.h5game-textarea { min-height: 80px; resize: vertical; }

/* === Tables (admin) === */
table.widefat { border-collapse: collapse; }
table.widefat th, table.widefat td { padding: 8px 12px; }

/* === Toast === */
.h5game-toast {
    position: fixed;
    bottom: calc(var(--h5game-safe-bottom) + 24px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,.85);
    color: #fff;
    border-radius: var(--h5game-radius-pill);
    padding: 10px 20px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.h5game-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Loading === */
.h5game-loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(224,45,45,.2);
    border-top-color: var(--h5game-primary);
    border-radius: 50%;
    animation: h5game-spin .8s linear infinite;
}
@keyframes h5game-spin { to { transform: rotate(360deg); } }

/* === Mobile-first responsive === */
/* 默认 ≤640px 已经覆盖,sm 也用此套样式即可 */

@media (min-width: 720px) {
    .h5game-game-grid { grid-template-columns: repeat(4, 1fr); }
    .h5game-front-page { padding: 24px 0; }
}

/* === Print: 隐藏手机 UI === */
@media print {
    .h5game-header, .h5game-footer { display: none; }
}
