.tpg-app {
	--tpg-ink: #17313a;
	--tpg-muted: #526870;
	--tpg-primary: #146b78;
	--tpg-primary-dark: #0b505c;
	--tpg-soft: #e8f5f6;
	--tpg-border: #b7cdd1;
	--tpg-focus: #f2a900;
	--tpg-danger: #b42318;
	--tpg-danger-dark: #7a1710;
	--tpg-warning: #8a4b08;
	--tpg-white: #ffffff;
	width: 100%;
	max-width: 980px;
	margin: 2rem auto;
	color: var(--tpg-ink);
	font-size: 16px;
	line-height: 1.7;
}

.tpg-app *,
.tpg-app *::before,
.tpg-app *::after {
	box-sizing: border-box;
}

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

.tpg-app__shell {
	overflow: hidden;
	border: 1px solid var(--tpg-border);
	border-radius: 18px;
	background: var(--tpg-white);
	box-shadow: 0 10px 28px rgba(23, 49, 58, 0.08);
}

.tpg-app__header {
	padding: clamp(1.25rem, 4vw, 2.5rem);
	background: linear-gradient(135deg, #f7fcfc, #e6f4f5);
	border-bottom: 1px solid var(--tpg-border);
}

.tpg-app__header h2 {
	margin: 0.15rem 0 0.5rem;
	color: var(--tpg-ink);
	font-size: clamp(1.65rem, 4vw, 2.35rem);
	line-height: 1.3;
}

.tpg-app__header p,
.tpg-app__screen p,
.tpg-app__result p {
	margin-top: 0;
}

.tpg-app__eyebrow,
.tpg-app__step-label,
.tpg-app__question-count,
.tpg-app__result-label {
	margin-bottom: 0.25rem;
	color: var(--tpg-primary-dark);
	font-size: 0.94rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.tpg-app__js {
	padding-bottom: 1.25rem;
}

.tpg-app__progress {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.5rem;
	margin: 0;
	padding: 1rem clamp(0.75rem, 3vw, 1.5rem);
	list-style: none;
	background: #f7fafb;
	border-bottom: 1px solid var(--tpg-border);
}

.tpg-app__progress li {
	position: relative;
	display: flex;
	min-width: 0;
	align-items: center;
	gap: 0.4rem;
	color: var(--tpg-muted);
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.25;
}

.tpg-app__progress li span {
	display: inline-grid;
	flex: 0 0 1.8rem;
	width: 1.8rem;
	height: 1.8rem;
	place-items: center;
	border: 2px solid var(--tpg-border);
	border-radius: 50%;
	background: var(--tpg-white);
}

.tpg-app__progress li.is-complete {
	color: var(--tpg-primary-dark);
}

.tpg-app__progress li.is-complete span {
	border-color: var(--tpg-primary);
	background: var(--tpg-soft);
}

.tpg-app__progress li.is-current {
	color: var(--tpg-ink);
}

.tpg-app__progress li.is-current span {
	border-color: var(--tpg-primary-dark);
	background: var(--tpg-primary);
	color: var(--tpg-white);
	border-radius: 7px;
}

.tpg-app__screen {
	padding: clamp(1rem, 4vw, 2rem);
}

.tpg-app__screen-heading {
	margin-bottom: 1.25rem;
	outline: 0;
}

.tpg-app__screen-heading h3,
.tpg-app__notice h3,
.tpg-app__noscript h3 {
	margin: 0.2rem 0 0.5rem;
	color: var(--tpg-ink);
	font-size: clamp(1.35rem, 3vw, 1.75rem);
	line-height: 1.35;
}

.tpg-app__notice,
.tpg-app__noscript {
	margin-bottom: 1.25rem;
	padding: clamp(1rem, 3vw, 1.5rem);
	border: 2px solid var(--tpg-primary);
	border-radius: 14px;
	background: #f7fcfc;
}

.tpg-app__notice ul {
	margin: 0;
	padding-left: 1.3rem;
}

.tpg-app__noscript strong {
	color: var(--tpg-danger-dark);
}

.tpg-app__button,
.tpg-app__option,
.tpg-app__view-switch button {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	min-height: 48px;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0.7rem 1rem;
	border: 2px solid var(--tpg-primary);
	border-radius: 10px;
	background: var(--tpg-white);
	color: var(--tpg-primary-dark);
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.35;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.tpg-app__button:hover,
.tpg-app__option:hover,
.tpg-app__view-switch button:hover {
	border-color: var(--tpg-primary-dark);
	background: var(--tpg-soft);
	color: var(--tpg-primary-dark);
}

.tpg-app__button:focus-visible,
.tpg-app__option:focus-visible,
.tpg-app__view-switch button:focus-visible,
.tpg-app a:focus-visible,
.tpg-app textarea:focus-visible,
.tpg-app__region:focus .tpg-app__region-hit {
	outline: 4px solid var(--tpg-focus);
	outline-offset: 3px;
}

.tpg-app__button--primary {
	border-color: var(--tpg-primary-dark);
	background: var(--tpg-primary);
	color: var(--tpg-white);
}

.tpg-app__button--primary:hover {
	background: var(--tpg-primary-dark);
	color: var(--tpg-white);
}

.tpg-app__button--secondary {
	background: var(--tpg-white);
}

.tpg-app__button--plain {
	border-color: var(--tpg-border);
	background: #f7fafb;
	color: var(--tpg-ink);
}

.tpg-app__button--emergency {
	border-color: var(--tpg-danger-dark);
	background: var(--tpg-danger);
	color: var(--tpg-white);
}

.tpg-app__button--emergency:hover {
	background: var(--tpg-danger-dark);
	color: var(--tpg-white);
}

.tpg-app__view-switch {
	display: none;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.tpg-app__view-switch button[aria-pressed="true"] {
	background: var(--tpg-primary);
	color: var(--tpg-white);
}

.tpg-app__body-maps {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
	align-items: start;
}

.tpg-app__body-figure {
	min-width: 0;
	margin: 0;
	padding: 0.75rem;
	border: 1px solid var(--tpg-border);
	border-radius: 14px;
	background: #fbfefe;
}

.tpg-app__body-figure figcaption {
	margin-bottom: 0.35rem;
	text-align: center;
	font-size: 1.1rem;
	font-weight: 700;
}

.tpg-app__body-svg {
	display: block;
	width: 100%;
	max-width: 300px;
	height: auto;
	margin: 0 auto;
	overflow: visible;
}

.tpg-app__silhouette {
	fill: #eff5f6;
	stroke: #55727a;
	stroke-width: 3;
}

.tpg-app__region {
	cursor: pointer;
}

.tpg-app__region-hit {
	fill: rgba(20, 107, 120, 0.12);
	stroke: rgba(20, 107, 120, 0.72);
	stroke-width: 2;
	transition: fill 150ms ease, stroke-width 150ms ease;
}

.tpg-app__region:hover .tpg-app__region-hit {
	fill: rgba(20, 107, 120, 0.28);
	stroke-width: 4;
}

.tpg-app__region.is-selected .tpg-app__region-hit,
.tpg-app__region[aria-pressed="true"] .tpg-app__region-hit {
	fill: rgba(20, 107, 120, 0.62);
	stroke: var(--tpg-primary-dark);
	stroke-width: 5;
	stroke-dasharray: 10 4;
}

.tpg-app__selection {
	margin: 1rem 0;
	padding: 0.85rem 1rem;
	border-left: 5px solid var(--tpg-primary);
	background: var(--tpg-soft);
	font-weight: 700;
}

.tpg-app__text-alternative {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--tpg-border);
}

.tpg-app__text-alternative h4,
.tpg-app__detail-layout h4,
.tpg-app__reason-box h4,
.tpg-app__memo h4 {
	margin: 0 0 0.4rem;
	color: var(--tpg-ink);
	font-size: 1.16rem;
}

.tpg-app__option-grid,
.tpg-app__question-options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.7rem;
}

.tpg-app__option {
	width: 100%;
	min-width: 0;
	justify-content: flex-start;
	text-align: left;
}

.tpg-app__option.is-selected,
.tpg-app__option[aria-pressed="true"] {
	border-color: var(--tpg-primary-dark);
	background: var(--tpg-primary);
	color: var(--tpg-white);
	box-shadow: inset 0 0 0 2px var(--tpg-white);
}

.tpg-app__option.is-selected::before,
.tpg-app__option[aria-pressed="true"]::before {
	content: "✓";
	margin-right: 0.55rem;
	font-weight: 900;
}

.tpg-app__screen-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 1.5rem;
}

.tpg-app__detail-layout {
	display: grid;
	grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.2fr);
	gap: 1.25rem;
	align-items: start;
}

.tpg-app__detail-visual {
	padding: 1rem;
	border: 1px solid var(--tpg-border);
	border-radius: 14px;
	background: var(--tpg-soft);
	text-align: center;
}

.tpg-app__detail-visual svg {
	display: block;
	width: 100%;
	height: auto;
}

.tpg-app__detail-visual path {
	fill: #f7fbfb;
	stroke: var(--tpg-primary);
	stroke-width: 4;
}

.tpg-app__detail-visual circle {
	fill: var(--tpg-primary);
	stroke: var(--tpg-white);
	stroke-width: 5;
}

.tpg-app__detail-visual p {
	margin: 0;
	font-weight: 700;
}

.tpg-app__question-options {
	grid-template-columns: 1fr;
	max-width: 720px;
}

.tpg-app__option--wide {
	padding: 0.9rem 1rem;
}

.tpg-app__error {
	margin: 1rem clamp(1rem, 4vw, 2rem) 0;
	padding: 0.85rem 1rem;
	border: 2px solid var(--tpg-danger);
	border-radius: 10px;
	background: #fff4f2;
	color: var(--tpg-danger-dark);
	font-weight: 700;
}

.tpg-app__persistent-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: space-between;
	margin: 0 clamp(1rem, 4vw, 2rem);
	padding-top: 1rem;
	border-top: 1px solid var(--tpg-border);
}

.tpg-app__result {
	padding: clamp(1rem, 4vw, 2rem);
	border: 3px solid var(--tpg-primary);
	border-radius: 16px;
	background: #f8fcfc;
}

.tpg-app__result--emergency {
	border-color: var(--tpg-danger);
	background: #fff7f5;
}

.tpg-app__result--same-day {
	border-color: var(--tpg-warning);
	background: #fffaf3;
}

.tpg-app__result--orthopedics {
	border-color: #315f90;
	background: #f6f9fd;
}

.tpg-app__result--clinic {
	border-color: var(--tpg-primary);
	background: #f4fbfb;
}

.tpg-app__result-title {
	margin: 0.1rem 0 0.75rem;
	color: var(--tpg-ink);
	font-size: clamp(1.55rem, 4vw, 2rem);
	line-height: 1.35;
	outline: none;
}

.tpg-app__result--emergency .tpg-app__result-label,
.tpg-app__result--emergency .tpg-app__result-title {
	color: var(--tpg-danger-dark);
}

.tpg-app__result-intro {
	font-size: 1.06rem;
	font-weight: 700;
}

.tpg-app__reason-box,
.tpg-app__memo,
.tpg-app__urgent-note {
	margin: 1.25rem 0;
	padding: 1rem;
	border: 1px solid var(--tpg-border);
	border-radius: 12px;
	background: var(--tpg-white);
}

.tpg-app__reason-box ul,
.tpg-app__memo ul {
	margin: 0;
	padding-left: 1.3rem;
}

.tpg-app__emergency-box {
	margin: 1.25rem 0;
	padding: clamp(1rem, 4vw, 1.5rem);
	border: 3px solid var(--tpg-danger);
	border-radius: 14px;
	background: var(--tpg-white);
	text-align: center;
}

.tpg-app__emergency-label {
	margin-bottom: 0.25rem;
	color: var(--tpg-danger-dark);
	font-weight: 800;
}

.tpg-app__emergency-number {
	display: block;
	margin: 0.25rem 0 0.75rem;
	color: var(--tpg-danger-dark);
	font-size: clamp(2rem, 8vw, 3.25rem);
	font-weight: 900;
	line-height: 1.2;
	text-decoration-thickness: 4px;
	text-underline-offset: 5px;
}

.tpg-app__result-actions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem;
	margin: 1.25rem 0;
}

.tpg-app__memo textarea {
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.75rem;
	border: 2px solid var(--tpg-border);
	border-radius: 8px;
	background: var(--tpg-white);
	color: var(--tpg-ink);
	font: inherit;
}

.tpg-app__copy-status {
	margin: 0.65rem 0 0;
	font-weight: 700;
}

.tpg-app__manual-copy {
	margin-top: 0.75rem;
}

.tpg-app__sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.tpg-duplicate-notice {
	padding: 0.75rem 1rem;
	border-left: 4px solid #146b78;
	background: #e8f5f6;
	color: #17313a;
	font-size: 16px;
	line-height: 1.7;
}

@media (max-width: 640px) {
	.tpg-app {
		margin: 1rem auto;
	}

	.tpg-app__shell {
		border-radius: 12px;
	}

	.tpg-app__progress {
		gap: 0.2rem;
		padding-inline: 0.5rem;
	}

	.tpg-app__progress li {
		flex-direction: column;
		gap: 0.2rem;
		font-size: 0.74rem;
		text-align: center;
	}

	.tpg-app__view-switch {
		display: grid;
	}

	.tpg-app__body-maps {
		grid-template-columns: 1fr;
	}

	.tpg-app__body-figure.is-mobile-hidden {
		display: none;
	}

	.tpg-app__body-svg {
		max-width: 340px;
	}

	.tpg-app__option-grid,
	.tpg-app__detail-layout,
	.tpg-app__result-actions {
		grid-template-columns: 1fr;
	}

	.tpg-app__persistent-actions {
		flex-direction: column;
	}

	.tpg-app__persistent-actions .tpg-app__button {
		width: 100%;
	}
}

@media (max-width: 360px) {
	.tpg-app__header,
	.tpg-app__screen,
	.tpg-app__result {
		padding-inline: 0.75rem;
	}

	.tpg-app__progress li span {
		width: 1.6rem;
		height: 1.6rem;
		flex-basis: 1.6rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tpg-app *,
	.tpg-app *::before,
	.tpg-app *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

@media (prefers-color-scheme: dark) {
	.tpg-app {
		color-scheme: light;
	}
}
