/* 爱捷径快捷指令管理器 —— 前端样式
 * 设计：浅灰白背景、白卡片、轻边框、克制阴影、蓝色主色。兼容手机/平板/桌面。
 */
:root {
	/* 主色复用 JustNews 主题色变量，主题改色时卡片整体跟随；无变量时回退默认蓝 */
	--ijiji-primary: var(--wpcom-theme-color, #42a7ff);
	--ijiji-primary-dark: color-mix(in srgb, var(--ijiji-primary) 62%, #000);
	--ijiji-bg: #f5f6f8;
	--ijiji-card: #ffffff;
	--ijiji-border: #e6e8eb;
	--ijiji-text: #2b2f36;
	--ijiji-muted: #6b7280;
	--ijiji-status-normal: #2e7d32;
	--ijiji-status-unavailable: #ed6c02;
	--ijiji-status-removed: #8a8f98;
	--ijiji-radius: 12px;
}

/* 资源网格 */
.ijiji-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 16px;
	margin: 18px 0;
}

/* 资源卡片（链接整体） */
.ijiji-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	background: var(--ijiji-card);
	border: 1px solid var(--ijiji-border);
	border-radius: var(--ijiji-radius);
	text-decoration: none;
	color: var(--ijiji-text);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ijiji-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
	border-color: var(--ijiji-primary);
}
.ijiji-card:focus-visible {
	outline: 2px solid var(--ijiji-primary);
	outline-offset: 2px;
}
.ijiji-card-icon {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	color: var(--ijiji-primary);
	background: color-mix(in srgb, var(--ijiji-primary) 8%, transparent);
	border-radius: 10px;
}
.ijiji-card-icon .material-icons {
	font-size: 26px;
}
.ijiji-card-body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.ijiji-card-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}
.ijiji-card-desc {
	font-size: 13px;
	color: var(--ijiji-muted);
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ijiji-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 2px;
}

/* 标签 */
.ijiji-tag {
	display: inline-block;
	padding: 2px 8px;
	font-size: 12px;
	line-height: 1.6;
	border-radius: 999px;
	background: #eef1f5;
	color: #4b5563;
}
.ijiji-tag-cat {
	background: color-mix(in srgb, var(--ijiji-primary) 10%, transparent);
	color: var(--ijiji-primary-dark);
}
.ijiji-tag-normal {
	background: rgba(46, 125, 50, 0.12);
	color: var(--ijiji-status-normal);
}
.ijiji-tag-unavailable {
	background: rgba(237, 108, 2, 0.12);
	color: var(--ijiji-status-unavailable);
}
.ijiji-tag-removed {
	background: rgba(138, 143, 152, 0.14);
	color: var(--ijiji-status-removed);
}

/* 详情页获取 Hero 卡片（磁贴色大卡，取代主题标题区）
 * 现代化两区布局：
 *   头部 —— 左（图标 + 标题 + 元信息）｜ 右（获取指令 CTA + 编号）；
 *   下方 —— 简介 → 信息条（系统要求/注意事项居左，公众号获取·收藏·分享居右）。
 */
.ijiji-get-card.ijiji-hero {
	--tile: #3478f6; /* 兜底色：模板未注入时使用 */
	position: relative;
	overflow: hidden;
	margin: 0 0 18px;
	padding: 16px 18px;
	border-radius: 18px;
	color: #fff;
	background: linear-gradient(135deg, var(--tile) 0%, color-mix(in srgb, var(--tile) 66%, #000) 100%);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
/* 头部：左（图标 + 标题/元信息）｜ 右（CTA） */
.ijiji-hero-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.ijiji-hero-id {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
	flex: 1 1 auto;
}
.ijiji-hero-icon {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	color: #fff;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 15px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.ijiji-hero-icon .material-icons {
	font-size: 30px;
}
.ijiji-hero-id-text {
	min-width: 0;
	flex: 1 1 auto;
}
/* 标题/元信息/简介：提高选择器优先级，覆盖主题 .entry-content h1/p 的默认 margin */
.ijiji-get-card .ijiji-hero-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
}
.ijiji-get-card .ijiji-hero-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	margin: 5px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.75);
}
.ijiji-hero-dot {
	margin: 0 2px;
	opacity: 0.6;
}
.ijiji-get-card .ijiji-hero-brief {
	margin: 12px 0 0;
	font-size: 13px;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.9);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ijiji-hero-tag {
	display: inline-block;
	padding: 1px 9px;
	font-size: 11px;
	line-height: 1.7;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
}
.ijiji-hero-tag-normal {
	background: rgba(255, 255, 255, 0.22);
}
.ijiji-hero-tag-unavailable {
	background: rgba(255, 255, 255, 0.12);
}
.ijiji-hero-tag-removed {
	background: rgba(0, 0, 0, 0.2);
}
/* 右侧 CTA：获取指令按钮 + 编号（居中于按钮下方） */
.ijiji-hero-cta {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	text-align: center;
}
/* 获取指令：白色实心按钮，强对比 CTA */
.ijiji-hero-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-width: 132px;
	min-height: 46px;
	padding: 10px 22px;
	background: #fff;
	color: var(--tile);
	border: 0;
	border-radius: 12px;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
	transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.ijiji-hero-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
	filter: brightness(0.96);
}
.ijiji-hero-btn.is-disabled {
	background: rgba(255, 255, 255, 0.18);
	color: rgba(255, 255, 255, 0.8);
	cursor: not-allowed;
	box-shadow: none;
}
.ijiji-hero-code {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.85);
	white-space: nowrap;
}
.ijiji-hero .ijiji-code {
	font-size: 14px;
	letter-spacing: 1px;
	color: #fff;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ijiji-hero .ijiji-copy-btn {
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	border-radius: 6px;
	padding: 1px 8px;
	margin-left: 4px;
	cursor: pointer;
	font-size: 11px;
}
.ijiji-hero .ijiji-copy-btn:hover {
	background: rgba(255, 255, 255, 0.22);
	border-color: rgba(255, 255, 255, 0.5);
}
.ijiji-hero-warning {
	margin-top: 12px;
	padding: 8px 12px;
	background: rgba(0, 0, 0, 0.18);
	border-radius: 10px;
	font-size: 12px;
	color: #fff;
}
/* 下方信息条：系统要求/注意事项（左）+ 操作（右），与头部以细线分隔 */
.ijiji-hero-sub {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin-top: 12px;
	padding-top: 11px;
	border-top: 1px solid rgba(255, 255, 255, 0.22);
	font-size: 12px;
	color: rgba(255, 255, 255, 0.78);
}
.ijiji-hero-actions {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-left: auto;
	color: rgba(255, 255, 255, 0.85);
}
.ijiji-hero .ijiji-sub-sep {
	color: rgba(255, 255, 255, 0.4);
}
.ijiji-hero .ijiji-mp-entry,
.ijiji-hero .ijiji-fav-btn,
.ijiji-hero .ijiji-share-btn {
	border: 0;
	background: none;
	color: #fff;
	font-size: 12px;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
	text-decoration-color: rgba(255, 255, 255, 0.4);
}
.ijiji-hero .ijiji-fav-btn.is-faved {
	color: #ffd54d;
}
.ijiji-hero-os,
.ijiji-hero-notes {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.78);
}

/* 隐藏主题默认的标题/文章信息区（仅快捷指令详情页，body class 由插件标记） */
body.ijiji-single-shortcut .entry-head {
	display: none !important;
}
/* 防止主题正文首行缩进（.text-indent p）影响 Hero 卡片内文字 */
.ijiji-get-card p {
	text-indent: 0;
}
body.ijiji-single-shortcut .entry-content .ijiji-get-card p {
	text-indent: 0;
}

/* 主页「快捷指令墙」工具栏 */
.ijiji-wall {
	margin: 18px 0 26px;
}
.ijiji-wall-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}
.ijiji-wall-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
}
.ijiji-wall-tools {
	display: flex;
	align-items: center;
	gap: 10px;
}
.ijiji-wall-view {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	background: var(--ijiji-bg);
	border-radius: 10px;
}
.ijiji-view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 28px;
	border: 0;
	background: transparent;
	color: var(--ijiji-muted);
	border-radius: 8px;
	cursor: pointer;
}
.ijiji-view-btn.is-active {
	background: #fff;
	color: var(--ijiji-text);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.ijiji-wall-search {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 12px;
	height: 34px;
	background: var(--ijiji-bg);
	border-radius: 999px;
	color: var(--ijiji-muted);
}
.ijiji-wall-search input {
	border: 0;
	background: transparent;
	outline: none;
	width: 140px;
	font-size: 14px;
	color: var(--ijiji-text);
}

/* 磁贴网格（网格视图） */
.ijiji-wall-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 14px;
}
.ijiji-tile {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 18px;
	aspect-ratio: 5 / 4;
	padding: 16px;
	border-radius: 20px;
	color: #fff;
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	overflow: hidden;
}
.ijiji-tile:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
	color: #fff;
}
.ijiji-tile:focus-visible {
	outline: 3px solid rgba(255, 255, 255, 0.8);
	outline-offset: 2px;
}
.ijiji-tile-icon {
	font-size: 30px;
	line-height: 1;
}
.ijiji-tile-icon .material-icons {
	font-size: 32px;
}
.ijiji-tile-icon.ijiji-icon-emoji {
	font-size: 30px;
}
.ijiji-tile-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
}

/* 列表视图：磁贴退化为横向条目 */
.ijiji-wall.is-list .ijiji-wall-grid {
	grid-template-columns: 1fr;
	gap: 10px;
}
.ijiji-wall.is-list .ijiji-tile {
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	gap: 12px;
	aspect-ratio: auto;
	padding: 12px 16px;
	border-radius: 14px;
}
.ijiji-wall.is-list .ijiji-tile-icon {
	font-size: 22px;
}
.ijiji-wall.is-list .ijiji-tile-icon .material-icons {
	font-size: 24px;
}
.ijiji-wall.is-list .ijiji-tile-title {
	font-size: 15px;
	-webkit-line-clamp: 1;
}
.ijiji-wall-empty {
	color: var(--ijiji-muted);
	text-align: center;
	padding: 24px 0;
}

/* 弹层（公众号获取 / 分享共用） */
.ijiji-modal {
	position: fixed;
	inset: 0;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ijiji-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}
.ijiji-modal-box {
	position: relative;
	z-index: 1;
	width: min(360px, calc(100vw - 32px));
	max-height: 85vh;
	overflow: auto;
	background: var(--ijiji-card);
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
	padding: 18px 20px 22px;
	box-sizing: border-box;
}
.ijiji-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	font-size: 16px;
}
.ijiji-modal-close {
	border: 0;
	background: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: var(--ijiji-muted);
	padding: 0 2px;
}
.ijiji-modal-close:hover {
	color: var(--ijiji-text);
}
.ijiji-modal-body {
	font-size: 14px;
	color: var(--ijiji-text);
}
.ijiji-modal-body p {
	margin: 8px 0;
}
.ijiji-get-modal-tip {
	color: var(--ijiji-muted);
	line-height: 1.7;
}
.ijiji-get-modal-code {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 10px 12px;
	background: var(--ijiji-bg);
	border-radius: 10px;
}
.ijiji-get-modal-qr {
	display: block;
	width: 180px;
	height: 180px;
	margin: 14px auto 6px;
	border: 1px solid var(--ijiji-border);
	border-radius: 10px;
	background: #fff;
	object-fit: cover;
}
.ijiji-get-modal-name {
	text-align: center;
	font-weight: 600;
}
.ijiji-share-url input {
	width: 100%;
	box-sizing: border-box;
}
.ijiji-share-qr {
	display: block;
	width: 180px;
	height: 180px;
	margin: 10px auto 0;
}
.ijiji-modal-body .button {
	margin-right: 6px;
}

/* 暗色模式（如主题支持 prefers-color-scheme） */
@media (prefers-color-scheme: dark) {
	:root {
		--ijiji-bg: #16181c;
		--ijiji-card: #1e2126;
		--ijiji-border: #2c3036;
		--ijiji-text: #e6e8eb;
		--ijiji-muted: #9aa1ab;
	}
	.ijiji-card-icon {
		background: color-mix(in srgb, var(--ijiji-primary) 18%, transparent);
	}
	.ijiji-tag {
		background: #2a2e34;
		color: #c2c8d0;
	}
	.ijiji-get-modal-code,
	.ijiji-copy-btn {
		background: #23262c;
	}
	.ijiji-copy-btn {
		background: transparent;
	}
}

/* =========================================================================
 * 移动端专项适配（仅 ≤768px / ≤600px / ≤360px 生效，桌面端样式不受影响）
 * 目标：小屏弹性布局、触控尺寸、防横向溢出、弹窗安全区与对齐。
 * ========================================================================= */

/* 平板 / 中屏（≤768px）：工具栏与网格间距收窄 */
@media (max-width: 768px) {
	.ijiji-wall-bar {
		gap: 10px;
	}
	.ijiji-wall-title {
		font-size: 20px;
	}
	.ijiji-wall-grid {
		gap: 12px;
	}
}

/* 手机端（≤600px） */
@media (max-width: 600px) {
	/* 防横向溢出：关键容器不超过视口宽度 */
	body.ijiji-single-shortcut,
	.ijiji-get-card,
	.ijiji-card,
	.ijiji-tile,
	.ijiji-modal-box,
	.ijiji-wall-search {
		max-width: 100%;
	}
	.ijiji-wall-search input {
		box-sizing: border-box;
	}

	/* 资源列表：单列 */
	.ijiji-grid {
		grid-template-columns: 1fr;
	}

	/* —— Hero 卡片：头部（图标+标题左 / 按钮右），与桌面端同构，仅收紧尺寸 —— */
	.ijiji-get-card.ijiji-hero {
		padding: 13px 14px;
		border-radius: 14px;
	}
	.ijiji-hero-head {
		gap: 12px;
	}
	.ijiji-hero-id {
		gap: 11px;
	}
	/* 手机端隐藏图标，缩短卡片整体高度（标题/元信息占满左列，按钮仍在右） */
	.ijiji-hero-icon {
		display: none;
	}
	.ijiji-hero-title {
		font-size: 17px;
	}
	/* 触控友好：按钮保持大点击区，可收缩避让图标 */
	.ijiji-hero-btn {
		flex: 0 1 auto;
		min-width: 0;
		min-height: 44px;
		padding: 8px 16px;
		font-size: 14px;
	}
	/* 操作文字（公众号获取 / 收藏 / 分享）加大点击区域，改半透明胶囊 */
	.ijiji-hero .ijiji-mp-entry,
	.ijiji-hero .ijiji-fav-btn,
	.ijiji-hero .ijiji-share-btn {
		font-size: 13px;
		line-height: 1.4;
		padding: 6px 10px;
		min-height: 32px;
		border-radius: 8px;
		background: rgba(255, 255, 255, 0.14);
		text-decoration: none;
	}
	.ijiji-hero-sub {
		gap: 4px 8px;
	}
	.ijiji-hero-actions {
		margin-left: 0;
	}

	/* —— 快捷指令墙工具栏 —— */
	.ijiji-wall-title {
		font-size: 18px;
		flex: 1 1 100%;
	}
	.ijiji-wall-tools {
		flex: 1 1 100%;
		justify-content: space-between;
	}
	/* 搜索框占满一行 */
	.ijiji-wall-search {
		flex: 1 1 auto;
	}
	.ijiji-wall-search input {
		width: 100%;
		flex: 1 1 auto;
	}
	/* 视图切换按钮加大触控区 */
	.ijiji-view-btn {
		width: 38px;
		height: 38px;
	}

	/* —— 弹窗：满宽、安全区适配、关闭按钮加大，避免错位 —— */
	.ijiji-modal {
		padding: env(safe-area-inset-top, 0)
		         env(safe-area-inset-right, 0)
		         env(safe-area-inset-bottom, 0)
		         env(safe-area-inset-left, 0);
	}
	.ijiji-modal-box {
		width: calc(100vw - 24px);
		max-height: calc(100vh - 48px - env(safe-area-inset-bottom, 0));
		padding: 16px 16px 20px;
	}
	.ijiji-modal-head {
		font-size: 15px;
		margin-bottom: 10px;
	}
	.ijiji-modal-close {
		font-size: 26px;
		line-height: 1;
		min-width: 32px;
		min-height: 32px;
	}
	.ijiji-get-modal-qr,
	.ijiji-share-qr {
		width: 150px;
		height: 150px;
	}
}

/* 超小屏（≤360px）：进一步收紧，规避 320 机型横向溢出 */
@media (max-width: 360px) {
	.ijiji-wall-grid {
		grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
		gap: 10px;
	}
	.ijiji-hero-title {
		font-size: 15px;
	}
	.ijiji-wall-title {
		font-size: 17px;
	}
}
