/* ==========================================================
   SLIME BREEDER plus — responsive stylesheet (v1.08-php6)
   원작(2002)의 색을 그대로 계승: 검정 바탕 + 틸(#003f3f) 패널,
   시안 링크, 핑크/골드 강조, [괄호] 메뉴, Times 이탤릭 로고.
   모바일 기준 1열(최대 640px), 데스크탑은 중앙 배치.
   ========================================================== */

:root {
	--bg:      #0a1414;
	--panel:   #013a35;
	--panel-2: #012723;
	--line:    #1d6b62;
	--ink:     #e6f2ef;
	--dim:     #9cc4bd;
	--cyan:    #46e0e6;
	--pink:    #ff9df2;
	--gold:    #ffd76a;
	--orange:  #ffb057;
	--red:     #ff6157;
	--blue:    #7f9dff;
	--mono:    ui-monospace, "Nanum Gothic Coding", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	background-image: radial-gradient(ellipse at 50% -10%, #0f2a26 0%, var(--bg) 60%);
	color: var(--ink);
	font-family: "Malgun Gothic", "맑은 고딕", Dotum, sans-serif;
	font-size: 15px;
	line-height: 1.55;
}

body {
	/* 푸터를 화면 맨 아래로: body만 flex, .wrap 내부는 일반 블록 흐름 유지 */
	min-height: 100svh;
	display: flex;
	flex-direction: column;
}
.wrap {
	max-width: 640px;
	width: 100%;
	margin: 0 auto;
	padding: 0 10px 24px;
	flex: 1 0 auto;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

hr {
	border: 0;
	border-top: 1px solid var(--line);
	margin: 14px 0;
	opacity: .55;
}

img { max-width: 100%; image-rendering: pixelated; }

/* ---------- 상단 메뉴 바 ---------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 10;
	margin: 0 -10px 12px;
	padding: 8px 10px;
	background: rgba(1, 39, 35, .96);
	border-bottom: 1px solid var(--line);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
}

.topbar .logo {
	font-family: "Times New Roman", serif;
	font-style: italic;
	font-weight: bold;
	color: #9f9fff;
	font-size: 15px;
	white-space: nowrap;
}
.topbar .logo:hover { text-decoration: none; color: #c3c3ff; }

nav.menu {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	font-size: 13px;
}
nav.menu a {
	padding: 5px 10px;
	white-space: nowrap;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--panel-2);
	color: var(--cyan);
}
nav.menu a:hover, nav.menu a:focus-visible {
	border-color: var(--cyan);
	background: var(--panel);
	text-decoration: none;
}
nav.menu a.home {
	color: #072220;
	font-weight: bold;
	background: var(--gold);
	border-color: var(--gold);
}
nav.menu a.home:hover { background: #ffe391; }

/* ---------- 타이틀 ---------- */

.hero {
	text-align: center;
	margin-top: 28px;
	padding: 26px 12px 20px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background:
		linear-gradient(rgba(1, 39, 35, .82), rgba(1, 39, 35, .82)),
		var(--panel-2);
	margin-bottom: 14px;
}
.hero h1 {
	margin: 0;
	font-family: "Times New Roman", serif;
	font-style: italic;
	font-weight: bold;
	font-size: clamp(30px, 9vw, 46px);
	color: #9f9fff;
	letter-spacing: 1px;
}
.hero h1 sup { font-size: .5em; }
.hero .tagline {
	font-family: "Times New Roman", serif;
	font-style: italic;
	color: var(--red);
	margin: 2px 0 18px;
}
.login {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
}
.login input { flex: 1 1 130px; max-width: 220px; }
.hint { color: var(--dim); font-size: 13px; margin: 10px 0 0; }

.notice {
	text-align: center;
	color: var(--red);
	font-weight: bold;
	margin: 0 0 10px;
}

/* ---------- 폼 요소 ---------- */

input, select, button {
	font: inherit;
	font-size: 16px; /* iOS 자동 확대 방지 */
	color: var(--ink);
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 8px 10px;
	max-width: 100%;
}
input[type="submit"], button {
	background: var(--panel);
	color: var(--gold);
	font-weight: bold;
	cursor: pointer;
	padding: 8px 18px;
}
input[type="submit"]:hover, button:hover { border-color: var(--cyan); }
select { min-height: 40px; }

/* ---------- 슬라임 카드 ---------- */

.card {
	display: flex;
	gap: 12px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--panel);
	padding: 10px;
	margin: 8px 0 12px;
}
.card.king { border-color: var(--gold); background: #2b2410; }

.c-left {
	flex: 0 0 112px;
	text-align: center;
}
.c-img {
	/* 장식 없는 정렬용 영역: 이미지가 weight에 따라 제 크기대로 보인다 */
	width: 112px;
	min-height: 112px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.c-img img {
	max-width: 112px;
	height: auto; /* 초대형 개체만 비율 유지 축소 */
	border-radius: 4px;
}
.c-w { font-size: 14px; color: var(--dim); margin-top: 4px; line-height: 1.4; }

.c-right { flex: 1 1 auto; min-width: 0; }
.c-meta { font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.c-meta b { color: var(--ink); }

table.stats {
	width: 100%;
	border-collapse: collapse;
	font-family: var(--mono);
	margin-bottom: 8px;
}
table.stats th, table.stats td {
	border: 1px solid var(--line);
	text-align: center;
	padding: 3px 2px;
	font-size: 13px;
}
table.stats th { background: var(--panel-2); color: var(--dim); font-weight: normal; }
table.stats td { font-size: 15px; color: var(--gold); }

.blood {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 6px;
	font-size: 12px;
	line-height: 1.5;
}
.bcell {
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 5px 6px;
	min-width: 0;
	overflow-wrap: anywhere;
}
.bt {
	display: block;
	color: var(--dim);
	font-size: 11px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 3px;
	padding-bottom: 2px;
}
.pink   { color: var(--pink); }
.orange { color: var(--orange); }
.yellow, a.yellow { color: var(--gold); }
.kfit { font-size: 13px; color: var(--dim); margin: -6px 0 12px; }

/* ---------- 랭킹/목록 머리글 ---------- */

.rhead { margin-top: 14px; line-height: 1.5; overflow-wrap: anywhere; }

/* ---------- 전투 결과 ---------- */

.fr {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	align-items: baseline;
	font-family: var(--mono);
	font-size: 13px;
	padding: 6px 8px;
	border: 1px solid var(--line);
	border-radius: 6px;
	margin: 4px 0;
	background: var(--panel-2);
}
.fr.me { background: #10254d; border-color: #35509c; }
.fr .fname {
	font-family: inherit;
	font-size: 14px;
	color: var(--pink);
	flex-basis: 100%;
}
.fr em { color: var(--gold); font-style: normal; }
@media (min-width: 480px) {
	.fr .fname { flex-basis: auto; min-width: 9em; }
}

.rmsg {
	text-align: center;
	font-family: "Times New Roman", serif;
	font-style: italic;
	font-weight: bold;
	font-size: clamp(26px, 7vw, 40px);
	margin: 14px 0 2px;
	line-height: 1.2;
}
.rmsg.win   { color: var(--red); }
.rmsg.lose  { color: var(--blue); }
.rmsg.champ { color: var(--gold); font-size: clamp(20px, 5.5vw, 30px); }
.rpts { text-align: center; color: var(--dim); margin-bottom: 8px; }
.rstar { text-align: center; color: var(--gold); }

.flog {
	font-family: var(--mono);
	font-size: 13px;
	letter-spacing: 1px;
	color: #7de6a8;
	background: #041210;
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 8px 10px;
	margin: 10px 0;
	word-break: break-all;
	line-height: 1.7;
}
.legend { font-size: 12px; color: var(--dim); }

/* ---------- HOME 귀환 버튼 ---------- */

.btn-home {
	display: block;
	max-width: 320px;
	margin: 18px auto;
	padding: 12px 16px;
	text-align: center;
	font-weight: bold;
	font-size: 17px;
	color: var(--gold);
	background: var(--panel);
	border: 1px solid var(--gold);
	border-radius: 8px;
}
.btn-home:hover { text-decoration: none; background: #024b44; }
.warn-small { display: block; text-align: center; font-size: 12px; color: var(--dim); }

/* ---------- 코멘트 ---------- */

.comt { border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 14px; overflow-wrap: anywhere; }
.comt .cd { color: var(--pink); font-size: 12px; margin-right: 6px; }
.comt .cn { color: var(--cyan); font-weight: bold; }

/* ---------- 범용 표(계통 목록·참가자·설명서·관리 화면) ---------- */

.xscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
.xscroll th, .xscroll td { white-space: nowrap; } /* 좁은 화면에서 셀이 세로로 눌리지 않고 표가 가로 스크롤됨 */
.xscroll select { max-width: 11em; } /* 계보 셀렉트가 화면 폭을 독식하지 않도록 */

table { border-color: var(--line); }
th, td { padding: 3px 6px; }

/* ---------- 레거시 마크업 보정 ---------- */

font[size="7"] { font-size: clamp(26px, 7vw, 40px); }
font[size="6"] { font-size: clamp(22px, 6vw, 32px); }
font[size="5"] { font-size: clamp(19px, 5vw, 26px); }
center form select { max-width: 92vw; }

/* ---------- 푸터 ---------- */

.foot {
	flex: 0 0 auto;
	max-width: 640px;
	width: 100%;
	margin: 0 auto;
	padding: 22px 10px 16px;
	font-size: 12px;
	color: var(--dim);
	text-align: center;
	line-height: 1.7;
}
.foot a { color: #9f9fff; }

/* ---------- 신의 영역 말풍선 (빌드 넘버 클릭) ---------- */

details.god {
	display: inline-block;
	position: relative;
}
details.god summary {
	list-style: none;
	cursor: pointer;
	display: inline;
	border-bottom: 1px dotted var(--line);
}
details.god summary::-webkit-details-marker { display: none; }
details.god[open] summary { color: var(--gold); }
.god-pop {
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 10px 12px;
	white-space: nowrap;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
	z-index: 20;
}
.god-pop::after { /* 말풍선 꼬리 */
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	margin-left: -6px;
	border: 6px solid transparent;
	border-top-color: var(--line);
}
.god-pop input[type="password"] { width: 7em; }

/* ---------- 좁은 화면 ---------- */

@media (max-width: 560px) {
	.topbar {
		flex-direction: column;
		align-items: stretch;
		gap: 5px;
		padding-bottom: 6px;
	}
	.topbar .logo { text-align: center; }
	nav.menu {
		flex-wrap: nowrap;          /* 줄바꿈 대신 */
		overflow-x: auto;           /* 한 줄 유지 + 넘치면 좌우 스와이프 */
		justify-content: flex-start;
		gap: 4px;
		font-size: 12px;
		padding-bottom: 2px;
		scrollbar-width: none;
	}
	nav.menu::-webkit-scrollbar { display: none; }
	nav.menu a { padding: 4px 8px; flex: 0 0 auto; }
}

@media (max-width: 520px) {
	.card { flex-direction: row; flex-wrap: wrap; }
	.c-left {
		flex: 1 1 100%;
		display: flex;
		align-items: center;
		gap: 10px;
		text-align: left;
	}
	.c-img { flex: 0 0 112px; min-height: 90px; }
	.blood { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}

/* ---------- HOME 교배/궁합 행 (한 줄 유지) ---------- */

.pairline {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: nowrap;
	margin: 6px 0;
	min-width: 0;
}
.pairline select {
	flex: 1 1 auto;
	min-width: 0; /* 좁은 화면에서 셀렉트가 줄어들고 버튼은 유지 */
}
.pairline input[type="submit"] { flex: 0 0 auto; }
.pairline .x { color: var(--dim); flex: 0 0 auto; }
.pairline big { white-space: nowrap; flex: 0 0 auto; }

/* ---------- 페이지 제목 ---------- */

h2.ptitle {
	margin: 14px 0 10px;
	font-size: clamp(19px, 5vw, 24px);
	color: var(--gold);
	text-align: center;
	font-weight: bold;
}

/* ---------- 페이지 나눔(페이저) ---------- */

nav.pager {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin: 10px 0 14px;
	flex-wrap: wrap;
}
nav.pager a {
	padding: 6px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--panel-2);
	font-size: 14px;
	white-space: nowrap;
}
nav.pager a:hover {
	border-color: var(--cyan);
	text-decoration: none;
}

/* ---------- 교배 대기 카운트다운 ---------- */

.waitbox {
	display: inline-block;
	margin: 4px 0 8px;
	padding: 8px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--panel-2);
	font-size: 14px;
	color: var(--dim);
	vertical-align: middle;
}
.waitbox b {
	font-family: var(--mono);
	font-size: 16px;
	color: var(--gold);
	margin-left: 4px;
}

/* ---------- HOME 인라인 궁합 목록 제목 ---------- */

h3.ksec {
	margin: 14px 0 4px;
	padding: 8px 12px;
	font-size: 15px;
	font-weight: bold;
	color: var(--gold);
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: 6px;
	overflow-wrap: anywhere;
	text-align: center;
	line-height: 1.6;
}

hr.sep { margin: 18px 0; }

/* ---------- '맨 위로' 플로팅 버튼 ---------- */

html { scroll-behavior: smooth; }

a.totop {
	position: fixed;
	right: 14px;
	bottom: 14px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: rgba(1, 39, 35, .92);
	color: var(--cyan);
	font-size: 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
	z-index: 15;
}
a.totop:hover { text-decoration: none; border-color: var(--cyan); }

/* ---------- 돌아가기 링크 ---------- */

.backlink { margin: 2px 0 10px; font-size: 14px; }
.backlink a {
	display: inline-block;
	padding: 5px 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--panel-2);
}
.backlink a:hover { border-color: var(--cyan); text-decoration: none; }
