/* Staging Search & Browse only. Keep the existing forms, rail and card system. */
:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .df-tabs-nav {
	position: static;
}

:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-shared-search {
	position: sticky;
	top: 0;
	z-index: 25;
	padding: 6px 0;
	background: var(--df-bg);
	border-bottom: 1px solid var(--df-line);
}

:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-catalog-fields {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
}

:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-catalog-fields label {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
}

:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-catalog-fields input {
	min-width: 0;
	font-size: 16px;
}

:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-search-toggle {
	display: none;
}

:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) :is(input, button, select, a) {
	scroll-margin-block-start: 80px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 {
	padding-top: 16px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 #df-tab-search .df-landing {
	padding: 16px 0 10px;
	text-align: left;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .df-landing__sub {
	max-width: none;
	margin: 0 0 12px;
	font-size: 15px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .df-bigsearch {
	max-width: none;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .gwd-recent-searches {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: none;
	margin: 12px 0 0;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .recent__label {
	flex: 0 0 auto;
	max-width: 6rem;
	margin: 0;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .recent__chips {
	flex: 1;
	min-width: 0;
	flex-wrap: nowrap;
	overflow-x: auto;
	padding: 4px 4px 6px;
	overscroll-behavior-x: contain;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .recent__chips > li {
	flex-shrink: 0;
	padding: 0;
	border: 0;
	background: transparent;
}

#gwd-discfinder-app.gwd-df-ux-phase1 #df-tab-search .df-advanced-search {
	padding: 8px 0 20px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .df-advanced-search .df-section__head {
	margin-bottom: 14px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .df-advanced-search .df-eyebrow {
	display: none;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .df-advanced-search .df-section__title {
	margin-bottom: 6px;
	font-size: clamp(22px, 2.2vw, 28px);
}

#gwd-discfinder-app.gwd-df-ux-phase1 .df-advanced-search .df-section__sub {
	margin-bottom: 0;
	font-size: 14px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .gwd-df-ux-support {
	padding-bottom: 16px;
}

#gwd-discfinder-app.gwd-df-ux-phase1 .gwd-df-ux-support .df-ai-cta {
	max-width: none;
	margin: 14px 0 0;
	text-align: left;
}

#gwd-discfinder-app.gwd-df-ux-phase1 :focus-visible,
:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-shared-search :focus-visible {
	outline: 2px solid var(--df-maroon);
	outline-offset: 3px;
}

@media (max-width: 860px) {
	:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-search-toggle {
		display: inline-flex;
		min-height: 44px;
		max-width: 100%;
		touch-action: manipulation;
	}

	:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-catalog-fields {
		display: none;
		grid-template-columns: minmax(0, 1fr) auto;
		padding: 8px 0;
	}

	:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-shared-search.is-open .gwd-df-catalog-fields {
		display: grid;
	}

	:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-catalog-fields label {
		grid-column: 1 / -1;
	}

	#gwd-discfinder-app.gwd-df-ux-phase1 {
		padding-top: 8px;
	}

	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filter-panel {
		visibility: hidden;
		height: 100dvh;
		z-index: 100000;
		transition: none;
		overscroll-behavior: contain;
	}

	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filter-panel.is-open {
		visibility: visible;
	}

	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filter-card {
		padding-top: env(safe-area-inset-top);
		padding-bottom: env(safe-area-inset-bottom);
	}

	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filters-close,
	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filter-toggle {
		min-width: 44px;
		min-height: 44px;
		touch-action: manipulation;
	}

	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filters-form input,
	#gwd-discfinder-app.gwd-df-ux-phase1 .df-filters-form select {
		font-size: 16px;
	}
}

/* Native GET remains available when the disclosure script cannot run. */
@media (max-width: 860px) and (scripting: none) {
	:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-catalog-fields {
		display: grid;
	}

	:is(#gwd-discfinder-app.gwd-df-ux-phase2, #gwd-disc-page) .gwd-df-search-toggle {
		display: none;
	}
}

/* Reuse the existing history rail as one names row !important; expansion is an overlay. */
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history {
	position: relative !important;
	inset: auto !important;
	transform: none !important;
	z-index: 20 !important;
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	width: 100% !important;
	max-height: none !important;
	height: 48px !important;
	min-height: 48px !important;
	margin: 10px 0 0 !important;
	overflow: visible !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history[hidden],
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions[hidden] { display: none !important; }

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history .df-recentrail__toggle {
	width: auto !important;
	min-height: 44px !important;
	flex-shrink: 0 !important;
	padding: 6px !important;
	border-radius: 6px !important;
	background: transparent !important;
	color: var(--df-ink) !important;
	font-size: 12px !important;
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history .df-recentrail__toggle-label { display: block !important; }
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history .df-recentrail__count { background: var(--df-line) !important; }

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history.is-collapsed .df-recentrail__list {
	display: flex !important;
	flex: 1 !important;
	min-width: 0 !important;
	flex-direction: row !important;
	gap: 6px !important;
	padding: 0 4px !important;
	overflow-x: auto !important;
	overscroll-behavior-x: contain !important;
	visibility: visible !important;
	max-height: none !important;
	overflow-y: hidden !important;
	background: transparent !important;
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history.is-collapsed .df-rtab {
	flex-shrink: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history.is-collapsed .df-rtab__main {
	min-height: 44px !important;
	padding: 6px 10px !important;
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history.is-collapsed :is(.df-disc, svg, .rtab__brand, .rtab__x) { display: none !important; }
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history .df-recentrail__clear { min-height: 44px !important; flex-shrink: 0 !important; white-space: nowrap !important; }

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history:not(.is-collapsed) .df-recentrail__list {
	position: absolute !important;
	top: 100% !important;
	inset-inline: 0 !important;
	max-height: min(400px, 45dvh) !important;
	border: 1px solid var(--df-line) !important;
	border-radius: 8px !important;
	box-shadow: var(--df-shadow-pop) !important;
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-catalog-fields { position: relative; }
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	z-index: 28;
	max-height: min(440px, 45dvh);
	overflow-y: auto;
	overscroll-behavior-y: contain;
	padding: 8px;
	border: 1px solid var(--df-line);
	border-radius: 8px;
	background: var(--df-card);
	box-shadow: var(--df-shadow-pop);
}

:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions h3 { margin: 6px 8px; font-size: 13px; }
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions a { display: flex; align-items: center; min-height: 44px; padding: 6px 8px; color: var(--df-ink); }
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions a:focus-visible { outline: 2px solid var(--df-maroon); outline-offset: -2px; }

/* One staging profile editor reuses the recommendation form without adding a page row. */
:is(#gwd-discfinder-app, #gwd-disc-page) #gwd-df-catalog-form.gwd-player-profile-toolbar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
}
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-player-profile-access { min-height: 44px; font-size: 14px; white-space: nowrap; }
#gwd-player-profile-dialog {
	box-sizing: border-box;
	width: min(680px, calc(100% - 24px));
	max-height: calc(var(--gwd-profile-height, 100dvh) - 24px);
	margin: auto;
	padding: 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 1px solid var(--df-line, #d4d4d4);
	border-radius: 12px;
	color: var(--df-ink, #202020);
	background: var(--df-bg, #fff);
	color-scheme: light;
}
html:is([data-theme="dark"], [data-color-mode="dark"]) #gwd-player-profile-dialog { background: #171d29; color: #f1f4f8; color-scheme: dark; border-color: #465063; }
#gwd-player-profile-dialog::backdrop { background: rgb(0 0 0 / 55%); }
.gwd-player-profile-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
#gwd-player-profile-dialog h2 { margin: 0; color: inherit; font-size: 24px; }
#gwd-player-profile-dialog .gwd-sr-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#gwd-player-profile-dialog [hidden] { display: none !important; }
#gwd-player-profile-dialog .gwd-sr-field { min-width: 0; }
#gwd-player-profile-dialog label { color: inherit; }
#gwd-player-profile-dialog .gwd-sr-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
#gwd-player-profile-dialog :is(input:not([type="checkbox"]), select) { box-sizing: border-box; width: 100%; min-height: 44px; font-size: 16px; color: inherit; background: var(--df-bg, #fff); }
html:is([data-theme="dark"], [data-color-mode="dark"]) #gwd-player-profile-dialog :is(input:not([type="checkbox"]), select) { background: #20293a; border-color: #667085; }
#gwd-player-profile-dialog :is(button, input[type="checkbox"]) { touch-action: manipulation; }
#gwd-player-profile-dialog button { min-height: 44px; white-space: normal; }
#gwd-player-profile-dialog button:disabled { opacity: .5; }
#gwd-player-profile-dialog :focus-visible { outline: 2px solid #b74d52; outline-offset: 3px; }
#gwd-player-profile-dialog .gwd-sr-consent-row { display: grid; gap: 10px; margin: 16px 0; }
#gwd-player-profile-dialog .gwd-sr-checkbox-label { display: flex; align-items: start; gap: 10px; font-size: 14px; }
#gwd-player-profile-dialog .gwd-sr-checkbox-label input { flex-shrink: 0; margin-top: 4px; }
#gwd-player-profile-dialog :is(.gwd-sr-privacy-note, .gwd-sr-pdga-attribution, .gwd-player-profile-source) { font-size: 13px; line-height: 1.5; color: inherit; }
#gwd-player-profile-dialog .gwd-sr-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#gwd-player-profile-dialog .gwd-sr-feedback { display: block; flex-basis: 100%; color: inherit; }
#gwd-player-profile-dialog .gwd-player-profile-confirm { flex-basis: 100%; }
@media (max-width: 860px) {
	:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-player-profile-toolbar .gwd-df-search-toggle { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
	:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-player-profile-toolbar .gwd-df-catalog-fields { grid-column: 1 / -1; grid-row: 2; }
	:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-player-profile-access { grid-column: 2; grid-row: 1; max-width: 48vw; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 540px) {
	#gwd-player-profile-dialog { width: calc(100% - 16px); padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); max-height: calc(var(--gwd-profile-height, 100dvh) - 16px); }
	#gwd-player-profile-dialog .gwd-sr-profile-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	#gwd-player-profile-dialog h2 { font-size: 20px; }
}
#gwd-player-profile-dialog { scroll-padding-top: 76px; }
#gwd-player-profile-dialog .gwd-player-profile-heading { position: sticky; top: -24px; z-index: 2; padding: 8px 0; background: inherit; }
#gwd-player-profile-dialog button { border: 1px solid var(--df-line, #d4d4d4); border-radius: 8px; padding: 8px 14px; font-weight: 600; color: inherit; background: transparent; }
#gwd-player-profile-dialog :is(#gwd-sr-apply-btn, #gwd-player-profile-save) { background: var(--df-maroon, #7c0236); border-color: var(--df-maroon, #7c0236); color: #fff; }
@media (max-width: 540px) { #gwd-player-profile-dialog .gwd-player-profile-heading { top: -16px; } }
#gwd-player-profile-dialog .gwd-sr-checkbox-label span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#gwd-player-profile-dialog h2 { min-width: 0; overflow-wrap: anywhere; }
#gwd-sr-recommendation-feedback:empty { display: none; }

/* Shared catalog shortcuts reuse the filter dropdown's name/category rows. */
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions a { display:grid; padding:10px 12px; border-radius:6px; text-decoration:none; }
:is(#gwd-discfinder-app, #gwd-disc-page) .gwd-df-history-suggestions a:hover { background:var(--df-inner); }
#gwd-disc-page .gwd-df-shared-search { position:relative; margin:12px 0 20px; }
#gwd-disc-page #gwd-df-catalog-form { padding-inline:0; }
#gwd-disc-page .gwd-df-catalog-fields { width:100%; }
#gwd-player-profile-dialog #gwd-sr-apply-btn { background:transparent; border-color:var(--gwd-input-border,#8b8186); color:inherit; }
#gwd-player-profile-dialog #gwd-player-profile-save { font-weight:700; }
#gwd-player-profile-dialog .gwd-sr-privacy-note { padding-block:12px; border-block:1px solid var(--df-line,#d4cbd0); margin:12px 0; }

/* Override the reused plugin's primary-button skin without changing its handlers. */
#gwd-player-profile-dialog #gwd-sr-apply-btn{background:transparent!important;color:inherit!important;border:1px solid var(--gwd-input-border,#8b8186)!important}
#gwd-player-profile-dialog #gwd-player-profile-save{background:#870338!important;color:#fff!important;border:1px solid #870338!important}

/* The legacy fixed rail sets display explicitly; honour an empty/cleared history. */
#gwd-df-recentrail[hidden], #df-recently-viewed-rail[hidden] { display: none !important; }
