.mm-adv-wrap {
    max-width: 860px;
    margin: 28px auto 36px;
    font-family: inherit;
    color: #1e293b;
}
.mm-adv-wrap button {
    text-transform: none !important;
    letter-spacing: normal !important;
}
.mm-adv-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

/* Admin Creation Studio */
.mm-adv-admin-panel {
    margin-bottom: 22px;
    border: 2px dashed #f59e0b;
    background: #fffdf7;
}
.mm-adv-admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.mm-adv-admin-head-btns { display: flex; gap: 6px; }
.mm-adv-admin-lock {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}
.mm-adv-admin-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}
.mm-adv-img-settings {
    margin: 0 0 18px;
    padding: 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
}
.mm-adv-img-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.mm-adv-provider-box {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.mm-adv-sub-lbl {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin: 4px 0 2px;
}
.mm-adv-input {
    width: 100%;
    height: 38px !important;
    padding: 0 10px !important;
    margin: 0 !important;
    border-radius: 7px !important;
    border: 1px solid #cbd5e1 !important;
    background: #fff !important;
    font-size: 13px !important;
}
.mm-adv-tok-badge {
    font-size: 11px;
    font-weight: 700;
    color: #16a34a;
    margin-left: 6px;
}
.mm-adv-img-cfg-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.mm-adv-cfg-msg {
    font-size: 12px;
    font-weight: 600;
}

.mm-adv-checks-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.mm-adv-admin-success {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.mm-adv-head { text-align: center; margin-bottom: 20px; }
.mm-adv-beta {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    background: #fef3c7; color: #b45309; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px;
}
.mm-adv-heading { margin: 0 0 8px; font-size: 24px; font-weight: 800; color: #0f172a; }
.mm-adv-sub { margin: 0; font-size: 14px; color: #475569; line-height: 1.6; }

.mm-adv-field { margin-bottom: 18px; }
.mm-adv-label { display: block; font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 8px; }
.mm-adv-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.mm-adv-label-row .mm-adv-label { margin-bottom: 0; }
.mm-adv-genres,
.mm-adv-lengths,
.mm-adv-lib-filters {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.mm-adv-lib-filters {
    justify-content: center;
    margin-bottom: 18px;
}
.mm-adv-pill {
    padding: 6px 14px; margin: 0; border-radius: 999px;
    border: 1px solid #cbd5e1; background: #f8fafc; color: #334155;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.mm-adv-pill:hover { border-color: var(--mauchudao, #e31010); }
.mm-adv-pill.active {
    background: var(--mauchudao, #e31010); border-color: var(--mauchudao, #e31010); color: #fff;
}

.mm-adv-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mm-adv-starter-btn {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    text-align: left; padding: 10px 12px; margin: 0;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
    cursor: pointer; transition: border-color .15s, background .15s;
}
.mm-adv-starter-btn:hover { border-color: var(--mauchudao, #e31010); background: #fff5f5; }
.mm-adv-starter-btn .st-tag {
    font-size: 11px; font-weight: 700; color: var(--mauchudao, #e31010); text-transform: uppercase;
}
.mm-adv-starter-btn .st-txt { font-size: 13px; font-weight: 600; color: #1e293b; line-height: 1.4; }

.mm-adv-textarea {
    width: 100%; padding: 12px 14px; border-radius: 10px;
    border: 1px solid #cbd5e1; background: #fff; color: #0f172a;
    font-size: 14px; line-height: 1.6; resize: vertical;
}
.mm-adv-opts {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    margin-top: 8px; font-size: 13px; color: #475569;
}
.mm-adv-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; font-weight: 500; }
.mm-adv-check input { margin: 0; }
.mm-adv-char { font-size: 12px; color: #64748b; }

.mm-adv-primary-btn {
    width: 100%; padding: 13px 20px; margin: 6px 0 0;
    border: none; border-radius: 10px;
    background: linear-gradient(135deg, var(--mauchudao, #e31010), #b91c1c);
    color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
    box-shadow: 0 6px 16px rgba(227, 16, 16, 0.25); transition: opacity .15s;
}
.mm-adv-primary-btn:hover { opacity: .92; }
.mm-adv-primary-btn:disabled { opacity: .55; cursor: not-allowed; }

.mm-adv-error {
    margin: 12px 0; padding: 10px 14px; border-radius: 8px;
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    font-size: 13px; font-weight: 600;
}

.mm-adv-recent { margin: 0 0 18px; padding: 14px; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; }
.mm-adv-recent-list { display: flex; flex-direction: column; gap: 8px; }
.mm-adv-recent-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid #e2e8f0;
    text-decoration: none; color: #0f172a; font-size: 13px; font-weight: 600;
}
.mm-adv-recent-item:hover { border-color: var(--mauchudao, #e31010); }
.mm-adv-recent-meta { font-size: 12px; color: #64748b; font-weight: 500; flex-shrink: 0; }

/* Public Story Library Grid */
.mm-adv-story-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.mm-adv-lib-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 36px 16px;
    color: #64748b;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
}
.mm-adv-story-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    transition: transform .15s, border-color .15s;
}
.mm-adv-story-card:hover {
    transform: translateY(-2px);
    border-color: var(--mauchudao, #e31010);
}
.mm-adv-story-card.is-draft {
    opacity: .72;
    border-style: dashed;
}
.mm-adv-card-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    overflow: hidden;
}
.mm-adv-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mm-adv-card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    z-index: 2;
}
.mm-adv-card-genre {
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--mauchudao, #e31010);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.mm-adv-card-plays {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}
.mm-adv-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.mm-adv-card-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.mm-adv-card-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
}
.mm-adv-card-turns {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.mm-adv-card-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
}
.mm-adv-card-excerpt {
    margin: 0 0 14px;
    font-size: 13px;
    color: #475569;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.mm-adv-join-btn {
    width: 100%;
    padding: 9px 14px;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: var(--mauchudao, #e31010);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
}
.mm-adv-join-btn:hover { opacity: .9; }
.mm-adv-join-btn:disabled { opacity: .55; cursor: not-allowed; }

.mm-adv-card-admin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    font-size: 11px;
}
.mm-adv-draft-tag {
    color: #b45309;
    font-weight: 700;
}
.mm-adv-card-admin-btns { display: flex; gap: 6px; margin-left: auto; }
.mm-adv-mini-btn {
    padding: 4px 10px;
    margin: 0;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.mm-adv-mini-btn.danger { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }

/* Play Screen */
.mm-adv-play.has-bg {
    position: relative;
    padding: 16px;
    border-radius: 16px;
    overflow: hidden;
    background: #f8fafc;
}
.mm-adv-play.has-bg::before {
    content: "";
    position: absolute;
    inset: -20px;
    background-image: var(--mm-adv-bg);
    background-size: cover;
    background-position: center;
    filter: blur(22px) saturate(1.1);
    opacity: .16;
    pointer-events: none;
    z-index: 0;
}
.mm-adv-play.has-bg > * {
    position: relative;
    z-index: 1;
}
.mm-adv-hero-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    background: #0f172a;
}
.mm-adv-hero-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mm-adv-hero-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(35deg, rgba(15, 23, 42, 0.82) 0%, rgba(15, 23, 42, 0.35) 45%, rgba(15, 23, 42, 0) 75%);
    pointer-events: none;
}
.mm-adv-hero-caption {
    position: absolute;
    left: 16px;
    bottom: 14px;
    max-width: 72%;
    z-index: 2;
    color: #fff;
}
.mm-adv-hero-genre {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--mauchudao, #e31010);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
}
.mm-adv-hero-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.mm-adv-hero-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #e2e8f0;
    font-weight: 600;
}
.mm-adv-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 12px 16px 14px; margin-bottom: 16px; overflow: hidden;
    background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px);
    border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}
.mm-adv-arc-bar {
    position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #e2e8f0;
}
.mm-adv-arc-fill {
    height: 100%; width: 10%;
    background: linear-gradient(90deg, var(--mauchudao, #e31010), #f59e0b);
    transition: width .3s ease;
}
.mm-adv-topbar-info { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.mm-adv-genre-badge {
    padding: 3px 9px; border-radius: 999px; background: #fee2e2; color: #b91c1c;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.mm-adv-story-title {
    margin: 0; font-size: 16px; font-weight: 800; color: #0f172a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mm-adv-topbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mm-adv-turn-badge { font-size: 12px; color: #475569; padding: 0 4px; }
.mm-adv-time-left {
    font-size: 11px; font-weight: 700; color: #1d4ed8;
    background: #eff6ff; padding: 2px 8px; border-radius: 999px;
}
.mm-adv-tool-btn {
    padding: 5px 10px; margin: 0; border-radius: 7px;
    border: 1px solid #cbd5e1; background: #f8fafc; color: #1e293b;
    font-size: 12px; font-weight: 600; cursor: pointer;
}
.mm-adv-tool-btn:hover { border-color: var(--mauchudao, #e31010); }
.mm-adv-tool-btn:disabled { opacity: .45; cursor: not-allowed; }

.mm-adv-timeline { display: flex; flex-direction: column; gap: 18px; }
.mm-adv-scene {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    overflow: hidden; box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}
.mm-adv-choice-taken {
    padding: 9px 16px; background: #f1f5f9; border-bottom: 1px solid #e2e8f0;
    font-size: 13px; font-weight: 700; color: #1d4ed8;
}
.mm-adv-img-box {
    position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0f172a; overflow: hidden;
}
.mm-adv-img-shimmer {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%; animation: mmAdvShimmer 1.4s infinite;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; font-size: 12px; font-weight: 600;
}
@keyframes mmAdvShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.mm-adv-img-box img {
    position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; display: block;
}

.mm-adv-scene-body { padding: 18px 20px; }
.mm-adv-scene-meta {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.mm-adv-scene-turn { font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; }
.mm-adv-scene-text { font-size: 16px; line-height: 1.8; color: #1e293b; }
.mm-adv-scene-text p { margin: 0 0 12px; }
.mm-adv-scene-text p:last-child { margin-bottom: 0; }

.mm-adv-loading {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 18px 0; padding: 16px; border-radius: 12px;
    background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8;
    font-size: 14px; font-weight: 600;
}
.mm-adv-spinner {
    width: 18px; height: 18px; border: 2.5px solid #93c5fd; border-top-color: #1d4ed8;
    border-radius: 50%; animation: mmAdvSpin .75s linear infinite;
}
@keyframes mmAdvSpin { to { transform: rotate(360deg); } }

.mm-adv-controls {
    margin-top: 18px; padding: 18px; border-radius: 14px;
    background: #f8fafc; border: 1px solid #e2e8f0;
}
.mm-adv-controls-title { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 12px; }
.mm-adv-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mm-adv-choice-btn {
    display: flex; align-items: flex-start; gap: 10px; text-align: left;
    padding: 12px 14px; margin: 0; border-radius: 10px;
    background: #fff; border: 1px solid #cbd5e1; color: #0f172a;
    font-size: 14px; line-height: 1.45; cursor: pointer; transition: all .15s;
}
.mm-adv-choice-btn:hover {
    border-color: var(--mauchudao, #e31010); background: #fff5f5; transform: translateY(-1px);
}
.mm-adv-choice-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.mm-adv-choice-key {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
    background: var(--mauchudao, #e31010); color: #fff; font-size: 12px; font-weight: 800;
}

/* Ending Card */
.mm-adv-ending-card {
    margin-top: 20px;
    padding: 24px 20px;
    border-radius: 14px;
    text-align: center;
    border: 2px solid #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.mm-adv-ending-card.ending-happy { border-color: #16a34a; background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%); }
.mm-adv-ending-card.ending-bad { border-color: #dc2626; background: linear-gradient(180deg, #fef2f2 0%, #ffffff 100%); }
.mm-adv-ending-card.ending-secret { border-color: #9333ea; background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%); }
.mm-adv-ending-card.ending-open { border-color: #2563eb; background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%); }
.mm-adv-end-badge {
    display: inline-block; padding: 4px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 800; margin-bottom: 10px;
    background: #0f172a; color: #fff;
}
.mm-adv-end-title { margin: 0 0 8px; font-size: 22px; font-weight: 800; color: #0f172a; }
.mm-adv-end-sub { margin: 0 0 18px; font-size: 13px; color: #475569; }
.mm-adv-end-actions {
    display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
}
.mm-adv-end-btn {
    padding: 9px 16px; margin: 0; border-radius: 8px;
    border: 1px solid #cbd5e1; background: #fff; color: #0f172a;
    font-size: 13px; font-weight: 700; cursor: pointer;
}
.mm-adv-end-btn.primary {
    background: var(--mauchudao, #e31010); border-color: var(--mauchudao, #e31010); color: #fff;
}

/* Dark mode */
html.mm-dark .mm-adv-card,
html.mm-dark .mm-adv-scene,
html.mm-dark .mm-adv-controls,
html.mm-dark .mm-adv-topbar,
html.mm-dark .mm-adv-story-card,
html.mm-dark .mm-adv-img-settings,
html.mm-dark .mm-adv-ending-card {
    background: #1a1d23 !important; border-color: #2c313c !important; color: #e5e7eb !important;
}
html.mm-dark .mm-adv-admin-panel { border-color: #b45309 !important; }
html.mm-dark .mm-adv-ending-card.ending-happy { border-color: #16a34a !important; }
html.mm-dark .mm-adv-ending-card.ending-bad { border-color: #dc2626 !important; }
html.mm-dark .mm-adv-ending-card.ending-secret { border-color: #9333ea !important; }
html.mm-dark .mm-adv-ending-card.ending-open { border-color: #2563eb !important; }
html.mm-dark .mm-adv-heading,
html.mm-dark .mm-adv-admin-title,
html.mm-dark .mm-adv-card-title,
html.mm-dark .mm-adv-story-title,
html.mm-dark .mm-adv-controls-title,
html.mm-dark .mm-adv-end-title,
html.mm-dark .mm-adv-starter-btn .st-txt { color: #e5e7eb !important; }
html.mm-dark .mm-adv-sub,
html.mm-dark .mm-adv-label,
html.mm-dark .mm-adv-sub-lbl,
html.mm-dark .mm-adv-card-excerpt,
html.mm-dark .mm-adv-end-sub,
html.mm-dark .mm-adv-scene-turn { color: #9ca3af !important; }
html.mm-dark .mm-adv-pill:not(.active),
html.mm-dark .mm-adv-starter-btn,
html.mm-dark .mm-adv-choice-btn,
html.mm-dark .mm-adv-tool-btn,
html.mm-dark .mm-adv-mini-btn,
html.mm-dark .mm-adv-end-btn:not(.primary),
html.mm-dark .mm-adv-recent,
html.mm-dark .mm-adv-recent-item,
html.mm-dark .mm-adv-lib-empty {
    background: #22262e !important; border-color: #343b46 !important; color: #e5e7eb !important;
}
html.mm-dark .mm-adv-choice-taken {
    background: #22262e !important; border-color: #2c313c !important; color: #93c5fd !important;
}
html.mm-dark .mm-adv-scene-text { color: #d4d4d8 !important; }
html.mm-dark .mm-adv-play.has-bg { background: #111318; }
html.mm-dark .mm-adv-hero-cover { border-color: #2c313c !important; }
html.mm-dark .mm-adv-play.has-bg::before { opacity: .22; }

@media (max-width: 640px) {
    .mm-adv-play.has-bg { padding: 10px; }
    .mm-adv-hero-title { font-size: 16px; }
    .mm-adv-hero-caption { max-width: 66%; left: 12px; bottom: 10px; }
    .mm-adv-wrap { margin-top: 16px; }
    .mm-adv-card { padding: 16px; }
    .mm-adv-starters,
    .mm-adv-story-grid,
    .mm-adv-choices { grid-template-columns: 1fr; }
    .mm-adv-scene-body { padding: 14px 16px; }
}
