:root {
  --primary: #6a6a6a;
  --primary-d: #6a6a6a;
  --text: #8a8a8a;
  --sub: #6a6a6a;
  --muted: #2c2c2c;
  --line: #0c0c0c;
  --bg: #0c0c0c;
  --card: #0c0c0c;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(138,138,138,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：类选择器里的 display 会盖掉 hidden 属性，必须强制生效 */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: #121212;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button { font-family: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
input { font-family: inherit; }

.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(242,242,242,.08);
}

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  height: 50px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12,12,12,.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-title { font-size: 16px; font-weight: 600; margin: 0; }
.nav-back {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--text); border-radius: 50%;
}
.nav-back:active { background: #0c0c0c; }

.main { flex: 1; padding-bottom: 76px; }
.view { padding: 12px 14px 20px; }

/* ---------- 首页：Banner 满宽 ---------- */
.view-home { padding: 0 0 20px; }
.banner { margin: 0; line-height: 0; background: #121212; }
.banner img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 3193 / 1313; object-fit: cover;
}

/* ---------- 搜索（压在 Banner 下沿） ---------- */
.search-wrap {
  position: relative; z-index: 2;
  margin: -22px 14px 0;
}
.search {
  display: flex; align-items: center; gap: 8px;
  background: #0c0c0c; border-radius: 11px;
  border: 1px solid #121212;
  padding: 0 13px; height: 42px;
  box-shadow: 0 2px 8px rgba(138,138,138,.05);
}
.search-ico { color: #1b1b1b; flex: none; }
.search input {
  flex: 1; border: 0; outline: 0; background: none;
  font-size: 13.5px; color: var(--text); min-width: 0;
}
.search input::placeholder { color: #2c2c2c; }

/* ---------- 两个大入口 ---------- */
.entry2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 14px 14px 0;
}
.card-lg {
  background: #0c0c0c; border-radius: 13px;
  padding: 13px 12px; min-height: 84px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  box-shadow: var(--shadow); text-align: left;
  transition: transform .12s;
}
.card-lg:active { transform: scale(.975); }
.cl-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cl-txt b { font-size: 15.5px; font-weight: 600; white-space: nowrap; }
.cl-txt small { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* 渐变有机色块 + 白色图形 */
.blob {
  flex: none; display: grid; place-items: center;
  border-radius: 46% 54% 52% 48% / 48% 44% 56% 52%;
  box-shadow: 0 3px 8px rgba(106,106,106,.18);
}
.b1 { width: 44px; height: 44px; background: linear-gradient(140deg, #2c2c2c, #2c2c2c 55%, #1b1b1b); }
.b2 { width: 44px; height: 44px; background: linear-gradient(140deg, #6a6a6a, #2c2c2c 55%, #2c2c2c); }

/* ---------- 四个小入口 ---------- */
.entry4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 10px 14px 0;
}
.card-sm {
  position: relative;
  background: #0c0c0c; border-radius: 12px;
  padding: 12px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  box-shadow: var(--shadow);
  transition: transform .12s;
}
.card-sm:active { transform: scale(.96); }
.card-sm b { font-size: 11.5px; font-weight: 500; color: var(--text); white-space: nowrap; }
.blob.s1 { width: 32px; height: 32px; background: linear-gradient(140deg, #2c2c2c, #1b1b1b 60%, #1b1b1b); }
.blob.s2 { width: 32px; height: 32px; background: linear-gradient(140deg, #2c2c2c, #2c2c2c 60%, #1b1b1b); }
.blob.s3 { width: 32px; height: 32px; background: linear-gradient(140deg, #2c2c2c, #1b1b1b 60%, #1b1b1b); }
.blob.s4 { width: 32px; height: 32px; background: linear-gradient(140deg, #2c2c2c, #2c2c2c 60%, #1b1b1b); }

.badge {
  position: absolute; right: -3px; top: -5px;
  background: linear-gradient(135deg, #2c2c2c, #6a6a6a);
  color: #0c0c0c; font-size: 9.5px; line-height: 1;
  padding: 3px 5px; border-radius: 5px 5px 5px 0;
  box-shadow: 0 2px 5px rgba(106,106,106,.3);
}

/* ---------- 分类标签行 ---------- */
.tabs-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 0 14px; margin-top: 12px;
}
.tabs {
  flex: 1; display: flex; gap: 18px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
  padding: 8px 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-item {
  flex: none; font-size: 14.5px; color: #2c2c2c;
  white-space: nowrap; transition: color .15s;
  padding: 0; line-height: 1.5;
}
.tab-item.active { color: var(--text); font-weight: 600; }
.tabs-more {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  color: #6a6a6a; border-radius: 8px;
}
.tabs-more:active { background: #0c0c0c; }

/* ---------- 规格卡片 ---------- */
.spec-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 4px 14px 0;
}
.spec {
  background: var(--card); border-radius: 12px; padding: 13px 12px;
  text-align: left; box-shadow: var(--shadow);
  border: 1px solid transparent;
  transition: all .15s;
  min-width: 0;
}
.spec:active { border-color: var(--primary); transform: scale(.98); }
.spec b {
  display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spec small { display: block; color: #2c2c2c; font-size: 11.5px; margin-top: 3px; }

.empty-tip { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0; margin: 0; }

/* ---------- 分类面板 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(214,214,214,.42);
  z-index: 60;
}
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 61;
  background: #0c0c0c; border-radius: 18px 18px 0 0;
  padding: 16px 16px 26px;
  box-shadow: 0 -6px 30px rgba(242,242,242,.14);
  animation: sheetUp .22s ease-out;
}
@keyframes sheetUp { from { transform: translateX(-50%) translateY(100%); } to { transform: translateX(-50%) translateY(0); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head b { font-size: 16px; }
.sheet-close { font-size: 13px; color: var(--muted); padding: 4px 6px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.cat-item {
  height: 40px; border-radius: 10px; background: #0c0c0c;
  font-size: 13px; color: var(--sub);
  display: grid; place-items: center;
}
.cat-item.active { background: #121212; color: var(--primary); font-weight: 600; }

/* ---------- 详情页 ---------- */
.notice-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.notice-card h3 { margin: 0 0 10px; font-size: 15px; }
.notice-body { display: flex; gap: 12px; align-items: flex-start; }
.notice-demo {
  width: 92px; flex: none; display: block; border-radius: 8px;
  aspect-ratio: 340 / 432; object-fit: cover;
}
.notice-list { margin: 0; padding: 0; list-style: none; flex: 1; min-width: 0; }
.notice-list li {
  position: relative; padding-left: 24px; font-size: 13px;
  color: var(--sub); line-height: 1.75;
}
.notice-list li + li { margin-top: 4px; }
.notice-list li::before {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 15px; height: 15px; border-radius: 50%;
  background-color: #2c2c2c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
  background-size: 9px 9px; background-position: center; background-repeat: no-repeat;
}

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-top: 12px; box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); display: inline-block; }

.kv { display: grid; grid-template-columns: 78px 1fr; gap: 10px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; font-size: 13.5px; color: var(--text); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid rgba(242,242,242,.1); display: inline-block;
}
.req { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.req span { color: var(--muted); font-size: 13.5px; }
.req p { margin: 6px 0 0; font-size: 13px; color: var(--sub); line-height: 1.75; }

/* ---------- 底部按钮 ---------- */
.bottom-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.btn {
  flex: 1; height: 46px; border-radius: 23px;
  font-size: 15.5px; font-weight: 600;
  display: grid; place-items: center;
  transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, #6a6a6a, #6a6a6a);
  color: #0c0c0c; box-shadow: 0 6px 16px rgba(106,106,106,.32);
}
.btn.ghost {
  background: #0c0c0c; color: var(--primary);
  border: 1px solid #121212;
}
.btn.full { flex: 1 1 100%; width: 100%; }

/* ---------- 裁剪 ---------- */
.crop-wrap {
  position: relative; background: #d6d6d6; border-radius: var(--radius);
  overflow: hidden; touch-action: none;
}
#cropCanvas { display: block; width: 100%; height: 380px; }
.crop-hint {
  position: absolute; left: 0; right: 0; top: 8px;
  text-align: center; font-size: 11.5px; color: rgba(12,12,12,.6);
  pointer-events: none;
}
.zoom-row {
  display: flex; align-items: center; gap: 10px;
  background: #0c0c0c; border-radius: var(--radius);
  padding: 10px 14px; margin-top: 12px; box-shadow: var(--shadow);
}
.zoom-row span { font-size: 13px; color: var(--muted); flex: none; }
input[type=range] {
  flex: 1; -webkit-appearance: none; height: 4px; border-radius: 2px;
  background: #121212; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 2px 6px rgba(106,106,106,.4);
  cursor: pointer;
}

.cut-panel {
  background: #0c0c0c; border-radius: var(--radius); padding: 12px 14px;
  margin-top: 12px; box-shadow: var(--shadow);
}
.cut-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.cut-tab { font-size: 14px; color: var(--muted); padding: 2px 0; position: relative; }
.cut-tab.active { color: var(--primary); font-weight: 600; }
.cut-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px;
  height: 2px; border-radius: 1px; background: var(--primary);
}
.cut-size { display: flex; align-items: center; gap: 8px; }
.cut-label { color: var(--muted); font-size: 13.5px; margin-right: 4px; }
.cut-size input {
  width: 76px; height: 38px; border-radius: 8px; border: 0;
  background: #0c0c0c; text-align: center; font-size: 15px; color: var(--text);
  outline: none;
}
.cut-size input:focus { background: #0c0c0c; }
.cut-x { color: var(--muted); }
.cut-unit { color: var(--muted); font-size: 13px; }

/* ---------- 结果 ---------- */
.result-wrap {
  background: #0c0c0c; border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); text-align: center;
  position: relative;
}
/* 服务端处理中 */
.result-wrap.loading::after {
  content: '处理中…';
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  padding: 7px 16px; border-radius: 999px;
  background: rgba(242,242,242,.62); color: #0c0c0c;
  font-size: 12px; letter-spacing: .5px; white-space: nowrap;
  pointer-events: none; z-index: 3;
}
.result-wrap.loading #resultCanvas { opacity: .5; }

/* 普通 / 高清 切换 */
.mode-tabs {
  display: flex; gap: 6px; background: #0c0c0c; border-radius: 22px;
  padding: 4px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.mode-tab {
  flex: 1; height: 36px; border-radius: 18px; font-size: 13.5px;
  color: var(--sub); background: transparent; border: 0;
  transition: all .15s;
}
.mode-tab.active { background: var(--primary); color: #0c0c0c; font-weight: 500; }

/* 主图 + 排版照并排 */
.result-duo { display: flex; gap: 10px; align-items: flex-start; }
.result-duo .result-wrap { flex: 1; min-width: 0; padding: 12px; }
.result-duo #resultCanvas { max-height: 340px; }
.sheet-col { flex: none; width: 116px; }
.sheet-shell {
  position: relative; background: #0c0c0c; border-radius: 10px;
  padding: 7px; box-shadow: var(--shadow);
}
.sheet-badge {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  background: #6a6a6a; color: #0c0c0c; font-size: 10px; font-weight: 500;
  padding: 2px 7px; border-radius: 9px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(106,106,106,.35);
}
#sheetCanvas { width: 100%; height: auto; display: block; border-radius: 3px; }
.sheet-dl {
  width: 100%; margin-top: 8px; height: 30px; border-radius: 15px;
  background: #0c0c0c; color: var(--primary); font-size: 12px; border: 0;
}
.sheet-info {
  font-size: 10.5px; color: var(--muted); text-align: center;
  margin: 5px 0 0; line-height: 1.4;
}
#resultCanvas {
  max-width: 100%; max-height: 380px;
  border-radius: 8px; box-shadow: 0 4px 18px rgba(242,242,242,.12);
  background: #0c0c0c;
}
.result-meta { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.panel {
  background: #0c0c0c; border-radius: var(--radius); padding: 16px;
  margin-top: 12px; box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.bg-list { display: flex; gap: 14px; flex-wrap: wrap; }
.bg-item {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid transparent; padding: 2px; position: relative;
  transition: all .15s;
}
.bg-item i {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  border: 1px solid rgba(242,242,242,.12);
}
.bg-item.active { border-color: var(--primary); }
.tol-row {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
}
.tol-row span { font-size: 13px; color: var(--muted); flex: none; width: 56px; }
.tol-row b { font-size: 13px; color: var(--primary); width: 42px; text-align: right; flex: none; }
.tip { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 12px 0 0; }

/* ---------- 区块标题（我的页） ---------- */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 2px 10px;
}
.sec-head h2 { font-size: 16px; margin: 0; font-weight: 600; }
.sec-head span { font-size: 12px; color: var(--muted); }

/* ---------- 规格列表页 ---------- */
.spec-search {
  display: flex; align-items: center; gap: 8px;
  background: #0c0c0c; border-radius: 22px; padding: 0 14px; height: 42px;
  margin-bottom: 14px; color: var(--muted);
}
.spec-search input {
  flex: 1; border: 0; outline: 0; background: none;
  font-size: 14px; color: var(--text);
}
.spec-search input::placeholder { color: var(--muted); }

.cat-tiles {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
  margin-bottom: 16px; padding-bottom: 2px;
}
.cat-tiles::-webkit-scrollbar { display: none; }
.cat-page {
  flex: none; width: 100%;
  display: grid; grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 8px;
  scroll-snap-align: start;
}
.cat-tile {
  background: #0c0c0c; border: 0; border-radius: 12px;
  padding: 12px 4px 10px; display: flex; flex-direction: column;
  align-items: center; gap: 7px; font-size: 12px; color: var(--text);
  box-shadow: var(--shadow); transition: transform .12s, background .15s;
}
.cat-tile:active { transform: scale(.96); }
.cat-tile .ct-ico { display: grid; place-items: center; height: 22px; }
.cat-tile .ct-name { white-space: nowrap; }
.cat-tile.active {
  background: var(--primary); color: #0c0c0c;
  box-shadow: 0 6px 16px rgba(106,106,106,.3);
}

.spec-rows { display: flex; flex-direction: column; gap: 10px; }
.spec-row {
  background: #0c0c0c; border: 0; border-radius: 12px;
  padding: 14px 16px; text-align: left; transition: background .12s;
}
.spec-row:active { background: #0c0c0c; }
.spec-row b {
  display: block; font-size: 15px; font-weight: 600;
  margin-bottom: 8px; color: var(--text);
}
.sr-meta { display: flex; gap: 20px; }
.sr-meta em { font-style: normal; font-size: 12.5px; color: var(--muted); }

/* ---------- 我的 ---------- */
.mine-head {
  display: flex; align-items: center; gap: 12px;
  background: #0c0c0c; border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #6a6a6a, #6a6a6a);
  color: #0c0c0c; display: grid; place-items: center; font-size: 18px; font-weight: 600;
}
.mine-head b { display: block; font-size: 15px; }
.mine-head small { color: var(--muted); font-size: 12px; }

.his-list { display: flex; flex-direction: column; gap: 10px; }
.his-item {
  display: flex; align-items: center; gap: 12px;
  background: #0c0c0c; border-radius: 12px; padding: 10px 12px;
  box-shadow: var(--shadow);
}
.his-item img {
  width: 44px; height: 60px; object-fit: cover; border-radius: 6px;
  background: #0c0c0c; flex: none;
}
.his-item b { display: block; font-size: 14px; font-weight: 600; }
.his-item small { color: var(--muted); font-size: 11.5px; }

/* ---------- 底部 tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: 58px; display: flex;
  background: rgba(12,12,12,.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: var(--muted); font-size: 11px;
}
.tab.active { color: var(--primary); }

/* ---------- 摄像头 ---------- */
.camera {
  position: fixed; inset: 0; background: #f2f2f2; z-index: 100;
  display: flex; flex-direction: column;
}
.camera video { flex: 1; width: 100%; object-fit: cover; }
.camera-stroke {
  /* 垂直居中于视频区域（减去底部 110px 控制条后的一半） */
  position: absolute; left: 50%; top: calc(50% - 55px);
  transform: translate(-50%, -50%);
  width: 84vw; max-width: 460px;
  pointer-events: none; user-select: none;
}
.camera-bar {
  height: 110px; display: flex; align-items: center; justify-content: space-around;
  background: #f2f2f2;
}
.shutter {
  width: 66px; height: 66px; border-radius: 50%;
  background: #0c0c0c; border: 5px solid #2c2c2c;
}
.camera-bar .btn { flex: none; width: 76px; color: #0c0c0c; border-color: #8a8a8a; background: #d6d6d6; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(10px);
  background: rgba(138,138,138,.92); color: #0c0c0c;
  padding: 10px 18px; border-radius: 22px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: all .22s; z-index: 200;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
