/* ==========================================================================
   Pindou 拼豆图样库 —— 手机优先样式表
   ========================================================================== */

:root {
	--pd-pink: #FF6B9D;
	--pd-pink-dark: #f04f86;
	--pd-pink-soft: #ffe6ef;
	--pd-teal: #4ECDC4;
	--pd-teal-soft: #e2f7f5;
	--pd-ink: #2f2f3d;
	--pd-muted: #7d7d8f;
	--pd-bg: #fdf7fa;
	--pd-card: #ffffff;
	--pd-line: #f1e5ec;
	--pd-radius: 16px;
	--pd-radius-sm: 10px;
	--pd-shadow: 0 2px 10px rgba(255, 107, 157, .10);
	--pd-shadow-hover: 0 6px 20px rgba(255, 107, 157, .20);
	--pd-wrap: 1140px;
}

* { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--pd-bg);
	color: var(--pd-ink);
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
		"Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.65;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--pd-pink-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; color: var(--pd-ink); }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

.pd-wrap { width: 100%; max-width: var(--pd-wrap); margin: 0 auto; padding: 0 14px; }
.pd-muted { color: var(--pd-muted); }
.pd-center { text-align: center; }

/* ---------------------------------------------------------------- header */
.pd-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(255, 255, 255, .96);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid var(--pd-line);
}
.pd-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 56px;
}
.pd-logo {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 1.05rem;
	color: var(--pd-ink);
	white-space: nowrap;
}
.pd-logo:hover { text-decoration: none; }
.pd-logo__dot {
	width: 22px; height: 22px; border-radius: 7px;
	background: linear-gradient(135deg, var(--pd-pink) 0%, var(--pd-teal) 100%);
	box-shadow: inset 0 0 0 3px #fff;
	flex: 0 0 auto;
}
.pd-logo__dot { box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px var(--pd-line); }
.pd-logo__sub { font-size: .72rem; color: var(--pd-muted); font-weight: 400; margin-left: 4px; }

.pd-nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.pd-nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.pd-nav li { position: relative; }
.pd-nav a {
	display: block;
	padding: 8px 10px;
	border-radius: 999px;
	color: var(--pd-ink);
	font-size: .9rem;
	white-space: nowrap;
}
.pd-nav a:hover,
.pd-nav .current-menu-item > a { background: var(--pd-pink-soft); color: var(--pd-pink-dark); text-decoration: none; }
.pd-nav .sub-menu {
	display: none;
	position: absolute; top: 100%; left: 0;
	background: #fff; border: 1px solid var(--pd-line); border-radius: var(--pd-radius-sm);
	box-shadow: var(--pd-shadow); padding: 6px; min-width: 150px;
}
.pd-nav li:hover > .sub-menu { display: block; }

.pd-menu-toggle {
	display: none;
	background: #fff; border: 1px solid var(--pd-line); border-radius: 10px;
	padding: 6px 10px; font-size: 1rem; cursor: pointer; color: var(--pd-ink);
}

/* ---------------------------------------------------------------- layout */
.pd-main { padding: 18px 0 40px; }
.pd-section { margin-bottom: 28px; }
.pd-section__head {
	display: flex; align-items: baseline; justify-content: space-between;
	gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.pd-section__title {
	position: relative; padding-left: 12px; font-size: 1.15rem; margin: 0;
}
.pd-section__title::before {
	content: ""; position: absolute; left: 0; top: .18em; bottom: .18em;
	width: 5px; border-radius: 3px;
	background: linear-gradient(180deg, var(--pd-pink), var(--pd-teal));
}
.pd-section__count { color: var(--pd-muted); font-size: .85rem; }

/* ---------------------------------------------------------------- banner */
.pd-hero {
	background: linear-gradient(135deg, var(--pd-pink-soft) 0%, var(--pd-teal-soft) 100%);
	border-radius: var(--pd-radius);
	padding: 20px 16px;
	margin-bottom: 20px;
}
.pd-hero h1 { margin-bottom: .3em; }
.pd-hero p { margin: 0 0 12px; color: #5c5c6e; font-size: .92rem; }

/* ---------------------------------------------------------------- search */
.pd-search { display: flex; gap: 8px; }
.pd-search input[type="search"],
.pd-search input[type="text"] {
	flex: 1 1 auto; min-width: 0;
	padding: 11px 14px;
	border: 1px solid var(--pd-line);
	border-radius: 999px;
	background: #fff; font-size: .95rem; color: var(--pd-ink);
}
.pd-search input:focus { outline: 2px solid var(--pd-pink-soft); border-color: var(--pd-pink); }

.pd-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 10px 18px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: var(--pd-pink);
	color: #fff;
	font-size: .92rem;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
	text-decoration: none;
}
.pd-btn:hover { background: var(--pd-pink-dark); color: #fff; text-decoration: none; box-shadow: var(--pd-shadow-hover); }
.pd-btn:active { transform: translateY(1px); }
.pd-btn--teal { background: var(--pd-teal); }
.pd-btn--teal:hover { background: #3cb8b0; }
.pd-btn--ghost { background: #fff; color: var(--pd-ink); border-color: var(--pd-line); }
.pd-btn--ghost:hover { background: var(--pd-pink-soft); color: var(--pd-pink-dark); }
.pd-btn--sm { padding: 7px 13px; font-size: .85rem; }
.pd-btn--block { width: 100%; }
.pd-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- filters */
.pd-filters {
	background: #fff; border: 1px solid var(--pd-line); border-radius: var(--pd-radius);
	padding: 14px; margin-bottom: 18px; box-shadow: var(--pd-shadow);
}
.pd-filters__row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.pd-field { display: flex; flex-direction: column; gap: 4px; }
.pd-field > label { font-size: .82rem; color: var(--pd-muted); font-weight: 600; }
.pd-field select,
.pd-field input[type="number"],
.pd-field input[type="text"] {
	padding: 9px 12px; border: 1px solid var(--pd-line); border-radius: var(--pd-radius-sm);
	background: #fff; font-size: .92rem; color: var(--pd-ink); width: 100%;
}
.pd-filters__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pd-filters__hint { font-size: .78rem; color: var(--pd-muted); }
.pd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-chip {
	display: inline-block; padding: 5px 12px; border-radius: 999px;
	background: var(--pd-pink-soft); color: var(--pd-pink-dark); font-size: .8rem;
}
.pd-chip--teal { background: var(--pd-teal-soft); color: #2f9c95; }

/* ---------------------------------------------------------------- grid */
.pattern-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}
@media (min-width: 640px) { .pattern-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1024px) { .pattern-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } }

.pattern-card {
	background: var(--pd-card);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	overflow: hidden;
	display: flex; flex-direction: column;
	box-shadow: var(--pd-shadow);
	transition: transform .15s ease, box-shadow .15s ease;
}
.pattern-card:hover { transform: translateY(-3px); box-shadow: var(--pd-shadow-hover); }
.pattern-card__thumb {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	background: #f7f1f5;
	overflow: hidden;
}
.pattern-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.pattern-card__thumb:hover { text-decoration: none; }
.pattern-card__body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.pattern-card__title {
	font-size: .92rem; font-weight: 600; margin: 0; line-height: 1.35;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pattern-card__title a { color: var(--pd-ink); }
.pattern-card__meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: auto; }
.pattern-card__stat { font-size: .74rem; color: var(--pd-muted); }
.pattern-card__badges { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; flex-wrap: wrap; }

/* 占位色块（无特色图时用 CSS 渐变代替真实图片） */
.pd-placeholder {
	width: 100%; height: 100%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; color: rgba(255, 255, 255, .92); font-size: 1.1rem;
	letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

.badge {
	display: inline-block; padding: 2px 8px; border-radius: 999px;
	font-size: .7rem; font-weight: 600; line-height: 1.6; white-space: nowrap;
	background: var(--pd-pink-soft); color: var(--pd-pink-dark);
}
.badge--easy { background: #e3f8ea; color: #2e9e5b; }
.badge--medium { background: #fff4dd; color: #c98a12; }
.badge--hard { background: #ffe8dc; color: #d9691f; }
.badge--master { background: #eee6ff; color: #6b46c1; }
.badge--teal { background: var(--pd-teal-soft); color: #2f9c95; }

/* ---------------------------------------------------------------- pagination */
.pd-pagination { margin: 24px 0 6px; }
.pd-pagination .page-numbers {
	display: inline-block; min-width: 34px; text-align: center;
	padding: 6px 10px; margin: 2px; border-radius: 10px;
	background: #fff; border: 1px solid var(--pd-line); color: var(--pd-ink); font-size: .88rem;
}
.pd-pagination .page-numbers.current { background: var(--pd-pink); border-color: var(--pd-pink); color: #fff; }
.pd-pagination a.page-numbers:hover { background: var(--pd-pink-soft); text-decoration: none; }
.pd-pagination .dots { border: 0; background: transparent; }

/* ---------------------------------------------------------------- single */
.pd-breadcrumb { font-size: .8rem; color: var(--pd-muted); margin-bottom: 12px; }
.pd-breadcrumb a { color: var(--pd-muted); }

.pd-single__layout { display: flex; flex-direction: column; gap: 20px; }
.pd-single__col > .pd-panel + .pd-panel { margin-top: 16px; }
@media (min-width: 1024px) {
	.pd-single__layout { display: grid; grid-template-columns: 1.05fr .95fr; align-items: start; gap: 22px; }
	.pd-single__col > .pd-panel + .pd-panel { margin-top: 18px; }
}
.pd-panel {
	background: #fff; border: 1px solid var(--pd-line); border-radius: var(--pd-radius);
	padding: 14px; box-shadow: var(--pd-shadow);
}
.pd-panel + .pd-panel { margin-top: 16px; }
.pd-panel__title { font-size: 1rem; margin: 0 0 10px; padding-left: 10px; position: relative; }
.pd-panel__title::before {
	content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px;
	border-radius: 3px; background: var(--pd-teal);
}

.pd-preview { position: relative; border-radius: var(--pd-radius); overflow: hidden; background: #f7f1f5; }
.pd-preview img { width: 100%; }
.pd-preview__hint {
	position: absolute; right: 8px; bottom: 8px;
	background: rgba(47, 47, 61, .72); color: #fff; font-size: .72rem;
	padding: 3px 9px; border-radius: 999px;
}

/* 网格图纸 */
.pd-gridsheet {
	border: 1px solid var(--pd-line); border-radius: var(--pd-radius-sm);
	background: #fff; padding: 8px; display: block;
}
.pd-gridsheet__canvas {
	position: relative; width: 100%;
	background-color: #fff;
	background-image:
		repeating-linear-gradient(to right, var(--pd-line) 0 1px, transparent 1px var(--pd-cell, 16px)),
		repeating-linear-gradient(to bottom, var(--pd-line) 0 1px, transparent 1px var(--pd-cell, 16px));
	border: 1px solid var(--pd-line);
	border-radius: 6px;
}
.pd-gridsheet__canvas img { width: 100%; display: block; }
.pd-gridsheet__legend { font-size: .78rem; color: var(--pd-muted); margin-top: 6px; }

/* 色号清单 */
.pd-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.pd-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.pd-table th,
table.pd-table td { padding: 8px 8px; border-bottom: 1px solid var(--pd-line); text-align: left; white-space: nowrap; }
table.pd-table thead th { color: var(--pd-muted); font-size: .78rem; font-weight: 600; background: #fdfafc; }
table.pd-table tbody tr:last-child td { border-bottom: 0; }
.pd-swatch {
	display: inline-block; width: 22px; height: 22px; border-radius: 6px;
	border: 1px solid rgba(0, 0, 0, .10); vertical-align: middle;
}

/* 统计 */
.pd-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .pd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pd-stat { background: #fdfafc; border: 1px solid var(--pd-line); border-radius: var(--pd-radius-sm); padding: 9px 10px; }
.pd-stat__label { font-size: .74rem; color: var(--pd-muted); display: block; }
.pd-stat__value { font-size: 1rem; font-weight: 700; }

.pd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-fav.is-active { background: var(--pd-pink-dark); }

/* 详情页「下载与打印」面板 */
.pd-dl { display: grid; gap: 10px; }
.pd-dl__main { display: grid; gap: 8px; }
.pd-dl__card {
	display: flex; align-items: center; gap: 12px;
	padding: 12px 14px; background: #fff;
	border: 1px solid var(--pd-line); border-radius: var(--pd-radius-sm);
	color: var(--pd-ink); text-decoration: none;
	transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pd-dl__card:hover {
	border-color: var(--pd-pink); box-shadow: var(--pd-shadow-hover);
	text-decoration: none; transform: translateY(-1px);
}
.pd-dl__card--primary { border-color: var(--pd-teal); background: var(--pd-teal-soft); }
.pd-dl__card--primary:hover { border-color: var(--pd-teal); box-shadow: 0 6px 20px rgba(78, 205, 196, .22); }
.pd-dl__ico { flex: 0 0 auto; font-size: 1.35rem; line-height: 1; }
.pd-dl__txt { flex: 1 1 auto; min-width: 0; }
.pd-dl__txt strong { display: block; font-size: .97rem; line-height: 1.35; }
.pd-dl__txt em { display: block; margin-top: 3px; font-style: normal; font-size: .78rem; line-height: 1.45; color: var(--pd-muted); }
.pd-dl__cta {
	flex: 0 0 auto; padding: 5px 13px; border-radius: 999px;
	background: var(--pd-pink); color: #fff; font-size: .8rem; font-weight: 700;
}
.pd-dl__card--primary .pd-dl__cta { background: var(--pd-teal); }
.pd-dl__row { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-dl__note { margin: 0; font-size: .78rem; line-height: 1.55; color: var(--pd-muted); }

@media (max-width: 520px) {
	.pd-dl__card { flex-wrap: wrap; }
	.pd-dl__cta { margin-left: auto; }
}

/* 色号对照表 */
.pd-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pd-tab {
	padding: 7px 14px; border-radius: 999px; background: #fff;
	border: 1px solid var(--pd-line); color: var(--pd-ink); font-size: .86rem; cursor: pointer;
}
.pd-tab.is-active { background: var(--pd-pink); border-color: var(--pd-pink); color: #fff; }
.pd-tabpanel { display: none; }
.pd-tabpanel.is-active { display: block; }
.pd-colorcount { font-size: .8rem; color: var(--pd-muted); margin: 0 0 8px; }

/* 生成器 */
.pd-form { display: flex; flex-direction: column; gap: 14px; }
.pd-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .pd-form__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pd-form__grid .pd-field--full { grid-column: 1 / -1; }
.pd-check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.pd-check input { width: 18px; height: 18px; accent-color: var(--pd-pink); }
.pd-drop {
	border: 2px dashed var(--pd-pink); border-radius: var(--pd-radius);
	background: var(--pd-pink-soft); padding: 22px 14px; text-align: center;
	font-size: .9rem; color: var(--pd-pink-dark); cursor: pointer;
}
.pd-drop:hover { background: #ffdbe8; }
.pd-preview-box { margin-top: 12px; }
.pd-preview-box img { border-radius: var(--pd-radius-sm); border: 1px solid var(--pd-line); max-height: 320px; width: auto; }
.pd-note {
	background: var(--pd-teal-soft); border-left: 4px solid var(--pd-teal);
	border-radius: var(--pd-radius-sm); padding: 10px 12px; font-size: .85rem; color: #2c7d78;
}

/* ---------------------------------------------------------------- footer */
.pd-footer {
	margin-top: 30px; padding: 22px 0 30px;
	border-top: 1px solid var(--pd-line); background: #fff;
	font-size: .85rem; color: var(--pd-muted);
}
.pd-footer__cols { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 640px) { .pd-footer__cols { flex-direction: row; justify-content: space-between; } }
.pd-footer ul { list-style: none; margin: 0; padding: 0; }
.pd-footer a { color: var(--pd-muted); }
.pd-footer__bottom { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--pd-line); font-size: .78rem; }
.pd-footer__title { font-weight: 700; color: var(--pd-ink); margin-bottom: 6px; }

/* ---------------------------------------------------------------- misc */
.pd-empty { background: #fff; border: 1px dashed var(--pd-line); border-radius: var(--pd-radius); padding: 30px 16px; text-align: center; color: var(--pd-muted); }
.pd-related { margin-top: 24px; }

/* ==== 生成结果展示（补充） ==== */
.pd-panel--warn { border-left: 4px solid #e8590c; background: #fff8f1; }
.pd-panel--result { border: 2px solid #4ECDC4; background: #f6fffe; }
.pd-result-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 12px 0 18px; }
@media (min-width: 720px) { .pd-result-grid { grid-template-columns: 1fr 1fr; } }
.pd-result-item { margin: 0; }
.pd-result-item figcaption { font-size: 13px; color: #666; margin-bottom: 6px; }
.pd-result-item img { width: 100%; height: auto; border-radius: 12px; background: #fff; border: 1px solid #e3e6ea; image-rendering: pixelated; }
.pd-note { background: #fffbe6; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
