/* OneDayQuiz - Convertitore di numeri romani [odq_numeri_romani] */

.odq-rom {
	--rom-violet: #6b46c1;
	--rom-violet-dk: #553c9a;
	--rom-violet-ink: #44287f;
	--rom-lav: #f4f0fb;
	--rom-line: #e4ddf2;
	--rom-text: #1f1a2e;
	--rom-muted: #5b5670;
	--rom-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--rom-ring: 0 0 0 3px #fff, 0 0 0 5px #6b46c1;
	max-width: 820px;
	margin: 0 auto;
	color: var(--rom-text);
	font-family: inherit;
	line-height: 1.5;
}
.odq-rom *,
.odq-rom *::before,
.odq-rom *::after { box-sizing: border-box; }
.odq-rom [hidden] { display: none !important; }

.odq-rom p { margin: 0; }
.odq-rom h3.odq-rom-h,
.odq-rom h3.odq-rom-title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	color: var(--rom-text);
	text-transform: none;
	letter-spacing: 0;
}
.odq-rom-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
.odq-rom-mono { font-family: var(--rom-mono); }
.odq-rom-ov {
	text-decoration: overline;
	text-decoration-thickness: .075em;
	text-decoration-skip-ink: none;
}

/* ---------- card ---------- */
.odq-rom-card {
	background: #fff;
	border: 1px solid var(--rom-line);
	border-radius: 20px;
	padding: clamp(16px, 3.6vw, 30px);
}

/* ---------- tab ---------- */
.odq-rom-tabs {
	display: inline-flex;
	gap: 4px;
	padding: 4px;
	margin-bottom: 22px;
	background: var(--rom-lav);
	border-radius: 999px;
}
.odq-rom button.odq-rom-tab {
	min-height: 44px;
	min-width: 104px;
	padding: 0 22px;
	margin: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--rom-muted);
	font: inherit;
	font-weight: 600;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color .15s, color .15s;
}
.odq-rom button.odq-rom-tab:hover,
.odq-rom button.odq-rom-tab:focus { background: #e9e2f7; color: var(--rom-violet-ink); }
.odq-rom button.odq-rom-tab[aria-selected="true"],
.odq-rom button.odq-rom-tab[aria-selected="true"]:hover,
.odq-rom button.odq-rom-tab[aria-selected="true"]:focus { background: var(--rom-violet); color: #fff; }
.odq-rom button.odq-rom-tab:focus-visible { outline: none; box-shadow: var(--rom-ring); }

/* ---------- campi ---------- */
.odq-rom-fields {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	gap: 12px;
	align-items: start;
}
.odq-rom-field { min-width: 0; }
.odq-rom-label {
	display: block;
	margin: 0 0 6px;
	padding: 0;
	font-weight: 700;
	font-size: .95rem;
	color: var(--rom-text);
}
.odq-rom input.odq-rom-input {
	display: block;
	width: 100%;
	min-height: 60px;
	margin: 0;
	padding: 10px 16px;
	border: 2px solid var(--rom-line);
	border-radius: 14px;
	background: #fff;
	color: var(--rom-text);
	font-family: var(--rom-mono);
	font-size: 1.6rem;
	font-weight: 600;
	letter-spacing: .03em;
	line-height: 1.2;
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
	-webkit-appearance: none;
	appearance: none;
}
.odq-rom input.odq-rom-input::placeholder { color: #9a95ab; font-weight: 400; opacity: 1; }
.odq-rom input.odq-rom-input:hover { border-color: #cfc3ea; }
.odq-rom input.odq-rom-input:focus {
	outline: none;
	border-color: var(--rom-violet);
	box-shadow: 0 0 0 4px rgba(107, 70, 193, .18);
}
.odq-rom input.odq-rom-input.is-invalid { border-color: #c2412d; }
.odq-rom input.odq-rom-input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(194, 65, 45, .16); }
.odq-rom-input-rom { text-transform: none; }

.odq-rom-swap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 60px;
	margin-top: 29px;
	color: var(--rom-violet);
}
.odq-rom-help { margin-top: 6px !important; font-size: .85rem; color: var(--rom-muted); min-height: 44px; }

.odq-rom button.odq-rom-linkbtn {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin: -8px 0 0;
	padding: 0 2px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--rom-violet);
	font: inherit;
	font-size: .85rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.odq-rom button.odq-rom-linkbtn:hover,
.odq-rom button.odq-rom-linkbtn:focus { background: transparent; color: var(--rom-violet-dk); }
.odq-rom button.odq-rom-linkbtn:focus-visible { outline: none; box-shadow: var(--rom-ring); }

/* ---------- rilevamento ---------- */
.odq-rom-detect {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin-top: 8px;
	padding: 10px 14px;
	border-radius: 14px;
	background: #fff8e6;
	border: 1px solid #f0dca4;
	color: #5c4300;
	font-weight: 600;
}

/* ---------- esempi rapidi ---------- */
.odq-rom-quick { margin-top: 14px; }
.odq-rom-quick-t { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 600; color: var(--rom-muted); }
.odq-rom ul.odq-rom-quick-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.odq-rom ul.odq-rom-quick-list li { margin: 0; padding: 0; }
.odq-rom button.odq-rom-qchip {
	min-height: 44px;
	min-width: 48px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid var(--rom-line);
	border-radius: 999px;
	background: #fff;
	color: var(--rom-violet-ink);
	font-family: var(--rom-mono);
	font-size: .95rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color .15s, border-color .15s;
}
.odq-rom button.odq-rom-qchip span { font-family: inherit; font-size: .75rem; font-weight: 500; color: var(--rom-muted); margin-left: 4px; }
.odq-rom button.odq-rom-qchip:hover,
.odq-rom button.odq-rom-qchip:focus { background: var(--rom-lav); border-color: #cfc3ea; color: var(--rom-violet-ink); }
.odq-rom button.odq-rom-qchip:focus-visible { outline: none; box-shadow: var(--rom-ring); }

/* ---------- opzioni ---------- */
.odq-rom-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0 22px;
	margin-top: 12px;
}
.odq-rom label.odq-rom-check {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0;
	font-size: .95rem;
	color: var(--rom-text);
	cursor: pointer;
}
.odq-rom label.odq-rom-check input {
	width: 20px;
	height: 20px;
	margin: 0;
	flex: 0 0 auto;
	accent-color: var(--rom-violet);
	cursor: pointer;
}
.odq-rom label.odq-rom-check input:focus-visible { outline: 2px solid var(--rom-violet); outline-offset: 2px; }

/* ---------- risultato ---------- */
.odq-rom-result {
	margin-top: 18px;
	padding: clamp(16px, 3vw, 24px);
	border-radius: 16px;
	background: var(--rom-lav);
	min-height: 120px;
}
.odq-rom-result.is-empty {
	display: flex;
	align-items: center;
	background: #fff;
	border: 2px dashed var(--rom-line);
}
.odq-rom-empty { color: var(--rom-muted); font-size: .98rem; }
.odq-rom-res-label {
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--rom-muted);
}
.odq-rom-res-main {
	margin-top: 4px !important;
	font-family: var(--rom-mono);
	font-size: clamp(2rem, 7vw, 3.1rem);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: .04em;
	color: var(--rom-violet-ink);
	overflow-wrap: anywhere;
}
.odq-rom-res-main.is-long { font-size: clamp(1.45rem, 5.2vw, 2.5rem); letter-spacing: .02em; }
.odq-rom-note {
	margin-top: 10px !important;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: .93rem;
	line-height: 1.45;
}
.odq-rom-note.is-info { padding: 0; color: var(--rom-muted); font-weight: 600; }
.odq-rom-note.is-soft { background: #fff; color: var(--rom-text); }
.odq-rom-note.is-warn { background: #fff8e6; border: 1px solid #f0dca4; color: #5c4300; }
.odq-rom-note strong { font-weight: 700; }

.odq-rom-result.is-error { background: #fff4f2; border: 1px solid #f3cbc3; }
.odq-rom-err { color: #8f2414; font-weight: 700; font-size: 1.02rem; }
.odq-rom-guess {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	margin-top: 12px;
	padding: 12px 14px;
	border-radius: 12px;
	background: #fff;
}
.odq-rom-guess-t { flex: 1 1 220px; }
.odq-rom-guess strong { color: var(--rom-violet-ink); font-size: 1.1rem; }

/* ---------- passo per passo ---------- */
.odq-rom-steps { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rom-line); }
.odq-rom h3.odq-rom-h {
	margin-bottom: 10px;
	font-size: .8rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--rom-muted);
}
.odq-rom ul.odq-rom-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.odq-rom ul.odq-rom-chips li { margin: 0; }
.odq-rom-chip {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 58px;
	padding: 8px 12px 7px;
	border-radius: 12px;
	border: 1px solid transparent;
	text-align: center;
}
.odq-rom-chip-r { font-family: var(--rom-mono); font-size: 1.3rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.odq-rom-chip-v { font-family: var(--rom-mono); font-size: .78rem; font-weight: 600; opacity: .85; white-space: nowrap; }
.odq-rom-p3 { background: #ece5fb; border-color: #d8ccf4; color: #3f2785; }
.odq-rom-p2 { background: #e1f3ef; border-color: #bfe3da; color: #0f4f45; }
.odq-rom-p1 { background: #fdeedd; border-color: #f4d6b2; color: #74400c; }
.odq-rom-p0 { background: #fce6ee; border-color: #f2c7d6; color: #84203f; }
.odq-rom-chip.is-sub { background: #fff; border: 2px dashed var(--rom-violet); color: var(--rom-violet-ink); }
.odq-rom-chip.is-neg { background: #fff; border: 2px dashed #c2412d; color: #8f2414; }
.odq-rom-chip.odq-rom-total { background: var(--rom-violet); border-color: var(--rom-violet); color: #fff; }
.odq-rom-chip.odq-rom-total .odq-rom-chip-v { opacity: .9; }
.odq-rom-chip.odq-rom-dd { background: #ece5fb; border-color: #d8ccf4; color: #3f2785; }
.odq-rom-chip.odq-rom-dm { background: #e1f3ef; border-color: #bfe3da; color: #0f4f45; }
.odq-rom-chip.odq-rom-dy { background: #fdeedd; border-color: #f4d6b2; color: #74400c; }
.odq-rom-op { font-family: var(--rom-mono); font-size: 1.15rem; font-weight: 700; color: var(--rom-muted); padding: 0 1px; }
.odq-rom-legend { margin-top: 8px !important; font-size: .82rem; color: var(--rom-muted); }
.odq-rom-steps-text {
	margin-top: 10px !important;
	font-family: var(--rom-mono);
	font-size: .9rem;
	color: var(--rom-muted);
	overflow-wrap: anywhere;
}

/* ---------- date ---------- */
.odq-rom-daterow {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: 16px 20px;
	align-items: end;
}
.odq-rom-inline { display: flex; gap: 8px; }
.odq-rom-inline input.odq-rom-input { flex: 1 1 auto; min-width: 0; }
.odq-rom input.odq-rom-input-date { font-size: 1.15rem; }
.odq-rom fieldset.odq-rom-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.odq-rom fieldset.odq-rom-fieldset legend { float: none; width: auto; }
.odq-rom-dmy { display: flex; gap: 8px; }
.odq-rom-mini { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }
.odq-rom-mini-y { flex-grow: 1.6; }
.odq-rom-mini label { font-size: .78rem; color: var(--rom-muted); margin: 0 0 2px; }
.odq-rom-mini input.odq-rom-input { font-size: 1.15rem; padding: 10px 10px; text-align: center; }

.odq-rom-dateopts {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 14px 22px;
	margin-top: 18px;
}
.odq-rom-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.odq-rom-seg label { position: relative; margin: 0; cursor: pointer; }
.odq-rom-seg input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}
.odq-rom-seg label > span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	min-width: 44px;
	padding: 0 14px;
	border: 1px solid var(--rom-line);
	border-radius: 12px;
	background: #fff;
	color: var(--rom-text);
	font-family: var(--rom-mono);
	font-size: .92rem;
	font-weight: 600;
	transition: background-color .15s, border-color .15s;
}
.odq-rom-seg label:hover > span { background: var(--rom-lav); }
.odq-rom-seg input:checked + span { background: var(--rom-violet); border-color: var(--rom-violet); color: #fff; }
.odq-rom-seg input:focus-visible + span { box-shadow: var(--rom-ring); }
.odq-rom-sep { font-size: 1.15rem !important; }

.odq-rom-tip {
	margin-top: 16px !important;
	padding-left: 12px;
	border-left: 3px solid var(--rom-violet);
	font-size: .93rem;
	color: var(--rom-muted);
}

/* ---------- pulsanti ---------- */
.odq-rom-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}
.odq-rom button.odq-rom-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	margin: 0;
	padding: 0 18px;
	border: 1px solid var(--rom-line);
	border-radius: 12px;
	background: #fff;
	color: var(--rom-violet-ink);
	font: inherit;
	font-size: .97rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s;
}
.odq-rom button.odq-rom-btn:hover,
.odq-rom button.odq-rom-btn:focus { background: var(--rom-lav); border-color: #cfc3ea; color: var(--rom-violet-ink); }
.odq-rom button.odq-rom-btn:focus-visible { outline: none; box-shadow: var(--rom-ring); }
.odq-rom button.odq-rom-btn-primary { background: var(--rom-violet); border-color: var(--rom-violet); color: #fff; }
.odq-rom button.odq-rom-btn-primary:hover,
.odq-rom button.odq-rom-btn-primary:focus { background: var(--rom-violet-dk); border-color: var(--rom-violet-dk); color: #fff; }
.odq-rom button.odq-rom-btn-primary.is-done,
.odq-rom button.odq-rom-btn-primary.is-done:hover { background: #217a5b; border-color: #217a5b; color: #fff; }
.odq-rom button.odq-rom-btn-ghost { border-color: transparent; background: transparent; color: var(--rom-muted); }
.odq-rom button.odq-rom-btn-ghost:hover,
.odq-rom button.odq-rom-btn-ghost:focus { background: var(--rom-lav); border-color: transparent; color: var(--rom-text); }
.odq-rom-inline button.odq-rom-btn-ghost { border-color: var(--rom-line); min-height: 60px; border-radius: 14px; }
.odq-rom button.odq-rom-btn-small { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.odq-rom-ico { flex: 0 0 auto; }

/* ---------- tabella simboli ---------- */
.odq-rom-symbols { margin-top: 28px; }
.odq-rom h3.odq-rom-title { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
.odq-rom-sub { margin-top: 4px !important; font-size: .92rem; color: var(--rom-muted); }
.odq-rom-tablewrap { margin-top: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.odq-rom table.odq-rom-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: 6px 0;
	table-layout: fixed;
	background: transparent;
}
.odq-rom-table th,
.odq-rom-table td {
	padding: 0;
	border: 0;
	background: transparent;
	text-align: center;
	vertical-align: middle;
}
.odq-rom-table th {
	width: 76px;
	padding-right: 4px;
	text-align: left;
	font-size: .82rem;
	font-weight: 600;
	color: var(--rom-muted);
}
.odq-rom-table tr:first-child td,
.odq-rom-table tr:first-child th { padding-bottom: 6px; }
.odq-rom button.odq-rom-sym {
	display: block;
	width: 100%;
	min-height: 56px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--rom-line);
	border-radius: 14px;
	background: var(--rom-lav);
	color: var(--rom-violet-ink);
	font-family: var(--rom-mono);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background-color .15s, color .15s, transform .15s;
}
.odq-rom button.odq-rom-sym:hover,
.odq-rom button.odq-rom-sym:focus { background: var(--rom-violet); border-color: var(--rom-violet); color: #fff; }
.odq-rom button.odq-rom-sym:focus-visible { outline: none; box-shadow: var(--rom-ring); }
.odq-rom-val { font-family: var(--rom-mono); font-size: .95rem; font-weight: 600; color: var(--rom-text); }

.odq-rom-guide { margin-top: 22px !important; }
.odq-rom-guide a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	color: var(--rom-violet);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.odq-rom-guide a:hover { color: var(--rom-violet-dk); }
.odq-rom-guide a:focus-visible { outline: none; box-shadow: var(--rom-ring); border-radius: 4px; }

/* ---------- toast ---------- */
.odq-rom-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 9999;
	max-width: calc(100vw - 32px);
	padding: 12px 18px;
	border-radius: 999px;
	background: var(--rom-text);
	color: #fff;
	font-size: .95rem;
	font-weight: 600;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 10px);
	transition: opacity .2s, transform .2s;
}
.odq-rom-toast:empty { padding: 0; }
.odq-rom-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
	.odq-rom-fields { grid-template-columns: minmax(0, 1fr); gap: 4px; }
	.odq-rom-swap { width: auto; height: 28px; margin: -6px 0 0; transform: rotate(90deg); }
	.odq-rom-help { min-height: 0; }
	.odq-rom-daterow { grid-template-columns: minmax(0, 1fr); }
	.odq-rom-tabs { display: flex; }
	.odq-rom button.odq-rom-tab { flex: 1 1 0; min-width: 0; }
	.odq-rom-table th { display: none; }
	.odq-rom table.odq-rom-table { border-spacing: 4px 0; }
	.odq-rom button.odq-rom-sym { min-height: 50px; font-size: 1.3rem; border-radius: 12px; }
	.odq-rom-actions .odq-rom-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
	.odq-rom *, .odq-rom-toast { transition: none !important; }
}
