/* ==============================
   MusicBox Shell — Macaron Style
   ============================== */

:root {
    --bg: #faf7f5;
    --bg-warm: #f5f0ec;
    --card-pink: #fce4ec;
    --card-blue: #e3f2fd;
    --card-lavender: #ede7f6;
    --card-mint: #e8f5e9;
    --accent: #b39ddb;
    --accent-dark: #7e57c2;
    --text: #3a3a3c;
    --text-secondary: #9e95a7;
    --text-light: #bdb3c6;
    --white: #ffffff;
    --radius: 18px;
    --radius-sm: 14px;
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== Install Guide (inside ap-card) ========== */
.ig-steps {
    padding: 4px 8px;
    text-align: left;
}

.ig-section {
    padding: 8px 0;
}

.ig-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--card-lavender);
    color: var(--accent-dark);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ig-list {
    padding-left: 18px;
    font-size: 13px;
    line-height: 2;
    color: #6b7280;
}

.ig-list strong {
    color: #3a3a3c;
    font-weight: 600;
}

.ig-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 4px 0;
}

.ig-tip {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.6;
    margin-bottom: 8px;
}

.ig-tip strong {
    color: #3a3a3c;
}

.ig-link {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 500;
}

.ig-link:active {
    opacity: 0.7;
}

/* ========== Activation Page (tone-wizard clone) ========== */

/* Animations */
@keyframes ap-fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ap-scale-in {
    from {
        opacity: 0;
        transform: scale(0.88);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ap-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes ap-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }
}

@keyframes ap-exit {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }
}

.ap-anim-logo {
    animation: ap-scale-in 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) 0.05s both;
}

.ap-anim-title {
    animation: ap-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

.ap-anim-sub {
    animation: ap-fade-in 0.45s ease 0.3s both;
}

.ap-anim-desc {
    animation: ap-fade-in 0.45s ease 0.38s both;
}

.ap-anim-card {
    animation: ap-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

.ap-anim-footer {
    animation: ap-fade-in 0.4s ease 0.7s both;
}

.ap-error-shake {
    animation: ap-shake 0.38s ease;
}

.ap-exiting {
    animation: ap-exit 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ap-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.ap-content {
    width: 100%;
    max-width: 380px;
    text-align: center;
}

/* Logo */
.ap-logo {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    overflow: hidden;
    margin: 0 auto 32px;
}

.ap-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Title */
.ap-title {
    font-size: 28px;
    font-weight: 700;
    color: #3a3a3c;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

/* Subtitle */
.ap-subtitle {
    font-size: 14px;
    color: #9ca3af;
    font-weight: 300;
    margin-bottom: 8px;
}

/* Description */
.ap-desc {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Form card */
.ap-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #f3f4f6;
    padding: 16px 20px;
    margin: 0 40px;
}

.ap-form {
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ap-field {
    text-align: left;
}

.ap-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 4px;
    padding-left: 2px;
}

.ap-input {
    width: 100%;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fefcfb;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ap-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(179, 157, 219, 0.15);
}

.ap-input::placeholder {
    color: #d1d5db;
}

.ap-input-code {
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Error */
.ap-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    font-size: 11px;
    color: #ef4444;
    text-align: left;
}

/* Button */
.ap-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--accent);
    color: var(--accent-dark);
}

.ap-btn:disabled {
    background: #f3f4f6;
    color: #d1d5db;
    cursor: not-allowed;
}

.ap-btn:not(:disabled):hover {
    filter: brightness(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ap-btn:not(:disabled):active {
    transform: scale(0.97);
}

.ap-btn-icon {
    font-size: 14px;
}

/* Footer */
.ap-footer {
    font-size: 10px;
    color: #d1d5db;
    margin-top: 24px;
}

/* ========== Main Page (Premium Macaron) ========== */
#main-page {
    background: var(--bg);
}

.mp-scroll {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Hero */
.mp-hero {
    text-align: center;
    padding: 48px 24px 28px;
    animation: mp-hero-in 0.6s ease-out both;
}

.mp-hero-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    margin: 0 auto 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.mp-hero-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.mp-hero-greeting {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

@keyframes mp-hero-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Grid */
.mp-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 0 20px;
    max-width: 400px;
    width: 100%;
}

/* Card */
.mc {
    position: relative;
    border-radius: 20px;
    padding: 18px 16px 16px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.25s;
    overflow: hidden;
    animation: mc-pop 0.45s ease-out both;
}

.mc::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

.mc:active {
    transform: scale(0.96);
}

@keyframes mc-pop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Card Colors */
.mc.card-pink {
    background: linear-gradient(145deg, #fce4ec 0%, #fff0f5 50%, #fdf2f8 100%);
    box-shadow: 0 4px 20px rgba(244, 143, 177, 0.12), 0 1px 3px rgba(0, 0, 0, 0.03);
}

.mc.card-blue {
    background: linear-gradient(145deg, #e3f2fd 0%, #f0f7ff 50%, #eef5fc 100%);
    box-shadow: 0 4px 20px rgba(100, 181, 246, 0.12), 0 1px 3px rgba(0, 0, 0, 0.03);
}

.mc.card-lavender {
    background: linear-gradient(145deg, #ede7f6 0%, #f5f0ff 50%, #f0ecfa 100%);
    box-shadow: 0 4px 20px rgba(179, 157, 219, 0.12), 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* Card Top Row */
.mc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.mc-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.card-pink .mc-icon {
    background: rgba(244, 143, 177, 0.18);
}

.card-blue .mc-icon {
    background: rgba(100, 181, 246, 0.18);
}

.card-lavender .mc-icon {
    background: rgba(179, 157, 219, 0.18);
}

.mc-go {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s, background 0.2s;
}

.mc:hover .mc-go {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(2px);
}

/* Card Body */
.mc-body {
    min-height: 0;
}

.mc-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}

.mc-desc {
    font-size: 10.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    opacity: 0.85;
}

/* Disabled / Coming Soon */
.mc-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
    filter: grayscale(40%);
}

.mc-badge {
    font-size: 9px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Footer */
.mp-footer {
    text-align: center;
    font-size: 10px;
    color: var(--text-light);
    padding: 32px 20px 28px;
    margin-top: auto;
}

/* ========== Animations ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-card {
    animation: fadeInUp 0.35s ease both;
}

.app-card:nth-child(1) {
    animation-delay: 0.05s;
}

.app-card:nth-child(2) {
    animation-delay: 0.1s;
}

.app-card:nth-child(3) {
    animation-delay: 0.15s;
}

.info-card {
    animation: fadeInUp 0.35s ease both;
}

.info-card:nth-child(1) {
    animation-delay: 0.2s;
}

.info-card:nth-child(2) {
    animation-delay: 0.25s;
}

/* ========== Iframe View ========== */
#iframe-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

#iframe-view.hidden {
    display: none !important;
}

.iframe-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--white);
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.iframe-back-btn {
    background: none;
    border: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--accent-dark);
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.iframe-back-btn:active {
    background: #f3f4f6;
}

.iframe-title-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.app-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg);
    display: none;
}

.app-iframe.active {
    display: block;
}

.iframe-container {
    flex: 1;
    position: relative;
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.4s ease;
}

.loading-overlay.hidden {
    display: none !important;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    width: 240px;
}

.loading-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    margin: 0 auto 24px;
    animation: loading-breathe 1.8s ease-in-out infinite;
}

@keyframes loading-breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.85;
    }

    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

.loading-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, #b39ddb, #ce93d8, #f48fb1);
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* ---- Install Guide: Icon Preload Status Bar ---- */
.ig-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 20px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--card);
    transition: background 0.4s, border-color 0.4s;
}

.ig-status-loading {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--border);
}

.ig-status-ready {
    background: rgba(186, 255, 201, 0.35);
    border-color: #86d9a0;
}

.ig-status-left {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-icon-preview {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ig-status-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.ig-status-ready .ig-status-title {
    color: #2D7A3E;
}

.ig-status-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Spinner animation */
.ig-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: igSpin 0.8s linear infinite;
}

@keyframes igSpin {
    to {
        transform: rotate(360deg);
    }
}