/* Калькулятор дат: слева начальная дата, справа конечная, между ними — период.
   Под начальной — «−» (отодвигает её назад от конечной), под конечной — «+» (вперёд от начальной). */
.dc {
	display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 1.25fr) minmax(0, 1fr); gap: 12px;
	width: 100%; max-width: 680px; margin: 0 auto;
}
#a { grid-area: 1 / 1; }
#b { grid-area: 1 / 3; }
#minus { grid-area: 2 / 1; }
#plus { grid-area: 2 / 3; }
.span { grid-area: 1 / 2 / 3 / 3; }

/* Даты: день недели и дата; поверх — невидимое поле даты (открывает системный выбор) */
.date {
	position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center;
	gap: 2px; min-width: 0; min-height: 88px; padding: 10px 8px; color: var(--fg); cursor: pointer;
	border: 1.5px solid var(--line); border-radius: 20px;
}
.date:hover { border-color: var(--mute); }
.date:focus-within { border-color: var(--fg); }
.date .wd { font-size: 15px; color: var(--mute); }
.date .d { font-size: clamp(18px, 4.8vw, 22px); font-weight: 600; white-space: nowrap; }
.dc.on .date input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dc.on .date input:focus-visible { outline: none; }

/* Период: число по центру, под ним — выбор вида (дни; недели и дни; месяцы и дни; годы, месяцы и дни) */
.span {
	display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
	min-height: 120px; padding: 12px; background: var(--card); border-radius: 24px;
}
.span .n { font-size: 18px; line-height: 1.15; }
.span .n b { font-size: clamp(44px, 12vw, 60px); font-weight: 600; }
/* несколько частей («5 лет 8 месяцев 11 дней») — мельче и с переносом по частям */
.span.parts .n { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 12px; }
.span.parts .n span { white-space: nowrap; }
.span.parts .n b { font-size: clamp(32px, 8.5vw, 40px); margin-right: 4px; }
.dc .span .unit:hover { background: var(--tile); }

/* Отнять / прибавить: знак слева, число крупно, под ним — своя единица (выпадающий список) */
.step {
	position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center;
	min-height: 104px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 20px;
}
.step:hover { border-color: var(--mute); }
.step:focus-within { border-color: var(--fg); }
.step .sign { position: absolute; left: 18px; top: calc(50% - 22px); transform: translateY(-50%); font-size: 26px; line-height: 1; pointer-events: none; }
.step input {
	height: 48px; padding: 0 36px; border: 0; background: none; text-align: center;
	font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.step input::placeholder { color: var(--line); }
.step input:focus-visible { outline: none; }
/* единица: слово с галочкой по ширине слова; поверх — невидимый список (системный выбор) */
.dc .unit {
	position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
	border-radius: 14px; color: var(--mute); font-size: 17px; cursor: pointer;
}
.dc .unit:hover { background: var(--card); color: var(--fg); }
.dc .unit:focus-within { color: var(--fg); }
.dc .unit::after {
	content: ""; width: 7px; height: 7px; margin-top: -4px;
	border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg);
}
.dc.on .unit select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }

/* Подсказка при наведении (только мышь): что это за поле; появляется с задержкой, над полем (у «−/+» — под ним) */
@media (hover: hover) and (pointer: fine) {
	.dc [data-tip] { position: relative; }
	.dc [data-tip]::after {
		content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 3;
		transform: translate(var(--tx, -50%), 4px); padding: 6px 12px; border-radius: 10px; white-space: nowrap;
		background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 500; line-height: 1.3;
		opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
	}
	.dc [data-tip]:hover::after { opacity: 1; transform: translate(var(--tx, -50%), 0); transition: opacity .2s .6s, transform .2s .6s; }
	/* у крайних полей — по их внешнему краю, чтобы не вылезать за окно */
	#a::after, #minus::after { left: 0; --tx: 0; }
	#b::after, #plus::after { left: auto; right: 0; --tx: 0; }
	/* у «−» и «+» — под полем: над ними даты, под ними пусто */
	.step[data-tip]::after { bottom: auto; top: calc(100% + 8px); transform: translate(var(--tx, -50%), -4px); }
}

/* Телефон: даты, под ними период, ниже «−» и «+» */
@media (max-width: 560px) {
	.dc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	#b, #plus { grid-column: 2; }
	.span { grid-area: 2 / 1 / 3 / 3; }
	#minus, #plus { grid-row: 3; }
}

@supports (corner-shape: squircle) {
	.date, .step { border-radius: 30px; corner-shape: squircle; }
	.span { border-radius: 38px; corner-shape: squircle; }
	.dc .unit { border-radius: 22px; corner-shape: squircle; }
	.dc [data-tip]::after { border-radius: 16px; corner-shape: squircle; }
}
