/**
 * Public styles for EMV esikolmikud.
 */
.emv-app {
	--emv-bg: #ffffff;
	--emv-surface: #f7f8fa;
	--emv-surface-strong: #eef1f5;
	--emv-border: #d9dee7;
	--emv-text: #18212f;
	--emv-muted: #657083;
	--emv-accent: #1d4ed8;
	--emv-accent-dark: #173ea5;
	--emv-focus: #2563eb;
	--emv-gold: #c78b00;
	--emv-gold-bg: #fff5cf;
	--emv-silver: #687386;
	--emv-silver-bg: #edf0f4;
	--emv-bronze: #9a5a2a;
	--emv-bronze-bg: #f8e8dc;
	--emv-radius: 12px;
	--emv-shadow: 0 8px 24px rgba(24, 33, 47, 0.08);
	box-sizing: border-box;
	color: var(--emv-text);
	font: inherit;
	line-height: 1.5;
	margin: 1.5rem 0;
	max-width: 100%;
}

.emv-app *,
.emv-app *::before,
.emv-app *::after {
	box-sizing: inherit;
}

.emv-app [hidden] {
	display: none !important;
}

.emv-summary {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	margin-bottom: 18px;
}

.emv-summary-card {
	background: linear-gradient(145deg, var(--emv-bg), var(--emv-surface));
	border: 1px solid var(--emv-border);
	border-radius: var(--emv-radius);
	box-shadow: 0 3px 12px rgba(24, 33, 47, 0.04);
	min-width: 0;
	padding: 16px 18px;
}

.emv-summary-card span {
	color: var(--emv-muted);
	display: block;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.035em;
	margin-bottom: 3px;
	text-transform: uppercase;
}

.emv-summary-card strong {
	display: block;
	font-size: clamp(1.4rem, 2.5vw, 2rem);
	font-variant-numeric: tabular-nums;
	line-height: 1.15;
}

.emv-toolbar {
	align-items: center;
	background: var(--emv-surface);
	border: 1px solid var(--emv-border);
	border-radius: var(--emv-radius);
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 18px;
	padding: 12px;
}

.emv-toolbar label {
	margin: 0;
}

.emv-search-field {
	flex: 1 1 260px;
}

.emv-toolbar input[type="search"],
.emv-toolbar select {
	appearance: auto;
	background-color: var(--emv-bg);
	border: 1px solid var(--emv-border);
	border-radius: 8px;
	box-shadow: none;
	color: var(--emv-text);
	font: inherit;
	font-size: 0.95rem;
	line-height: 1.3;
	margin: 0;
	min-height: 42px;
	padding: 8px 11px;
	width: 100%;
}

.emv-toolbar select {
	min-width: 165px;
}

.emv-toolbar input[type="search"]:focus,
.emv-toolbar select:focus,
.emv-tool-button:focus-visible,
.emv-accordion-button:focus-visible,
.emv-stats-box summary:focus-visible,
.emv-members summary:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.32);
	outline-offset: 2px;
}

.emv-toolbar-actions {
	display: flex;
	gap: 6px;
}

.emv-tool-button {
	background: var(--emv-bg);
	border: 1px solid var(--emv-border);
	border-radius: 8px;
	color: var(--emv-text);
	cursor: pointer;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 650;
	line-height: 1.2;
	margin: 0;
	min-height: 42px;
	padding: 8px 12px;
}

.emv-tool-button:hover {
	background: var(--emv-surface-strong);
	border-color: #bcc4d1;
}

.emv-visible-count {
	color: var(--emv-muted);
	font-size: 0.9rem;
	margin-left: auto;
	white-space: nowrap;
}

.emv-visible-count strong {
	color: var(--emv-text);
}

.emv-event-list {
	display: grid;
	gap: 10px;
}

.emv-event {
	background: var(--emv-bg);
	border: 1px solid var(--emv-border);
	border-radius: var(--emv-radius);
	box-shadow: 0 2px 8px rgba(24, 33, 47, 0.035);
	overflow: clip;
}

.emv-event-heading {
	font: inherit;
	margin: 0 !important;
	padding: 0;
}

.emv-accordion-button {
	align-items: center;
	background: var(--emv-bg);
	border: 0;
	color: var(--emv-text);
	cursor: pointer;
	display: grid;
	font: inherit;
	grid-template-columns: minmax(0, 1fr) auto 20px;
	gap: 16px;
	margin: 0;
	padding: 17px 18px;
	text-align: left;
	width: 100%;
}

.emv-accordion-button:hover,
.emv-accordion-button[aria-expanded="true"] {
	background: var(--emv-surface);
}

.emv-accordion-button[aria-expanded="true"] {
	border-bottom: 1px solid var(--emv-border);
}

.emv-event-title {
	min-width: 0;
}

.emv-event-title > span {
	display: block;
	font-size: 1.05rem;
	font-weight: 750;
	letter-spacing: 0.005em;
	line-height: 1.28;
}

.emv-event-title small {
	color: var(--emv-muted);
	display: block;
	font-size: 0.78rem;
	font-weight: 600;
	margin-top: 3px;
}

.emv-event-meta {
	color: var(--emv-muted);
	font-size: 0.84rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.emv-chevron {
	border-bottom: 2px solid currentColor;
	border-right: 2px solid currentColor;
	display: block;
	height: 9px;
	justify-self: end;
	transform: rotate(45deg) translateY(-2px);
	transition: transform 160ms ease;
	width: 9px;
}

.emv-accordion-button[aria-expanded="true"] .emv-chevron {
	transform: rotate(225deg) translate(-2px, -2px);
}

.emv-accordion-panel {
	background: var(--emv-bg);
}

.emv-panel-inner {
	padding: 18px;
}

.emv-event-note {
	background: #fff8e7;
	border-left: 4px solid #d99b18;
	border-radius: 6px;
	color: #493710;
	font-size: 0.9rem;
	margin-bottom: 16px;
	padding: 10px 12px;
}


.emv-record-box {
	align-items: center;
	background: linear-gradient(145deg, #f0f7ff, var(--emv-surface));
	border: 1px solid #bfd7ff;
	border-radius: 9px;
	display: grid;
	gap: 10px 16px;
	grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.8fr);
	margin: 0 0 16px;
	padding: 12px 13px;
}

.emv-record-label {
	color: var(--emv-accent-dark);
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.035em;
	text-transform: uppercase;
}

.emv-record-details {
	display: grid;
	gap: 10px;
	grid-template-columns: 0.7fr minmax(0, 1.6fr) 0.8fr;
	margin: 0;
}

.emv-record-details div {
	min-width: 0;
}

.emv-record-details dt {
	color: var(--emv-muted);
	font-size: 0.72rem;
	font-weight: 750;
	letter-spacing: 0.035em;
	margin: 0 0 2px;
	text-transform: uppercase;
}

.emv-record-details dd {
	font-size: 0.95rem;
	font-weight: 650;
	margin: 0;
	overflow-wrap: anywhere;
}

.emv-stats-box {
	background: var(--emv-surface);
	border: 1px solid var(--emv-border);
	border-radius: 9px;
	margin: 0 0 16px;
}

.emv-stats-box > summary {
	cursor: pointer;
	font-size: 0.92rem;
	font-weight: 700;
	padding: 11px 13px;
}

.emv-stats-box[open] > summary {
	border-bottom: 1px solid var(--emv-border);
}

.emv-stats-threshold {
	color: var(--emv-muted);
	font-size: 0.82rem;
	line-height: 1.45;
	margin: 11px 13px 4px;
}

.emv-stats-threshold strong {
	color: var(--emv-text);
}

.emv-results-scroll,
.emv-stats-scroll {
	-webkit-overflow-scrolling: touch;
	overflow-x: auto;
}

.emv-stats-scroll {
	padding: 0 12px 12px;
}

.emv-results-table,
.emv-stats-table {
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 0.91rem;
	margin: 0;
	min-width: 760px;
	width: 100%;
}

.emv-stats-table {
	min-width: 560px;
}

.emv-results-table th,
.emv-results-table td,
.emv-stats-table th,
.emv-stats-table td {
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--emv-border);
	color: var(--emv-text);
	padding: 11px 12px;
	text-align: left;
	vertical-align: top;
}

.emv-results-table thead th,
.emv-stats-table thead th {
	background: var(--emv-surface);
	color: var(--emv-muted);
	font-size: 0.76rem;
	font-weight: 750;
	letter-spacing: 0.035em;
	text-transform: uppercase;
}

.emv-results-table thead th:first-child,
.emv-stats-table thead th:first-child {
	border-top-left-radius: 8px;
}

.emv-results-table thead th:last-child,
.emv-stats-table thead th:last-child {
	border-top-right-radius: 8px;
}

.emv-results-table tbody tr:hover td,
.emv-results-table tbody tr:hover th,
.emv-stats-table tbody tr:hover td,
.emv-stats-table tbody tr:hover th {
	background: rgba(238, 241, 245, 0.55);
}

.emv-results-table tbody tr:last-child th,
.emv-results-table tbody tr:last-child td,
.emv-stats-table tbody tr:last-child th,
.emv-stats-table tbody tr:last-child td {
	border-bottom: 0;
}

.emv-results-table tbody > tr > th {
	font-variant-numeric: tabular-nums;
	width: 92px;
}

.emv-year {
	display: block;
	font-weight: 800;
}

.emv-row-note {
	color: var(--emv-muted);
	display: block;
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.35;
	margin-top: 4px;
}

.emv-medal-label {
	align-items: center;
	display: inline-flex;
	gap: 6px;
}

.emv-medal-label::before,
.emv-medal-dot {
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 50%;
	content: "";
	flex: 0 0 auto;
	height: 12px;
	width: 12px;
}

.emv-gold::before,
.emv-medal-dot.emv-gold {
	background: var(--emv-gold-bg);
	border-color: var(--emv-gold);
}

.emv-silver::before,
.emv-medal-dot.emv-silver {
	background: var(--emv-silver-bg);
	border-color: var(--emv-silver);
}

.emv-bronze::before,
.emv-medal-dot.emv-bronze {
	background: var(--emv-bronze-bg);
	border-color: var(--emv-bronze);
}

.emv-medal-cell {
	display: flex;
	gap: 9px;
	min-width: 0;
}

.emv-medal-dot {
	margin-top: 4px;
}

.emv-medal-content {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.emv-medal-content strong {
	font-weight: 700;
	overflow-wrap: anywhere;
}

.emv-result {
	color: var(--emv-muted);
	font-size: 0.84rem;
	font-variant-numeric: tabular-nums;
}

.emv-members {
	font-size: 0.78rem;
	margin-top: 3px;
}

.emv-members summary {
	color: var(--emv-accent);
	cursor: pointer;
	font-weight: 650;
	width: fit-content;
}

.emv-members span {
	color: var(--emv-muted);
	display: block;
	line-height: 1.45;
	margin-top: 3px;
	max-width: 34rem;
}

.emv-dash {
	color: var(--emv-muted);
}

.emv-stats-table td:not(:first-child),
.emv-stats-table th:not(:first-child) {
	text-align: right;
}

.emv-no-results,
.emv-empty {
	background: var(--emv-surface);
	border: 1px dashed var(--emv-border);
	border-radius: var(--emv-radius);
	color: var(--emv-muted);
	padding: 24px;
	text-align: center;
}

@media (max-width: 860px) {
	.emv-summary {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.emv-visible-count {
		margin-left: 0;
		width: 100%;
	}
}

@media (max-width: 600px) {
	.emv-app {
		margin: 1rem 0;
	}

	.emv-summary {
		gap: 8px;
	}

	.emv-summary-card {
		padding: 12px;
	}

	.emv-summary-card span {
		font-size: 0.68rem;
	}

	.emv-toolbar {
		align-items: stretch;
		flex-direction: column;
	}

	.emv-search-field,
	.emv-toolbar label,
	.emv-toolbar select {
		flex-basis: auto;
		min-width: 0;
		width: 100%;
	}

	.emv-toolbar-actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}

	.emv-accordion-button {
		grid-template-columns: minmax(0, 1fr) 18px;
		gap: 10px;
		padding: 15px 14px;
	}

	.emv-event-meta {
		display: none;
	}

	.emv-record-box,
	.emv-record-details {
		grid-template-columns: 1fr;
	}

	.emv-panel-inner {
		padding: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.emv-chevron {
		transition: none;
	}
}

@media print {
	.emv-toolbar,
	.emv-tool-button,
	.emv-chevron {
		display: none !important;
	}

	.emv-event {
		break-inside: avoid;
		box-shadow: none;
	}

	.emv-accordion-panel[hidden] {
		display: block !important;
	}

	.emv-results-scroll,
	.emv-stats-scroll {
		overflow: visible;
	}
}
