
:root {
	--bg: #f1f1f1;
	--surface: #ffffff;
	--text: #0b0b0b;
	--hint: #8a8f98;
	--accent: #f89235;
	--accent-soft: rgba(248, 146, 53, 0.12);
	--accent-border: rgba(248, 146, 53, 0.32);
	--green: #4d7c0f;
	--red: #b91c1c;
	--neo: #94a3b8;
	--border: #e4e6ea;
	--radius: 1rem;
	--shadow: 4px 4px 0 0 var(--neo);
	--shadow-sm: 2px 2px 0 0 var(--neo);
	--font: -apple-system, BlinkMacSystemFont, "avenir next", avenir, "segoe ui", "helvetica neue", helvetica, Cantarell, Ubuntu, roboto, arial, sans-serif;
	--mono: Menlo, Consolas, Monaco, "Liberation Mono", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--font);
	color: var(--text);
	background-color: var(--bg);
	background-image: radial-gradient(rgba(138,143,152,0.28) 1px, transparent 1px);
	background-size: 18px 18px;
	line-height: 1.45;
}
a { color: inherit; }
code { font-family: var(--mono); }

.layout { display: flex; align-items: flex-start; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
	position: sticky; top: 0; align-self: stretch;
	width: 290px; min-width: 290px; height: 100vh; overflow-y: auto;
	background: var(--surface); border-right: 2px solid var(--text);
	padding: 18px 14px 40px;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 8px 10px 16px; }
.brand-mark {
	font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center;
	background: var(--accent); border: 2px solid var(--text); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.brand b { display: block; font-size: 16px; }
.brand small { color: var(--hint); font-size: 12px; }
.nav-group { margin-bottom: 16px; }
.nav-group-title {
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
	color: var(--hint); padding: 6px 10px;
}
.nav-item {
	display: block; padding: 7px 10px; margin: 2px 0; border-radius: 10px;
	text-decoration: none; font-size: 13.5px; color: var(--text);
	border: 2px solid transparent;
}
.nav-item:hover { background: var(--accent-soft); }
.nav-item.active { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }

/* ---- main ---- */
main { flex: 1; min-width: 0; padding: 30px clamp(20px, 4vw, 56px) 100px; max-width: 1100px; }
.scenario-head { margin-bottom: 22px; }
.crumb { color: var(--accent); font-weight: 600; font-size: 13px; text-transform: lowercase; letter-spacing: 0.02em; }
.scenario-head h1 { margin: 4px 0 12px; font-size: 26px; line-height: 1.2; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill {
	font-size: 12px; padding: 3px 10px; border-radius: 999px;
	background: var(--surface); border: 2px solid var(--text); box-shadow: var(--shadow-sm);
}
.file { font-size: 12px; color: var(--hint); }
.warn { background: #fff7ed; border: 2px solid var(--accent); border-radius: 12px; padding: 8px 12px; margin-bottom: 16px; font-size: 13px; }

/* ---- setup ---- */
.setup {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px;
	background: var(--surface); border: 2px solid var(--text); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 16px; margin-bottom: 28px;
}
.setup-block h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--hint); }
.members { display: flex; flex-wrap: wrap; gap: 6px; }
.member { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); border: 2px solid var(--accent-border); }
.member em { color: var(--hint); font-style: normal; }
.mock-list { margin: 0; padding-left: 16px; font-size: 13px; }
.mock-list li { margin: 3px 0; }
.mock-list code { background: var(--bg); padding: 1px 5px; border-radius: 6px; }

/* ---- storyboard ---- */
.storyboard { display: flex; flex-direction: column; gap: 0; }
/* Mobile-first: a single column (action + expectations, then screens). The timeline rail
   runs down the left; the 2-column desktop layout is opted into at >=1024px below. */
.step {
	position: relative; padding-left: 26px; padding-bottom: 26px;
	display: grid; grid-template-columns: 1fr; gap: 12px;
}
.step::before {
	content: ""; position: absolute; left: 7px; top: 6px; bottom: -6px; width: 2px;
	background: var(--border);
}
.step:last-child::before { display: none; }
.step::after {
	content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px;
	border-radius: 50%; background: var(--accent); border: 2px solid var(--text);
}
.step-main { min-width: 0; }

.action { margin-bottom: 12px; }
.action-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verb {
	font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 6px;
	background: var(--text); color: #fff; letter-spacing: 0.02em;
}
.summary { font-size: 16px; font-weight: 600; }
.surface-miniapp .verb { background: var(--accent); }
.surface-system .verb { background: var(--hint); }
.surface-system .summary { color: #475569; font-weight: 500; }
.badge.rejected { font-size: 11px; font-weight: 700; color: var(--red); border: 2px solid var(--red); border-radius: 999px; padding: 1px 8px; text-transform: uppercase; }
.action-detail { margin-top: 4px; color: var(--hint); font-style: italic; }
.fired-row { margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.fired { font-size: 12px; background: #eef6e7; border: 1px solid #cfe3b8; color: #3f6212; padding: 2px 9px; border-radius: 999px; }
.fired-item { display: flex; flex-direction: column; gap: 5px; max-width: 100%; }
.llm-req { font-size: 12px; }
.llm-req > summary { cursor: pointer; color: var(--hint); user-select: none; }
.llm-req > summary:hover { color: var(--text); }
.llm-req-body { margin-top: 6px; padding: 10px; background: #f7f7f8; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.llm-req-body pre { margin: 0; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 6px; font-size: 11px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.llm-sub > summary { cursor: pointer; color: var(--hint); user-select: none; }
.llm-sub-label { font-weight: 600; color: var(--hint); text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; }
.llm-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.llm-tools code { font-size: 11px; background: #eef; border: 1px solid #ccd; color: #335; padding: 1px 6px; border-radius: 5px; }

/* ---- screens ---- */
.step-screens { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; min-width: 0; }
.tg-chat {
	width: min(420px, 100%); flex: 1 1 320px; max-width: 100%;
	background: #e9eef3; border: 2px solid var(--text); border-radius: 16px;
	box-shadow: var(--shadow); overflow: hidden;
}
.tg-chat.admin { background: #eceef0; }
.tg-header {
	background: var(--surface); border-bottom: 2px solid var(--border);
	padding: 9px 14px; font-size: 13px; font-weight: 600; color: #475569;
}
.tg-body {
	padding: 14px; display: flex; flex-direction: column; gap: 10px;
	max-height: 720px; overflow-y: auto;
}
.empty { color: var(--hint); font-size: 13px; text-align: center; padding: 18px; }

.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.bot { align-self: flex-start; align-items: flex-start; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.sender { font-size: 12px; font-weight: 600; color: var(--accent); margin: 0 0 2px 4px; }
.bubble {
	position: relative; padding: 8px 11px; font-size: 14px; word-break: break-word;
	box-shadow: var(--shadow-sm);
}
.msg.bot .bubble {
	background: var(--surface); border: 2px solid var(--accent-border);
	border-radius: 2px 16px 16px 16px;
}
.msg.user .bubble {
	background: var(--accent-soft); border: 2px solid var(--accent);
	border-radius: 16px 2px 16px 16px; text-align: left;
}
.msg.changed .bubble { box-shadow: 0 0 0 3px rgba(248,146,53,0.45), var(--shadow-sm); }
.msg.deleted { opacity: 0.5; }
.msg.deleted .bubble .text { text-decoration: line-through; }
.deleted-tag { display: inline-block; margin-top: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--red); }

.bubble .text { white-space: normal; }
.bubble b, .bubble strong { font-weight: 700; }
.bubble i, .bubble em { font-style: italic; }
.bubble s { text-decoration: line-through; }
.bubble code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.bubble a.ext { color: var(--accent); text-decoration: underline; }
.mention { color: var(--accent); font-weight: 600; }

.reply-quote {
	border-left: 3px solid var(--accent); padding: 2px 8px; margin-bottom: 6px;
	font-size: 12px; color: var(--hint); background: rgba(0,0,0,0.03); border-radius: 4px;
}
.long-msg > summary { cursor: pointer; color: #475569; list-style: none; }
.long-msg > summary::-webkit-details-marker { display: none; }
.long-msg > summary .more { color: var(--accent); font-size: 12px; font-weight: 600; }
.long-msg .text { margin-top: 6px; }
.media-chip { font-size: 13px; font-weight: 600; color: #475569; }
.reaction {
	position: absolute; bottom: -10px; right: 6px; font-size: 14px;
	background: var(--surface); border: 1.5px solid var(--border); border-radius: 999px; padding: 0 4px;
}
.invoice .invoice-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.invoice-price { display: inline-block; margin-top: 6px; font-weight: 700; }

.keyboard { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.kbd-row { display: flex; gap: 5px; }
.kbd {
	flex: 1; text-align: center; padding: 6px 8px; border-radius: 9px;
	background: rgba(248,146,53,0.10); border: 1.5px solid var(--accent-border); color: #7c3a06; font-weight: 600;
}
.kbd.url { background: rgba(0,0,0,0.04); border-color: var(--border); color: #475569; }
.kbd-ext { opacity: 0.6; }

/* ---- asserts ---- */
.asserts { list-style: none; margin: 12px 0 0; padding: 10px 12px; background: #f6faf2; border: 2px solid #d6e7c3; border-radius: 12px; }
.asserts li { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; font-size: 12.5px; }
.asserts .check { color: var(--green); font-weight: 700; }
.asserts .claim { color: #33470f; word-break: break-word; }
.asserts li.failed .check, .asserts li.failed .claim { color: var(--red); }

/* ---- landing ---- */
.landing { font-size: 15px; max-width: 760px; }
.landing > p { color: #475569; }
.landing-group { margin-top: 22px; }
.landing-group h3 { margin: 0 0 8px; font-size: 15px; }
.landing-group ul { margin: 0; padding-left: 18px; columns: 2; }
.landing-group a { color: var(--accent); }

/* ---- mobile nav toggle (burger) — hidden on desktop ---- */
.nav-burger { display: none; }

/* Desktop: each step is two columns — action + expectations (left) | screens (right).
   The left column sticks while you scroll tall screens. */
@media (min-width: 1024px) {
	.step { grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: 26px; align-items: start; }
	.step-main { position: sticky; top: 16px; }
}

/* Phone/tablet: sidebar collapses behind a tappable burger; chats go full width. */
@media (max-width: 760px) {
	.layout { flex-direction: column; }
	.sidebar {
		position: static; width: 100%; min-width: 0; height: auto;
		border-right: none; border-bottom: 2px solid var(--text); padding: 12px 14px;
	}
	.nav-burger {
		display: block; cursor: pointer; user-select: none;
		font-weight: 600; font-size: 14px; padding: 8px 12px;
		border: 2px solid var(--text); border-radius: 10px; box-shadow: var(--shadow-sm);
		background: var(--accent-soft);
	}
	.sidebar nav { display: none; margin-top: 10px; max-height: 60vh; overflow-y: auto; }
	.nav-toggle:checked ~ nav { display: block; }
	main { padding: 20px 16px 64px; }
	.scenario-head h1 { font-size: 21px; }
	.landing-group ul { columns: 1; }
}

/* Mini App screenshot panel (Layer 2 — the real rendered webapp beside the Telegram screens). */
.tg-chat.miniapp .tg-body { padding: 0; background: transparent; }
.miniapp-shot { display: block; width: 100%; max-width: 360px; border-radius: 14px; border: 2px solid #f89235; }
