/* From the Mold to Gold – coaching app. Black, dark red and gold. */
:root {
	--bg: #0E0D0C;
	--bar: #141210;
	--card: #181614;
	--card2: #221F1C;
	--line: #34302B;
	--line2: #4A443D;
	--text: #F3EEE6;
	--muted: #B3AA9E;
	--faint: #8F877C;
	--gold: #C9A24A;
	--gold-2: #E0B84E;
	--gold-tint: #1F1A12;
	--gold-line: #4A3D22;
	--red: #9B1C1C;
	--red-2: #E07A7A;
	--red-tint: #2A1414;
	--red-line: #6B2020;
	--radius: 14px;
	--display: Fraunces, Georgia, "Times New Roman", serif;
	--body: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.m2g-body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased; }
#m2g-app { background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.45; }
#m2g-app.m2g-embedded { border-radius: 16px; overflow: hidden; min-height: 80vh; }
#m2g-app *, #m2g-app *::before, #m2g-app *::after { box-sizing: border-box; }
#m2g-app a { color: var(--gold); text-decoration: none; }
#m2g-app a:hover { color: var(--gold-2); }
#m2g-app h1, #m2g-app h2, #m2g-app h3 { margin: 0; }
#m2g-app button, #m2g-app input, #m2g-app textarea, #m2g-app select { font-family: var(--body); font-size: 15px; }
#m2g-app :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Shell */
.m2g-shell { display: flex; min-height: 100dvh; }
.m2g-side { display: none; }
.m2g-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m2g-content { flex: 1; padding: 16px 16px 96px; width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.m2g-content.wide { max-width: 1240px; }
.m2g-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: env(safe-area-inset-top) 16px 0; }
.m2g-wordmark { font-family: var(--display); font-weight: 600; letter-spacing: .14em; color: var(--gold); font-size: 14px; }
.m2g-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--bar); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.m2g-bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 64px; color: var(--muted) !important; font-size: 11px; font-weight: 600; position: relative; }
.m2g-bottomnav a.on { color: var(--gold) !important; font-weight: 800; }
.m2g-dot { position: absolute; top: 10px; right: calc(50% - 18px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

@media (min-width: 900px) {
	.m2g-side { display: flex; flex-direction: column; gap: 4px; width: 240px; flex-shrink: 0; background: var(--bar); border-right: 1px solid var(--line); padding: 24px 14px; position: sticky; top: 0; height: 100dvh; }
	.m2g-side .m2g-wordmark { padding: 0 12px 20px; }
	.m2g-side a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--muted) !important; font-weight: 600; font-size: 14px; }
	.m2g-side a.on { background: var(--card2); color: var(--text) !important; font-weight: 800; }
	.m2g-side .m2g-side-foot { margin-top: auto; font-size: 13px; color: var(--faint); padding: 0 12px; }
	.m2g-bottomnav { display: none; }
	.m2g-topbar { display: none; }
	.m2g-content { padding: 32px 32px 48px; }
	.m2g-embedded .m2g-side { position: static; height: auto; }
}

/* Type */
.m2g-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .07em; color: var(--muted); text-transform: uppercase; }
.m2g-title { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.15; }
.m2g-h2 { font-size: 17px; font-weight: 800; }
.m2g-muted { color: var(--muted); }
.m2g-small { font-size: 13px; }
.m2g-gold { color: var(--gold); }

/* Cards */
.m2g-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.m2g-card.gold { background: var(--gold-tint); border-color: var(--gold-line); }
.m2g-card.red { background: var(--red-tint); border-color: var(--red-line); }
.m2g-row { display: flex; align-items: center; gap: 12px; }
.m2g-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m2g-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.m2g-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m2g-stat-label { font-size: 11px; color: var(--muted); }
.m2g-stat { font-size: 17px; font-weight: 800; }
.m2g-pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 10px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.m2g-pill.gold { background: var(--gold); color: var(--bg); }
.m2g-pill.red { background: var(--red); color: #fff; }
.m2g-pill.outline { background: transparent; border: 1px solid var(--line2); }

/* Buttons & inputs */
.m2g-btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-weight: 700; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.m2g-btn:disabled { opacity: .5; cursor: not-allowed; }
.m2g-btn.gold { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 800; }
.m2g-btn.red { background: var(--red); border-color: var(--red); color: #fff; font-weight: 800; }
.m2g-btn.ghost { background: transparent; }
.m2g-btn.outline-gold { background: transparent; border-color: var(--gold); color: var(--gold); }
.m2g-btn.outline-red { background: transparent; border-color: var(--red); color: #F3B4B4; }
.m2g-btn.icon { width: 46px; padding: 0; flex-shrink: 0; }
.m2g-btn.block { width: 100%; }
.m2g-field { display: flex; flex-direction: column; gap: 5px; }
.m2g-field label, .m2g-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.m2g-input, .m2g-textarea, .m2g-select { width: 100%; min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 10px 12px; }
.m2g-textarea { min-height: 92px; resize: vertical; }
.m2g-input::placeholder, .m2g-textarea::placeholder { color: var(--faint); }
.m2g-input[readonly], .m2g-textarea[readonly] { opacity: .75; }
.m2g-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; padding: 6px 0; cursor: pointer; }
.m2g-check input { width: 20px; height: 20px; accent-color: var(--gold); margin-top: 1px; flex-shrink: 0; }

/* Gates bar */
.m2g-gates { display: flex; align-items: center; gap: 6px; }
.m2g-gate-dot { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; border: 1px solid var(--line); color: var(--faint); flex-shrink: 0; }
.m2g-gate-dot.done { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.m2g-gate-dot.now { border: 2px solid var(--gold); color: var(--gold); }
.m2g-gate-dot.wait { border: 2px solid var(--gold); color: var(--gold); background: var(--gold-tint); }
.m2g-gate-dot.redo { border: 2px solid var(--red-2); color: var(--red-2); }
.m2g-gate-line { flex: 1; height: 2px; background: var(--line); }
.m2g-gate-line.done { background: var(--gold); }

/* Result checks */
.m2g-result { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.m2g-result i { width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; font-weight: 900; flex-shrink: 0; }
.m2g-result.ok i { background: var(--gold); color: var(--bg); }
.m2g-result.bad i { background: #C23B3B; color: #fff; }
.m2g-result.warn i { background: var(--line2); color: var(--text); }
.m2g-result span:last-child { margin-left: auto; font-weight: 800; }
.m2g-result.ok span:last-child { color: var(--gold); }
.m2g-result.bad span:last-child { color: var(--red-2); }
.m2g-big { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1; }

/* Chat */
.m2g-chat { display: flex; flex-direction: column; min-height: calc(100dvh - 56px); }
.m2g-chat-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bar); border-bottom: 1px solid var(--line); }
.m2g-avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; flex-shrink: 0; }
.m2g-avatar.student { background: var(--card2); color: var(--gold); }
.m2g-msgs { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 760px; width: 100%; margin: 0 auto; }
.m2g-msg { max-width: 82%; display: flex; flex-direction: column; gap: 6px; }
.m2g-msg.mine { align-self: flex-end; align-items: flex-end; }
.m2g-msg.theirs { align-self: flex-start; }
.m2g-msg.system { align-self: center; max-width: 92%; }
.m2g-bubble { border-radius: 14px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
.m2g-msg.mine .m2g-bubble { background: #2A2622; border-bottom-right-radius: 4px; }
.m2g-msg.theirs .m2g-bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.m2g-msg.system .m2g-bubble { background: var(--gold-tint); border: 1px solid var(--gold-line); font-size: 14px; }
.m2g-msg-name { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--red-2); }
.m2g-msg.mine .m2g-msg-name { color: var(--gold); }
.m2g-msg-time { font-size: 11px; color: var(--faint); }
.m2g-media img, .m2g-media video { display: block; max-width: 100%; width: 280px; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.m2g-media audio { width: 260px; max-width: 100%; }
.m2g-flag { font-size: 11px; font-weight: 800; color: #fff; background: var(--red); border-radius: 6px; padding: 2px 8px; }
.m2g-composer { position: sticky; bottom: 0; z-index: 6; background: var(--bar); border-top: 1px solid var(--line); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.m2g-composer-inner { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.m2g-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.m2g-pending { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13px; }
.m2g-pending img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
@media (max-width: 899px) { .m2g-has-chat .m2g-bottomnav { display: none; } .m2g-has-chat .m2g-content { padding-bottom: 0; } }

/* Lists */
.m2g-list { display: flex; flex-direction: column; gap: 10px; }
.m2g-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid #2A2622; color: var(--text) !important; }
.m2g-item:hover { border-color: var(--line2); }
.m2g-tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; border-radius: 6px; padding: 4px 8px; min-width: 96px; text-align: center; flex-shrink: 0; }
.m2g-tag.gate { background: var(--gold); color: var(--bg); }
.m2g-tag.need_rebel { background: var(--red); color: #fff; }
.m2g-tag.message { background: var(--card2); color: var(--text); border: 1px solid var(--line2); }
.m2g-tag.stalled { background: var(--red-tint); color: #F3B4B4; border: 1px solid var(--red-line); }
.m2g-grow { flex: 1; min-width: 0; }
.m2g-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m2g-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.m2g-chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
.m2g-chip.on { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.m2g-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.m2g-tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 700; padding: 10px 12px; cursor: pointer; white-space: nowrap; }
.m2g-tab.on { color: var(--text); border-bottom-color: var(--gold); }

/* Coach layout */
.m2g-coach-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1100px) { .m2g-coach-grid { grid-template-columns: 7fr 5fr; } }
.m2g-bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; height: 150px; }
.m2g-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 150px; font-weight: 800; }
.m2g-bar div { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--line2); min-height: 3px; }
.m2g-bar-labels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; font-size: 11px; color: var(--muted); text-align: center; font-weight: 700; }
.m2g-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.m2g-thumb { position: relative; }
.m2g-thumb img, .m2g-thumb video { width: 150px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #000; display: block; }
.m2g-thumb audio { width: 220px; }
.m2g-thumb .m2g-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-weight: 900; }

/* Modal */
.m2g-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; padding: 16px; }
.m2g-modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; width: 100%; max-width: 560px; max-height: 94dvh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.m2g-modal video { width: 100%; max-height: 50dvh; border-radius: 12px; background: #000; }
.m2g-rec { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--red-2); }
.m2g-rec::before { content: ""; width: 10px; height: 10px; border-radius: 5px; background: #E53935; animation: m2gblink 1s infinite; }
@keyframes m2gblink { 50% { opacity: .2; } }
.m2g-canvas-wrap { position: relative; width: 100%; background: #000; border-radius: 12px; overflow: hidden; touch-action: none; }
.m2g-canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.m2g-swatch { width: 34px; height: 34px; border-radius: 17px; border: 2px solid var(--line); cursor: pointer; }
.m2g-swatch.on { border-color: var(--text); }

/* Toast */
.m2g-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 200; background: var(--card2); border: 1px solid var(--line2); color: var(--text); padding: 12px 16px; border-radius: 12px; font-weight: 700; max-width: 92vw; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.m2g-toast.err { border-color: var(--red-line); background: var(--red-tint); }

.m2g-center { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.m2g-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: m2gspin .8s linear infinite; }
@keyframes m2gspin { to { transform: rotate(360deg); } }
.m2g-lesson-body { font-size: 14px; color: var(--text); }
.m2g-lesson-body img, .m2g-lesson-body video, .m2g-lesson-body iframe { max-width: 100%; }
.m2g-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
