@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
	--md-sys-color-background: #edf1f4;
	--md-sys-color-surface: #ffffff;
	--md-sys-color-surface-bright: #ffffff;
	--md-sys-color-surface-container-low: #f5f7f9;
	--md-sys-color-surface-container: #eef2f5;
	--md-sys-color-surface-container-high: #e6ebf0;
	--md-sys-color-surface-container-highest: #dbe2e9;
	--md-sys-color-primary: #1f2630;
	--md-sys-color-on-primary: #ffffff;
	--md-sys-color-primary-container: #1f2630;
	--md-sys-color-on-primary-container: #ffffff;
	--md-sys-color-secondary: #19c6da;
	--md-sys-color-secondary-container: #daf6fb;
	--md-sys-color-on-secondary-container: #10343d;
	--md-sys-color-outline: #cad3dc;
	--md-sys-color-outline-variant: #d9e0e7;
	--md-sys-color-on-surface: #1f2630;
	--md-sys-color-on-surface-variant: #65707c;
	--md-sys-color-surface-tint: #19c6da;
	--pokeball-red: #ef4056;
	--pokeball-red-soft: #ffe7eb;
	--pokeball-red-dark: #d93449;
	--pokeball-ink: #1f2630;
	--pokeball-ink-soft: #424955;
	--pokeball-grid: #d7dee5;
	--galar-cyan: #19c6da;
	--galar-cyan-soft: #daf6fb;
	--galar-red: #ff5f74;
	--galar-red-dark: #de4d62;
	--galar-yellow: #ffcc47;
	--galar-ink: #1f2630;
	--galar-ink-soft: #3c4551;
	--galar-grid: #d7dee5;

	--bg-card: #ffffff;
	--bg-tab-hover: #eef3f7;
	--bg-tab-active: var(--galar-ink);
	--bg-tab-deactive: #ffffff;
	--bg-table-wrap: var(--md-sys-color-surface-bright);
	--bg-table-header-top: var(--pokeball-red);
	--bg-table-header-side: var(--galar-ink-soft);
	--text-table-header: var(--md-sys-color-on-primary);
	--type-column-width: 156px;
	--matchup-column-width: calc((100% - var(--type-column-width)) / 3);

	--card-border: rgba(31, 38, 48, 0.12);
	--focus-ring: rgba(25, 198, 218, 0.28);
	--toggle-selected-outline: var(--galar-cyan);
	--text-main: var(--md-sys-color-on-surface);
	--text-sub: var(--md-sys-color-on-surface-variant);
	--shadow-1: 0 1px 2px rgba(31, 38, 48, 0.04);
	--shadow-2: 0 6px 20px rgba(31, 38, 48, 0.06);
	--shadow-3: 0 12px 28px rgba(31, 38, 48, 0.08);
	--shadow: var(--shadow-1);
}

* {
	box-sizing: border-box;
}

html {
	color-scheme: light;
	background: var(--md-sys-color-background);
}

body {
	font-family: 'Noto Sans JP', sans-serif;
	margin: 0;
	min-height: 100vh;
	color: var(--text-main);
	background: var(--md-sys-color-background);
}

#app {
	min-height: 100vh;
}

.page {
	width: min(100% - 32px, 1280px);
	margin: 0 auto;
	padding: 20px 0 40px;
}

.hero {
	position: relative;
	margin-bottom: 16px;
	padding: 20px 24px 20px 36px;
	border: 2px solid var(--galar-ink);
	border-radius: 18px;
	background: #ffffff;
	box-shadow: var(--shadow-1);
	overflow: hidden;
}

.hero::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 12px;
	background: var(--galar-cyan);
}

.hero::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 84px;
	height: 84px;
	background: var(--galar-red);
	clip-path: polygon(100% 0, 0 0, 100% 100%);
}

h1 {
	position: relative;
	margin: 0;
	font-size: clamp(1.55rem, 3vw, 2.1rem);
	line-height: 1.2;
	letter-spacing: 0;
	color: var(--galar-ink);
	z-index: 1;
}

.shell {
	background: #ffffff;
	border: 1px solid var(--galar-grid);
	border-radius: 18px;
	box-shadow: var(--shadow-1);
	overflow: hidden;
}

.tab-bar {
	display: flex;
	gap: 8px;
	padding: 14px 16px 12px;
	flex-wrap: wrap;
	border-bottom: 1px solid var(--galar-grid);
	background: var(--md-sys-color-surface-container);
}

.tab-button {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	border: 2px solid var(--galar-grid);
	border-radius: 999px;
	padding: 10px 16px;
	background: var(--bg-tab-deactive);
	color: var(--text-sub);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	letter-spacing: 0.01em;
	transition:
		background-color 160ms ease,
		border-color 160ms ease,
		color 160ms ease,
		box-shadow 160ms ease;
}

.tab-button:hover:not([aria-selected="true"]) {
	background: var(--galar-cyan-soft);
	border-color: var(--galar-cyan);
	color: var(--galar-ink);
	box-shadow: 0 0 0 3px rgba(25, 198, 218, 0.12);
}

.tab-button[aria-selected="true"] {
	background: var(--bg-tab-active);
	border-color: var(--galar-ink);
	color: #ffffff;
	box-shadow: 0 0 0 3px rgba(25, 198, 218, 0.14);
}

.tab-button:focus-visible,
.type-toggle-button:focus-visible {
	outline: 3px solid var(--focus-ring);
	outline-offset: 2px;
}

.panel {
	display: none;
	padding: 18px;
	animation: fade-in 180ms ease;
}

.panel.is-active {
	display: block;
}

.panel-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 16px;
	padding: 4px 2px 16px;
	margin-bottom: 16px;
	flex-wrap: wrap;
	border-bottom: 1px solid var(--galar-grid);
}

.panel-header h2 {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: clamp(1.05rem, 2vw, 1.35rem);
	font-weight: 700;
	letter-spacing: 0;
	color: var(--galar-ink);
}

.panel-header h2::before {
	content: "";
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--galar-cyan);
	flex: 0 0 auto;
}

.panel-lead {
	max-width: 70ch;
	margin: 10px 0 0;
	color: var(--text-sub);
	font-size: 0.97rem;
	line-height: 1.65;
}

.table-wrap {
	border: 1px solid var(--galar-grid);
	border-radius: 14px;
	background: var(--bg-table-wrap);
	overflow: auto;
}

.type-filter-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
	gap: 18px;
	margin-bottom: 20px;
}

.type-filter-controls,
.type-filter-summary,
.matchup-card {
	border: 2px solid var(--galar-grid);
	border-radius: 14px;
	background: #ffffff;
}

.type-filter-controls,
.type-filter-summary {
	padding: 20px;
}

.type-filter-label {
	margin: 0 0 14px;
	font-size: 0.96rem;
	font-weight: 700;
	letter-spacing: 0.01em;
}

.type-toggle-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
	gap: 12px;
}

.type-badge,
.type-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	letter-spacing: 0.01em;
	white-space: nowrap;
	background: var(--type-bg, #ddd4c8);
	color: var(--type-fg, #fffdfa);
	border: 2px solid var(--type-outline, rgba(34, 25, 18, 0.18));
	text-shadow:
		1.25px 0 var(--type-outline, rgba(34, 25, 18, 0.18)),
		-1.25px 0 var(--type-outline, rgba(34, 25, 18, 0.18)),
		0 1.25px var(--type-outline, rgba(34, 25, 18, 0.18)),
		0 -1.25px var(--type-outline, rgba(34, 25, 18, 0.18)),
		1.25px 1.25px var(--type-outline, rgba(34, 25, 18, 0.18)),
		-1.25px -1.25px var(--type-outline, rgba(34, 25, 18, 0.18)),
		1.25px -1.25px var(--type-outline, rgba(34, 25, 18, 0.18)),
		-1.25px 1.25px var(--type-outline, rgba(34, 25, 18, 0.18));
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.18),
		0 1px 2px rgba(31, 38, 48, 0.12);
}

.type-toggle-button {
	appearance: none;
	width: 100%;
	min-height: 52px;
	border-radius: 18px;
	cursor: pointer;
	font: inherit;
	transition:
		box-shadow 160ms ease,
		filter 160ms ease,
		opacity 160ms ease;
}

.type-toggle-button:hover:not(.is-muted) {
	filter: brightness(1.01) saturate(1.03);
}

.type-toggle-button.is-selected {
	box-shadow: 0 0 0 4px var(--toggle-selected-outline);
}

.type-toggle-button.is-muted {
	opacity: 0.5;
}

.type-filter-hint,
.type-filter-status {
	margin: 0;
	color: var(--text-sub);
	font-size: 0.94rem;
	line-height: 1.65;
}

.type-filter-hint {
	margin-top: 14px;
}

.type-filter-summary {
	display: grid;
	gap: 16px;
	align-content: start;
}

.selected-type-tags,
.matchup-result-tags {
	min-height: 40px;
	align-content: flex-start;
}

.matchup-summary-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.matchup-card {
	padding: 18px;
	min-height: 160px;
	border-width: 1px;
}

.matchup-card-header {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: baseline;
	margin-bottom: 14px;
}

.matchup-card h3 {
	margin: 0;
	font-size: 1rem;
	line-height: 1.45;
}

.matchup-card-count {
	margin: 0;
	color: var(--text-sub);
	font-size: 0.82rem;
	font-weight: 700;
	white-space: nowrap;
}

.matchup-card-danger,
.matchup-card-extremely-effective {
	background: #fff7f8;
	border-top: 6px solid var(--galar-red);
}

.matchup-card-danger-soft,
.matchup-card-super-effective {
	background: #fff8f0;
	border-top: 6px solid #ff9a4a;
}

.matchup-card-neutral {
	background: #fffbef;
	border-top: 6px solid var(--galar-yellow);
}

.matchup-card-good,
.matchup-card-not-very-effective {
	background: #f3fff8;
	border-top: 6px solid #35c788;
}

.matchup-card-good-strong,
.matchup-card-mostly-ineffective {
	background: #eefcf8;
	border-top: 6px solid #1cb67b;
}

.matchup-card-immune,
.matchup-card-doesnt-affect {
	background: #f2fdff;
	border-top: 6px solid var(--galar-cyan);
}

table {
	width: 100%;
	min-width: 960px;
	border-collapse: separate;
	border-spacing: 0;
	table-layout: fixed;
}

.column-type-header,
.row-heading {
	width: var(--type-column-width);
	min-width: var(--type-column-width);
}

.column-type-header {
	left: 0;
	z-index: 3;
	box-shadow: 1px 0 0 rgba(31, 38, 48, 0.1);
}

.column-matchup-header,
.column-matchup-cell {
	width: var(--matchup-column-width);
}

thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: 15px 14px;
	border-bottom: 2px solid var(--pokeball-red-dark);
	background: var(--bg-table-header-top);
	color: var(--text-table-header);
	font-size: 0.95rem;
	font-weight: 700;
	text-align: center;
	white-space: nowrap;
}

tbody th,
tbody td {
	padding: 14px 12px;
	border-bottom: 1px solid var(--galar-grid);
	vertical-align: middle;
	background: #ffffff;
}

tbody tr:last-child th,
tbody tr:last-child td {
	border-bottom: 0;
}

tbody tr:nth-child(even) td {
	background: #f7f9fb;
}

tbody tr:hover td,
tbody tr:hover .row-heading {
	background: #eef7fb;
}

.row-heading {
	position: sticky;
	left: 0;
	z-index: 1;
	background: var(--galar-ink-soft);
	color: #ffffff;
	white-space: nowrap;
	box-shadow: 1px 0 0 rgba(0, 0, 0, 0.08);
}

.row-heading-content {
	display: grid;
	gap: 6px;
}

.type-badge,
.type-pill {
	border-radius: 999px;
}

.type-badge {
	padding: 8px 14px;
	font-size: 0.94rem;
	width: fit-content;
	border-radius: 12px;
}

.type-pill {
	padding: 6px 12px;
	font-size: 0.86rem;
	border-radius: 999px;
}

.type-toggle-grid .type-toggle-button.type-badge {
	width: 100%;
	min-height: 52px;
	border-radius: 14px;
}

.type-toggle-grid .type-toggle-button.type-badge.is-muted {
	opacity: 0.5;
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.empty {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--md-sys-color-surface-container);
	color: var(--text-sub);
	font-size: 0.88rem;
	font-weight: 500;
}

@keyframes fade-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 960px) {
	.type-filter-layout,
	.matchup-summary-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.page {
		width: min(100% - 16px, 1180px);
		padding-top: 16px;
		padding-bottom: 32px;
	}

	.hero,
	.shell {
		border-radius: 16px;
	}

	.hero {
		padding: 18px 18px 18px 28px;
	}

	.tab-bar {
		padding: 14px 14px 10px;
	}

	.tab-button {
		flex: 1 1 calc(50% - 8px);
		justify-content: center;
		text-align: center;
	}

	.panel {
		padding: 14px 12px 16px;
	}

	.panel-header {
		padding: 0 2px 18px;
		margin-bottom: 18px;
	}

	.type-filter-layout,
	.matchup-summary-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.type-filter-controls,
	.type-filter-summary,
	.matchup-card {
		padding: 16px;
	}

	.type-toggle-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	thead th,
	tbody th,
	tbody td {
		padding: 14px 12px;
	}

	.type-pill,
	.type-toggle-button {
		font-size: 0.84rem;
	}
}
