/* 拼豆图纸工坊 - 移动端样式（原创设计） */
:root {
  --c-bg: #fff1f7;
  --c-card: #ffffff;
  --c-text: #351326;
  --c-sub: #8c6a7e;
  --c-primary: #e84393;
  --c-primary-2: #ff6f9c;
  --c-accent: #ffd166;
  --c-border: #f3d9e4;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(232, 67, 147, 0.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 15px;
  line-height: 1.5;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 64px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }

/* 页面头 */
.page-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center;
  padding: 12px 14px;
  background: rgba(255, 241, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
}
.page-header__back { width: 32px; font-size: 26px; line-height: 1; color: var(--c-sub); }
.page-header h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
.page-header__right { width: 32px; }
.page-body { padding: 14px; }
.page-missing { padding: 80px 20px; text-align: center; color: var(--c-sub); }

/* 首页 */
.home-hero {
  padding: 26px 20px 20px;
  background: linear-gradient(160deg, #ffd6e8 0%, #fff1f7 60%, #fff8f0 100%);
  border-radius: 0 0 24px 24px;
}
.home-hero__title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.home-hero__sub { margin: 6px 0 0; color: var(--c-sub); font-size: 13px; }
.home-balance {
  margin-top: 16px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.85); border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--shadow);
}
.home-balance__label { color: var(--c-sub); font-size: 13px; }
.home-balance__num { font-size: 22px; font-weight: 800; color: var(--c-primary); flex: 1; }

.btn {
  border: none; cursor: pointer; border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  background: #f3d9e4; color: var(--c-text); transition: opacity .15s;
}
.btn:active { opacity: .7; }
.btn--primary { background: linear-gradient(135deg, var(--c-primary), var(--c-primary-2)); color: #fff; }
.btn--secondary { background: #fff; border: 1px solid var(--c-border); color: var(--c-text); }
.btn--danger { background: #ffe3e3; color: #d64545; }
.btn--mini { padding: 6px 12px; font-size: 12px; }
.btn--lg { width: 100%; padding: 13px; font-size: 16px; }
.btn--block { width: 100%; margin-top: 16px; }

.home-entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 14px 0; }
.entry-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--c-card); border-radius: var(--radius); padding: 16px 10px;
  box-shadow: var(--shadow); text-align: center;
}
.entry-card__icon { font-size: 30px; }
.entry-card__title { font-size: 14px; font-weight: 700; }
.entry-card__desc { font-size: 11px; color: var(--c-sub); line-height: 1.4; min-height: 30px; }
.entry-card__price {
  font-size: 11px; color: var(--c-primary); font-weight: 700;
  background: #fff0f6; border-radius: 999px; padding: 3px 8px; align-self: center;
}
.entry-card--photo { border-top: 3px solid #ff8fa3; }
.entry-card--qr { border-top: 3px solid #b39ddb; }
.entry-card--text { border-top: 3px solid #ffd166; }

.home-quick { display: flex; gap: 10px; padding: 14px; }
.quick-link {
  flex: 1; text-align: center; padding: 10px; font-size: 13px; font-weight: 600;
  background: #fff; border-radius: 12px; border: 1px dashed #e8b8cc; color: var(--c-primary);
}
.section-title { font-size: 15px; margin: 6px 0 10px; padding: 0 14px; font-weight: 700; }
.home-drafts { padding-bottom: 10px; }

/* 草稿/作品卡片 */
.draft-item, .work-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--c-card); border-radius: 12px; margin: 0 14px 10px; padding: 10px;
  box-shadow: var(--shadow); cursor: pointer;
}
.draft-item__thumb {
  width: 56px; height: 56px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; overflow: hidden;
}
.draft-item__info { flex: 1; min-width: 0; }
.draft-item__title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-item__meta { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
.work-card__thumb { flex-shrink: 0; border-radius: 8px; overflow: hidden; background: #f6e8ef; }
.work-card__thumb--mini { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; }
.work-card__thumb canvas { display: block; }
.work-card__info { flex: 1; min-width: 0; }
.work-card__title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-card__meta { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
.work-card__share { font-size: 18px; padding: 8px; }

.empty { text-align: center; color: var(--c-sub); padding: 40px 0; font-size: 14px; }

/* 分段切换 */
.seg { display: flex; background: #f6e8ef; border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg__btn { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--c-sub); cursor: pointer; }
.seg__btn.active { background: #fff; color: var(--c-primary); box-shadow: 0 2px 8px rgba(232,67,147,.15); }

/* 赚豆豆 */
.earn-card {
  background: linear-gradient(135deg, #ffd6e8, #ffe3f0);
  border-radius: var(--radius); text-align: center; padding: 28px 16px; margin-bottom: 14px;
}
.earn-card__beans { font-size: 40px; font-weight: 800; color: var(--c-primary); }
.earn-card__label { color: var(--c-sub); font-size: 13px; margin-top: 4px; }
.earn-list { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.earn-item {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border-bottom: 1px solid #f9edf2;
}
.earn-item:last-child { border-bottom: none; }
.earn-item__icon { font-size: 22px; }
.earn-item__name { flex: 1; font-weight: 600; }
.earn-item__reward { color: var(--c-primary); font-weight: 700; font-size: 13px; }
.earn-item__arrow { color: #d8b8c6; font-size: 18px; }
.earn-tasks { margin-top: 16px; }
.task-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--c-card); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.task-item__name { font-weight: 600; font-size: 14px; }
.task-item__desc { font-size: 12px; color: var(--c-sub); }
.task-item .btn { margin-left: auto; flex-shrink: 0; }

/* 签到 */
.checkin-hero {
  background: linear-gradient(135deg, #ffd6e8, #fff1f7);
  border-radius: var(--radius); text-align: center; padding: 40px 20px;
}
.checkin-hero__beans { font-size: 48px; font-weight: 800; color: var(--c-primary); }
.checkin-hero__label { color: var(--c-sub); margin: 8px 0 20px; }
.checkin-tip { text-align: center; color: var(--c-sub); font-size: 12px; margin-top: 12px; }

/* 表单 */
.form-card { background: var(--c-card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--c-sub); margin: 12px 0 6px; }
.form-label:first-child { margin-top: 0; }
.form-input {
  width: 100%; border: 1px solid var(--c-border); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; background: #fffdfe; color: var(--c-text); outline: none;
}
.form-input:focus { border-color: var(--c-primary-2); }
.form-tip { font-size: 12px; color: var(--c-sub); margin-top: 10px; text-align: center; }

/* 登录 */
.login-box { padding: 30px 10px; text-align: center; }
.login-logo { font-size: 56px; }
.login-box h2 { margin: 10px 0 2px; font-size: 22px; }
.login-sub { color: var(--c-sub); font-size: 13px; margin-bottom: 20px; }
.login-tabs { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.login-tab { border: none; background: transparent; font-size: 16px; font-weight: 700; color: var(--c-sub); padding: 6px 2px; cursor: pointer; border-bottom: 2px solid transparent; }
.login-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* 我的 */
.login-prompt { text-align: center; padding: 60px 20px; }
.login-prompt__icon { font-size: 60px; }
.login-prompt__text { color: var(--c-sub); margin: 10px 0 20px; }
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #ffd6e8, #fff1f7);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.profile-card__avatar {
  width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--c-primary);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; overflow: hidden;
}
.profile-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-card__info { flex: 1; min-width: 0; }
.profile-card__name { font-size: 17px; font-weight: 700; }
.profile-card__id { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
.profile-card__beans { font-size: 13px; color: var(--c-primary); font-weight: 700; }
.profile-card__beans span { font-size: 20px; }
.profile-menu { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid #f9edf2; font-size: 14px; font-weight: 500; }
.menu-item:last-child { border-bottom: none; }
.menu-item span:first-child { font-size: 18px; }
.menu-item__arrow { margin-left: auto; color: #d8b8c6; }

/* 工作室 */
.studio-upload {
  border: 2px dashed #e8b8cc; border-radius: var(--radius);
  padding: 36px 16px; text-align: center; background: #fffdfe; cursor: pointer;
  margin-bottom: 14px;
}
.studio-upload__icon { font-size: 42px; }
.studio-upload__text { font-weight: 700; margin-top: 8px; font-size: 15px; }
.studio-upload__sub { font-size: 12px; color: var(--c-sub); margin-top: 4px; }
.studio-link-input, .studio-text-input { margin-top: 12px; }
.studio-preview { text-align: center; margin-bottom: 14px; }
.studio-preview canvas { border-radius: 12px; box-shadow: var(--shadow); max-width: 100%; }
.studio-params { background: var(--c-card); border-radius: var(--radius); padding: 6px 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.param-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f9edf2; }
.param-row:last-child { border-bottom: none; }
.param-label { flex: 1; font-size: 14px; font-weight: 500; }
.param-stepper { display: flex; align-items: center; gap: 10px; }
.stepper-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--c-border);
  background: #fff; font-size: 18px; cursor: pointer; color: var(--c-primary);
}
.stepper-val { min-width: 34px; text-align: center; font-weight: 700; font-size: 16px; }
.param-select {
  border: 1px solid var(--c-border); border-radius: 10px; padding: 8px 10px; font-size: 14px;
  background: #fff; color: var(--c-text); outline: none;
}
.switch { position: relative; width: 48px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute; inset: 0; background: #e8c6d6; border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch__slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch__slider { background: var(--c-primary); }
.switch input:checked + .switch__slider::before { transform: translateX(22px); }
input[type="range"] { flex: 1; accent-color: var(--c-primary); }

.studio-actions { margin-bottom: 14px; }
.studio-result { background: var(--c-card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.result-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.result-canvas-wrap { text-align: center; overflow: auto; -webkit-overflow-scrolling: touch; }
.result-canvas-wrap canvas { max-width: 100%; image-rendering: pixelated; }

/* 图纸查看 */
.view-card { background: var(--c-card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); text-align: center; overflow: auto; margin-bottom: 12px; }
.view-card canvas { max-width: 100%; image-rendering: pixelated; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.view-actions .btn { flex: 1; min-width: 90px; }

/* 色号统计 */
.stats-title { font-size: 14px; margin: 4px 0 10px; }
.stats-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.stat-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  background: #fff8fb; border-radius: 10px; padding: 8px 10px;
}
.stat-item__swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.08); flex-shrink: 0; }
.stat-item__name { font-weight: 600; }
.stat-item__code { color: var(--c-sub); font-size: 11px; }
.stat-item__count { margin-left: auto; color: var(--c-sub); font-size: 12px; flex-shrink: 0; }

/* 列表（订单/流水） */
.order-list, .ledger-list { display: flex; flex-direction: column; gap: 10px; }
.order-item, .ledger-item {
  display: flex; align-items: center; background: var(--c-card);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow);
}
.order-item__main, .ledger-item__main { flex: 1; min-width: 0; }
.order-item__title, .ledger-item__name { font-weight: 600; font-size: 14px; }
.order-item__meta, .ledger-item__time { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
.order-item__beans { color: var(--c-primary); font-weight: 700; }
.ledger-item__delta { font-weight: 800; font-size: 16px; }
.ledger-item__delta.plus { color: #27ae60; }
.ledger-item__delta.minus { color: #e74c3c; }

/* 帮助 / 富文本 */
.guide-list { display: flex; flex-direction: column; gap: 10px; }
.guide-item {
  display: flex; gap: 12px; background: var(--c-card); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow);
}
.guide-item__icon { font-size: 26px; }
.guide-item__title { font-weight: 700; font-size: 14px; }
.guide-item__desc { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
.rich { background: var(--c-card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.rich h3 { margin: 18px 0 8px; font-size: 15px; }
.rich h3:first-child { margin-top: 0; }
.rich p { font-size: 14px; color: #5d4a55; margin: 0 0 10px; line-height: 1.8; }
.rich ol { padding-left: 20px; }
.rich li { margin-bottom: 6px; font-size: 14px; line-height: 1.7; color: #5d4a55; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; background: rgba(255,255,255,0.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--c-border); z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; color: #b391a3; font-size: 11px;
}
.tabbar__icon { font-size: 20px; line-height: 1; }
.tabbar__item.active { color: var(--c-primary); font-weight: 700; }

/* Toast */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: rgba(53,19,38,0.92); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 999px; z-index: 99;
  opacity: 0; pointer-events: none; transition: .25s; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 空状态 */
.page-missing { padding: 80px 20px; text-align: center; color: var(--c-sub); }
