:root {
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-right: env(safe-area-inset-right, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--safe-left: env(safe-area-inset-left, 0px);
	--accent: #70f5ff;
	--accent2: #4d7fff;
	--panel: rgba(5, 12, 27, 0.72);
	--line: rgba(255, 255, 255, 0.16);
}

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background: #050914;
	font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
	color: #fff;
	touch-action: none;
}

button {
	font: inherit;
}

#camerafeed {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	background: #050914;
}

.hidden {
	display: none !important;
}

.screen {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: calc(24px + var(--safe-top)) calc(20px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(20px + var(--safe-left));
}

.start-screen {
	background:
		radial-gradient(circle at 50% 22%, rgba(65, 184, 255, 0.30), transparent 30%),
		radial-gradient(circle at 20% 70%, rgba(76, 86, 255, 0.22), transparent 35%),
		linear-gradient(155deg, #071322 0%, #070b18 50%, #03050c 100%);
}

.start-screen::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
	background-size: 32px 32px;
	mask-image: linear-gradient(to bottom, #000, transparent 80%);
	pointer-events: none;
}

.start-card {
	position: relative;
	width: min(100%, 430px);
	padding: 34px 24px 28px;
	text-align: center;
	background: rgba(6, 16, 32, 0.72);
	border: 1px solid rgba(255,255,255,.12);
	border-radius: 28px;
	box-shadow: 0 30px 70px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.07);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
}

.eyebrow {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .18em;
	color: #8bdfff;
	margin-bottom: 17px;
}

.signal-mark {
	height: 44px;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 5px;
	margin-bottom: 20px;
}

.signal-mark span {
	width: 6px;
	border-radius: 6px;
	background: linear-gradient(to top, #4c7dff, #72fbff);
	box-shadow: 0 0 16px rgba(112,245,255,.45);
	animation: signal 1s ease-in-out infinite alternate;
}

.signal-mark span:nth-child(1) { height: 12px; animation-delay: -.4s; }
.signal-mark span:nth-child(2) { height: 22px; animation-delay: -.2s; }
.signal-mark span:nth-child(3) { height: 32px; animation-delay: -.3s; }
.signal-mark span:nth-child(4) { height: 42px; animation-delay: -.1s; }

@keyframes signal {
	to { transform: scaleY(.45); opacity: .45; }
}

.start-card h1 {
	margin: 0;
	font-size: clamp(29px, 8vw, 38px);
	line-height: 1.22;
	letter-spacing: -.045em;
}

.start-card p {
	margin: 18px 0 26px;
	font-size: 14px;
	line-height: 1.72;
	color: rgba(255,255,255,.72);
}

.primary-button,
.secondary-button {
	width: 100%;
	min-height: 58px;
	border: 0;
	border-radius: 18px;
	font-weight: 900;
	cursor: pointer;
}

.primary-button {
	color: #07101d;
	background: linear-gradient(135deg, #7ef8ff, #68b7ff 50%, #7d87ff);
	box-shadow: 0 12px 35px rgba(71, 147, 255, .32);
}

.primary-button:disabled {
	filter: grayscale(.6);
	opacity: .5;
	cursor: default;
}

.camera-icon {
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 8px;
	border: 2px solid #07101d;
	border-radius: 50%;
	vertical-align: 1px;
	background: transparent;
}

.engine-state {
	min-height: 18px;
	margin-top: 14px;
	font-size: 11px;
	color: rgba(255,255,255,.48);
}

.hud {
	position: fixed;
	inset: 0;
	z-index: 20;
	pointer-events: none;
}

.top-bar {
	position: absolute;
	left: calc(14px + var(--safe-left));
	right: calc(14px + var(--safe-right));
	top: calc(13px + var(--safe-top));
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.collection-pill,
.icon-button {
	background: rgba(5, 12, 27, .66);
	border: 1px solid var(--line);
	box-shadow: 0 8px 24px rgba(0,0,0,.18);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.collection-pill {
	display: flex;
	align-items: baseline;
	gap: 3px;
	padding: 10px 13px;
	border-radius: 16px;
}

.collection-label {
	margin-right: 7px;
	font-size: 9px;
	font-weight: 900;
	letter-spacing: .13em;
	color: #88e8ff;
}

.collection-pill strong {
	font-size: 23px;
	line-height: 1;
}

.collection-pill span:last-child {
	font-size: 13px;
	color: rgba(255,255,255,.65);
}

.icon-button {
	pointer-events: auto;
	border-radius: 14px;
	padding: 11px 13px;
	color: #fff;
	font-size: 11px;
	font-weight: 800;
}

.scan-guide {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(82vw, 350px);
	padding: 25px 22px 21px;
	text-align: center;
	border-radius: 24px;
	background: rgba(4, 10, 22, .66);
	border: 1px solid rgba(255,255,255,.14);
	box-shadow: 0 20px 45px rgba(0,0,0,.28);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.scan-orbit {
	position: relative;
	width: 84px;
	height: 84px;
	margin: 0 auto 17px;
	border: 1px solid rgba(124,237,255,.28);
	border-radius: 50%;
}

.scan-orbit::before {
	content: "";
	position: absolute;
	inset: 8px;
	border: 2px dashed rgba(124,237,255,.5);
	border-radius: 50%;
	animation: orbit 4s linear infinite;
}

.phone-shape {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 25px;
	height: 44px;
	transform: translate(-50%, -50%) rotate(-16deg);
	border: 2px solid #9bf4ff;
	border-radius: 6px;
	box-shadow: 0 0 18px rgba(112,245,255,.28);
	animation: phoneScan 1.7s ease-in-out infinite alternate;
}

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes phoneScan { to { transform: translate(-50%, -50%) rotate(16deg); } }

.scan-guide strong,
.scan-guide span {
	display: block;
}

.scan-guide strong {
	font-size: 16px;
}

.scan-guide span {
	margin-top: 7px;
	font-size: 12px;
	color: rgba(255,255,255,.68);
}

.scan-progress {
	height: 4px;
	margin-top: 18px;
	background: rgba(255,255,255,.12);
	border-radius: 999px;
	overflow: hidden;
}

.scan-progress i {
	display: block;
	width: 0%;
	height: 100%;
	background: linear-gradient(90deg, #5b8cff, #6efff4);
	box-shadow: 0 0 14px rgba(110,255,244,.55);
	transition: width .15s linear;
}

.hunt-message {
	position: absolute;
	left: 50%;
	top: calc(88px + var(--safe-top));
	transform: translateX(-50%);
	width: min(88vw, 430px);
	padding: 13px 18px;
	text-align: center;
	border-radius: 17px;
	background: rgba(4, 10, 22, .63);
	border: 1px solid rgba(255,255,255,.13);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	animation: rise .35s ease-out;
}

.hunt-message strong,
.hunt-message span {
	display: block;
}

.hunt-message strong {
	font-size: 14px;
}

.hunt-message span {
	margin-top: 4px;
	font-size: 11px;
	color: rgba(255,255,255,.68);
}

.radar {
	position: absolute;
	left: calc(14px + var(--safe-left));
	bottom: calc(48px + var(--safe-bottom));
	padding: 10px 12px 9px;
	border-radius: 14px;
	background: rgba(4, 10, 22, .62);
	border: 1px solid rgba(255,255,255,.12);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.radar-label {
	display: block;
	margin-bottom: 7px;
	font-size: 8px;
	font-weight: 900;
	letter-spacing: .14em;
	color: rgba(255,255,255,.55);
}

.radar-bars {
	display: flex;
	align-items: flex-end;
	gap: 3px;
	height: 22px;
}

.radar-bars i {
	width: 4px;
	border-radius: 3px;
	background: rgba(255,255,255,.18);
	transition: background .15s, box-shadow .15s;
}

.radar-bars i:nth-child(1) { height: 7px; }
.radar-bars i:nth-child(2) { height: 10px; }
.radar-bars i:nth-child(3) { height: 14px; }
.radar-bars i:nth-child(4) { height: 18px; }
.radar-bars i:nth-child(5) { height: 22px; }

.radar-bars i.active {
	background: #70f5ff;
	box-shadow: 0 0 11px rgba(112,245,255,.7);
}

.tap-hint {
	position: absolute;
	left: 50%;
	bottom: calc(86px + var(--safe-bottom));
	transform: translateX(-50%);
	padding: 10px 15px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 900;
	background: rgba(112,245,255,.92);
	color: #07101d;
	box-shadow: 0 8px 28px rgba(112,245,255,.25);
	animation: pulse 1s ease-in-out infinite alternate;
}

.bottom-note {
	position: absolute;
	left: 50%;
	bottom: calc(14px + var(--safe-bottom));
	transform: translateX(-50%);
	white-space: nowrap;
	font-size: 9px;
	color: rgba(255,255,255,.58);
	text-shadow: 0 1px 3px rgba(0,0,0,.7);
}

.catch-layer {
	position: fixed;
	inset: 0;
	z-index: 70;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
	background: rgba(2,7,16,.72);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.catch-flash {
	position: absolute;
	left: 50%;
	top: 43%;
	width: 80vmin;
	height: 80vmin;
	transform: translate(-50%,-50%);
	border-radius: 50%;
	background: radial-gradient(circle, rgba(118,255,248,.44), rgba(77,127,255,.15) 42%, transparent 70%);
	animation: flash 1.15s ease-out both;
}

.catch-content {
	position: relative;
	width: min(100%, 380px);
	text-align: center;
	animation: catchIn .45s cubic-bezier(.2,.8,.2,1.2) both;
}

.catch-content img {
	width: min(65vw, 260px);
	height: auto;
	filter: drop-shadow(0 18px 30px rgba(26,163,255,.25));
	animation: floaty 1.7s ease-in-out infinite alternate;
}

.catch-badge {
	display: inline-block;
	margin-top: 5px;
	padding: 7px 10px;
	border: 1px solid rgba(119,242,255,.44);
	border-radius: 999px;
	font-size: 9px;
	font-weight: 900;
	letter-spacing: .14em;
	color: #8ff6ff;
}

.catch-content h2 {
	margin: 12px 0 6px;
	font-size: 25px;
	letter-spacing: -.04em;
}

.catch-count {
	margin-bottom: 19px;
}

.catch-count strong {
	font-size: 36px;
}

.catch-count span {
	font-size: 16px;
	color: rgba(255,255,255,.55);
}

.secondary-button {
	color: #fff;
	background: rgba(255,255,255,.1);
	border: 1px solid rgba(255,255,255,.18);
}

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(90px + var(--safe-bottom));
	z-index: 100;
	transform: translateX(-50%);
	max-width: calc(100vw - 32px);
	padding: 11px 15px;
	border-radius: 13px;
	background: rgba(3, 8, 18, .88);
	border: 1px solid rgba(255,255,255,.14);
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	box-shadow: 0 10px 30px rgba(0,0,0,.32);
}

@keyframes rise {
	from { opacity: 0; transform: translate(-50%, -10px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes pulse {
	to { transform: translateX(-50%) scale(1.06); }
}

@keyframes flash {
	0% { opacity: 0; transform: translate(-50%,-50%) scale(.25); }
	35% { opacity: 1; }
	100% { opacity: .35; transform: translate(-50%,-50%) scale(1.25); }
}

@keyframes catchIn {
	from { opacity: 0; transform: scale(.72) translateY(20px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes floaty {
	to { transform: translateY(-8px) rotate(1.5deg); }
}
