/* Market One app embed (js/app-embed.js): the page opened by the app with
   embed=app shows only the function it asked for. html.wt-embed is set by
   js/boot.js before the first paint, so the terminal and the sign-in page
   never show. Nothing here applies to a normal visit. */

html.wt-embed #login-screen,
html.wt-embed #app,
html.wt-embed #chat-widget,
html.wt-embed #mobile-nav,
html.wt-embed .trader-popup-overlay {
    display: none !important;
}

html.wt-embed body {
    background: var(--bg-primary);
    min-height: 100vh;
}

/* The function's panel fills the in-app browser on a phone. */
@media (max-width: 767px) {
    html.wt-embed .tm-overlay { align-items: stretch; }
    html.wt-embed .tm-panel { width: 100%; max-width: none; max-height: none; min-height: 100vh; border-radius: 0; }
}

/* History: the terminal's closed positions, moved out of it (openHistory). */
#wt-embed-root {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 50;
}
.wt-embed-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}
.wt-embed-bar-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.wt-embed-close { width: auto; margin: 0; padding: 8px 16px; }
/* Its own page: shown whatever the phone layout hides, without the tabs,
   the resize handle or any other tab. */
html.wt-embed #wt-embed-root #bottom-area {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    width: 100% !important;
}
html.wt-embed #wt-embed-root #positions-panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
html.wt-embed #wt-embed-root .panel-header-tabs,
html.wt-embed #wt-embed-root #bp-drag-handle,
html.wt-embed #wt-embed-root .bp-tab-content:not(#bptab-closed) {
    display: none !important;
}
html.wt-embed #wt-embed-root #bptab-closed {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
html.wt-embed #wt-embed-root .bp-table-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

/* "Done - you can return to the app" / "This page has expired". */
.wt-embed-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.wt-embed-mark {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
    background: var(--accent);
}
.wt-embed-screen.is-done .wt-embed-mark { background: var(--green); }
.wt-embed-title { margin: 6px 0 0; font-size: 20px; font-weight: 600; }
.wt-embed-note { margin: 0; font-size: 14px; color: var(--text-primary); max-width: 420px; }
.wt-embed-text { margin: 0; font-size: 14px; color: var(--text-secondary); max-width: 420px; }
