.layout {
	display: grid;
	grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}
.output, .form { min-width: 0; }

@media (max-width: 960px) {
	.layout { grid-template-columns: minmax(0, 1fr); }
}

/* Form */
.field { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.field code, .params code { font: 12px var(--mono); color: var(--muted); font-weight: 400; margin-left: 4px; }
.req { color: var(--err); }
.help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.error, .warning { margin: 6px 0 0; font-size: 13px; }
.error { color: var(--err); }
.warning { color: var(--warn); }
.error:empty, .warning:empty { display: none; }
.warning button { margin-left: 6px; }

input[type='text'], select {
	width: 100%;
	font: inherit;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 9px 11px;
}
input[type='text']:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[aria-invalid='true'] { border-color: var(--err); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .option { position: relative; cursor: pointer; }
.chip input, .option input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 12px;
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: 14px;
	background: var(--surface);
}
.chip span::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.chip input:checked + span, .option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.chip input:focus-visible + span, .option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.options { display: grid; gap: 8px; }
.option span {
	display: block;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
}
.option strong { display: block; font-size: 14px; }
.option small { color: var(--muted); }
.option code { margin: 0; }

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font: 600 14px var(--font);
	padding: 8px 14px;
	border-radius: 8px;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: #fff;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}
.link-btn { margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.45; pointer-events: none; }

/* Output */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.actions { display: flex; gap: 8px; }
.muted { color: var(--muted); }
#preview-caption { display: inline-flex; align-items: center; gap: 7px; }
#preview-caption img { width: 18px; height: 18px; object-fit: contain; }
.small { font-size: 13px; }

.url {
	font: 13.5px/1.6 var(--mono);
	background: var(--code-bg);
	color: var(--code-text);
	padding: 14px 16px;
	border-radius: 8px;
	word-break: break-all;
	min-height: 52px;
}
.url .k { color: var(--code-key); }
.url .v { color: var(--code-val); }
.url .placeholder { color: #8a93a3; font-family: var(--font); }

.params { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.params td { padding: 7px 0; border-top: 1px solid var(--border); vertical-align: top; }
.params td:first-child { width: 40%; color: var(--muted); }
.params td:last-child { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.params .empty { color: var(--muted); font-family: var(--font); font-style: italic; }

.links-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.links-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 0 8px 8px 0; }
.links-table td { padding: 8px 8px 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.links-table td.u { font-family: var(--mono); word-break: break-all; }
.links-table tr.current td { background: var(--accent-soft); }
.links-table td:last-child { padding-right: 0; text-align: right; }

/*
 * Preview: a mock of the Gen browsers' new tab page. It is laid out at a fixed
 * 1280px desktop width (.np) and scaled down to fit the card by app.js, so the
 * proportions match the real page at any screen size.
 */
.preview { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; }
.np {
	position: absolute;
	top: 0;
	left: 0;
	width: 1280px;
	transform-origin: 0 0;
	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	color: #1f2329;
	background: #fff;
	-webkit-font-smoothing: antialiased;
}

/* Browser window */
.np-titlebar { display: flex; align-items: flex-end; gap: 14px; height: 46px; padding: 0 14px; background: #d6e3e8; }
.np-lights { display: flex; gap: 8px; align-self: center; }
.np-lights i { width: 12px; height: 12px; border-radius: 50%; }
.np-lights i:nth-child(1) { background: #ff5f57; }
.np-lights i:nth-child(2) { background: #febc2e; }
.np-lights i:nth-child(3) { background: #28c840; }
.np-tab { display: flex; align-items: center; gap: 10px; width: 260px; height: 36px; padding: 0 14px; background: #fff; border-radius: 10px 10px 0 0; font-size: 14px; }
.np-tab .fav { width: 16px; height: 16px; object-fit: contain; }
span.fav { border-radius: 50%; background: #d1d5db; }
.np-tab .x { margin-left: auto; color: #5f6368; font-size: 16px; }
.np-toolbar { display: flex; align-items: center; gap: 18px; height: 52px; padding: 0 16px; background: #fff; }
.np-nav { display: flex; gap: 18px; color: #6b7280; font-size: 20px; }
.np-omnibox { flex: 1; height: 36px; border: 2px solid #c7d2fe; border-radius: 999px; display: flex; align-items: center; padding: 0 14px; color: #9ca3af; font-size: 14px; }
.np-menu { color: #4b5563; font-size: 26px; line-height: 1; padding: 0 4px; }
.np-bookmarks { display: flex; gap: 22px; align-items: center; height: 34px; padding: 0 16px; background: #fff; border-bottom: 1px solid #e5e7eb; font-size: 13px; color: #374151; }
.np-bookmarks span { display: inline-flex; align-items: center; gap: 7px; }
.np-bookmarks span::before { content: ''; width: 14px; height: 14px; border-radius: 3px; background: #d1d5db; }

/* New tab page */
.np-page { position: relative; padding: 30px 0 0; background: linear-gradient(115deg, #f6f1e9 0%, #eef0f4 45%, #e7ecf8 100%); }
.np-weather { position: absolute; top: 30px; left: 30px; display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: #fff; border-radius: 10px; font-size: 17px; font-weight: 500; }
.np-weather::before { content: ''; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #ffd54a 45%, #ffb300 46% 55%, transparent 56%); }
.np-tools { position: absolute; top: 30px; right: 30px; display: flex; gap: 18px; padding: 10px 14px; background: #fff; border-radius: 10px; }
.np-tools svg { width: 24px; height: 24px; stroke: #374151; fill: none; stroke-width: 1.7; }
.np-center { width: 920px; margin: 86px auto 0; }
.np-search { display: flex; align-items: center; gap: 16px; height: 72px; padding: 0 28px; background: #fff; border-radius: 26px; box-shadow: 0 1px 3px rgba(17, 24, 39, .06); color: #6b7280; font-size: 20px; }
.np-search svg { width: 26px; height: 26px; stroke: #4b5563; fill: none; stroke-width: 2; }
.np-shortcuts { display: flex; justify-content: center; gap: 4px; margin-top: 22px; padding: 38px 20px 56px; background: rgba(255, 255, 255, .55); border-radius: 18px; }
.np-sc { width: 125px; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 4px; border-radius: 12px; text-decoration: none; color: inherit; }
.np-sc .ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px; background: #e5e7eb; color: #fff; font-weight: 700; font-size: 18px; }
.np-sc .ico.plain { background: #fff; color: #111827; border-radius: 8px; width: 42px; height: 42px; font-weight: 300; font-size: 28px; margin: 3px 0 17px; }
.np-sc .name { font-size: 15px; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.np-sc .sp { font-size: 15px; color: #9ca3af; margin-top: 3px; }
.np-sc.np-ours .ico { background: url('/assets/adblock-icon-circle.svg') center / contain no-repeat; }
.np-sc.np-ours .ico.has-image { background: #fff center / cover no-repeat; }

.np-banner-slot { display: flex; justify-content: center; margin-top: 76px; }
.np-banner { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; width: 754px; aspect-ratio: 754 / 129; border-radius: 30px; text-decoration: none; color: #fff; background: radial-gradient(circle at 12% 120%, #3b82f6 0 18%, transparent 19%), radial-gradient(circle at 92% -20%, #3b82f6 0 16%, transparent 17%), linear-gradient(90deg, #0b3fb3, #0b5cff 50%, #0b3fb3); }
.np-banner strong { font-size: 27px; font-weight: 800; letter-spacing: -.01em; text-align: center; padding: 0 60px; line-height: 1.1; }
.np-banner .tagline { font-size: 16px; color: rgba(255, 255, 255, .88); text-align: center; padding: 0 60px; }
.np-banner .tagline b { color: #ffc629; font-weight: 600; }
.np-banner .cta { background: #ffc629; color: #0b2a66; font-weight: 700; font-size: 16px; padding: 5px 18px; border-radius: 999px; }
.np-banner img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.np-feed { margin: 88px 40px 0; background: #fff; border-radius: 14px 14px 0 0; }
.np-feed-tabs { display: flex; gap: 22px; padding: 0 32px; height: 62px; align-items: center; border-bottom: 1px solid #eceef2; font-size: 15px; font-weight: 600; letter-spacing: .07em; color: #4b5563; white-space: nowrap; }
.np-feed-tabs span:first-child { color: #2563eb; box-shadow: 0 19px 0 -17px #2563eb; padding-top: 2px; }
.np-feed-tabs .chev { flex-shrink: 0; margin-left: auto; width: 22px; height: 22px; fill: none; stroke: #6b7280; stroke-width: 2; }
.np-feed-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 22px; padding: 48px 32px 30px; align-items: start; }
.np-story { display: block; text-decoration: none; color: inherit; border-radius: 6px; }
.np-story .img { aspect-ratio: 16 / 9.2; background: linear-gradient(160deg, #d9dee6, #c4cbd6); border-radius: 2px; overflow: hidden; }
.np-story.hero { align-self: stretch; }
.np-story.hero .img { aspect-ratio: auto; height: 100%; min-height: 330px; background: linear-gradient(160deg, #cfd5de, #b5bdca); }
.np-story .src { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; letter-spacing: .06em; color: #6b7280; text-transform: uppercase; }
.np-story .src::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: #d1d5db; }
.np-story .title { margin-top: 8px; font-size: 19px; line-height: 1.35; color: #111827; }
.np-story .line { height: 12px; border-radius: 6px; background: #e5e7eb; margin-top: 12px; }
.np-story .line.short { width: 65%; }
.np-story.np-ours .img { display: grid; place-items: center; background: linear-gradient(135deg, #0b3fb3, #0b5cff); }
.np-story.np-ours .img::before { content: ''; width: 30%; aspect-ratio: 1; background: url('/assets/adblock-mark.svg') center / contain no-repeat; }
.np-story.np-ours .img.has-image::before { display: none; }
.np-story.np-ours .img img { width: 100%; height: 100%; object-fit: cover; }
/* A real creative keeps its own shape rather than the filler cards' 16:9. */
.np-story.np-ours .img.has-image { display: block; aspect-ratio: auto; height: auto; min-height: 0; background: none; }
.np-story.np-ours .img.has-image img { height: auto; }
.np-story.np-ours .src::before { background: #0b5cff url('/assets/adblock-mark.svg') center / 70% no-repeat; }

/* Our placement */
.np-ours { position: relative; outline: 3px solid var(--accent); outline-offset: 6px; cursor: pointer; }
.np-ours::after {
	content: attr(data-label);
	position: absolute;
	bottom: calc(100% + 12px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--accent);
	color: #fff;
	font: 600 15px/1 var(--font);
	padding: 7px 10px;
	border-radius: 6px;
	white-space: nowrap;
	z-index: 1;
}

@media (max-width: 640px) {
	.links-table thead { display: none; }
	.links-table td { display: block; border-top: 0; padding: 2px 0; text-align: left !important; }
	.links-table tr { display: block; border-top: 1px solid var(--border); padding: 8px 0; }
}

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 20px);
	background: var(--text);
	color: var(--bg);
	padding: 9px 16px;
	border-radius: 8px;
	font-size: 14px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Target switch */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented label { position: relative; cursor: pointer; margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 5px 11px; font-size: 14px; border-left: 1px solid var(--border); background: var(--surface); }
.segmented label:first-child span { border-left: 0; }
.segmented input:checked + span { background: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
#target-help.test { color: var(--warn); }

/* Export */
.export-options { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 14px 0; }
.export-options fieldset { border: 0; padding: 0; margin: 0; }
.export-options legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.checks input { accent-color: var(--accent); margin: 0; }
.export-count { font-size: 14px; margin: 0 0 10px; }
.export-more { margin: 10px 0 0; }

.form-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.form-top #reset-builder { margin-top: 2px; }

/* Chosen creative */
.creative:empty { display: none; }
.creative { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.creative .thumb { display: block; margin-bottom: 10px; }
.creative .thumb img { display: block; max-width: 100%; max-height: 140px; border-radius: 6px; margin: 0 auto; }
.creative .downloads { display: flex; flex-wrap: wrap; gap: 6px; }
