/* ========== MOBILE ONLY (max-width: 1023px) — matches desktop design system ========== */
:root {
    --m-bg: #0f0f13;
    --m-surface: #18181f;
    --m-surface-2: #1e1e28;
    --m-border: rgba(255,255,255,0.08);
    --m-text: #f0f0f5;
    --m-text-muted: #8b8b9e;
    --m-accent: #7c5cfc;
    --m-accent-hover: #6344e0;
    --m-live: #ff4757;
    --m-gold: #ffc107;
    --m-content-bg: #f4f5f9;
    --m-card-bg: #ffffff;
    --m-radius: 12px;
    --m-header-h: 56px;
    --m-tabs-h: 60px;
}

.m-view { display: block; min-height: 100vh; background: var(--m-content-bg); padding-bottom: var(--m-tabs-h); }
.m-view:has(.m-chat-full),
.m-view:has(.m-live) {
    padding-bottom: 0;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
    background: var(--m-bg);
}
.d-view { display: none !important; }

.m-page-pad { padding: 16px; }

/* ---- Header (dark, like desktop topbar) ---- */
.m-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--m-header-h); padding: 0 14px;
    background: var(--m-bg); border-bottom: 1px solid var(--m-border);
}
.m-logo {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 1rem; color: var(--m-text);
}
.m-logo-icon { color: var(--m-live); font-size: 1.125rem; }
.m-logo-text span { color: var(--m-accent); }
.m-header-actions { display: flex; align-items: center; gap: 8px; }

.m-coin-badge {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 10px; background: rgba(124,92,252,0.15);
    border: 1px solid rgba(124,92,252,0.3); border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; color: #b49cff;
}
.m-user-menu { display: flex; align-items: center; }
.m-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--m-accent), #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8125rem; color: #fff;
    overflow: hidden;
}
.m-btn-primary {
    padding: 7px 12px; background: var(--m-accent); color: #fff;
    border-radius: 8px; font-size: 0.75rem; font-weight: 600;
}
.m-btn-outline {
    padding: 7px 12px; border: 1px solid var(--m-border); color: var(--m-text-muted);
    border-radius: 8px; font-size: 0.75rem;
}
.m-btn-block { width: 100%; padding: 14px; border-radius: 10px; font-weight: 600; font-size: 0.9375rem; margin-top: 0; }
.m-btn-block + .m-btn-block { margin-top: 12px; }

/* ---- Bottom tabs ---- */
.m-tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    display: flex; height: var(--m-tabs-h);
    background: var(--m-bg); border-top: 1px solid var(--m-border);
    padding-bottom: env(safe-area-inset-bottom);
}
.m-tabs a {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    font-size: 0.625rem; color: var(--m-text-muted);
    transition: color 0.15s;
}
.m-tabs a span { font-size: 1.2rem; }
.m-tabs a.on { color: var(--m-accent); font-weight: 700; }

/* ---- Welcome banner ---- */
.m-banner {
    background: linear-gradient(135deg, #667eea22, #764ba222);
    border-bottom: 1px solid #e8e4ff;
    padding: 12px 16px;
    font-size: 0.8125rem; color: #555;
}
.m-banner strong { color: var(--m-accent); }

/* ---- Section blocks ---- */
.m-block { margin-bottom: 28px; }
.m-block-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.m-block-head h2 {
    font-size: 1.0625rem; font-weight: 800; color: #1a1a2e;
    display: flex; align-items: center; gap: 8px;
}
.m-block-head h2::before {
    content: ''; width: 4px; height: 18px;
    background: var(--m-accent); border-radius: 2px;
}
.m-block-head a { font-size: 0.8125rem; color: var(--m-accent); font-weight: 500; }

/* ---- Stream card grid ---- */
.m-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 480px) {
    .m-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

.m-stream-card {
    display: block; background: var(--m-card-bg);
    border-radius: var(--m-radius); overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
}
.m-stream-card:active { transform: scale(0.98); }

.m-card-thumb {
    position: relative; aspect-ratio: 16/9;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-size: cover; background-position: center;
    overflow: hidden;
}
.m-card-thumb.has-cover { background-color: #1a1a2e; }
.m-card-gradient {
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.5) 100%);
}
.m-live-tag {
    position: absolute; top: 8px; left: 8px; z-index: 2;
    background: var(--m-live); color: #fff;
    font-size: 0.625rem; font-weight: 800; padding: 2px 6px;
    border-radius: 3px; letter-spacing: 0.05em;
}
.m-live-tag.lg { font-size: 0.75rem; padding: 4px 10px; border-radius: 5px; }
.m-adult-tag {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    background: var(--m-live); color: #fff;
    font-size: 0.625rem; font-weight: 800; padding: 2px 6px; border-radius: 3px;
}
.m-viewers {
    position: absolute; bottom: 8px; left: 8px; z-index: 2;
    background: rgba(0,0,0,0.65); color: #fff;
    font-size: 0.6875rem; padding: 2px 6px; border-radius: 4px;
}

.m-card-body { display: flex; gap: 8px; padding: 10px 10px 12px; }
.m-card-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--m-accent), #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.75rem; color: #fff;
    overflow: hidden;
}
.m-card-avatar.has-img { background: #eee; }
.m-card-info { min-width: 0; }
.m-card-info h3 {
    font-size: 0.8125rem; font-weight: 600; color: #1a1a2e;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 2px;
}
.m-card-info p { font-size: 0.75rem; color: #888; }
.m-card-cat {
    display: inline-block; margin-top: 3px;
    font-size: 0.625rem; color: var(--m-accent);
    background: #f3f0ff; padding: 1px 5px; border-radius: 4px;
}

/* ---- Featured hero ---- */
.m-featured-card {
    display: block; border-radius: 14px; overflow: hidden;
    margin-bottom: 20px; box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}
.m-featured-thumb {
    position: relative; aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: cover; background-position: center;
    min-height: 160px; overflow: hidden;
}
.m-featured-thumb.has-cover { background-color: #0f0f13; }
.m-featured-gradient {
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(90deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}
.m-featured-overlay {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
    padding: 20px 18px; color: #fff;
}
.m-featured-viewers {
    display: inline-block; background: rgba(255,71,87,0.9);
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; margin-bottom: 8px;
}
.m-featured-overlay h2 { font-size: 1.125rem; font-weight: 800; margin-bottom: 4px; }
.m-featured-overlay p { font-size: 0.875rem; opacity: 0.85; margin-bottom: 10px; }
.m-featured-cta {
    display: inline-block; padding: 8px 16px;
    background: var(--m-accent); border-radius: 8px;
    font-size: 0.8125rem; font-weight: 600;
}

/* ---- Search ---- */
.m-search {
    position: relative; margin-bottom: 16px;
    display: flex; align-items: center;
}
.m-search svg {
    position: absolute; left: 12px; color: #aaa; pointer-events: none;
}
.m-search input {
    width: 100%; padding: 10px 14px 10px 38px;
    background: var(--m-card-bg); border: 1px solid #e0e0e0;
    border-radius: 10px; outline: none; font-size: 0.875rem; color: #333;
}
.m-search input:focus {
    border-color: var(--m-accent);
    box-shadow: 0 0 0 3px rgba(124,92,252,0.12);
}

/* ---- Side panel (ranking on home) ---- */
.m-panel {
    background: var(--m-card-bg); border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden; margin-bottom: 20px;
}
.m-panel-head {
    padding: 14px 16px; border-bottom: 1px solid #f0f0f0;
    font-size: 0.9375rem; font-weight: 700; color: #1a1a2e;
    display: flex; align-items: center; gap: 8px;
}
.m-rank-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid #f8f8f8;
    cursor: pointer;
}
.m-rank-row:last-child { border-bottom: none; }
.m-rank-row:active { background: #faf9ff; }
.m-rank-num {
    width: 22px; text-align: center; font-weight: 800;
    font-size: 0.8125rem; color: #ccc; flex-shrink: 0;
}
.m-rank-num.rank-1 { color: var(--m-gold); }
.m-rank-num.rank-2 { color: #aaa; }
.m-rank-num.rank-3 { color: #cd7f32; }
.m-rank-av {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8125rem; color: #fff;
    overflow: hidden;
}
.m-rank-av.has-img { background: #eee; }
.m-rank-info { flex: 1; min-width: 0; }
.m-rank-info strong { display: block; font-size: 0.8125rem; color: #333; }
.m-rank-info small { font-size: 0.75rem; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.m-rank-view { font-size: 0.75rem; color: #bbb; flex-shrink: 0; }

/* ---- Ranking page ---- */
.m-rank-hero {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 14px; padding: 28px 20px; color: #fff;
    margin-bottom: 20px; text-align: center;
}
.m-rank-hero h1 { font-size: 1.375rem; font-weight: 800; margin-bottom: 6px; }
.m-rank-hero p { font-size: 0.875rem; opacity: 0.9; }

.m-rank-table {
    background: var(--m-card-bg); border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden;
}
.m-rank-table-row {
    display: grid; grid-template-columns: 36px 40px 1fr auto;
    gap: 10px; padding: 14px 16px; align-items: center;
    border-bottom: 1px solid #f8f8f8; cursor: pointer;
}
.m-rank-table-row:last-child { border-bottom: none; }
.m-rank-table-row:active { background: #faf9ff; }
.m-rank-table-row.top1 { background: linear-gradient(90deg, #fffbeb, #fff); }
.m-rank-table-row.top2 { background: linear-gradient(90deg, #f9f9f9, #fff); }
.m-rank-table-row.top3 { background: linear-gradient(90deg, #fff8f0, #fff); }
.m-rank-table-row .num { font-weight: 800; font-size: 1rem; color: #ddd; text-align: center; }
.m-rank-table-row.top1 .num { color: var(--m-gold); }
.m-rank-table-row.top2 .num { color: #aaa; }
.m-rank-table-row.top3 .num { color: #cd7f32; }
.m-rank-table-row .info strong { display: block; font-size: 0.875rem; }
.m-rank-table-row .info small { font-size: 0.75rem; color: #888; }
.m-rank-table-row .viewers { font-size: 0.75rem; color: #888; white-space: nowrap; }

/* ---- My page ---- */
.m-profile-card {
    background: var(--m-card-bg); border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 28px 20px; text-align: center; margin-bottom: 16px;
}
.m-profile-av {
    width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 14px;
    background: linear-gradient(135deg, var(--m-accent), #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; font-weight: 800; color: #fff;
    overflow: hidden;
}
.m-profile-card h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 4px; color: #1a1a2e; }
.m-profile-card .uid { font-size: 0.8125rem; color: #aaa; margin-bottom: 18px; }
.m-profile-coin {
    background: linear-gradient(135deg, #7c5cfc, #a855f7);
    color: #fff; border-radius: 12px; padding: 14px;
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; font-size: 1rem;
}

.m-menu-card {
    background: var(--m-card-bg); border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden;
    margin-bottom: 14px;
}
.m-menu-card-title {
    padding: 14px 16px; background: #fafafa;
    font-size: 0.75rem; font-weight: 700; color: #888;
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid #f0f0f0;
}
.m-menu-link {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid #f8f8f8;
    font-size: 0.9375rem; color: #444;
}
.m-menu-link:last-child { border-bottom: none; }
.m-menu-link:active { background: #faf9ff; color: var(--m-accent); }

.m-login-page {
    max-width: 400px; margin: 48px auto; text-align: center;
    background: var(--m-card-bg); border-radius: 16px;
    padding: 36px 24px; box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.m-login-page h2 { font-size: 1.375rem; margin-bottom: 8px; color: #1a1a2e; }
.m-login-page p { color: #888; margin-bottom: 24px; font-size: 0.9375rem; }

/* ---- Mobile LIVE room (theater) ---- */
.m-live {
    display: flex; flex-direction: column;
    height: 100dvh; height: 100vh;
    overflow: hidden;
    background: #000;
}
.m-live-video {
    aspect-ratio: 16/9; background: #0a0a0a; position: relative;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.m-theater-info {
    background: var(--m-surface); padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-top: 1px solid var(--m-border); flex-shrink: 0;
}
.m-theater-info-left h3 { color: var(--m-text); font-size: 0.9375rem; font-weight: 700; }
.m-theater-info-left p { color: var(--m-text-muted); font-size: 0.75rem; margin-top: 2px; }
.m-theater-live {
    display: flex; align-items: center; gap: 5px;
    color: var(--m-live); font-size: 0.8125rem; font-weight: 700; flex-shrink: 0;
}
.m-theater-live::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: var(--m-live); animation: mpulse 1.5s infinite;
}
@keyframes mpulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.m-theater-chat-head {
    padding: 10px 16px; border-bottom: 1px solid var(--m-border);
    display: flex; justify-content: space-between; align-items: center;
    color: var(--m-text); font-weight: 700; font-size: 0.875rem;
    background: var(--m-surface); flex-shrink: 0;
}
.m-theater-chat-head span:last-child { font-weight: 400; color: var(--m-text-muted); font-size: 0.75rem; }

.m-live-chat {
    flex: 1; min-height: 0; overflow-y: auto;
    background: var(--m-surface); padding: 14px 16px;
    -webkit-overflow-scrolling: touch;
}

.m-live-input {
    display: flex; gap: 8px; align-items: center;
    padding: 10px 14px;
    background: var(--m-surface-2); border-top: 1px solid var(--m-border);
    flex-shrink: 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.m-live-input input {
    flex: 1; padding: 10px 14px;
    background: var(--m-bg); border: 1px solid var(--m-border);
    border-radius: 8px; color: var(--m-text); outline: none; font-size: 0.875rem;
}
.m-live-input input::placeholder { color: var(--m-text-muted); }
.m-live-input input:focus { border-color: var(--m-accent); }
.m-live-input button {
    width: 40px; height: 40px; border-radius: 8px;
    background: var(--m-accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}

/* ---- CHAT full screen ---- */
.m-chat-full {
    display: flex; flex-direction: column;
    height: 100dvh; height: 100vh;
    overflow: hidden;
    background: var(--m-surface);
}
.m-chat-full-head {
    padding: 12px 16px; border-bottom: 1px solid var(--m-border);
    background: var(--m-surface-2); flex-shrink: 0;
}
.m-chat-back {
    display: inline-block; font-size: 0.8125rem; color: var(--m-accent);
    margin-bottom: 10px;
}
.m-chat-head-main {
    display: flex; align-items: center; gap: 12px;
}
.m-chat-av {
    width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.m-chat-av-fallback {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--m-accent), #a855f7);
    color: #fff; font-weight: 700; font-size: 1.125rem;
}
.m-chat-head-main strong { display: block; font-size: 1rem; color: var(--m-text); }
.m-chat-head-main p { font-size: 0.75rem; color: var(--m-text-muted); margin-top: 3px; }
.m-chat-badge {
    margin-left: auto; flex-shrink: 0;
    background: var(--m-accent); color: #fff; font-size: 0.6875rem;
    font-weight: 700; padding: 4px 10px; border-radius: 6px;
}
.m-chat-full-msgs {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 16px;
    background: var(--m-surface);
    -webkit-overflow-scrolling: touch;
}
.m-chat-full-input {
    display: flex; gap: 8px; align-items: center;
    padding: 12px 16px;
    background: var(--m-surface-2); border-top: 1px solid var(--m-border);
    flex-shrink: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.m-chat-full-input input {
    flex: 1; padding: 10px 14px;
    background: var(--m-bg); border: 1px solid var(--m-border);
    border-radius: 10px; color: var(--m-text); outline: none; font-size: 0.9375rem;
}
.m-chat-full-input input::placeholder { color: var(--m-text-muted); }
.m-chat-full-input input:focus { border-color: var(--m-accent); }
.m-chat-full-input button {
    background: var(--m-accent); color: #fff; width: 42px; height: 42px;
    border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

/* ---- Notices ---- */
.m-notice-page {
    background: var(--m-card-bg); border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden;
}
.m-notice-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid #f0f0f0;
    color: inherit;
}
.m-notice-item .title { font-size: 0.9375rem; font-weight: 500; color: #333; }
.m-notice-item .date { font-size: 0.75rem; color: #bbb; flex-shrink: 0; margin-left: 12px; }
.m-notice-pin { background: #fce4ec; color: #e91e63; font-size: 0.6875rem; padding: 2px 6px; border-radius: 4px; margin-right: 6px; font-weight: 700; }
.m-notice-detail { padding: 20px 16px; background: var(--m-card-bg); border-radius: var(--m-radius); margin: 16px; }
.m-notice-detail h2 { font-size: 1.125rem; margin-bottom: 8px; color: #1a1a2e; }
.m-notice-detail .meta { font-size: 0.8125rem; color: #999; margin-bottom: 16px; }
.m-notice-detail .body { font-size: 0.9375rem; line-height: 1.7; white-space: pre-wrap; color: #444; }

.m-empty { text-align: center; padding: 32px 16px; color: #bbb; font-size: 0.875rem; grid-column: 1 / -1; }

/* ---- Support & Legal ---- */
.m-legal-article {
    background: var(--m-card-bg); border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 24px 18px;
}
.m-legal-article h1 { font-size: 1.25rem; font-weight: 800; color: #1a1a2e; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f0; }
.m-legal-article .body { font-size: 0.9375rem; line-height: 1.8; color: #444; white-space: pre-wrap; }

/* Legacy aliases (unused list items) */
.m-section { padding: 16px; }
.m-section-title {
    font-size: 1rem; font-weight: 700; margin-bottom: 12px;
    display: flex; justify-content: space-between; align-items: center;
}
