/* portal.css — 门户页面样式（首页 / 登录态 / 账号设置 / 游戏目录）。
   交互原语在 ds.css；Agent 聊天页不用这套。 */

/* ---------- 整页登录态 ---------- */
.login-view {
  position: fixed; inset: 64px 0 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: var(--page); padding: 24px; overflow-y: auto; align-items: safe center;
}
.login-box {
  width: min(92vw, 340px); display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  text-align: center; animation: rise .24s cubic-bezier(.2, .8, .2, 1);
}
.login-mark { width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 6px; }
.login-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.login-sub { margin: 0 0 6px; color: var(--text-secondary); font-size: 14px; }
.login-go { width: 100%; }
.login-other { align-self: center; }
.login-hint { margin: 4px 0 0; color: var(--text-tertiary); font-size: 12.5px; }

/* ---------- 页面骨架 ---------- */
.wrap { max-width: 72rem; margin: 0 auto; padding: 36px 22px 72px; }
.wrap.narrow { max-width: 46rem; }
.hero { margin: 6px 0 26px; }
.hero h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.hero .sub { margin: 0; color: var(--text-secondary); font-size: 14.5px; }

/* ---------- 首页 ---------- */
.home-top { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(16rem, 1fr); gap: 16px; align-items: stretch; }

.hero-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.hero-head { display: flex; align-items: flex-start; gap: 12px; }
.hero-icon { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.hero-title { font-size: 18px; font-weight: 650; }
.hero-sub { color: var(--text-secondary); font-size: 13.5px; margin-top: 2px; }
/* 首页直接提问：Quick Composer */
.hero-compose {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px 6px 6px 14px;
  transition: border-color .15s, background .15s;
}
.hero-compose:focus-within { border-color: var(--interactive-border); background: var(--surface); }
.hero-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; padding: 8px 0; }
.hero-input:focus { outline: none; }
.hero-input::placeholder { color: var(--text-tertiary); }
.hero-send {
  width: 38px; height: 38px; border-radius: 11px; border: 0; flex: none;
  background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  transition: transform 160ms var(--ease-out), filter var(--motion-ui) ease, box-shadow var(--motion-ui) ease;
}
.hero-send:hover { filter: brightness(1.06); box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 28%, transparent); }
.hero-send:hover .i { transform: translateY(-1px); }
.hero-send .i { transition: transform 200ms var(--ease-out); }
.hero-send:active { transform: scale(.94); transition-duration: var(--motion-press); }

.hero-last { display: flex; align-items: center; gap: 8px; min-width: 0; text-decoration: none; border-left: 2px solid var(--brand-soft); padding-left: 12px; }
.hero-conv, .hero-go { transition: color var(--motion-ui) ease, transform 200ms var(--ease-out); }
.hero-last.clickable:hover .hero-conv { color: var(--brand); }
.hero-last.clickable:hover .hero-go { color: var(--brand); transform: translateX(3px); }
.hero-last-label { color: var(--text-tertiary); font-size: 12.5px; flex: none; }
.hero-conv { color: var(--text); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-go { color: var(--text-tertiary); flex: none; }
.hero-actions { display: flex; gap: 10px; align-items: center; margin-top: auto; }

.status-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.status-head { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; }
.app-icon-tile { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-muted); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-tertiary); }
.status-dot.on, .presence-dot { position: relative; }
.status-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16); }
.status-dot.on::after, .presence-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: #22c55e; animation: live-ping 2.4s var(--ease-out) infinite;
}
@keyframes live-ping { 0% { opacity: .45; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(2.6); } }
.status-dot.off { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.status-count { font-size: 20px; font-weight: 650; }
.status-sub { color: var(--text-secondary); font-size: 13px; }
/* "谁在玩"做主视觉：头像堆叠 */
.player-faces { display: flex; align-items: center; }
.player-faces .face {
  width: 34px; height: 34px; border-radius: 50%; margin-right: -8px;
  background: var(--tint, var(--surface-muted)); color: #1d1d22;   /* tint 恒为浅色，深色主题下也要深字 */
  border: 2px solid var(--surface); display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 650; letter-spacing: .3px;
}
.player-faces .face.more { background: var(--surface-muted); color: var(--text-tertiary); font-size: 12px; }
.status-details { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.status-details .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-secondary); }
.status-details .row b { color: var(--text); font-weight: 550; }
.status-empty { color: var(--text-secondary); font-size: 13.5px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 14px; }
.game-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 150px; }
.game-title { font-size: 16px; font-weight: 650; }
.game-desc { color: var(--text-secondary); font-size: 13.5px; }
.game-stats { color: var(--text-tertiary); font-size: 12.5px; }
.game-card .btn { align-self: flex-start; margin-top: auto; }
.game-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.game-icon .game-icon-img { width: 20px; height: 20px; }

.feed { padding: 6px 0; }
.feed-row { display: flex; gap: 12px; padding: 14px 18px; align-items: flex-start; }
.feed-row + .feed-row { border-top: 1px solid var(--border); }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-top: 8px; flex: none; }
.feed-main { flex: 1; min-width: 0; }
.feed-text { color: var(--text); font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.feed-meta { color: var(--text-tertiary); font-size: 12.5px; margin-top: 3px; }
.feed-row { transition: background var(--motion-ui) ease; }
.feed-del { opacity: 0; transition: opacity var(--motion-ui) ease; }
.feed-row:hover .feed-del { opacity: 1; }

/* ---------- 账号设置 ---------- */
.account-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 8px; }
.account-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.account-head .meta { display: flex; align-items: center; gap: 8px; color: var(--text-tertiary); font-size: 13px; margin-top: 4px; }
.setting-value { color: var(--text-secondary); font-size: 14px; }
.setting-row { cursor: default; }
.setting-row.action { cursor: pointer; }
.setting-row.action { transition: background var(--motion-ui) ease; }
.setting-row.action:hover { background: var(--surface-muted); }
.setting-row .right { display: flex; align-items: center; gap: 8px; color: var(--text-tertiary); }

/* 主题分段选择器 */
.seg { display: inline-flex; background: var(--surface-muted); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-item { border: 0; background: transparent; color: var(--text-secondary); padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13.5px; cursor: pointer; transition: color var(--motion-ui) ease, transform var(--motion-fast) var(--ease-out); }
.seg-item:hover { color: var(--text); }
.seg-item.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); font-weight: 600; }

/* ---------- 游戏目录 ---------- */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 16px; }
.catalog-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.catalog-head { display: flex; align-items: center; gap: 12px; }
.catalog-title { font-size: 17px; font-weight: 650; }
.catalog-actions { margin-top: auto; display: flex; gap: 10px; align-items: center; }

@media (max-width: 860px) {
  .home-top { grid-template-columns: 1fr; }
  .wrap { padding: 26px 16px 56px; }
  .hero h1 { font-size: 23px; }
  .topbar { padding: 0 14px; }
  .nav { margin-left: 2px; overflow-x: auto; }
}

/* 目录卡整卡可点 */
.catalog-card.clickable {
  cursor: pointer;
  transition: border-color var(--motion-ui) ease, transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
.catalog-card.clickable:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16, 24, 40, .07); }
.catalog-card.clickable:active { transform: translateY(0) scale(.99); transition-duration: var(--motion-press); }
.catalog-art-piece { transition: transform 320ms var(--ease-out); }
.catalog-card.clickable:hover .catalog-art-piece { transform: translateY(-2px) scale(1.04); }

/* Games 目录页比 Portal 窄（避免"还差一张卡"的空旷感） */
.wrap.games-wrap { max-width: 52rem; }
@media (max-width: 640px) {
  .wrap.games-wrap { max-width: 100%; }
}

/* ---------- Games 内容卡（视觉头 + 轻量 affordance）---------- */
.catalog-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.catalog-art {
  display: flex; align-items: center; justify-content: center;
  height: 108px; position: relative; overflow: hidden; text-decoration: none;
}
.catalog-art-piece { width: 56px; height: 56px; opacity: .9; position: relative; z-index: 1; }
.art-chess { background: var(--surface-muted); }
.art-chess::before {
  content: ''; position: absolute; inset: -20%;
  background:
    repeating-conic-gradient(rgba(10, 132, 255, .10) 0% 25%, transparent 0% 50%) 0 0 / 48px 48px;
  opacity: .8;
}
.art-gomoku { background: var(--surface-muted); }
.art-gomoku::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(24, 24, 27, .16) 1.2px, transparent 1.4px) 0 0 / 22px 22px;
}
.catalog-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.catalog-card .catalog-head { display: flex; align-items: center; gap: 8px; }
.catalog-go { margin-top: auto; color: var(--interactive); font-size: 14px; font-weight: 600; text-decoration: none; transition: transform 200ms var(--ease-out); align-self: flex-start; }
.catalog-card.clickable:hover .catalog-go { transform: translateX(3px); }


/* ---------- Account：iOS/macOS 设置式分组（全站最"平"的页面）---------- */
.settings { display: flex; flex-direction: column; }
.settings .list-row { padding: 12px 2px; }
.settings .list-row + .list-row { border-top: 1px solid var(--border); }
.settings .list-row.action { padding: 12px 8px; border-radius: 10px; cursor: pointer; transition: background var(--motion-ui) ease; }
.settings .list-row.action .right { transition: transform 200ms var(--ease-out), color var(--motion-ui) ease; }
.settings .list-row.action:hover .right { transform: translateX(2px); color: var(--text-secondary); }
.settings .list-row.action:hover { background: var(--surface-muted); }
.section-head .section-title { font-size: 15px; color: var(--text-secondary); font-weight: 600; }

/* 在线 chip（Presence） */
.presence { display: inline-flex; align-items: center; gap: 7px; margin-left: 10px; color: var(--text-tertiary); font-size: 12.5px; vertical-align: middle; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .14); }
.presence .player-faces { margin-left: 2px; }
.presence .face { width: 22px; height: 22px; font-size: 11px; margin-right: -7px; }

/* 动态流：对局结果用一个小奖杯色点区分 */
.feed-dot.game { background: #f59e0b; }

.demo-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px; margin: 0 0 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }

/* Shared page geometry. */
.wrap { max-width: var(--content-width); padding: 40px 24px 64px; }
.wrap.narrow { max-width: 920px; }
.catalog { min-width: 0; }
.catalog-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.catalog-card, .catalog-body, .catalog-head { min-width: 0; }
.catalog-head { flex-wrap: wrap; }
.catalog-go { min-height: 44px; display: inline-flex; align-items: center; color: var(--link); }
.catalog-card { box-shadow: none; }
.game-description { overflow-wrap: anywhere; }
.login-view { inset: var(--shell-height) 0 0; }
.login-box { width: min(100%, 400px); padding: 28px 0; animation: none; text-align: left; }
.login-home { display: inline-flex; min-height: 44px; align-items: center; color: var(--link); font-size: 14px; text-decoration: none; }
.login-recovery { border-top: 1px solid var(--border); padding-top: 8px; font-size: 13px; }
.login-recovery summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.login-help-link { color: var(--link) !important; display: inline-flex; align-items: center; min-height: 44px; }
.settings button.list-row { width: 100%; background: none; border: 0; text-align: left; font: inherit; }
.settings a.list-row { color: inherit; text-decoration: none; }
.settings .list-main { min-width: 0; }
.settings .list-title, .settings .list-sub { overflow-wrap: anywhere; }
.error-page { padding-block: 100px; }
.error-code { color: var(--text-secondary); font-size: 14px; }
.error-page h1 { font-size: 32px; margin-block: 12px; }
.error-page p { color: var(--text-secondary); margin-bottom: 24px; }
.error-page .btn { margin: 0 8px 12px 0; }
.status-dot.on::after, .presence-dot::after { animation: none; }
@media (max-width: 640px) { .wrap { padding: 24px 16px 36px; } .catalog-grid, .game-grid { grid-template-columns: 1fr; } .login-view { padding: 20px 24px calc(84px + env(safe-area-inset-bottom)); } .settings .list-row { gap: 12px; flex-wrap: wrap; } }

.account-recovery summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 14px; }
.account-recovery p { max-width: 65ch; }
