/* Analyze Stock: one dialog, the MarketSnap Philosophy stages with real tool buttons. */
html.ms-an-open { overflow: hidden; }

.ms-an {
	--an-gold: #F59E0B;
	--an-surface: rgba(255, 255, 255, 0.04);
	--an-border: rgba(255, 255, 255, 0.08);
	--an-muted: #aab2bd;
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 48px 16px;
	overflow-y: auto;
	background: rgba(6, 8, 10, 0.78);
	backdrop-filter: blur(4px);
	font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
	color: #e5e7eb;
}
.ms-an[hidden] { display: none; }
.ms-an h2, .ms-an h3 { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0; }
.ms-an__panel {
	position: relative;
	width: min(1168px, 100%);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 16px;
	background: #14181c;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.ms-an.is-loading .ms-an__body { opacity: 0.55; transition: opacity 0.15s; }

/* Header: title, stock selector (always visible), close */
.ms-an__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px 24px;
	padding: 24px 28px 20px;
	border-bottom: 1px solid var(--an-border);
}
.ms-an__titlewrap { flex: 1 1 260px; }
.ms-an__kicker { margin: 0 0 4px; color: var(--an-muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ms-an__title { margin: 0; color: var(--an-gold); font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.ms-an__picker { position: relative; flex: 0 1 380px; display: flex; flex-direction: column; gap: 6px; margin-right: 40px; }
.ms-an__picker-label { color: var(--an-muted); font-size: 0.78rem; }
.ms-an__input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 10px;
	background: #0f1215;
	color: #fff;
	font: 500 0.95rem/1.3 Inter, system-ui, sans-serif;
}
.ms-an__input:focus { outline: none; border-color: var(--an-gold); }
.ms-an__results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 2;
	max-height: 320px;
	margin: 6px 0 0;
	padding: 6px;
	overflow-y: auto;
	list-style: none;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 10px;
	background: #0f1215;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.ms-an__results[hidden] { display: none; }
.ms-an__result {
	display: flex;
	gap: 10px;
	width: 100%;
	padding: 8px 10px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: #e5e7eb;
	font: inherit;
	text-align: left;
	cursor: pointer;
}
.ms-an__result:hover, .ms-an__result:focus-visible { background: rgba(245, 158, 11, 0.1); }
.ms-an__result-sym { min-width: 64px; color: var(--an-gold); font-weight: 600; }
.ms-an__result-name { color: #cbd2da; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-an__noresult { padding: 8px 10px; color: var(--an-muted); font-size: 0.9rem; }
.ms-an__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	border: 1px solid var(--an-border);
	border-radius: 50%;
	background: none;
	color: #cbd2da;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}
.ms-an__close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

.ms-an__body { position: relative; padding: 28px; }

/* Question + guide sit on top of the (dimmed) flowchart */
.ms-an__stage, .ms-an__dest, .ms-an__foot { transition: opacity 0.25s, filter 0.25s; }
.ms-an__flow.is-dimmed .ms-an__stage,
.ms-an__flow.is-dimmed .ms-an__dest,
.ms-an__flow.is-dimmed .ms-an__foot { opacity: 0.3; }
.ms-an__flow.is-dimmed .ms-an__stages.is-spot .ms-an__stage,
.ms-an__flow.is-dimmed .ms-an__stage.is-spot,
.ms-an__flow.is-dimmed .ms-an__dest.is-spot { opacity: 1; }
/* Question + simple guide: the whole map recedes so the one sentence stays in focus */
.ms-an__flow.is-focus .ms-an__stage,
.ms-an__flow.is-focus .ms-an__dest,
.ms-an__flow.is-focus .ms-an__foot { opacity: 0.18; filter: blur(3px); }
.ms-an__stage.is-spot, .ms-an__dest.is-spot { border-color: var(--an-gold); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.ms-an__callout {
	position: absolute;
	z-index: 3;
	box-sizing: border-box;
	border: 1px solid rgba(245, 158, 11, 0.55);
	border-radius: 14px;
	background: #1b2025;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
	animation: ms-an-in 0.25s ease-out;
}
@keyframes ms-an-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ms-an__callout--center { top: 40px; left: 50%; width: min(760px, calc(100% - 32px)); margin-left: calc(min(760px, 100% - 32px) / -2); padding: 28px; }

/* Guide part 1: one big sentence per screen */
.ms-an__intro { padding: 22px 28px 28px; text-align: center; }
.ms-an__intro-text { max-width: 620px; min-height: 3em; margin: 28px auto 32px; color: #fff; font-size: 1.6rem; font-weight: 500; line-height: 1.4; }
.ms-an__intro-row { display: flex; justify-content: center; align-items: center; gap: 18px; }

/* Guide part 2: card pinned to one part of the flowchart */
.ms-an__tip { padding: 16px 18px; }
.ms-an__tip-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ms-an__tip-step { color: #8b949e; font-size: 0.75rem; }
.ms-an__tip-skip, .ms-an__tip-back { border: 0; background: none; color: var(--an-muted); font: inherit; font-size: 0.82rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ms-an__tip-title { margin: 0 0 4px; color: var(--an-gold); font-weight: 600; }
.ms-an__tip-text { margin: 0; color: #e5e7eb; font-size: 0.95rem; line-height: 1.5; }
.ms-an__tip-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; margin-top: 14px; }
.ms-an__tip-dont { margin-right: auto; color: var(--an-muted); font-size: 0.82rem; cursor: pointer; }
.ms-an__tip-next {
	padding: 8px 16px;
	border: 0;
	border-radius: 10px;
	background: linear-gradient(180deg, #fbbf24, #F59E0B);
	color: #111;
	font: 600 0.88rem/1.3 Inter, system-ui, sans-serif;
	cursor: pointer;
}

/* Guidance question */
.ms-an__question { text-align: center; }
.ms-an__q-title { margin: 0 0 8px; color: #fff; font-size: 1.4rem; font-weight: 600; }
.ms-an__q-sub { margin: 0 0 24px; color: var(--an-muted); }
.ms-an__q-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ms-an__q-option {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px;
	border: 1px solid var(--an-border);
	border-radius: 12px;
	background: var(--an-surface);
	color: #cbd2da;
	font: inherit;
	font-size: 0.9rem;
	line-height: 1.45;
	text-align: left;
	cursor: pointer;
}
.ms-an__q-option strong { color: #fff; font-size: 1rem; }
.ms-an__q-option:hover, .ms-an__q-option:focus-visible, .ms-an__q-option.is-current { border-color: var(--an-gold); }

.ms-an__btn {
	display: inline-block;
	padding: 10px 18px;
	border: 0;
	border-radius: 10px;
	background: linear-gradient(180deg, #fbbf24, #F59E0B);
	color: #111 !important;
	font: 600 0.9rem/1.3 Inter, system-ui, sans-serif;
	text-decoration: none !important;
	cursor: pointer;
}
.ms-an__tip-next:hover, .ms-an__btn:hover { filter: brightness(1.06); }

/* Flowchart: the cards share five rows (subgrid) so every button sits on the same line */
.ms-an__stages {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-template-rows: repeat(5, auto);
	column-gap: 16px;
	row-gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	border-radius: 12px;
}
.ms-an__stage {
	position: relative;
	display: grid;
	grid-row: span 5;
	grid-template-rows: subgrid;
	row-gap: 10px;
	margin: 0;
	padding: 18px;
	border: 1px solid var(--an-border);
	border-radius: 12px;
	background: var(--an-surface);
}
.ms-an__stage + .ms-an__stage::before {
	content: "→";
	position: absolute;
	top: 26px;
	left: -14px;
	color: rgba(245, 158, 11, 0.7);
	font-size: 0.9rem;
}
.ms-an__stage-top { display: flex; align-items: center; gap: 8px; }
.ms-an__num { color: #6b7280; font-size: 0.78rem; font-weight: 600; }
.ms-an__short { color: var(--an-gold); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; }
.ms-an__visual { margin-left: auto; width: 56px; color: rgba(245, 158, 11, 0.75); }
.ms-an__visual svg, .ms-an__dest-visual svg { display: block; width: 100%; height: auto; }
.ms-an__label { margin: 0; color: #fff; font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.ms-an__explain { margin: 0; color: #b8c0ca; font-size: 0.88rem; line-height: 1.5; }
.ms-an__explain:empty { display: none; }
.ms-an__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 4px; }
.ms-an__extra { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ms-an__btn { font-size: 0.85rem; padding: 9px 14px; }
.ms-an__btn--secondary { background: none; border: 1px solid rgba(245, 158, 11, 0.55); color: var(--an-gold) !important; }
.ms-an__parts { margin: 0; color: #8b949e; font-size: 0.78rem; }
.ms-an__hint { margin: 0; padding: 6px 10px; border-radius: 8px; background: rgba(34, 197, 94, 0.08); color: #86efac; font-size: 0.8rem; }
.ms-an__learn { color: var(--an-gold) !important; font-size: 0.82rem; text-decoration: none; }
.ms-an__learn:hover { text-decoration: underline; }

/* 05 Build wealth for the long term / My Investing */
.ms-an__dest { display: grid; grid-template-columns: minmax(240px, 1fr) 3fr; gap: 16px 28px; margin-top: 16px; padding: 18px; border: 1px dashed rgba(245, 158, 11, 0.35); border-radius: 12px; }
.ms-an__dest-head { display: flex; align-items: flex-start; gap: 14px; }
.ms-an__dest-visual { width: 64px; flex: 0 0 64px; margin-top: 4px; color: rgba(245, 158, 11, 0.75); }
.ms-an__dest-text { display: flex; flex-direction: column; gap: 4px; }
.ms-an__dest-kicker { display: flex; gap: 8px; }
.ms-an__dest-text strong { color: #fff; font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.ms-an__dest-text > span:last-child { color: var(--an-muted); font-size: 0.85rem; line-height: 1.5; }
.ms-an__dest-cols { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 16px; }
.ms-an__dest-col { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-left: 16px; border-left: 1px solid var(--an-border); }
.ms-an__dest-col strong { color: #fff; font-weight: 600; }
.ms-an__dest-line { color: #cbd2da; font-size: 0.88rem; line-height: 1.45; }
.ms-an__dest-more { color: var(--an-muted); font-size: 0.82rem; line-height: 1.5; }

.ms-an__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 20px; font-size: 0.85rem; }
.ms-an__stocklink { color: var(--an-muted) !important; text-decoration: none; }
.ms-an__stocklink:hover { color: #fff !important; }
.ms-an__change { border: 0; background: none; color: var(--an-muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ms-an__change:hover { color: #fff; }

/* Stock page: research tool links under the valuation section */
.ms-research-tools { text-align: left; margin: 32px 0 8px; padding-top: 20px; border-top: 1px solid rgba(148, 163, 184, 0.2); font-family: Inter, system-ui, sans-serif; }
.ms-research-tools__title { text-align: left !important; margin: 0 0 12px; color: #9ca3af; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.ms-research-tools ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 28px; margin: 0; padding: 0; list-style: none; }
.ms-research-tools li { display: flex; flex-direction: column; gap: 2px; }
.ms-research-tools a { color: #F59E0B !important; font-weight: 600; text-decoration: none; }
.ms-research-tools a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ms-research-tools span { color: #9ca3af; font-size: 0.85rem; }

/* Doors */
.ms-an-door { cursor: pointer; font: inherit; }
.ms-an-start { margin: 20px 0 0; text-align: center; }
.ms-an-start__btn {
	padding: 12px 40px;
	border: 0;
	border-radius: 12px;
	background: linear-gradient(180deg, #fbbf24, #F59E0B);
	color: #111;
	font: 700 1rem/1.2 Inter, system-ui, sans-serif;
	letter-spacing: 0.02em;
	box-shadow: 0 6px 18px rgba(245, 158, 11, 0.25);
}
.ms-an-start__btn:hover { filter: brightness(1.06); }

@media (max-width: 1000px) {
	.ms-an__stages { grid-template-columns: 1fr; grid-template-rows: none; gap: 12px; }
	.ms-an__stage { display: flex; flex-direction: column; grid-row: auto; gap: 10px; }
	.ms-an__dest { grid-template-columns: 1fr; }
	.ms-an__dest-cols { grid-template-columns: 1fr; }
	.ms-an__dest-col { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--an-border); }
	.ms-an__stage + .ms-an__stage::before { content: "↓"; top: -15px; left: 22px; }
	.ms-an__q-options { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.ms-an { padding: 0; }
	.ms-an__panel { min-height: 100%; border-radius: 0; border: 0; }
	.ms-an__head { padding: 18px 16px 16px; }
	.ms-an__picker { flex: 1 1 100%; margin-right: 0; }
	.ms-an__body { padding: 18px 16px 24px; }
	.ms-an__callout--center { top: 16px; padding: 20px 16px; }
	.ms-an__intro-text { margin: 20px auto 24px; font-size: 1.3rem; }
	.ms-an { backdrop-filter: none; } /* a backdrop-filter would pin the fixed guide bar to the scrolling dialog, not the screen */
	.ms-an__tip { position: fixed; top: auto !important; left: 12px !important; right: 12px; bottom: 12px; width: auto !important; z-index: 100001; }
	.ms-an__body:has(.ms-an__tip) { padding-bottom: 240px; }
	.ms-an__visual { width: 44px; }
}
