* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: #f5f3ee; color: #23231f; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.hidden-input { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.page { max-width: 480px; margin: 0 auto; padding: 0 16px 120px; padding-top: 12px; padding-top: var(--content-top, 12px); min-height: 100vh; }
.head { padding: 8px 2px 14px; }
.head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.sub { margin: 2px 0 0; color: #7a776d; font-size: 13px; }

.pick { display: block; text-align: center; border: 1.5px dashed #c9c4b6; border-radius: 16px; background: #fbfaf7; padding: 44px 16px 36px; cursor: pointer; }
.pick:active { background: #f0ede5; }
.pick-icon { display: inline-block; width: 52px; height: 52px; position: relative; margin-bottom: 14px; }
.pick-icon .g { position: absolute; width: 23px; height: 23px; border-radius: 6px; background: #3d6b5c; opacity: .85; }
.pick-icon .g:nth-child(1) { left: 0; top: 0; }
.pick-icon .g:nth-child(2) { right: 0; top: 0; opacity: .55; }
.pick-icon .g:nth-child(3) { left: 0; bottom: 0; opacity: .55; }
.pick-icon .g:nth-child(4) { right: 0; bottom: 0; opacity: .3; }
.pick-title { display: block; font-size: 17px; font-weight: 600; }
.pick-hint { display: block; margin-top: 4px; color: #8a867b; font-size: 12px; }
.tips { list-style: none; margin: 18px 0 0; padding: 0; color: #5d5a52; font-size: 13px; }
.tips li { padding: 9px 2px; border-bottom: 1px solid #e7e3d9; }
.tips li:last-child { border-bottom: 0; }
.tips b { color: #23231f; font-weight: 600; }

.seg { display: flex; background: #e9e5db; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 0; border-radius: 8px; font-size: 14px; color: #6b685f; }
.seg button.on { background: #fff; color: #23231f; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.stage { position: relative; border-radius: 12px; overflow: hidden; background-color: #fff;
  background-image: linear-gradient(45deg, #ece9e1 25%, transparent 25%), linear-gradient(-45deg, #ece9e1 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ece9e1 75%), linear-gradient(-45deg, transparent 75%, #ece9e1 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.stage canvas { display: block; width: 100%; touch-action: none; }
.note { margin: 6px 2px 0; min-height: 18px; color: #8a867b; font-size: 12px; }
.note.warn { color: #a0522d; }

.panel { background: #fff; border-radius: 12px; padding: 4px 14px; margin-top: 12px; }
.row { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid #f0ede6; }
.row:last-child { border-bottom: 0; }
.lbl { width: 72px; flex: none; color: #4a4841; }
.val { width: 34px; flex: none; text-align: right; color: #8a867b; font-variant-numeric: tabular-nums; }
.mini { color: #9a968b; font-size: 12px; margin-left: 8px; }
.mini.block { display: block; margin: 6px 2px; }
.center { text-align: center; }
input[type=range] { flex: 1; min-width: 0; margin: 0 6px; accent-color: #3d6b5c; }
input[type=range]:disabled { opacity: .35; }
.bginfo { display: flex; align-items: center; color: #6b685f; }
.bginfo i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid #d8d4c9; margin-right: 6px; background: #fff; }
.bginfo i.clear { background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%), linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%); background-size: 8px 8px; background-position: 0 0, 4px 4px; }

.sw { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.sw i { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 12px; background: #dcd8cd; transition: background .15s; pointer-events: none; }
.sw i:after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.sw input:checked + i { background: #3d6b5c; }
.sw input:checked + i:after { transform: translateX(18px); }

.step { display: flex; align-items: center; border: 1px solid #e2ded3; border-radius: 9px; overflow: hidden; }
.step button { width: 38px; height: 32px; border: 0; background: #f7f5f0; font-size: 18px; }
.step button:active { background: #ebe7dd; }
.step output { width: 36px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.presets { flex-wrap: wrap; padding: 8px 0; }
.chips { display: flex; flex-wrap: wrap; }
.chip { border: 1px solid #e2ded3; background: #fff; border-radius: 16px; padding: 4px 12px; margin: 3px 6px 3px 0; font-size: 13px; color: #4a4841; }
.chip.on { border-color: #3d6b5c; background: #3d6b5c; color: #fff; }

.results-head { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 8px; }
#countText { font-weight: 600; }
.link { border: 0; background: none; color: #3d6b5c; padding: 4px 0; }
.results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 8px; }
.card { background: #fff; border-radius: 10px; padding: 6px 6px 4px; position: relative; }
.card .th { display: block; width: 100%; height: 0; padding-bottom: 100%; position: relative; border-radius: 6px; overflow: hidden;
  background-color: #fff; background-image: linear-gradient(45deg, #efece5 25%, transparent 25%, transparent 75%, #efece5 75%), linear-gradient(45deg, #efece5 25%, transparent 25%, transparent 75%, #efece5 75%); background-size: 10px 10px; background-position: 0 0, 5px 5px; }
.card canvas, .card img.result-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
.card img.result-img { -webkit-user-select: auto; user-select: auto; -webkit-touch-callout: default; pointer-events: auto; touch-action: manipulation; }
.card .th { -webkit-user-select: auto; user-select: auto; -webkit-touch-callout: default; }
.card .no { position: absolute; left: 4px; top: 4px; font-size: 10px; background: rgba(35,35,31,.72); color: #fff; border-radius: 4px; padding: 0 4px; line-height: 16px; }
.card .act { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 3px; font-size: 11px; color: #9a968b; }
.card .act button { flex: none; border: 0; background: #eef3f0; color: #3d6b5c; border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.card .act button.ghost { background: transparent; color: #9a968b; padding: 1px 4px; }
.card.off .th { opacity: .25; }
.card.off .act button:not(.ghost) { visibility: hidden; }
.card.done .act button { background: #3d6b5c; color: #fff; }

.credit { text-align: center; color: #b3afa3; font-size: 12px; margin: 28px 0 8px; letter-spacing: 1px; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); background: rgba(245,243,238,.94); border-top: 1px solid #e7e3d9; }
.primary, .secondary { display: block; width: 100%; max-width: 448px; margin: 0 auto; border-radius: 12px; font-size: 16px; font-weight: 600; padding: 13px 0; }
.primary { border: 0; background: #23231f; color: #fff; }
.primary:active, .secondary:active { opacity: .85; }
.primary:disabled, .secondary:disabled { opacity: .4; }
.secondary { margin-top: 8px; border: 1px solid #23231f; background: transparent; color: #23231f; padding: 11px 0; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: 86%; background: rgba(35,35,31,.9); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; text-align: center; z-index: 30; }
.busy { position: fixed; left: 0; right: 0; top: 0; bottom: 0; background: rgba(245,243,238,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.busy-box { width: 220px; background: #fff; border-radius: 14px; padding: 18px 18px 20px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.busy-text { font-size: 14px; margin-bottom: 10px; text-align: center; }
.prog { height: 4px; background: #ece9e1; border-radius: 2px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: #3d6b5c; transition: width .12s; }
