/* app.css — PC 壳布局（index.html）。变量与组件在 tokens.css，工作区在 workspace.css。 */

.app:not([hidden]) { display: flex; min-height: 100vh; }

/* 左侧导航：88px 窄轨，上图标下文案（旧站结构；文字保持可见） */
.sidebar {
  flex: none; position: sticky; top: 0;
  display: flex; flex-direction: column; align-items: center;
  width: var(--sidebar-w); height: 100vh; padding: 14px 6px var(--sp-4);
  background: var(--surface); border-right: 1px solid var(--line);
}
.sidebar .brand { justify-content: center; width: 76px; margin-bottom: var(--sp-4); padding: 0; }
/* 侧栏只留「潮」字方块，品牌全名交给顶栏 */
.sidebar .brand > span:not(.logo) { display: none; }
.sidebar .logo {
  flex: none; width: 34px; height: 34px; border-radius: 11px;
  background: var(--surface-2); color: var(--text); font-size: 15px;
}
#nav { display: flex; flex-direction: column; gap: var(--sp-2); width: 76px; }
#nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 76px; height: 58px; padding: 0 2px;
  border: 0; border-radius: 14px;
  background: transparent; color: var(--text-3);
  font-size: 11px; font-weight: 650; line-height: 1.2; text-align: center; white-space: normal;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
#nav button svg, .sidebar-service svg {
  flex: none; width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
#nav button:hover { background: var(--surface-2); color: var(--text); }
#nav button:active { background: var(--line); color: var(--text); }
#nav button.active { background: var(--surface-2); color: var(--text); font-weight: 650; }
#nav button.active span { color: var(--brand-hover); }
#nav button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sidebar-service {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  margin-top: auto; width: 76px; height: 58px; padding: 0 2px;
  border: 0; border-radius: 14px;
  background: transparent; color: var(--text-3);
  font-size: 11px; font-weight: 650; line-height: 1.2; text-align: center;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.sidebar-service:hover { background: var(--surface-2); color: var(--text); }
.sidebar-service:active { background: var(--line); color: var(--text); }
.sidebar-service:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 顶栏：左侧品牌 + 右侧账号区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { justify-content: space-between; gap: var(--sp-3); padding: 0 var(--sp-5); font-size: var(--fs-sm); }
.topbar .brand { font-size: var(--fs-h3); }
.topbar-account .recharge-btn { flex: none; }

/* 内容 */
.content { width: 100%; padding: var(--sp-5); }

/* 登录 / 找回密码：在「我的」里当卡片，不再占满整屏 */
.login-wrap:not([hidden]) { display: block; padding: 0; }
.login-wrap[hidden] { display: none; }
.login-card { width: 100%; max-width: 420px; margin: 0 auto; }
.login-card h2 { margin-bottom: var(--sp-2); }
.sms-code-row { display: flex; align-items: center; gap: var(--sp-2); }
.sms-code-row input { flex: 1; min-width: 0; }
.sms-code-row .btn { flex: none; white-space: nowrap; }

/* 页内结构 */
.tab, .subpanel { display: none; }
.tab.active, .subpanel.active { display: block; }
.subtabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.subtabs button {
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  background: var(--surface); color: var(--text-2); font-size: var(--fs-sm);
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}
.subtabs button:hover { border-color: #aaa4ff; }
.subtabs button.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
.home-card { margin-bottom: 0; cursor: pointer; transition: border-color 150ms ease-out, box-shadow 150ms ease-out; }
.home-card:hover { border-color: #c8c5ff; box-shadow: var(--shadow-1); }
.home-card h3 { margin-bottom: var(--sp-1); }
.home-card p:last-child { margin-bottom: 0; }

.thumbs { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--r-sm); }
.result img { max-width: 100%; margin-top: var(--sp-3); border-radius: var(--r-md); }

.progress { margin-top: var(--sp-3); }
.progress-bar { height: 8px; overflow: hidden; border-radius: var(--r-full); background: var(--surface-2); }
.progress-bar div { height: 100%; background: var(--brand); transition: width .3s ease-out; }
.progress p { margin: var(--sp-2) 0 0; color: var(--text-3); font-size: var(--fs-sm); }

.task-list { display: grid; gap: var(--sp-3); }
.task-card {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); text-align: left;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.task-card:hover { border-color: #c8c5ff; box-shadow: var(--shadow-1); }
.task-card img { flex: none; width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); }
.task-card .t-meta { min-width: 0; }
.task-card .t-title { display: block; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.task-card .t-sub { color: var(--text-3); font-size: var(--fs-sm); }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 var(--sp-2);
  border-radius: var(--r-full);
  background: var(--success-soft); color: var(--success);
  font-size: var(--fs-xs); font-weight: 600;
}
.badge.fail { background: var(--danger-soft); color: var(--danger); }
.badge.doing { background: var(--warning-soft); color: var(--warning); }
.voice-panel { margin: var(--sp-3) 0; padding: var(--sp-3); border: 2px dashed var(--line-strong); border-radius: var(--r-lg); }
.voice-panel audio { width: 100%; margin-top: var(--sp-2); }

/* 手机（<768px）：侧栏整体隐藏，主导航交给底部 .bottomnav；顶栏保留品牌 + 账号区 */
@media (max-width: 767px) {
  .app:not([hidden]) { flex-direction: column; }
  /* 窄屏隐藏侧栏（避免与底栏重复，导航交给 .bottomnav） */
  .sidebar { display: none; }
  /* 底栏 fixed 高约 56px + 内边距；内容底部留出 72px + 安全区，避免被挡住 */
  .content { padding: var(--sp-3) var(--sp-3) calc(72px + env(safe-area-inset-bottom, 0px)); }
  .topbar { height: auto; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
  .topbar .brand { display: flex; }
  .topbar-account { flex: 1; justify-content: flex-end; flex-wrap: wrap; }

  /* BUG-063：index.html 只引 app.css，窄屏下可点控件 ≥44×44（桌面尺寸不动） */
  button, .btn, .chip, [role="button"] { min-width: 44px; min-height: 44px; }
  .btn.small { min-height: 44px; }
  select, input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }

  /* 登录页段落内行内链接（注册 / 忘记密码 / 返回登录）同样 ≥44×44，文字不换行 */
  .login-wrap p a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; min-width: 44px; padding: 0 var(--sp-2);
    white-space: nowrap; vertical-align: middle;
  }
}
