/* 02-base.css — reset + body + .topbar */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: var(--maxw);
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
  padding-top: calc(var(--topbar-h) + var(--safe-top));
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

ul,
ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 顶栏 */
.topbar {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 0 var(--sp-2);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 50;
  box-sizing: border-box;
}

.topbar__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  border-radius: var(--r-full);
  transition: background 0.15s;
}
.topbar__btn:active {
  background: var(--surface-3);
}

.topbar__title {
  text-align: center;
  font-size: var(--fs-16);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar [data-icon] svg,
.topbar__btn svg {
  width: 22px;
  height: 22px;
}

/* SVG 图标统一尺寸 */
[data-icon] svg,
.icon-svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

/* 搜索 overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--safe-top) var(--sp-4) 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.15s ease;
}
.search-overlay[hidden] {
  display: none;
}
.search-overlay__bar {
  width: 100%;
  max-width: var(--maxw);
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border-radius: var(--r-full);
  padding: var(--sp-1) var(--sp-3);
  box-shadow: var(--shadow-md);
}
.search-overlay__icon {
  color: var(--text-3);
  display: inline-flex;
}
.search-overlay__bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--fs-14);
  padding: var(--sp-2) 0;
}
.search-overlay__bar button {
  color: var(--accent);
  font-size: var(--fs-14);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-2);
}
.search-overlay__bar #search-close {
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
}
.search-overlay__hint {
  margin-top: var(--sp-3);
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--fs-12);
  text-align: center;
}

/* 主容器 */
.app {
  min-height: calc(100vh - var(--topbar-h) - var(--nav-h) - var(--safe-top) - var(--safe-bottom));
  padding: var(--sp-4);
  padding-bottom: var(--sp-8);
}

.app--no-pad {
  padding: 0;
}

/* section 标题 */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--sp-5) 0 var(--sp-3);
  font-size: var(--fs-16);
  font-weight: 600;
}
.section-title:first-child {
  margin-top: 0;
}
.section-title__more {
  font-size: var(--fs-13);
  color: var(--text-3);
  font-weight: normal;
}

/* 状态色文本 */
.t-ok { color: var(--ok); }
.t-warn { color: var(--warn); }
.t-danger { color: var(--danger); }
.t-info { color: var(--info); }
.t-muted { color: var(--text-3); }
.t-2 { color: var(--text-2); }

.mono { font-family: var(--mono); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideInLeft {
  from { transform: translateX(-104%); }
  to { transform: translateX(0); }
}

@media (max-width: 480px) {
  body { font-size: var(--fs-14); }
}
