/*
 * 手机端 App 外壳：顶部栏目条 + 底部五个入口 + 三个 App 页面
 *
 * 全部规则都压在 959px 以下（跟主题的响应式断点一致），
 * 电脑版完全不受影响 —— 大屏上这两条固定栏是 display:none。
 */

:root {
	--gapp-red: #ff3333;
	--gapp-ink: #16181c;
	--gapp-sub: #8a94a6;
	--gapp-faint: #98a2b3;
	--gapp-line: #eef1f5;
	--gapp-bg: #f5f6f8;
}

/* 电脑版：整套外壳不出现 */
.gapp-top,
.gapp-bar,
.gapp-sheet {
	display: none;
}

/* ============================================================
 * 一、顶部栏目条
 * ============================================================ */

@media only screen and (max-width: 959px) {

	/* 给两条固定栏腾出位置，否则首屏内容会被压住 */
	body.gapp-on {
		padding-top: 46px;
		padding-bottom: calc(58px + env(safe-area-inset-bottom));
	}
	/* 只有 App 页面换成浅灰底（卡片是白的）；
	   内容页保持原来的白底，免得文章正文看着像换了皮肤 */
	body.gapp-app {
		background: var(--gapp-bg);
	}

	/* 原来那排 logo + 搜索图标收起来，改由下面的栏目条承担。
	   注意要用 header.site-header：主题里还有一条 .site-start{height:auto!important}
	   带着 !important，只用 .site-header 压不住 */
	header.site-header,
	#masthead {
		height: 0 !important;
		min-height: 0 !important;
		border: 0 !important;
		box-shadow: none !important;
	}
	.site-start,
	.search-icon,
	#secondary-bar {
		display: none !important;
	}

	/* 主题的下拉菜单原本绝对定位在 header 里，header 高度归零后会跑位，
	   改成贴着顶栏的固定层，滚到哪儿点都能出来 */
	.mobile-menu {
		position: fixed !important;
		top: 46px !important;
		left: 0 !important;
		right: 0 !important;
		width: 100% !important;
		max-height: calc(100vh - 46px);
		overflow-y: auto;
		z-index: 9992 !important;
		box-shadow: 0 10px 24px rgba(16, 24, 40, .12);
	}
	.mobile-menu .container {
		width: 100% !important;
		padding: 0 16px;
		box-sizing: border-box;
	}

	.gapp-top {
		display: flex;
		align-items: center;
		gap: 2px;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		height: 46px;
		padding: 0 4px;
		background: #fff;
		border-bottom: 1px solid var(--gapp-line);
		z-index: 9990;
	}

	.gapp-top-btn {
		flex: 0 0 38px;
		width: 38px;
		height: 38px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #3d4451;
		background: none;
		border: 0;
		padding: 0;
		cursor: pointer;
		text-decoration: none;
	}
	.gapp-top-btn:active {
		opacity: .55;
	}

	.gapp-tabs {
		flex: 1 1 auto;
		min-width: 0;
		align-self: stretch;
		display: flex;
		align-items: stretch;
		gap: 19px;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding: 0 2px;
	}
	.gapp-tabs::-webkit-scrollbar {
		display: none;
		width: 0;
		height: 0;
	}

	.gapp-tab {
		position: relative;
		flex: 0 0 auto;
		display: flex;
		align-items: center;
		font-size: 15px;
		line-height: 1;
		color: #6b7280;
		text-decoration: none;
		white-space: nowrap;
		-webkit-tap-highlight-color: transparent;
	}
	.gapp-tab:visited {
		color: #6b7280;
	}
	.gapp-tab.is-on {
		color: var(--gapp-ink);
		font-weight: 700;
	}
	.gapp-tab.is-on:after {
		content: "";
		position: absolute;
		left: 50%;
		bottom: 7px;
		width: 16px;
		height: 3px;
		margin-left: -8px;
		border-radius: 2px;
		background: var(--gapp-red);
	}

	/* ============================================================
 * 二、底部 tab 条
 * ============================================================ */

	.gapp-bar {
		display: flex;
		align-items: stretch;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		height: calc(56px + env(safe-area-inset-bottom));
		padding-bottom: env(safe-area-inset-bottom);
		background: #fff;
		border-top: 1px solid var(--gapp-line);
		z-index: 9995;
		box-sizing: content-box;
	}

	.gapp-b {
		flex: 1 1 0;
		min-width: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		height: 56px;
		color: #8a94a6;
		font-size: 10.5px;
		line-height: 1;
		text-decoration: none;
		-webkit-tap-highlight-color: transparent;
	}
	.gapp-b span {
		font-size: 10.5px;
	}
	.gapp-b.is-on {
		color: var(--gapp-red);
	}

	.gapp-b-plus {
		background: none;
		border: 0;
		padding: 0;
		cursor: pointer;
		gap: 4px;
	}
	.gapp-plus {
		position: relative;
		display: block;
		width: 42px;
		height: 27px;
		border-radius: 7px;
		background: var(--gapp-red);
		box-shadow: 0 2px 8px rgba(255, 51, 51, .28);
	}
	.gapp-plus i {
		position: absolute;
		left: 50%;
		top: 50%;
		background: #fff;
		border-radius: 1px;
	}
	.gapp-plus i:first-child {
		width: 15px;
		height: 2px;
		margin: -1px 0 0 -7.5px;
	}
	.gapp-plus i:last-child {
		width: 2px;
		height: 15px;
		margin: -7.5px 0 0 -1px;
	}
	.gapp-b-plus:active .gapp-plus {
		transform: scale(.94);
	}
	.gapp-b-plus .gapp-plus-t {
		color: #8a94a6;
	}

	/* ============================================================
 * 三、提问上榜弹层
 * ============================================================ */

	.gapp-sheet {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 100000;
		visibility: hidden;
		pointer-events: none;
	}
	.gapp-sheet.is-on {
		visibility: visible;
		pointer-events: auto;
	}

	.gapp-sheet-mask {
		position: absolute;
		inset: 0;
		background: rgba(12, 16, 24, .45);
		opacity: 0;
		transition: opacity .22s;
	}
	.gapp-sheet.is-on .gapp-sheet-mask {
		opacity: 1;
	}

	.gapp-sheet-panel {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		background: #fff;
		border-radius: 16px 16px 0 0;
		padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
		transform: translateY(100%);
		transition: transform .26s cubic-bezier(.22, .61, .36, 1);
		box-sizing: border-box;
	}
	.gapp-sheet.is-on .gapp-sheet-panel {
		transform: translateY(0);
	}

	.gapp-sheet-x {
		position: absolute;
		top: 10px;
		right: 12px;
		width: 32px;
		height: 32px;
		border: 0;
		background: none;
		font-size: 24px;
		line-height: 1;
		color: #b6bfcc;
		cursor: pointer;
	}
	.gapp-sheet-panel h2 {
		margin: 0 0 6px;
		font-size: 17px;
		font-weight: 700;
		color: var(--gapp-ink);
	}
	.gapp-sheet-sub {
		margin: 0 0 14px;
		font-size: 12.5px;
		line-height: 1.6;
		color: var(--gapp-sub);
	}
	.gapp-sheet-panel textarea {
		width: 100%;
		box-sizing: border-box;
		border: 1px solid var(--gapp-line);
		background: #fafbfc;
		border-radius: 10px;
		padding: 11px 12px;
		font-size: 15px;
		line-height: 1.6;
		color: var(--gapp-ink);
		resize: none;
		outline: none;
		font-family: inherit;
	}
	.gapp-sheet-panel textarea:focus {
		border-color: #ffc9c9;
		background: #fff;
	}
	.gapp-sheet-bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 10px;
	}
	.gapp-count {
		font-size: 11.5px;
		color: #b6bfcc;
	}
	.gapp-sheet-ok {
		padding: 10px 0 2px;
		font-size: 13.5px;
		color: #12a594;
	}
	.gapp-sheet-err {
		padding: 8px 0 0;
		font-size: 12.5px;
		color: var(--gapp-red);
	}

	/* ============================================================
 * 四、App 页面
 * ============================================================ */

	.gapp-app #content,
	.gapp-app .site-content {
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		max-width: none !important;
	}
	.gapp-app .site-content > .clear {
		padding: 0;
	}

	/* App 页面里不重复出现底部「24 小时热文 / 标签球」和整块页脚 */
	.gapp-app .goaita-trend-mobile,
	.gapp-app .header-ad,
	.gapp-app #colophon {
		display: none !important;
	}
}

/* --- 下面是所有屏宽共用的部分（手机上是主体，电脑上是居中窄栏） --- */

/*
 * 主题里有 section / div 的 display 规则，会把 <section hidden> 上的
 * hidden 属性压掉（属性选择器的优先级比类低），页面上就会出现
 * "本该收起来却一直显示"的块。这里统一兜住。
 */
.gapp-page [hidden],
.gapp-sheet [hidden] {
	display: none !important;
}

.gapp-page {
	padding: 4px 12px 24px;
	box-sizing: border-box;
	font-size: 14px;
	color: var(--gapp-ink);
}

.gapp-hd {
	padding: 10px 2px 12px;
}
.gapp-hd h1 {
	margin: 0 0 5px;
	font-size: 23px;
	line-height: 1.25;
	font-weight: 800;
	letter-spacing: -.3px;
	color: var(--gapp-ink);
}
.gapp-hd .gapp-sub {
	margin: 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--gapp-sub);
}

/* 发现页第一次进入的方向选择 */
.gapp-pick {
	background: #fff;
	border-radius: 14px;
	padding: 16px 14px;
	margin-bottom: 12px;
}
.gapp-pick h2 {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 700;
}
.gapp-pick-tip {
	margin: 0 0 12px;
	font-size: 12px;
	color: var(--gapp-sub);
}
.gapp-pick-list {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}
.gapp-pick-i {
	border: 1px solid var(--gapp-line);
	background: #fbfcfd;
	border-radius: 10px;
	padding: 11px 0;
	font-size: 14px;
	color: #4b5563;
	cursor: pointer;
	font-family: inherit;
	transition: all .15s;
}
.gapp-pick-i.is-on {
	background: #fff5f5;
	border-color: var(--gapp-red);
	color: var(--gapp-red);
	font-weight: 600;
}

.gapp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--gapp-red);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 9px 20px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	font-family: inherit;
	text-decoration: none;
}
.gapp-btn:disabled {
	background: #f0b8b8;
	cursor: default;
}
.gapp-btn-wide {
	display: flex;
	width: 100%;
	margin-top: 14px;
	padding: 12px 0;
	font-size: 15px;
}

/* --- 文章卡片 --- */

.gapp-feed {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gapp-card {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	background: #fff;
	border-radius: 12px;
	padding: 12px;
	text-decoration: none;
	color: inherit;
	-webkit-tap-highlight-color: transparent;
}
.gapp-card:active {
	background: #fafbfc;
}

.gapp-card-tx {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
}
.gapp-card-tx b {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 15.5px;
	line-height: 1.5;
	font-weight: 600;
	color: #1f2329;
}
.gapp-card-m {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	font-size: 11.5px;
	color: var(--gapp-faint);
}
.gapp-card-m i {
	font-style: normal;
	color: #b9c1cd;
}

.gapp-card-img {
	display: block;
	flex: 0 0 96px;
	width: 96px;
	height: 72px;
	border-radius: 8px;
	overflow: hidden;
	background: #f2f4f7;
}
.gapp-card-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 第一条用大图，一眼看得出这里在推什么。
   高度用 aspect-ratio 撑：主题给全站设了 box-sizing:border-box，
   用传统的 height:0 + padding-bottom 会被压成 0，图片直接看不见 */
.gapp-card-hero {
	display: block;
	padding: 0;
	overflow: hidden;
}
.gapp-card-hero .gapp-card-img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	position: relative;
	border-radius: 0;
	flex: none;
}
.gapp-card-hero .gapp-card-img img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.gapp-card-hero .gapp-card-tx {
	padding: 12px 14px 14px;
}
.gapp-card-hero .gapp-card-tx b {
	-webkit-line-clamp: 2;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.45;
}

.gapp-more,
.gapp-end {
	padding: 16px 0 6px;
	text-align: center;
	font-size: 12.5px;
	color: var(--gapp-faint);
}
.gapp-end a {
	color: var(--gapp-red);
	text-decoration: none;
}

/* --- 通用区块 --- */

.gapp-sec {
	background: #fff;
	border-radius: 12px;
	padding: 14px;
	margin-top: 10px;
}
.gapp-sec h2 {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 10px;
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: .3px;
	color: var(--gapp-sub);
}
.gapp-sec-plain {
	background: none;
	padding: 6px 2px;
}

.gapp-linkbtn {
	border: 0;
	background: none;
	padding: 0;
	font-size: 12px;
	color: #b6bfcc;
	font-family: inherit;
	cursor: pointer;
}

.gapp-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.gapp-chip {
	display: inline-block;
	padding: 7px 13px;
	border: 1px solid var(--gapp-line);
	border-radius: 999px;
	background: #fbfcfd;
	font-size: 13px;
	line-height: 1.2;
	color: #4b5563;
	text-decoration: none;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
}
.gapp-chip:active {
	background: #fff5f5;
	border-color: var(--gapp-red);
	color: var(--gapp-red);
}

.gapp-note {
	margin: 10px 0 0;
	font-size: 11.5px;
	line-height: 1.6;
	color: #b0b8c4;
}

/* --- 提问页 --- */

.gapp-askbox {
	background: #fff;
	border-radius: 14px;
	padding: 12px 12px 10px;
	box-shadow: 0 2px 10px rgba(16, 24, 40, .04);
}
.gapp-askbox textarea {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: 82px;
	border: 0;
	outline: none;
	resize: none;
	padding: 2px 2px 6px;
	background: transparent;
	font-size: 15px;
	line-height: 1.6;
	color: var(--gapp-ink);
	font-family: inherit;
}
.gapp-askbox textarea::placeholder,
.gapp-sheet-panel textarea::placeholder {
	color: #b6bfcc;
}
.gapp-askbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	border-top: 1px solid #f5f7f9;
	padding-top: 9px;
}
.gapp-askhint {
	font-size: 11px;
	color: #b6bfcc;
}

.gapp-asklog {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.gapp-asklog button {
	border: 0;
	background: none;
	padding: 8px 0;
	text-align: left;
	font-size: 13.5px;
	color: #4b5563;
	font-family: inherit;
	cursor: pointer;
	border-bottom: 1px dashed #f4f6f8;
}
.gapp-asklog button:last-child {
	border-bottom: 0;
}
.gapp-asklog button:before {
	content: "?";
	display: inline-block;
	width: 16px;
	margin-right: 6px;
	color: #d5dbe3;
	font-weight: 700;
}

.gapp-search {
	display: flex;
	gap: 8px;
}
.gapp-search input {
	flex: 1 1 auto;
	min-width: 0;
	height: 38px;
	border: 1px solid var(--gapp-line);
	border-radius: 999px;
	padding: 0 16px;
	font-size: 13.5px;
	color: var(--gapp-ink);
	background: #fbfcfd;
	outline: none;
	font-family: inherit;
}
.gapp-search input:focus {
	border-color: #ffd0d0;
	background: #fff;
}
.gapp-search button {
	flex: 0 0 auto;
	border: 0;
	border-radius: 999px;
	background: var(--gapp-red);
	color: #fff;
	padding: 0 18px;
	font-size: 13.5px;
	font-family: inherit;
	cursor: pointer;
}

/* --- 我 --- */

.gapp-hd-me {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 2px 14px;
}
.gapp-hd-me h1 {
	margin: 0 0 4px;
	font-size: 18px;
}
.gapp-ava {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	border-radius: 14px;
	background: linear-gradient(135deg, #ff5a5a, #e02a2a);
	color: #fff;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: .5px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gapp-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	background: #fff;
	border-radius: 12px;
	padding: 13px 0;
	text-align: center;
}
.gapp-stat {
	text-decoration: none;
	color: inherit;
	border-right: 1px solid #f6f8fa;
}
.gapp-stat:last-child {
	border-right: 0;
}
.gapp-stat b {
	display: block;
	font-size: 18px;
	font-weight: 700;
	color: var(--gapp-ink);
	line-height: 1.2;
}
.gapp-stat span {
	display: block;
	margin-top: 3px;
	font-size: 11px;
	color: var(--gapp-faint);
}

.gapp-hist {
	display: flex;
	flex-direction: column;
}
.gapp-hist-i {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 9px 0;
	border-bottom: 1px dashed #f4f6f8;
	text-decoration: none;
	color: inherit;
}
.gapp-hist-i:last-child {
	border-bottom: 0;
}
.gapp-hist-i img {
	flex: 0 0 58px;
	width: 58px;
	height: 44px;
	border-radius: 6px;
	object-fit: cover;
	background: #f2f4f7;
}
.gapp-hist-tx {
	flex: 1 1 auto;
	min-width: 0;
}
.gapp-hist-tx b {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 13.5px;
	line-height: 1.45;
	font-weight: 500;
	color: #2b3038;
}
.gapp-hist-tx span {
	display: block;
	margin-top: 4px;
	font-size: 11px;
	color: var(--gapp-faint);
}

.gapp-tools {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px 8px;
}
.gapp-tools a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 10px 0;
	border-radius: 10px;
	background: #fbfcfd;
	font-size: 12px;
	color: #4b5563;
	text-decoration: none;
}
.gapp-tools a span {
	width: 30px;
	height: 30px;
	border-radius: 9px;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gapp-rank {
	display: flex;
	flex-direction: column;
}
.gapp-rank a {
	display: flex;
	gap: 8px;
	align-items: baseline;
	padding: 8px 0;
	border-bottom: 1px dashed #f4f6f8;
	font-size: 13.5px;
	line-height: 1.5;
	color: #2b3038;
	text-decoration: none;
}
.gapp-rank a:last-child {
	border-bottom: 0;
}
.gapp-rank i {
	flex: 0 0 16px;
	width: 16px;
	text-align: center;
	font-style: normal;
	font-size: 12px;
	color: #c3cad4;
}
.gapp-rank a:nth-child(-n+3) i {
	color: var(--gapp-red);
	font-weight: 700;
}
.gapp-rank span {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
}

.gapp-links {
	display: flex;
	gap: 20px;
	font-size: 12.5px;
}
.gapp-links a {
	color: #7c8798;
	text-decoration: none;
}
.gapp-copy {
	margin: 10px 0 0;
	font-size: 11px;
	color: #c3cad4;
}

/* ============================================================
 * 五、电脑版：页面本身仍然可读，只是收成窄栏
 * ============================================================ */

@media only screen and (min-width: 960px) {
	.gapp-page {
		max-width: 720px;
		margin: 10px auto 40px;
		padding: 0;
	}
	.gapp-pick,
	.gapp-sec,
	.gapp-stats,
	.gapp-card,
	.gapp-askbox {
		box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
	}
}
