:root {
  --paper: #f6f8ff;
  --paper-2: #ffffff;
  --ink: #172033;
  --muted: #70798c;
  --line: #e1e6f0;
  --coral: #ff7f8e;
  --coral-deep: #ef5f75;
  --mint: #6ed1cf;
  --sky: #1fa7e1;
  --butter: #ffb356;
  --rose: #ffb2e7;
  --violet: #7d61a6;
  --blue: #3457f1;
  --green: #05f873;
  --panel: rgba(255, 255, 255, .93);
  --panel-soft: #f7fbff;
  --shadow: 0 22px 58px rgba(38, 45, 84, .12);
  --small-shadow: 0 10px 26px rgba(38, 45, 84, .1);
  --lift-shadow: 0 6px 0 rgba(125, 97, 166, .12), 0 22px 42px rgba(38, 45, 84, .1);
  --radius: 20px;
  --font-display: "Nunito", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Nunito", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    linear-gradient(rgba(39, 51, 74, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 51, 74, .035) 1px, transparent 1px),
    radial-gradient(circle at 18% 12%, rgba(239, 106, 91, .12), transparent 26%),
    radial-gradient(circle at 86% 4%, rgba(127, 200, 180, .16), transparent 28%),
    var(--paper);
  background-size: 22px 22px, 22px 22px, auto, auto, auto;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(1500px, calc(100% - 32px));
  margin: 18px auto 48px;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(39, 51, 74, .08);
  background: rgba(255, 253, 248, .88);
  backdrop-filter: blur(14px);
  box-shadow: var(--small-shadow);
  border-radius: var(--radius);
  position: sticky;
  top: 12px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  justify-self: start;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  background: #fffdf8 url("./assets/site-icon.png") center / cover no-repeat;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(39, 51, 74, .12);
}

.brand-mark span {
  display: none;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.view-tabs {
  display: none;
  align-items: center;
  gap: 6px;
  background: #f1e7da;
  padding: 5px;
  border-radius: 8px;
}

.view-tab {
  border: 0;
  background: transparent;
  padding: 9px 18px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
}

.view-tab.active {
  color: var(--paper-2);
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(39, 51, 74, .18);
}

.sync-pill,
.auth-pill,
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #236553;
  background: #e5f7f0;
  border: 1px solid #c3e8dc;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.auth-pill {
  min-width: 112px;
  justify-content: center;
  border: 1px solid #cfe0ff;
  color: #2f78ff;
  background: #eef5ff;
  cursor: pointer;
  justify-self: end;
}

.auth-pill[data-auth-state="synced"] {
  color: #236553;
  background: #e5f7f0;
  border-color: #c3e8dc;
  cursor: pointer;
}

.logout-text {
  margin-left: 4px;
  padding-left: 8px;
  color: #dd4f43;
  border-left: 1px solid rgba(35, 101, 83, .24);
  font-style: normal;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(127, 200, 180, .18);
}

.view-panel {
  display: none;
  margin-top: 22px;
}

.view-panel.active {
  display: block;
}

.web-app {
  min-height: 860px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 330px;
  gap: 16px;
}

.web-sidebar,
.web-center,
.web-inspector,
.page-preview,
.design-system {
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(39, 51, 74, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.web-sidebar,
.web-inspector {
  padding: 16px;
}

.web-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-head,
.block-title,
.canvas-toolbar,
.mini-header,
.mini-topline,
.profile-layout,
.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--coral-deep);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
}

.side-head h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.18;
}

.icon-btn,
.tool-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}

svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-panel,
.section-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf2;
}

.upload-panel {
  display: grid;
  gap: 12px;
}

.upload-panel h2,
.mini-upload h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.upload-panel p,
.mini-upload p,
.design-system p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.upload-art {
  min-height: 118px;
  display: grid;
  place-items: center;
  border: 1px dashed #d9c8b6;
  border-radius: 8px;
  background: #fffdf8;
}

.mini-bead-grid {
  width: 84px;
  height: 84px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  transform: rotate(-4deg);
}

.mini-bead-grid::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  background:
    radial-gradient(circle, #ef6a5b 0 42%, transparent 45%) 0 0 / 12px 12px,
    radial-gradient(circle, #f4c86b 0 42%, transparent 45%) 6px 6px / 12px 12px,
    radial-gradient(circle, #7fc8b4 0 42%, transparent 45%) 3px 9px / 12px 12px,
    radial-gradient(circle, #80a9d6 0 42%, transparent 45%) 9px 3px / 12px 12px;
  border-radius: 8px;
}

.primary-btn,
.secondary-btn,
.text-btn,
.style-card,
.brand-chip,
.dropzone,
.apple-upload,
.apple-choice button,
.apple-actions button,
.apple-primary,
.apple-mobile-upload,
.apple-mobile-choice button,
.preset-row button,
.export-grid button,
.mini-style-scroll button,
.mini-toggle-line button,
.mini-tool-dock button,
.mini-tabbar button {
  border: 0;
  cursor: pointer;
}

.dropzone {
  min-height: 240px;
  width: 100%;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 22px;
  text-align: center;
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(90deg, rgba(239, 106, 91, .45) 0 12px, rgba(127, 200, 180, .45) 12px 24px, rgba(244, 200, 107, .45) 24px 36px) border-box;
  border: 2px dashed transparent;
  border-radius: 8px;
  box-shadow: var(--small-shadow);
}

.dropzone:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(54, 44, 31, .14);
}

.dropzone h2 {
  margin-bottom: 6px;
  font-size: 26px;
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dropzone > span {
  display: inline-flex;
  padding: 10px 14px;
  color: var(--coral-deep);
  background: #fff1ec;
  border: 1px solid rgba(239, 106, 91, .24);
  border-radius: 8px;
  font-weight: 900;
}

.dropzone-art {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff6ea;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(180deg, #f27868, var(--coral-deep));
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(216, 76, 66, .22);
}

.primary-btn.wide {
  width: 100%;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.secondary-btn.wide {
  width: 100%;
}

.text-btn {
  padding: 0;
  color: var(--coral-deep);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.section-block h3 {
  margin: 0;
  font-size: 17px;
}

.section-block.tight {
  margin-bottom: 14px;
}

.style-grid,
.brand-select-list,
.export-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.style-grid {
  grid-template-columns: repeat(2, 1fr);
}

.style-grid.compact {
  margin-top: 10px;
  gap: 7px;
}

.style-card {
  min-height: 66px;
  padding: 11px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.style-card b {
  display: block;
  margin-bottom: 4px;
}

.style-card span,
.brand-chip span {
  color: var(--muted);
  font-size: 12px;
}

.style-card.active,
.brand-chip.active,
.preset-row .active {
  border-color: rgba(239, 106, 91, .55);
  background: #fff1ec;
  box-shadow: inset 0 0 0 1px rgba(239, 106, 91, .16);
}

.range-row {
  display: grid;
  grid-template-columns: 70px 1fr 28px;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.color-limit-row {
  grid-template-columns: 78px 1fr 42px;
}

.color-limit-row strong {
  color: var(--ink);
  text-align: right;
  font-weight: 900;
}

.range-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pattern-mode-panel {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.pattern-mode-panel > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.mode-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mode-segment button {
  min-height: 42px;
  padding: 0 8px;
  border: 1px solid rgba(255, 127, 142, .38);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(255, 127, 142, .1);
}

.mode-segment button.active {
  color: #fff;
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  border-color: transparent;
  box-shadow: 0 6px 0 rgba(197, 67, 91, .2), 0 14px 24px rgba(239, 95, 117, .12);
}

input[type="range"] {
  accent-color: var(--coral);
}

.brand-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.brand-dropdown {
  position: relative;
  margin-top: 12px;
}

.brand-select-trigger {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
  background: #fff1ec;
  border: 1px solid rgba(239, 106, 91, .55);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(239, 106, 91, .16);
  cursor: pointer;
}

.brand-select-trigger span {
  overflow: hidden;
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-select-trigger b {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.brand-select-trigger i {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .18s ease;
}

.brand-dropdown.open .brand-select-trigger i {
  transform: translateY(2px) rotate(225deg);
}

.brand-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: rgba(255, 253, 248, .98);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 38px rgba(54, 44, 31, .14);
}

.brand-options[hidden] {
  display: none;
}

.brand-options button {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: 1px solid transparent;
  color: var(--ink);
  background: transparent;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.brand-options button:hover,
.brand-options button.active {
  background: #fff1ec;
  border-color: rgba(239, 106, 91, .25);
}

.brand-options span {
  color: var(--muted);
  font-size: 12px;
}

.module-stack {
  display: grid;
  gap: 12px;
}

.path-stack {
  display: grid;
  gap: 12px;
}

.path-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.path-card.direct-path {
  background: #fff1ec;
  border-color: rgba(239, 106, 91, .34);
}

.path-card span,
.mini-module-card > span {
  color: var(--coral-deep);
  font-size: 11px;
  font-weight: 900;
}

.path-card h2 {
  margin: 6px 0 5px;
  font-size: 20px;
}

.path-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.48;
}

.style-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}

.style-pills button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 4px;
  font-weight: 900;
  cursor: pointer;
}

.style-pills .active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.style-pills .more-style-btn {
  color: var(--muted);
  background: #fffdf8;
  border-style: dashed;
}

.path-card .primary-btn + .primary-btn,
.path-card .secondary-btn + .primary-btn {
  margin-top: 8px;
}

.ai-result-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: #e5f7f0;
  border: 1px solid #c3e8dc;
  border-radius: 8px;
}

.ai-result-panel[hidden] {
  display: none;
}

.ai-result-panel b,
.ai-result-panel span {
  display: block;
}

.ai-result-panel b {
  color: #236553;
}

.ai-result-panel span {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.advanced-box,
.inline-advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.advanced-box {
  padding: 0;
}

.advanced-box summary,
.inline-advanced summary {
  padding: 13px 14px;
  font-weight: 900;
  cursor: pointer;
}

.advanced-box .brand-select-list {
  padding: 0 14px 14px;
}

.inline-advanced {
  background: #fffdf8;
}

.inline-advanced .color-list,
.inline-advanced .check-row {
  margin-left: 12px;
  margin-right: 12px;
}

.module-card {
  position: relative;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf2;
}

.module-card.featured {
  background: linear-gradient(180deg, #fff4ef, #fffdf8);
  border-color: rgba(239, 106, 91, .35);
  box-shadow: inset 0 0 0 1px rgba(239, 106, 91, .08);
}

.module-label {
  width: fit-content;
  margin-bottom: 9px;
  padding: 5px 8px;
  color: var(--coral-deep);
  background: #fff;
  border: 1px solid rgba(239, 106, 91, .18);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

.module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.module-head h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.module-head p,
.mini-module-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.module-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(39, 51, 74, .12);
}

.module-icon.ai {
  background:
    radial-gradient(circle at 30% 28%, #fff 0 10%, transparent 11%),
    radial-gradient(circle at 66% 64%, #fff 0 9%, transparent 10%),
    linear-gradient(135deg, var(--mint), var(--sky));
}

.module-icon.bead {
  background:
    radial-gradient(circle, var(--coral) 0 38%, transparent 40%) 0 0 / 14px 14px,
    radial-gradient(circle, var(--butter) 0 38%, transparent 40%) 7px 7px / 14px 14px,
    #fff6ea;
}

.upload-art.compact {
  min-height: 78px;
  margin-top: 12px;
}

.upload-art.compact .mini-bead-grid {
  width: 58px;
  height: 58px;
}

.module-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.web-center {
  padding: 16px;
  overflow: hidden;
}

.workflow-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.step {
  position: relative;
  padding: 11px 12px;
  color: var(--muted);
  background: #f7efe5;
  border-radius: 8px;
  font-weight: 800;
  text-align: center;
}

.step.done {
  color: #236553;
  background: #e5f7f0;
}

.step.optional {
  color: #7a5b18;
  background: #fff1cf;
}

.step.active {
  color: #fff;
  background: var(--ink);
}

.canvas-stage {
  min-height: 760px;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 16px;
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(39, 51, 74, .035) 25%, transparent 25%) 0 0 / 18px 18px,
    #fffdf8;
  border: 1px solid var(--line);
}

.canvas-toolbar h2 {
  margin: 0;
}

.style-preview-card .canvas-toolbar h2 {
  display: none;
}

.tool-group {
  display: flex;
  gap: 7px;
}

.tool-btn.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.pattern-wrap {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px 0;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.pattern-board {
  width: min(620px, 92%);
  aspect-ratio: var(--board-cols, 24) / var(--board-rows, 24);
  display: grid;
  grid-template-columns: repeat(var(--board-cols, 24), 1fr);
  grid-template-rows: repeat(var(--board-rows, 24), 1fr);
  gap: var(--board-gap, 2px);
  padding: 14px;
  background: #f4eadc;
  border: 1px solid #d8c6b4;
  border-radius: 8px;
  box-shadow: 0 30px 70px rgba(39, 51, 74, .15);
  transform-origin: center;
  transition: transform .08s ease-out;
  cursor: zoom-in;
  user-select: none;
  touch-action: none;
  will-change: transform;
}

.pattern-board.image-mode {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  place-items: center;
  padding: 0;
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(90deg, rgba(239, 106, 91, .26) 0 12px, rgba(127, 200, 180, .24) 12px 24px, rgba(244, 200, 107, .24) 24px 36px) border-box;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(39, 51, 74, .04), 0 24px 60px rgba(39, 51, 74, .1);
  overflow: hidden;
}

.preview-zoom-layer {
  width: 100%;
  height: 100%;
  transform: scale(var(--preview-zoom, 1));
  transform-origin: center;
  transition: transform .12s ease-out;
}

.pattern-board.image-mode img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: auto;
}

.pattern-board.generated-pattern {
  gap: 0;
  padding: 0;
  background: #fff;
  border: 1px solid #d6dce7;
  box-shadow: 0 30px 70px rgba(39, 51, 74, .12);
  cursor: grab;
  image-rendering: auto;
}

.pattern-wrap .pattern-canvas,
.pattern-wrap img {
  pointer-events: none;
}

.pattern-board.canvas-pattern {
  display: block;
  overflow: hidden;
  background: #fff;
  aspect-ratio: var(--board-cols, 24) / var(--board-rows, 24);
}

.pattern-board.canvas-pattern .pattern-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.pattern-board.generated-pattern.is-panning,
.pattern-board.image-mode.is-panning {
  cursor: grabbing;
}

.pattern-wrap.is-panning {
  cursor: grabbing;
  user-select: none;
}

.pattern-board.preview-pattern {
  box-shadow: 0 26px 58px rgba(39, 51, 74, .1);
}

.pattern-board.final-pattern {
  box-shadow: 0 30px 70px rgba(39, 51, 74, .14);
}

.bead {
  position: relative;
  border-radius: 50%;
  background: var(--c, #fffaf2);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .13), inset 0 2px 0 rgba(255, 255, 255, .35);
}

.generated-pattern .bead {
  border-radius: 0;
  border-right: 1px solid rgba(159, 169, 188, .48);
  border-bottom: 1px solid rgba(159, 169, 188, .48);
  box-shadow: none;
  overflow: hidden;
}

.generated-pattern .bead.board-break-right,
.generated-pattern .bead.board-break-bottom,
.generated-pattern .bead.board-break-right.board-break-bottom {
  box-shadow: none;
}

.generated-pattern.show-board-lines .bead.board-break-right {
  border-right: 2px solid rgba(224, 78, 78, .9);
}

.generated-pattern.show-board-lines .bead.board-break-bottom {
  border-bottom: 2px solid rgba(224, 78, 78, .9);
}

.bead::after {
  content: attr(data-code);
  position: absolute;
  inset: 18%;
  display: grid;
  place-items: center;
  color: rgba(39, 51, 74, .66);
  font-size: clamp(5px, .62vw, 8px);
  font-weight: 900;
}

.generated-pattern .bead::after {
  inset: 0;
  color: rgba(28, 35, 51, .76);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--code-size, 6px);
  font-weight: 400;
  line-height: .9;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  transform: scale(.86);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
}

.pattern-board.hide-codes .bead::after {
  content: "";
}

.pattern-board.hide-grid {
  --board-gap: 0px;
}

.pattern-board.hide-grid .bead {
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.pattern-board.hide-grid .bead.board-break-right {
  border-right-color: transparent;
}

.pattern-board.hide-grid .bead.board-break-bottom {
  border-bottom-color: transparent;
}

.pattern-board.hide-grid.show-board-lines .bead.board-break-right {
  border-right-color: rgba(224, 78, 78, .9);
}

.pattern-board.hide-grid.show-board-lines .bead.board-break-bottom {
  border-bottom-color: rgba(224, 78, 78, .9);
}

.pattern-board.hide-background {
  background: #fff;
}

body.no-upload #webView .style-preview-card .pattern-board {
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(90deg, rgba(239, 106, 91, .2) 0 12px, rgba(127, 200, 180, .2) 12px 24px, rgba(244, 200, 107, .2) 24px 36px) border-box;
  border: 2px solid transparent;
  box-shadow: none;
}

body.no-upload #webView .style-preview-card .bead {
  background:
    radial-gradient(circle at center, transparent 0 30%, rgba(39, 51, 74, .08) 31% 34%, transparent 35%),
    #fffaf2;
  box-shadow: inset 0 -1px 0 rgba(39, 51, 74, .08), inset 0 1px 0 rgba(255, 255, 255, .75);
}

body.no-upload #webView .style-preview-card .bead::after {
  content: "";
}

body.no-upload #webView .style-preview-card .pattern-board.hide-grid {
  --board-gap: 2px;
}

.board-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.board-note span {
  padding: 7px 10px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.color-list .empty-material {
  grid-template-columns: 1fr;
  color: var(--muted);
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  padding: 14px;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-family: var(--font-display);
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.preset-row button {
  min-height: 48px;
  padding: 9px 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.board-size-panel {
  display: grid;
  gap: 13px;
  margin: 12px 0 16px;
  padding: 14px;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.size-slider-row,
.size-readonly-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 66px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.size-slider-row input {
  width: 100%;
  accent-color: var(--coral);
}

.size-readonly-row em {
  font-style: normal;
  color: #9aa2b1;
  font-size: 12px;
}

.size-slider-row strong,
.size-readonly-row strong {
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.size-slider-row b,
.size-readonly-row b {
  font-family: var(--font-display);
  font-size: 18px;
}

.editable-size-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.editable-size-value input {
  width: 44px;
  min-width: 0;
  padding: 2px 3px;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 1000;
  line-height: 1.1;
  text-align: right;
  outline: none;
}

.editable-size-value input:hover,
.editable-size-value input:focus {
  background: #fff;
  border-color: rgba(52, 87, 241, .45);
  box-shadow: 0 0 0 4px rgba(52, 87, 241, .08);
}

.editable-size-value input::-webkit-outer-spin-button,
.editable-size-value input::-webkit-inner-spin-button {
  margin: 0;
}

.size-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(39, 51, 74, .14);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.size-summary b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  accent-color: var(--coral);
}

.bead.empty {
  background: #fff;
}

.generated-pattern .bead.empty {
  background: #fff;
}

.bead.empty::after {
  content: "";
}

.recrop-btn {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  min-height: 40px;
  padding: 0 18px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.recrop-btn:hover {
  border-color: rgba(239, 106, 91, .46);
  color: var(--coral-deep);
}

.crop-modal[hidden] {
  display: none;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 28, 38, .56);
  backdrop-filter: blur(8px);
}

.crop-dialog {
  position: relative;
  width: min(1040px, calc(100vw - 36px));
  max-height: calc(100vh - 42px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px;
  background: #fffdf8;
  border: 1px solid rgba(216, 198, 180, .9);
  border-radius: 12px;
  box-shadow: 0 34px 90px rgba(24, 28, 38, .24);
}

.crop-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #9b8590;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.crop-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding-right: 44px;
}

.crop-head h2 {
  margin: 0;
  font-size: 28px;
}

.crop-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.crop-ratio-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: #f6eee4;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.crop-ratio-tabs button {
  min-width: 58px;
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.crop-ratio-tabs button.active {
  color: #fff;
  background: var(--ink);
}

.crop-stage {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(39, 51, 74, .04) 25%, transparent 25%) 0 0 / 16px 16px,
    #fffaf2;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.crop-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  border-radius: 6px;
  box-shadow: 0 16px 45px rgba(39, 51, 74, .16);
}

.crop-box {
  position: absolute;
  border: 2px solid var(--coral);
  background:
    linear-gradient(rgba(255, 255, 255, .2), rgba(255, 255, 255, .2)),
    repeating-linear-gradient(90deg, transparent 0 calc(33.333% - 1px), rgba(255, 255, 255, .7) calc(33.333% - 1px) 33.333%),
    repeating-linear-gradient(0deg, transparent 0 calc(33.333% - 1px), rgba(255, 255, 255, .7) calc(33.333% - 1px) 33.333%);
  box-shadow: 0 0 0 9999px rgba(22, 26, 34, .46);
  cursor: move;
  touch-action: none;
}

.crop-box i {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--coral);
  border-radius: 50%;
}

.crop-box i[data-crop-handle="nw"] {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.crop-box i[data-crop-handle="ne"] {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.crop-box i[data-crop-handle="sw"] {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.crop-box i[data-crop-handle="se"] {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.crop-actions .primary-btn,
.crop-actions .secondary-btn {
  min-width: 132px;
  min-height: 48px;
}

.color-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.color-list div,
.mobile-color-list div,
.setting-list div,
.mini-history div {
  display: grid;
  align-items: center;
  gap: 9px;
  padding: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.color-list div {
  grid-template-columns: 22px 1fr auto;
}

.color-list i,
.mobile-color-list i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c);
  border: 1px solid rgba(39, 51, 74, .16);
}

.color-list b,
.mobile-color-list span {
  font-size: 13px;
}

.color-list span {
  color: var(--muted);
  font-weight: 900;
}

.export-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 10px;
}

.export-grid button {
  padding: 11px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.web-pages {
  margin-top: 16px;
}

.page-preview {
  padding: 18px;
}

.profile-layout {
  align-items: stretch;
}

.user-card {
  justify-content: flex-start;
  flex: 1;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  font-weight: 900;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18);
}

.avatar.small {
  width: 42px;
  height: 42px;
}

.user-card h3,
.sync-card h2 {
  margin-bottom: 4px;
}

.user-card p,
.sync-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.history-strip {
  flex: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.history-strip div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-strip span {
  display: block;
  height: 70px;
  margin-bottom: 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle, var(--coral) 0 38%, transparent 40%) 0 0 / 14px 14px,
    radial-gradient(circle, var(--mint) 0 38%, transparent 40%) 7px 7px / 14px 14px,
    #fff6ea;
}

.history-strip b,
.history-strip small {
  display: block;
}

.history-strip small {
  color: var(--muted);
  margin-top: 3px;
}

.mini-board {
  min-height: 880px;
  display: flex;
  gap: 26px;
  align-items: flex-start;
  justify-content: center;
  padding: 28px;
  background: rgba(255, 253, 248, .86);
  border: 1px solid rgba(39, 51, 74, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.phone {
  width: 330px;
  min-width: 330px;
  height: 714px;
  padding: 12px;
  background: #263047;
  border-radius: 34px;
  box-shadow: 0 34px 80px rgba(39, 51, 74, .25);
}

.phone-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  padding: 16px 16px 72px;
  background: var(--paper);
  border-radius: 24px;
}

.mini-status {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.mini-status span {
  width: 58px;
  height: 12px;
  display: block;
  background: linear-gradient(90deg, var(--ink) 55%, transparent 55% 70%, var(--ink) 70%);
  border-radius: 10px;
  opacity: .8;
}

.mini-header {
  margin: 14px 0 16px;
}

.mini-home .mini-header {
  margin: 10px 0 10px;
}

.mini-header.compact {
  margin-bottom: 12px;
}

.mini-header p,
.mini-header h1 {
  margin: 0;
}

.mini-header p {
  color: var(--coral-deep);
  font-size: 13px;
  font-weight: 900;
}

.mini-header h1 {
  margin-top: 5px;
  font-size: 26px;
}

.mini-home .mini-header h1 {
  font-size: 24px;
}

.small-round {
  width: 38px;
  height: 38px;
  border: 0;
  background:
    radial-gradient(circle at 50% 50%, var(--butter) 0 28%, transparent 30%),
    var(--ink);
  border-radius: 50%;
}

.mini-upload {
  padding: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: var(--small-shadow);
  color: var(--ink);
  cursor: pointer;
}

.mini-home .mini-upload {
  min-height: 186px;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 16px;
  text-align: center;
}

.mini-home .mini-upload .mini-bead-grid {
  width: 74px;
  height: 74px;
}

.mini-home .mini-upload h2 {
  margin: 0 0 3px;
  font-size: 18px;
}

.mini-home .mini-upload p {
  font-size: 13px;
  line-height: 1.45;
}

.mini-home .mini-upload strong {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  color: #fff;
  background: var(--coral-deep);
  border-radius: 8px;
}

.mini-upload .primary-btn {
  margin-top: 14px;
  width: 100%;
}

.mini-module-card {
  margin-top: 9px;
  padding: 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-module-card.primary {
  background: #fff1ec;
  border-color: rgba(239, 106, 91, .32);
}

.mini-module-card > span {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--coral-deep);
  font-size: 11px;
  font-weight: 900;
}

.mini-module-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.mini-module-card .primary-btn,
.mini-module-card .secondary-btn {
  margin-top: 8px;
  padding: 10px 12px;
}

.mini-module-card p {
  font-size: 12px;
}

.mini-module-card .mini-style-scroll {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 7px;
}

.mini-module-card .mini-style-scroll button {
  min-width: 0;
  padding: 8px 6px;
  font-size: 12px;
}

.mini-choice-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.mini-choice-panel button {
  min-height: 96px;
  padding: 12px 10px;
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}

.mini-choice-panel button.active {
  background: #fff1ec;
  border-color: rgba(239, 106, 91, .36);
}

.mini-choice-panel span,
.mini-choice-panel b,
.mini-choice-panel small {
  display: block;
}

.mini-choice-panel span {
  color: var(--coral-deep);
  font-size: 11px;
  font-weight: 900;
}

.mini-choice-panel b {
  margin-top: 5px;
  font-size: 17px;
}

.mini-choice-panel small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.mini-section {
  margin-top: 16px;
}

.mini-home .mini-section {
  display: none;
}

.mini-section h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.mini-style-scroll {
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.mini-style-scroll button {
  min-width: 92px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.mini-style-scroll .active {
  color: #fff;
  background: var(--ink);
}

.mini-brand-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-brand-row span {
  padding: 10px 0;
  text-align: center;
  font-weight: 900;
  background: #fff1ec;
  border: 1px solid rgba(239, 106, 91, .22);
  border-radius: 8px;
}

.mini-tabbar,
.mini-tool-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 52px;
  display: grid;
  gap: 5px;
  padding: 6px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(39, 51, 74, .14);
}

.mini-tabbar {
  grid-template-columns: repeat(3, 1fr);
}

.mini-tool-dock {
  grid-template-columns: repeat(4, 1fr);
}

.mini-tabbar button,
.mini-tool-dock button {
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.mini-tabbar .active,
.mini-tool-dock button:first-child {
  color: #fff;
  background: var(--ink);
}

.mini-topline {
  margin: 12px 0 10px;
}

.mini-topline button {
  border: 0;
  background: transparent;
  color: var(--coral-deep);
  font-weight: 900;
}

.mini-pattern-card {
  padding: 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pattern-board.mini {
  width: 100%;
  padding: 8px;
  gap: 1px;
  box-shadow: none;
}

.pattern-board.mini .bead::after {
  content: "";
}

.mini-inspector {
  margin-top: 12px;
  padding: 12px;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.mini-metrics div {
  padding: 8px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.mini-metrics span,
.setting-list span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mini-metrics b {
  display: block;
  margin-top: 4px;
}

.mini-toggle-line {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
}

.mini-toggle-line button {
  padding: 8px 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.mini-toggle-line .active {
  color: #fff;
  background: var(--coral-deep);
}

.mobile-color-list {
  display: grid;
  gap: 6px;
}

.mobile-color-list div {
  grid-template-columns: 22px 1fr auto;
  padding: 7px;
}

.sync-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #e5f7f0;
  border: 1px solid #c3e8dc;
  border-radius: 8px;
}

.mini-history,
.setting-list {
  display: grid;
  gap: 8px;
}

.mini-history div {
  grid-template-columns: 34px 1fr auto;
}

.mini-history i {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    radial-gradient(circle, var(--coral) 0 38%, transparent 40%) 0 0 / 10px 10px,
    radial-gradient(circle, var(--mint) 0 38%, transparent 40%) 5px 5px / 10px 10px,
    #fff6ea;
}

.setting-list div {
  grid-template-columns: 1fr auto;
}

.setting-list b {
  font-size: 12px;
}

.design-system {
  padding: 28px;
}

.design-system h1 {
  font-size: 34px;
  margin-bottom: 10px;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.token-grid div {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.token-grid span {
  display: block;
  height: 80px;
  border-radius: 8px;
  background: var(--c);
  border: 1px solid rgba(39, 51, 74, .1);
}

.token-grid b,
.token-grid code {
  display: block;
  margin-top: 8px;
}

.token-grid code {
  color: var(--muted);
}

.component-showcase {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.web-flow {
  position: relative;
  min-height: calc(100vh - 130px);
  padding: 26px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(39, 51, 74, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.flow-tabs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: #f1e7da;
  border-radius: 8px;
}

.flow-tabs button {
  min-width: 124px;
  padding: 10px 18px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.flow-tabs button.active {
  color: #fff;
  background: var(--ink);
}

.login-modal[hidden] {
  display: none;
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, .34);
  backdrop-filter: blur(5px);
}

.login-dialog {
  position: relative;
  width: min(470px, calc(100vw - 36px));
  padding: 30px;
  background: rgba(255, 253, 248, .98);
  border: 1px solid rgba(39, 51, 74, .08);
  border-radius: 24px;
  box-shadow: 0 34px 90px rgba(39, 51, 74, .22);
}

.login-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 34px;
  height: 34px;
  border: 0;
  color: #9b8590;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 24px;
}

.login-brand h2 {
  margin: 0;
  font-size: 28px;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.login-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 6px;
  margin-bottom: 22px;
  background: #f2e8db;
  border-radius: 12px;
}

.login-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.login-tabs button.active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(39, 51, 74, .18);
}

.login-panel {
  display: none;
}

.login-panel.active {
  display: block;
}

.login-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.login-field span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.login-field input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.login-field input:focus {
  border-color: #b8cffc;
  box-shadow: 0 0 0 4px rgba(47, 120, 255, .1);
}

.code-field div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.code-field button {
  border: 1.5px solid rgba(239, 106, 91, .28);
  color: var(--coral-deep);
  background: #fff1ec;
  border-radius: 10px;
  font-weight: 900;
  cursor: pointer;
}

.code-field button:disabled {
  color: var(--muted);
  background: #f5efe8;
  cursor: default;
}

.login-primary,
.login-secondary {
  width: 100%;
  min-height: 54px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.login-primary {
  margin-top: 6px;
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #f36f62, #df4c43);
  box-shadow: 0 16px 34px rgba(216, 76, 66, .22);
}

.login-secondary {
  border: 1.5px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.login-consent {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-consent input {
  width: 16px;
  height: 16px;
  accent-color: var(--coral);
}

.login-hint {
  min-height: 20px;
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.login-hint[data-type="success"] {
  color: #1d8a6a;
}

.login-hint[data-type="error"] {
  color: #dd4f43;
}

.access-key-panel {
  display: grid;
  gap: 12px;
}

.access-key-panel .login-field {
  margin: 0;
}

.access-key-panel .login-hint {
  min-height: 22px;
  margin: 0;
}

.access-key-panel .login-primary:disabled {
  opacity: .62;
  cursor: wait;
}

.access-key-clear {
  margin-top: 2px;
}

.access-key-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.wechat-box {
  display: grid;
  place-items: center;
  min-height: 230px;
  margin: 4px 0 18px;
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(90deg, rgba(239, 106, 91, .34) 0 10px, rgba(127, 200, 180, .34) 10px 20px, rgba(244, 200, 107, .34) 20px 30px) border-box;
  border: 2px solid transparent;
  border-radius: 16px;
}

.wechat-qr {
  position: relative;
  width: 170px;
  height: 170px;
  padding: 14px;
  background:
    linear-gradient(90deg, var(--ink) 11px, transparent 11px) 0 0 / 22px 22px,
    linear-gradient(var(--ink) 11px, transparent 11px) 0 0 / 22px 22px,
    #fff;
  border: 10px solid #fff;
  border-radius: 10px;
  box-shadow: 0 16px 34px rgba(39, 51, 74, .12);
}

.wechat-qr span {
  position: absolute;
  width: 42px;
  height: 42px;
  background: #fff;
  border: 9px solid var(--ink);
  border-radius: 4px;
}

.wechat-qr span:nth-child(1) { top: 10px; left: 10px; }
.wechat-qr span:nth-child(2) { top: 10px; right: 10px; }
.wechat-qr span:nth-child(3) { left: 10px; bottom: 10px; }

.wechat-qr i {
  position: absolute;
  right: 30px;
  bottom: 34px;
  width: 34px;
  height: 34px;
  background:
    radial-gradient(circle at 30% 30%, var(--coral) 0 23%, transparent 25%),
    radial-gradient(circle at 70% 30%, var(--butter) 0 23%, transparent 25%),
    radial-gradient(circle at 30% 70%, var(--mint) 0 23%, transparent 25%),
    radial-gradient(circle at 70% 70%, var(--rose) 0 23%, transparent 25%),
    var(--ink);
  border: 4px solid #fff;
  border-radius: 8px;
}

.login-panel h3 {
  margin: 0;
  text-align: center;
  font-size: 24px;
}

.login-panel p {
  margin: 8px 0 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.flow-page {
  display: none;
}

.flow-page.active {
  display: block;
}

.upload-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 40px 48px;
}

.flow-title {
  margin: 0 0 26px;
}

.flow-title h1 {
  max-width: 760px;
  margin: 0;
  font-size: 48px;
  line-height: 1.12;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) 380px;
  gap: 54px;
  align-items: center;
}

.large-upload-card {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
  padding: 42px;
  text-align: center;
  color: var(--ink);
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(90deg, rgba(239, 106, 91, .45) 0 12px, rgba(127, 200, 180, .45) 12px 24px, rgba(244, 200, 107, .45) 24px 36px) border-box;
  border: 3px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.large-upload-card.is-dragging,
.large-upload-card.is-uploaded {
  background:
    linear-gradient(#f6fbff, #fffdf8) padding-box,
    repeating-linear-gradient(90deg, rgba(239, 106, 91, .6) 0 12px, rgba(127, 200, 180, .6) 12px 24px, rgba(244, 200, 107, .6) 24px 36px) border-box;
  box-shadow: 0 20px 46px rgba(54, 44, 31, .13);
}

.upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.large-upload-card h2 {
  margin: 0;
  font-size: 46px;
}

.large-upload-card p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.45;
}

.large-upload-card > span {
  padding: 15px 24px;
  color: var(--coral-deep);
  background: #fff1ec;
  border: 1px solid rgba(239, 106, 91, .28);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 900;
}

.upload-preview-art {
  width: 210px;
  height: 150px;
  display: grid;
  place-items: center;
  background: #fff6ea;
  border-radius: 8px;
  overflow: hidden;
}

.upload-preview-art .mini-bead-grid {
  width: 136px;
  height: 110px;
}

.upload-preview-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.route-panel {
  display: grid;
  gap: 18px;
}

.route-card {
  min-height: 160px;
  padding: 28px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
}

.route-card.selected {
  background: #f6f9ff;
  border-color: #b8cffc;
}

.route-card small,
.route-card b,
.route-card span {
  display: block;
}

.route-card small {
  color: #2f78ff;
  font-size: 16px;
  font-weight: 900;
}

.route-card b {
  margin-top: 12px;
  font-size: 30px;
}

.route-card span {
  margin-top: 10px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.45;
}

.style-workspace,
.pattern-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
}

#webView [data-flow-page="pattern"] .pattern-workspace {
  grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
  align-items: stretch;
  max-width: none;
  min-height: calc(100vh - 188px);
}

.style-preview-card,
.style-control-card,
.pattern-control-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--small-shadow);
}

.style-preview-card {
  height: min(780px, calc(100vh - 170px));
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 24px;
}

#webView [data-flow-page="pattern"] .style-preview-card {
  height: auto;
  min-height: calc(100vh - 188px);
}

.style-preview-card .pattern-wrap {
  min-height: 0;
  place-items: start center;
  overflow: auto;
  overscroll-behavior: contain;
}

.style-preview-card .pattern-board {
  width: min(640px, 92%);
}

#webView [data-flow-page="pattern"] .style-preview-card .pattern-board {
  width: min(100%, 980px);
}

.style-control-card,
.pattern-control-card {
  padding: 26px;
  align-self: start;
}

#webView [data-flow-page="pattern"] .pattern-control-card {
  align-self: stretch;
  max-height: calc(100vh - 188px);
  overflow: auto;
}

.style-control-card h2 {
  margin: 0 0 12px;
  font-size: 30px;
}

.style-control-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.style-control-card .style-pills {
  grid-template-columns: repeat(2, 1fr);
}

.style-control-card .style-pills button {
  min-height: 78px;
  text-align: left;
  padding: 14px 16px;
  font-size: 18px;
}

.style-control-card .primary-btn,
.style-control-card .secondary-btn,
.pattern-control-card .primary-btn,
.pattern-control-card .secondary-btn {
  margin-top: 14px;
  min-height: 54px;
  font-size: 18px;
}

.pattern-control-card .metric-grid {
  margin: 14px 0;
}

.export-modal[hidden] {
  display: none;
}

.export-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}

.export-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, .36);
  backdrop-filter: blur(4px);
}

.export-dialog {
  position: relative;
  width: min(460px, calc(100vw - 40px));
  padding: 30px;
  background: rgba(255, 253, 252, .98);
  border-radius: 24px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .22);
}

.export-close {
  position: absolute;
  top: 30px;
  right: 34px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #a48692;
  font-size: 26px;
  cursor: pointer;
}

.export-dialog h2 {
  margin: 0 0 24px;
  font-size: 28px;
}

.export-choice-list {
  display: grid;
  gap: 14px;
}

.export-choice {
  min-height: 62px;
  border: 1.5px solid var(--line);
  color: var(--ink);
  background: #fff;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.export-choice.primary {
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #f36f62, #df4c43);
  box-shadow: 0 16px 34px rgba(216, 76, 66, .22);
}

/* Web theme refresh: toy-like rounded UI, layout unchanged. */
:root {
  --paper: #f8fffe;
  --paper-2: #ffffff;
  --ink: #176d66;
  --muted: #68aaa4;
  --line: #8ee3df;
  --coral: #ff8b8b;
  --coral-deep: #ef6f7d;
  --mint: #6ed1cf;
  --sky: #1fa7e1;
  --butter: #ffb356;
  --rose: #fb96bb;
  --amethyst: #9956de;
  --slate-blue: #7274ed;
  --pastel-green: #75d06a;
  --toy-shadow: 0 7px 0 rgba(43, 163, 157, .58), 0 18px 34px rgba(31, 167, 225, .13);
  --toy-coral-shadow: 0 7px 0 rgba(205, 82, 96, .48), 0 18px 34px rgba(255, 139, 139, .18);
  --shadow: 0 18px 40px rgba(31, 167, 225, .12);
  --small-shadow: 0 7px 0 rgba(43, 163, 157, .42), 0 14px 26px rgba(31, 167, 225, .11);
  --radius: 18px;
  --font-display: "Nunito", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Nunito", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  background:
    radial-gradient(circle at 12% 10%, rgba(110, 209, 207, .18), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(31, 167, 225, .12), transparent 30%),
    radial-gradient(circle at 26% 88%, rgba(255, 179, 86, .12), transparent 34%),
    #f8fffe;
}

.topbar {
  border: 2px solid var(--mint);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--toy-shadow);
  border-radius: 20px;
}

.brand-name,
.flow-title h1,
#webView h2,
#webView h3,
#webView b,
#webView strong,
#webView button {
  letter-spacing: .01em;
}

.brand-name {
  color: #108c82;
  font-weight: 1000;
}

.brand-sub {
  color: #4f82c9;
  font-weight: 800;
}

.brand-mark {
  border: 2px solid #ffffff;
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(110, 209, 207, .58), 0 12px 20px rgba(31, 167, 225, .12);
}

.flow-tabs {
  gap: 8px;
  padding: 7px;
  background: #eaf9fb;
  border: 2px solid rgba(110, 209, 207, .72);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(110, 209, 207, .38);
}

.flow-tabs button {
  border-radius: 14px;
  color: #4f82c9;
  font-weight: 1000;
}

.flow-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #1fa7e1, #2386cf);
  box-shadow: 0 5px 0 rgba(25, 106, 181, .46);
}

.auth-pill,
.sync-pill,
.status-tag {
  color: #1a746d;
  background: #e8fbf8;
  border: 2px solid var(--mint);
  border-radius: 15px;
  box-shadow: 0 5px 0 rgba(110, 209, 207, .42);
  font-weight: 1000;
}

#webView .web-flow {
  background: rgba(255, 255, 255, .96);
  border: 2px solid rgba(110, 209, 207, .78);
  border-radius: 22px;
  box-shadow: var(--toy-shadow);
}

#webView .eyebrow {
  color: var(--coral-deep);
  font-weight: 1000;
}

#webView .flow-title h1 {
  color: #176d66;
  font-weight: 1000;
}

#webView .large-upload-card {
  background:
    linear-gradient(#ffffff, #f6ffff) padding-box,
    repeating-linear-gradient(90deg, #ff8b8b 0 14px, #6ed1cf 14px 28px, #ffb356 28px 42px, #75d06a 42px 56px) border-box;
  border: 4px solid transparent;
  border-radius: 22px;
  box-shadow: var(--toy-shadow);
}

#webView .large-upload-card.is-dragging,
#webView .large-upload-card.is-uploaded {
  background:
    linear-gradient(#ffffff, #f2fdff) padding-box,
    repeating-linear-gradient(90deg, #9956de 0 14px, #1fa7e1 14px 28px, #6ed1cf 28px 42px, #ff8b8b 42px 56px) border-box;
  box-shadow: 0 8px 0 rgba(31, 167, 225, .38), 0 22px 44px rgba(31, 167, 225, .16);
}

#webView .upload-preview-art {
  background: #fff7df;
  border: 2px solid rgba(255, 179, 86, .58);
  border-radius: 20px;
  box-shadow: 0 6px 0 rgba(255, 179, 86, .32);
}

#webView .large-upload-card > span,
#webView .recrop-btn {
  color: #ef596b;
  background: #fff4f6;
  border: 2px solid #ffb6c5;
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(239, 111, 125, .26);
  font-weight: 1000;
}

#webView [data-flow-page="upload"] .upload-hero {
  max-width: 1060px;
  min-height: calc(100vh - 150px);
  display: grid;
  align-content: start;
  justify-items: center;
  padding: 62px 24px 78px;
}

#webView [data-flow-page="upload"] .flow-title {
  width: min(840px, 100%);
  margin: 0 auto 36px;
  text-align: center;
}

#webView [data-flow-page="upload"] .flow-title h1 {
  max-width: none;
  margin: 0 auto;
  color: #122033;
  font-size: 52px;
  line-height: 1.08;
  letter-spacing: 0;
}

#webView [data-flow-page="upload"] .flow-subtitle {
  max-width: 760px;
  margin: 20px auto 0;
  color: #6c7280;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.62;
}

#webView [data-flow-page="upload"] .upload-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 42px;
  margin-top: 28px;
  color: #222b38;
  font-size: 20px;
  font-weight: 1000;
}

#webView [data-flow-page="upload"] .upload-steps span {
  display: inline-flex;
  align-items: center;
  gap: 13px;
}

#webView [data-flow-page="upload"] .upload-steps b {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #6a95ff, #497df0);
  border-radius: 50%;
  box-shadow: 0 9px 22px rgba(73, 125, 240, .28);
  font-size: 20px;
}

#webView [data-flow-page="upload"] .upload-layout {
  display: block;
  width: min(820px, 100%);
}

#webView [data-flow-page="upload"] .large-upload-card {
  min-height: 390px;
  gap: 13px;
  padding: 52px 42px;
  background: #fff;
  border: 2px dashed #e3e6eb;
  border-radius: 28px;
  box-shadow: 0 28px 72px rgba(31, 167, 225, .08);
}

#webView [data-flow-page="upload"] .large-upload-card:hover,
#webView [data-flow-page="upload"] .large-upload-card.is-dragging {
  background: #fbfdff;
  border-color: #8fb2ff;
  box-shadow: 0 30px 78px rgba(73, 125, 240, .13);
}

#webView [data-flow-page="upload"] .large-upload-card.is-uploaded {
  align-content: center;
  background: #fff;
  border-color: rgba(110, 209, 207, .62);
  border-style: solid;
  box-shadow: 0 28px 72px rgba(110, 209, 207, .12);
}

#webView [data-flow-page="upload"] .upload-preview-art {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(73, 125, 240, .12);
}

#webView [data-flow-page="upload"] .large-upload-card.is-uploaded .upload-preview-art {
  width: min(100%, 680px);
  height: 260px;
  background: #fff;
  border-radius: 22px;
  box-shadow: none;
}

#webView [data-flow-page="upload"] .upload-preview-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#webView [data-flow-page="upload"] .upload-icon {
  position: relative;
  width: 48px;
  height: 42px;
  display: block;
}

#webView [data-flow-page="upload"] .upload-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 1px;
  height: 19px;
  border: 5px solid #4f7ff0;
  border-top: 0;
  border-radius: 0 0 13px 13px;
}

#webView [data-flow-page="upload"] .upload-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 23px;
  height: 23px;
  border-left: 5px solid #4f7ff0;
  border-top: 5px solid #4f7ff0;
  border-radius: 4px 0 0 0;
  transform: translateX(-50%) rotate(45deg);
}

#webView [data-flow-page="upload"] .large-upload-card h2 {
  margin: 12px 0 0;
  color: #262b35;
  font-size: 24px;
  line-height: 1.22;
}

#webView [data-flow-page="upload"] .large-upload-card p {
  max-width: none;
  color: #9aa0aa;
  font-size: 17px;
  line-height: 1.45;
}

#webView [data-flow-page="upload"] .large-upload-card > span {
  padding: 0;
  color: #9aa0aa;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 15px;
  font-weight: 900;
}

#webView [data-flow-page="upload"] .recrop-btn {
  margin-top: 8px;
}

#webView .route-card,
#webView .style-preview-card,
#webView .pattern-control-card,
#webView .section-block,
#webView .metric,
#webView .board-size-panel,
#webView .inline-advanced,
#webView .export-dialog,
#webView .crop-dialog,
#webView .size-dialog,
#webView .login-dialog {
  background: #ffffff;
  border: 2px solid rgba(110, 209, 207, .58);
  border-radius: 20px;
  box-shadow: 0 7px 0 rgba(110, 209, 207, .32), 0 18px 30px rgba(31, 167, 225, .08);
}

#webView .route-card.selected {
  background: #effbff;
  border-color: #1fa7e1;
  box-shadow: 0 7px 0 rgba(31, 167, 225, .35), 0 18px 30px rgba(31, 167, 225, .1);
}

#webView .route-card small,
#webView .block-title .text-btn {
  color: #1fa7e1;
  font-weight: 1000;
}

#webView .route-card b,
#webView .section-block h3,
#webView .metric strong,
#webView .size-summary b {
  color: #2269b2;
  font-weight: 1000;
}

#webView .tool-btn {
  background: #ffffff;
  border: 2px solid rgba(110, 209, 207, .65);
  border-radius: 15px;
  box-shadow: 0 5px 0 rgba(110, 209, 207, .3);
}

#webView .tool-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #7274ed, #5260d8);
  border-color: #7274ed;
  box-shadow: 0 5px 0 rgba(82, 96, 216, .42);
}

#webView .board-note span {
  color: #4f82c9;
  background: #f5fbff;
  border: 2px solid rgba(31, 167, 225, .28);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(31, 167, 225, .15);
  font-weight: 1000;
}

#webView .brand-select-trigger,
#webView .brand-options {
  background: #fff6f8;
  border: 2px solid #ffb6c5;
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(239, 111, 125, .24);
}

#webView .brand-select-trigger span {
  color: #2269b2;
  font-weight: 1000;
}

#webView .brand-options button:hover,
#webView .brand-options button.active {
  background: #eaf9fb;
  border-color: rgba(110, 209, 207, .62);
}

#webView .metric {
  background: #f7fffe;
}

#webView .metric:nth-child(1) {
  border-color: rgba(31, 167, 225, .45);
  box-shadow: 0 6px 0 rgba(31, 167, 225, .18);
}

#webView .metric:nth-child(2) {
  border-color: rgba(255, 179, 86, .58);
  box-shadow: 0 6px 0 rgba(255, 179, 86, .24);
}

#webView .metric:nth-child(3) {
  border-color: rgba(117, 208, 106, .58);
  box-shadow: 0 6px 0 rgba(117, 208, 106, .24);
}

#webView .metric:nth-child(4) {
  border-color: rgba(251, 150, 187, .58);
  box-shadow: 0 6px 0 rgba(251, 150, 187, .24);
}

#webView .board-size-panel {
  background: #fffdf3;
  border-color: rgba(255, 179, 86, .5);
  box-shadow: 0 6px 0 rgba(255, 179, 86, .22);
}

#webView input[type="range"] {
  accent-color: var(--coral);
}

#webView .check-row input,
#webView .login-consent input {
  accent-color: var(--coral);
}

#webView .primary-btn,
#webView .login-primary,
#webView .size-apply,
#webView .export-choice.primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8b8b, #ef6f7d);
  border: 0;
  border-radius: 17px;
  box-shadow: var(--toy-coral-shadow);
  font-weight: 1000;
}

#webView .secondary-btn,
#webView .login-secondary,
#webView .export-choice,
#webView .crop-ratio-tabs button,
#webView .login-tabs button,
#webView .code-field button {
  color: #2269b2;
  background: #ffffff;
  border: 2px solid rgba(31, 167, 225, .35);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(31, 167, 225, .16);
  font-weight: 1000;
}

#webView .crop-ratio-tabs,
#webView .login-tabs {
  background: #eaf9fb;
  border: 2px solid rgba(110, 209, 207, .52);
  border-radius: 18px;
}

#webView .crop-ratio-tabs button.active,
#webView .login-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #1fa7e1, #2386cf);
  border-color: transparent;
  box-shadow: 0 5px 0 rgba(35, 134, 207, .35);
}

#webView .crop-stage,
#webView .wechat-box {
  background:
    linear-gradient(#f8fffe, #ffffff) padding-box,
    repeating-linear-gradient(90deg, #ff8b8b 0 12px, #6ed1cf 12px 24px, #ffb356 24px 36px) border-box;
  border: 3px solid transparent;
  border-radius: 20px;
}

#webView .crop-box {
  border-color: #1fa7e1;
}

#webView .crop-box i {
  border-color: #1fa7e1;
}

#webView .color-list div {
  background: #f9fffd;
  border: 2px solid rgba(110, 209, 207, .28);
  border-radius: 14px;
}

/* Polished playful visual refresh: visual-only overrides. */
:root {
  --paper: #f6f8ff;
  --paper-2: #ffffff;
  --ink: #172033;
  --muted: #70798c;
  --line: #e1e6f0;
  --coral: #ff7f8e;
  --coral-deep: #ef5f75;
  --mint: #6ed1cf;
  --sky: #1fa7e1;
  --butter: #ffb356;
  --rose: #ffb2e7;
  --violet: #7d61a6;
  --blue: #3457f1;
  --green: #05f873;
  --panel: rgba(255, 255, 255, .93);
  --panel-soft: #f7fbff;
  --shadow: 0 22px 58px rgba(38, 45, 84, .12);
  --small-shadow: 0 10px 26px rgba(38, 45, 84, .1);
  --lift-shadow: 0 6px 0 rgba(125, 97, 166, .12), 0 22px 42px rgba(38, 45, 84, .1);
  --radius: 20px;
  --font-display: "Nunito", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Nunito", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(246, 248, 255, .88) 42%, rgba(255, 255, 255, .96)),
    linear-gradient(135deg, rgba(52, 87, 241, .08), transparent 34%),
    linear-gradient(315deg, rgba(255, 178, 231, .14), transparent 30%),
    var(--paper);
  background-size: auto;
}

.topbar {
  border: 1px solid rgba(125, 97, 166, .18);
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 18px 46px rgba(31, 41, 75, .08);
  border-radius: 18px;
}

.brand-mark {
  background-color: #fff;
  border: 1px solid rgba(125, 97, 166, .16);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(52, 87, 241, .14);
}

.brand-name {
  color: var(--ink);
  font-weight: 1000;
  letter-spacing: 0;
}

.brand-sub {
  color: var(--muted);
  font-weight: 800;
}

.flow-tabs {
  background: #f2edf7;
  border: 1px solid rgba(125, 97, 166, .14);
  border-radius: 18px;
  box-shadow: inset 0 -2px 0 rgba(125, 97, 166, .08);
}

.flow-tabs button {
  color: #747b90;
  border-radius: 14px;
  font-weight: 1000;
}

.flow-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #26395f, #172033);
  box-shadow: 0 7px 0 rgba(125, 97, 166, .26), 0 14px 26px rgba(23, 32, 51, .16);
}

.auth-pill,
.sync-pill,
.status-tag {
  color: #315fe8;
  background: #f2f7ff;
  border: 1px solid rgba(52, 87, 241, .24);
  border-radius: 14px;
  box-shadow: 0 7px 20px rgba(52, 87, 241, .1);
}

.auth-pill[data-auth-state="synced"] {
  color: #168378;
  background: #ecfffb;
  border-color: rgba(110, 209, 207, .46);
}

#webView .web-flow {
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(125, 97, 166, .12);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(31, 41, 75, .08);
}

#webView .flow-title h1,
#webView [data-flow-page="upload"] .flow-title h1 {
  color: var(--ink);
  font-weight: 1000;
  letter-spacing: 0;
}

#webView [data-flow-page="upload"] .flow-subtitle {
  color: #6f7583;
  font-weight: 760;
}

#webView [data-flow-page="upload"] .upload-steps {
  color: #2a3143;
}

#webView [data-flow-page="upload"] .upload-steps b {
  background: linear-gradient(180deg, #5f8dff, #3457f1);
  box-shadow: 0 10px 24px rgba(52, 87, 241, .24);
}

#webView .style-preview-card,
#webView .pattern-control-card,
#webView .section-block,
#webView .metric,
#webView .board-size-panel,
#webView .inline-advanced,
#webView .export-dialog,
#webView .crop-dialog,
#webView .size-dialog,
#webView .login-dialog {
  background: var(--panel);
  border: 1px solid rgba(125, 97, 166, .16);
  border-radius: 22px;
  box-shadow: var(--lift-shadow);
}

#webView .style-preview-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(250, 252, 255, .94)),
    linear-gradient(135deg, rgba(31, 167, 225, .08), transparent 38%);
}

#webView .pattern-control-card {
  background: rgba(255, 255, 255, .92);
}

#webView .pattern-wrap {
  background: #ffffff;
  border-color: rgba(125, 97, 166, .12);
  border-radius: 18px;
}

#webView [data-flow-page="upload"] .large-upload-card {
  color: var(--ink);
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(52, 87, 241, .26), rgba(255, 178, 231, .28), rgba(110, 209, 207, .28)) border-box;
  border: 2px dashed transparent;
  border-radius: 30px;
  box-shadow: 0 28px 70px rgba(31, 41, 75, .08);
}

#webView [data-flow-page="upload"] .large-upload-card:hover,
#webView [data-flow-page="upload"] .large-upload-card.is-dragging {
  background:
    linear-gradient(#fbfdff, #ffffff) padding-box,
    linear-gradient(135deg, #3457f1, #ffb2e7, #6ed1cf) border-box;
  box-shadow: 0 32px 78px rgba(52, 87, 241, .13);
}

#webView [data-flow-page="upload"] .large-upload-card.is-uploaded {
  border-style: solid;
  border-color: rgba(110, 209, 207, .55);
}

#webView [data-flow-page="upload"] .upload-preview-art {
  background: #f5f8ff;
  border: 1px solid rgba(52, 87, 241, .12);
  border-radius: 24px;
  box-shadow: 0 16px 34px rgba(52, 87, 241, .12);
}

#webView [data-flow-page="upload"] .large-upload-card.is-uploaded .upload-preview-art {
  background: #fff;
  border: 0;
}

#webView [data-flow-page="upload"] .upload-icon::before {
  border-color: #3457f1;
}

#webView [data-flow-page="upload"] .upload-icon::after {
  border-color: #3457f1;
}

#webView [data-flow-page="upload"] .large-upload-card h2 {
  color: #202739;
  font-weight: 1000;
}

#webView [data-flow-page="upload"] .large-upload-card p,
#webView [data-flow-page="upload"] .large-upload-card > span {
  color: #8b92a1;
}

#webView .tool-btn {
  background: #ffffff;
  border: 1px solid rgba(125, 97, 166, .2);
  border-radius: 14px;
  box-shadow: 0 5px 0 rgba(125, 97, 166, .1), 0 10px 22px rgba(31, 41, 75, .06);
}

#webView .tool-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #3457f1, #253a82);
  border-color: transparent;
  box-shadow: 0 6px 0 rgba(37, 58, 130, .28), 0 12px 26px rgba(52, 87, 241, .18);
}

#webView .board-note span {
  color: #3457f1;
  background: #f5f7ff;
  border: 1px solid rgba(52, 87, 241, .2);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(52, 87, 241, .08);
}

#webView .block-title .text-btn,
#webView .route-card small {
  color: var(--coral-deep);
  font-weight: 1000;
}

#webView .section-block h3,
#webView .route-card b,
#webView .metric strong,
#webView .size-summary b {
  color: #243257;
  font-weight: 1000;
}

#webView .brand-select-trigger,
#webView .brand-options {
  color: #243257;
  background: #fff7fb;
  border: 1px solid rgba(255, 127, 142, .45);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(255, 127, 142, .12), 0 14px 24px rgba(31, 41, 75, .06);
}

#webView .brand-select-trigger span {
  color: #243257;
}

#webView .brand-select-trigger b {
  color: #7a8293;
}

#webView .brand-options button {
  border-radius: 12px;
}

#webView .brand-options button:hover,
#webView .brand-options button.active {
  background: #eefcff;
  border-color: rgba(31, 167, 225, .36);
}

#webView .metric {
  background: linear-gradient(180deg, #ffffff, #fbfcff);
}

#webView .metric:nth-child(1) {
  border-color: rgba(136, 162, 255, .38);
  box-shadow: 0 5px 0 rgba(136, 162, 255, .12);
}

#webView .metric:nth-child(2) {
  border-color: rgba(255, 179, 86, .42);
  box-shadow: 0 5px 0 rgba(255, 179, 86, .14);
}

#webView .metric:nth-child(3) {
  border-color: rgba(255, 178, 231, .42);
  box-shadow: 0 5px 0 rgba(255, 178, 231, .14);
}

#webView .metric:nth-child(4) {
  border-color: rgba(110, 209, 207, .42);
  box-shadow: 0 5px 0 rgba(110, 209, 207, .14);
}

#webView .board-size-panel {
  background: linear-gradient(180deg, #fffdfa, #ffffff);
  border-color: rgba(255, 179, 86, .32);
  box-shadow: 0 5px 0 rgba(255, 179, 86, .11);
}

#webView input[type="range"] {
  accent-color: #ff7f8e;
}

#webView .check-row {
  color: #27334a;
}

#webView .check-row input,
#webView .login-consent input {
  accent-color: #3457f1;
}

#webView .primary-btn,
#webView .login-primary,
#webView .size-apply,
#webView .export-choice.primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 7px 0 rgba(197, 67, 91, .22), 0 18px 34px rgba(239, 95, 117, .18);
  font-weight: 1000;
}

#webView .primary-btn:hover,
#webView .login-primary:hover,
#webView .size-apply:hover,
#webView .export-choice.primary:hover {
  filter: saturate(1.04) brightness(1.02);
}

#webView .secondary-btn,
#webView .login-secondary,
#webView .export-choice,
#webView .crop-ratio-tabs button,
#webView .login-tabs button,
#webView .code-field button,
#webView .recrop-btn {
  color: #3457f1;
  background: #ffffff;
  border: 1px solid rgba(52, 87, 241, .28);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(52, 87, 241, .08), 0 12px 24px rgba(31, 41, 75, .06);
  font-weight: 1000;
}

#webView .crop-ratio-tabs,
#webView .login-tabs {
  background: #f3f6ff;
  border: 1px solid rgba(125, 97, 166, .14);
  border-radius: 18px;
}

#webView .crop-ratio-tabs button.active,
#webView .login-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #3457f1, #253a82);
  border-color: transparent;
  box-shadow: 0 5px 0 rgba(37, 58, 130, .22);
}

#webView .crop-stage,
#webView .wechat-box {
  background:
    linear-gradient(#ffffff, #f9fcff) padding-box,
    linear-gradient(135deg, rgba(52, 87, 241, .36), rgba(255, 178, 231, .28), rgba(110, 209, 207, .32)) border-box;
  border: 2px solid transparent;
  border-radius: 22px;
}

#webView .crop-box {
  border-color: #3457f1;
}

#webView .crop-box i {
  border-color: #3457f1;
}

#webView .color-list div {
  background: #ffffff;
  border: 1px solid rgba(125, 97, 166, .14);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(125, 97, 166, .06);
}

#webView .login-field input,
#webView .size-input-grid input {
  background: #fbfcff;
  border-color: rgba(125, 97, 166, .18);
  border-radius: 14px;
}

#webView .login-field input:focus,
#webView .size-input-grid input:focus {
  border-color: rgba(52, 87, 241, .46);
  box-shadow: 0 0 0 4px rgba(52, 87, 241, .08);
}

#webView .export-close,
#webView .crop-close,
#webView .size-close,
#webView .login-close {
  color: #3457f1;
  background: #f4f7ff;
  border: 1px solid rgba(52, 87, 241, .18);
  box-shadow: 0 6px 18px rgba(52, 87, 241, .1);
}

#webView [data-flow-page="pattern"] .style-preview-card {
  padding: 18px;
}

#webView [data-flow-page="pattern"] .style-preview-card .pattern-wrap {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  align-content: stretch;
  gap: 7px;
  padding: 10px;
}

#webView [data-flow-page="pattern"] .style-preview-card .pattern-board {
  max-width: 100%;
  max-height: 100%;
}

#webView [data-flow-page="pattern"] .board-note {
  gap: 6px;
  min-height: 28px;
}

#webView [data-flow-page="pattern"] .board-note span {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.1;
  box-shadow: 0 3px 0 rgba(52, 87, 241, .07);
}

#webView [data-flow-page="pattern"] .style-preview-card .canvas-toolbar {
  justify-content: flex-start;
}

#webView [data-flow-page="pattern"] .style-preview-card .tool-group {
  display: none;
}

#webView .color-list i {
  border: 2px solid #ffffff;
  box-shadow: 0 3px 0 rgba(39, 51, 74, .14);
}

/* Home and login color sync with the pattern workspace. */
#webView [data-flow-page="upload"] .flow-title h1 {
  color: #172033;
}

#webView [data-flow-page="upload"] .flow-subtitle {
  color: #70798c;
}

#webView [data-flow-page="upload"] .upload-steps {
  color: #243257;
}

#webView [data-flow-page="upload"] .upload-steps b {
  background: linear-gradient(180deg, #3457f1, #253a82);
  box-shadow: 0 7px 0 rgba(37, 58, 130, .22), 0 14px 28px rgba(52, 87, 241, .16);
}

#webView [data-flow-page="upload"] .large-upload-card {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(52, 87, 241, .36), rgba(255, 178, 231, .30), rgba(110, 209, 207, .34)) border-box;
  border-color: transparent;
  box-shadow: 0 6px 0 rgba(125, 97, 166, .10), 0 28px 70px rgba(31, 41, 75, .08);
}

#webView [data-flow-page="upload"] .large-upload-card:hover,
#webView [data-flow-page="upload"] .large-upload-card.is-dragging {
  background:
    linear-gradient(#fbfdff, #ffffff) padding-box,
    linear-gradient(135deg, #3457f1, #ffb2e7, #6ed1cf) border-box;
  box-shadow: 0 7px 0 rgba(52, 87, 241, .13), 0 32px 78px rgba(52, 87, 241, .13);
}

#webView [data-flow-page="upload"] .large-upload-card.is-uploaded {
  border-color: rgba(125, 97, 166, .18);
}

#webView [data-flow-page="upload"] .upload-preview-art {
  background: #f5f7ff;
  border: 1px solid rgba(52, 87, 241, .16);
  box-shadow: 0 14px 34px rgba(52, 87, 241, .10);
}

#webView [data-flow-page="upload"] .upload-icon::before,
#webView [data-flow-page="upload"] .upload-icon::after {
  border-color: #3457f1;
}

#webView [data-flow-page="upload"] .large-upload-card h2 {
  color: #243257;
}

#webView [data-flow-page="upload"] .large-upload-card p,
#webView [data-flow-page="upload"] .large-upload-card > span {
  color: #70798c;
}

#webView .login-backdrop {
  background:
    radial-gradient(circle at 28% 20%, rgba(52, 87, 241, .18), transparent 32%),
    radial-gradient(circle at 74% 18%, rgba(255, 178, 231, .20), transparent 30%),
    rgba(23, 32, 51, .34);
  backdrop-filter: blur(8px);
}

#webView .login-dialog {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(250, 252, 255, .96)),
    linear-gradient(135deg, rgba(31, 167, 225, .08), transparent 38%);
  border: 1px solid rgba(125, 97, 166, .16);
  box-shadow: 0 6px 0 rgba(125, 97, 166, .12), 0 34px 90px rgba(31, 41, 75, .20);
}

#webView .login-brand h2 {
  color: #172033;
  font-weight: 1000;
}

#webView .login-brand p,
#webView .login-field span,
#webView .login-panel p,
#webView .login-consent {
  color: #70798c;
}

#webView .login-tabs {
  background: #f2edf7;
  border: 1px solid rgba(125, 97, 166, .14);
  box-shadow: inset 0 -2px 0 rgba(125, 97, 166, .08);
}

#webView .login-tabs button {
  color: #747b90;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

#webView .login-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #3457f1, #253a82);
  box-shadow: 0 5px 0 rgba(37, 58, 130, .22), 0 12px 24px rgba(52, 87, 241, .14);
}

#webView .login-field input {
  color: #172033;
  background: #fbfcff;
  border: 1px solid rgba(125, 97, 166, .18);
}

#webView .login-field input:focus {
  border-color: rgba(52, 87, 241, .46);
  box-shadow: 0 0 0 4px rgba(52, 87, 241, .08);
}

#webView .code-field button,
#webView .login-secondary {
  color: #3457f1;
  background: #ffffff;
  border-color: rgba(52, 87, 241, .28);
}

#webView .code-field button:disabled {
  color: #9aa2b1;
  background: #f5f7ff;
  border-color: rgba(125, 97, 166, .12);
  box-shadow: none;
}

#webView .login-primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  box-shadow: 0 7px 0 rgba(197, 67, 91, .22), 0 18px 34px rgba(239, 95, 117, .18);
}

#webView .wechat-box {
  background:
    linear-gradient(#ffffff, #f9fcff) padding-box,
    linear-gradient(135deg, rgba(52, 87, 241, .36), rgba(255, 178, 231, .28), rgba(110, 209, 207, .32)) border-box;
  border: 2px solid transparent;
}

#webView .login-close {
  color: #3457f1;
  background: #f4f7ff;
  border: 1px solid rgba(52, 87, 241, .18);
}

/* Final primary color unification: use the pattern page pink as the global main accent. */
.flow-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  box-shadow: 0 7px 0 rgba(197, 67, 91, .22), 0 14px 26px rgba(239, 95, 117, .16);
}

.auth-pill {
  color: #ef5f75;
  background: #fff4f7;
  border-color: rgba(239, 95, 117, .28);
  box-shadow: 0 7px 20px rgba(239, 95, 117, .10);
}

#webView [data-flow-page="upload"] .upload-steps b {
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  box-shadow: 0 7px 0 rgba(197, 67, 91, .22), 0 14px 28px rgba(239, 95, 117, .16);
}

#webView [data-flow-page="upload"] .large-upload-card {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(239, 95, 117, .42), rgba(255, 178, 231, .34), rgba(110, 209, 207, .26)) border-box;
  box-shadow: 0 6px 0 rgba(239, 95, 117, .10), 0 28px 70px rgba(31, 41, 75, .08);
}

#webView [data-flow-page="upload"] .large-upload-card:hover,
#webView [data-flow-page="upload"] .large-upload-card.is-dragging {
  background:
    linear-gradient(#fffafb, #ffffff) padding-box,
    linear-gradient(135deg, #ef5f75, #ffb2e7, #6ed1cf) border-box;
  box-shadow: 0 7px 0 rgba(239, 95, 117, .13), 0 32px 78px rgba(239, 95, 117, .13);
}

#webView [data-flow-page="upload"] .upload-preview-art {
  background: #fff5f8;
  border-color: rgba(239, 95, 117, .16);
  box-shadow: 0 14px 34px rgba(239, 95, 117, .10);
}

#webView [data-flow-page="upload"] .upload-icon::before,
#webView [data-flow-page="upload"] .upload-icon::after {
  border-color: #ef5f75;
}

#webView .login-backdrop {
  background:
    radial-gradient(circle at 28% 20%, rgba(239, 95, 117, .20), transparent 32%),
    radial-gradient(circle at 74% 18%, rgba(255, 178, 231, .22), transparent 30%),
    rgba(23, 32, 51, .34);
}

#webView .login-dialog {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 250, 252, .96)),
    linear-gradient(135deg, rgba(239, 95, 117, .08), transparent 38%);
}

#webView .login-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  box-shadow: 0 5px 0 rgba(197, 67, 91, .22), 0 12px 24px rgba(239, 95, 117, .14);
}

#webView .login-field input:focus {
  border-color: rgba(239, 95, 117, .46);
  box-shadow: 0 0 0 4px rgba(239, 95, 117, .08);
}

#webView .code-field button,
#webView .login-secondary {
  color: #ef5f75;
  border-color: rgba(239, 95, 117, .28);
}

#webView .login-close {
  color: #ef5f75;
  background: #fff4f7;
  border-color: rgba(239, 95, 117, .18);
}

#webView .wechat-box {
  background:
    linear-gradient(#ffffff, #fffafb) padding-box,
    linear-gradient(135deg, rgba(239, 95, 117, .40), rgba(255, 178, 231, .30), rgba(110, 209, 207, .26)) border-box;
}

.size-modal[hidden] {
  display: none;
}

.size-modal {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: grid;
  place-items: center;
}

.size-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, .34);
  backdrop-filter: blur(5px);
}

.size-dialog {
  position: relative;
  width: min(420px, calc(100vw - 36px));
  padding: 28px;
  background: rgba(255, 253, 248, .98);
  border: 1px solid rgba(39, 51, 74, .08);
  border-radius: 22px;
  box-shadow: 0 34px 90px rgba(39, 51, 74, .22);
}

.size-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 34px;
  height: 34px;
  border: 0;
  color: #9b8590;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.size-dialog h2 {
  margin: 0;
  font-size: 26px;
}

.size-dialog p {
  margin: 6px 0 20px;
  color: var(--muted);
  font-weight: 800;
}

.size-input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.size-input-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.size-input-grid input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.size-input-grid input:focus {
  border-color: rgba(239, 106, 91, .55);
  box-shadow: 0 0 0 4px rgba(239, 106, 91, .1);
}

.size-apply {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #f36f62, #df4c43);
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(216, 76, 66, .22);
}

.apple-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 122, 255, .12), transparent 32%),
    linear-gradient(180deg, #f5f7fb, #ffffff);
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(30, 41, 59, .12);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

.apple-web,
.apple-phone-wrap {
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 50px rgba(30, 41, 59, .08);
}

.apple-web {
  padding: 18px;
}

.apple-nav,
.apple-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.apple-nav span,
.apple-preview-head span {
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}

.apple-nav h1,
.apple-preview-head h2 {
  margin: 4px 0 0;
  letter-spacing: 0;
}

.apple-nav h1 {
  font-size: 34px;
}

.apple-nav button,
.apple-actions button {
  padding: 10px 14px;
  color: #007aff;
  background: rgba(0, 122, 255, .09);
  border: 1px solid rgba(0, 122, 255, .16);
  border-radius: 999px;
  font-weight: 800;
}

.apple-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 220px;
  gap: 14px;
  margin-top: 18px;
}

.apple-left,
.apple-preview,
.apple-panel {
  padding: 14px;
  border: 1px solid rgba(60, 60, 67, .1);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
}

.apple-upload,
.apple-mobile-upload {
  width: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  border: 1.5px dashed rgba(0, 122, 255, .32);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.apple-upload h2,
.apple-mobile-upload b {
  margin: 0;
  font-size: 24px;
}

.apple-upload p,
.apple-mobile-upload span {
  margin: 0;
  color: #6b7280;
}

.apple-upload-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background:
    radial-gradient(circle, #ff3b30 0 36%, transparent 38%) 0 0 / 18px 18px,
    radial-gradient(circle, #34c759 0 36%, transparent 38%) 9px 9px / 18px 18px,
    #f2f7ff;
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, .12);
}

.apple-choice {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.apple-choice button {
  padding: 14px;
  text-align: left;
  background: #fff;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 14px;
}

.apple-choice .active {
  border-color: rgba(0, 122, 255, .35);
  background: #f2f7ff;
}

.apple-choice span,
.apple-choice b,
.apple-choice small {
  display: block;
}

.apple-choice span {
  color: #007aff;
  font-size: 12px;
  font-weight: 800;
}

.apple-choice b {
  margin-top: 4px;
  font-size: 17px;
}

.apple-choice small {
  margin-top: 4px;
  color: #6b7280;
}

.apple-detail {
  margin-top: 14px;
  padding: 0;
  border: 1px solid rgba(60, 60, 67, .1);
  border-radius: 14px;
  background: #fff;
}

.apple-detail summary {
  padding: 13px 14px;
  cursor: pointer;
  font-weight: 800;
}

.apple-detail div {
  padding: 0 14px 14px;
  color: #6b7280;
}

.apple-preview {
  min-height: 700px;
}

.apple-pattern {
  width: min(620px, 100%);
  margin: 26px auto 0;
  border: 0;
  background: #f5f5f7;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(30, 41, 59, .12);
}

.apple-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.apple-stat {
  padding: 14px;
  border-radius: 14px;
  background: #f5f5f7;
}

.apple-stat span {
  display: block;
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}

.apple-stat b {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.apple-primary {
  width: 100%;
  padding: 13px 16px;
  color: #fff;
  background: #007aff;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
}

.apple-phone-wrap {
  display: grid;
  place-items: center;
  padding: 22px;
}

.apple-phone {
  width: 320px;
  height: 690px;
  padding: 10px;
  border-radius: 42px;
  background: #111827;
  box-shadow: 0 34px 80px rgba(17, 24, 39, .22);
}

.apple-phone-screen {
  height: 100%;
  padding: 16px;
  overflow: hidden;
  border-radius: 34px;
  background: #f5f5f7;
}

.apple-phone-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
}

.apple-phone-top span {
  width: 52px;
  height: 12px;
  border-radius: 999px;
  background: #111827;
  opacity: .65;
}

.apple-phone-screen h2 {
  margin: 18px 0 12px;
  font-size: 30px;
}

.apple-mobile-upload {
  min-height: 172px;
  background: #fff;
}

.apple-mobile-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.apple-mobile-choice button {
  padding: 12px 8px;
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.apple-mobile-choice .active {
  color: #fff;
  background: #007aff;
  border-color: #007aff;
}

.apple-mini-pattern {
  width: 100%;
  margin: 8px 0 14px;
  background: #fff;
  border: 0;
  border-radius: 16px;
}

#webView [data-flow-page="history"] {
  min-height: 690px;
}

.history-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 0;
}

.history-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.history-empty {
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(240px, .82fr) minmax(0, 1fr);
  align-items: center;
  gap: 38px;
  padding: 48px 56px;
  border: 2px solid rgba(255, 150, 187, .30);
  border-radius: 34px;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 150, 187, .16), transparent 28%),
    radial-gradient(circle at 84% 16%, rgba(171, 157, 255, .18), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 250, 253, .90));
  box-shadow: 0 12px 0 rgba(226, 219, 238, .72), 0 30px 70px rgba(37, 45, 72, .08);
}

.history-empty-art {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.empty-paper {
  width: min(280px, 100%);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 24px;
  border: 2px solid rgba(171, 157, 255, .36);
  border-radius: 32px;
  background: #ffffff;
  transform: rotate(-3deg);
  box-shadow: 0 10px 0 rgba(171, 157, 255, .18), 0 28px 54px rgba(37, 45, 72, .10);
}

.empty-paper span {
  border-radius: 12px;
  background: #f3f5fb;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, .06);
}

.empty-paper span:nth-child(2),
.empty-paper span:nth-child(7),
.empty-paper span:nth-child(12) {
  background: #ff96bb;
}

.empty-paper span:nth-child(6),
.empty-paper span:nth-child(10),
.empty-paper span:nth-child(11) {
  background: #ab9dff;
}

.empty-paper span:nth-child(8),
.empty-paper span:nth-child(13) {
  background: #6ed1cf;
}

.empty-paper span:nth-child(15) {
  background: #ffb356;
}

.empty-bead {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 5px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(37, 45, 72, .14);
}

.bead-a {
  left: 12%;
  top: 16%;
  background: #ff8b8b;
}

.bead-b {
  right: 9%;
  top: 24%;
  background: #6ed1cf;
}

.bead-c {
  right: 20%;
  bottom: 9%;
  background: #ffb356;
}

.history-empty-copy {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.history-empty-copy .eyebrow {
  margin: 0;
  color: #ef5f75;
}

.history-empty-copy h2 {
  margin: 0;
  color: #172033;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.history-empty-copy > p:not(.eyebrow) {
  max-width: 520px;
  margin: 0;
  color: #687285;
  font-size: 16px;
  line-height: 1.8;
}

.history-empty-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.history-empty-steps span {
  padding: 9px 13px;
  color: #315fe8;
  background: #f2f7ff;
  border: 1px solid rgba(52, 87, 241, .18);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(171, 157, 255, .16);
}

.history-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 190px;
  align-items: center;
  gap: 18px;
  overflow: visible;
  padding: 14px;
  border: 2px solid rgba(171, 157, 255, .30);
  border-radius: 26px;
  background:
    radial-gradient(circle at 96% 0%, rgba(255, 150, 187, .16), transparent 34%),
    #ffffff;
  box-shadow: 0 10px 0 rgba(226, 219, 238, .74), 0 24px 42px rgba(37, 45, 72, .08);
}

.history-card canvas {
  display: block;
  width: 100%;
  height: 132px;
  background:
    linear-gradient(45deg, rgba(110, 209, 207, .08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 150, 187, .09) 25%, transparent 25%),
    #ffffff;
  background-size: 20px 20px;
  border: 1px solid rgba(39, 51, 74, .08);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
}

.history-card-body {
  display: grid;
  gap: 12px;
  padding: 0;
}

.history-card h2 {
  margin: 0;
  color: #172033;
  font-size: 24px;
  line-height: 1.15;
}

.history-name-input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 3px 8px 5px;
  color: #172033;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 24px;
  font-weight: 1000;
  line-height: 1.15;
  letter-spacing: 0;
  outline: none;
}

.history-name-input:hover {
  background: rgba(255, 244, 247, .86);
  border-color: rgba(239, 95, 117, .16);
}

.history-name-input:focus {
  background: #ffffff;
  border-color: rgba(239, 95, 117, .42);
  box-shadow: 0 0 0 4px rgba(239, 95, 117, .10);
}

.history-card p {
  margin: 6px 0 0;
  color: #687285;
  font-size: 14px;
  line-height: 1.6;
}

.history-status {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  padding: 4px 10px;
  color: #ef5f75;
  background: #fff4f7;
  border: 1px solid rgba(239, 95, 117, .28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.history-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-swatches i {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 7px;
  background: var(--c);
  box-shadow: 0 2px 0 rgba(39, 51, 74, .15);
}

.history-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.history-actions .primary-btn,
.history-actions .secondary-btn,
.history-actions .danger-btn {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 14px;
}

.history-actions .danger-btn {
  color: #ef5f75;
  background: #fff6f8;
  border: 1px solid rgba(239, 95, 117, .30);
  box-shadow: 0 5px 0 rgba(239, 95, 117, .12);
  font-weight: 900;
  cursor: pointer;
}

.history-actions .danger-btn:hover {
  color: #ffffff;
  background: linear-gradient(180deg, #ff8aa1, #ef5f75);
  box-shadow: 0 6px 0 rgba(197, 67, 91, .20), 0 12px 22px rgba(239, 95, 117, .14);
}

.flow-tabs {
  width: clamp(340px, 38vw, 470px);
  min-width: 0;
  max-width: calc(100vw - 450px);
  box-sizing: border-box;
}

.flow-tabs button {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
}

@media (max-width: 980px) and (min-width: 761px) {
  .topbar {
    gap: 10px;
    padding-inline: 12px;
  }

  .brand {
    min-width: 190px;
    gap: 10px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .flow-tabs {
    width: 330px;
    max-width: calc(100vw - 390px);
    padding: 5px;
    gap: 4px;
    border-radius: 16px;
  }

  .flow-tabs button {
    padding: 9px 6px;
    border-radius: 13px;
    font-size: 14px;
  }

  .auth-pill {
    min-width: 96px;
    padding-inline: 10px;
  }

  .history-empty {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 22px;
    min-height: 360px;
    padding: 34px 30px;
  }

  .history-empty-art {
    min-height: 220px;
  }

  .empty-paper {
    padding: 18px;
    gap: 6px;
    border-radius: 26px;
  }

  .history-empty-copy h2 {
    font-size: 40px;
  }

  .history-empty-copy > p:not(.eyebrow) {
    font-size: 14px;
  }

  .history-card {
    grid-template-columns: 150px minmax(0, 1fr) 150px;
    gap: 12px;
    padding: 12px;
  }

  .history-card canvas {
    height: 112px;
  }

  .history-card h2 {
    font-size: 20px;
  }

  .history-name-input {
    font-size: 20px;
  }

  .history-card p {
    font-size: 12px;
  }

  .view-tabs {
    display: none !important;
  }

  .history-actions .primary-btn,
  .history-actions .secondary-btn,
  .history-actions .danger-btn {
    min-height: 38px;
    font-size: 12px;
  }
}

@media (max-width: 1180px) {
  .web-app {
    grid-template-columns: 300px 1fr;
  }

  .web-inspector {
    grid-column: 1 / -1;
  }

  .mini-board {
    justify-content: flex-start;
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1500px);
    margin-top: 9px;
  }

  .topbar {
    height: auto;
    display: flex;
    flex-wrap: wrap;
    position: static;
  }

  .view-tabs {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .view-tab {
    padding: 9px 8px;
  }

  .sync-pill {
    display: none;
  }

  .flow-tabs {
    position: static;
    transform: none;
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .flow-tabs button {
    min-width: 0;
    flex: 1;
    padding: 9px 8px;
  }

  .history-empty {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 30px 22px;
    text-align: center;
  }

  .history-empty-art {
    min-height: 210px;
  }

  .history-empty-copy {
    justify-items: center;
  }

  .history-empty-steps {
    justify-content: center;
  }

  .web-app {
    grid-template-columns: 1fr;
  }

  .canvas-stage {
    min-height: auto;
  }

  .pattern-board {
    width: 100%;
    gap: 1px;
    padding: 8px;
  }

  .pattern-board .bead::after {
    content: "";
  }

  .profile-layout,
  .history-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .token-grid {
    grid-template-columns: 1fr;
  }

  .login-dialog {
    width: min(100vw - 22px, 470px);
    padding: 24px 18px;
    border-radius: 18px;
  }

  .login-brand h2 {
    font-size: 24px;
  }

  .login-tabs button {
    min-height: 42px;
    font-size: 14px;
  }

  .code-field div {
    grid-template-columns: 1fr;
  }

  .code-field button {
    min-height: 46px;
  }

  .wechat-box {
    min-height: 210px;
  }
}

/* Mobile adaptive workspace */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    min-width: 0;
    background: #f8f8fd;
  }

  .shell {
    width: 100%;
    margin: 0;
    padding: 8px 8px calc(24px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    min-height: 0;
    padding: calc(9px + env(safe-area-inset-top)) 10px 10px;
    border-radius: 18px;
  }

  .brand {
    grid-column: 1;
    min-width: 0;
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  .brand-name {
    font-size: 18px;
    line-height: 1.1;
  }

  .brand-sub {
    max-width: 45vw;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-pill {
    grid-column: 2;
    min-width: 76px;
    max-width: 124px;
    min-height: 44px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .view-tabs {
    display: none !important;
  }

  .flow-tabs {
    position: static;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    max-width: none;
    padding: 4px;
    transform: none;
  }

  .flow-tabs button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .view-panel {
    margin-top: 10px;
  }

  .web-flow {
    min-height: 0;
    padding: 8px;
    border-radius: 20px;
  }

  .upload-hero {
    min-height: calc(100svh - 154px);
    padding: 28px 8px 24px;
  }

  #webView [data-flow-page="upload"] .upload-hero {
    width: 100%;
    min-height: calc(100svh - 154px);
    padding: 28px 8px 24px;
  }

  .flow-title {
    margin-bottom: 20px;
  }

  .flow-title h1 {
    font-size: clamp(30px, 9vw, 38px);
    line-height: 1.15;
  }

  #webView [data-flow-page="upload"] .upload-title h1 {
    font-size: clamp(29px, 9vw, 36px);
    line-height: 1.15;
  }

  .flow-title > p {
    max-width: 30em;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
  }

  #webView [data-flow-page="upload"] .flow-subtitle {
    max-width: 30em;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
  }

  .upload-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin-top: 18px;
    font-size: 14px;
  }

  #webView [data-flow-page="upload"] .upload-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin-top: 18px;
    font-size: 14px;
  }

  .upload-steps span {
    justify-content: center;
    min-width: 0;
    white-space: nowrap;
  }

  #webView [data-flow-page="upload"] .upload-steps span {
    justify-content: center;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
  }

  .upload-steps b {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  #webView [data-flow-page="upload"] .upload-steps b {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .upload-layout {
    width: 100%;
  }

  .large-upload-card {
    width: 100%;
    min-height: min(52svh, 440px);
    gap: 10px;
    padding: 26px 16px;
    border-radius: 22px;
  }

  #webView [data-flow-page="upload"] .large-upload-card {
    width: 100%;
    min-height: min(52svh, 440px);
    gap: 10px;
    padding: 26px 16px;
    border-radius: 22px;
  }

  .large-upload-card h2 {
    font-size: 22px;
  }

  #webView [data-flow-page="upload"] .large-upload-card h2 {
    font-size: 22px;
  }

  .large-upload-card p {
    max-width: 24em;
    font-size: 14px;
    line-height: 1.55;
  }

  #webView [data-flow-page="upload"] .large-upload-card p {
    max-width: 24em;
    font-size: 14px;
    line-height: 1.55;
  }

  .large-upload-card .upload-art {
    width: 72px;
    height: 72px;
  }

  .large-upload-card.uploaded .upload-preview,
  .large-upload-card .upload-preview {
    width: 100%;
    height: min(50svh, 360px);
    max-height: 360px;
    object-fit: contain;
  }

  .pattern-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
  }

  #webView [data-flow-page="pattern"] .pattern-workspace {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .style-preview-card,
  #webView [data-flow-page="pattern"] .style-preview-card {
    width: 100%;
    height: min(66svh, 620px);
    min-height: 430px;
    padding: 10px;
    border-radius: 18px;
  }

  .canvas-toolbar {
    min-height: 30px;
  }

  .pattern-wrap {
    min-height: 0;
    gap: 4px;
    padding: 6px 3px 4px;
    overscroll-behavior: contain;
  }

  .pattern-board {
    width: 100%;
    max-width: none;
  }

  .board-note {
    gap: 5px;
    min-height: 24px;
  }

  .board-note span {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 10px;
  }

  .pattern-control-card {
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 10px;
    border-radius: 18px;
  }

  #webView [data-flow-page="pattern"] .pattern-control-card {
    align-self: auto;
    max-height: none;
    overflow: visible;
  }

  .section-block {
    padding: 14px;
    border-radius: 16px;
  }

  .section-title-row h2,
  .section-title-row h3 {
    font-size: 18px;
  }

  .brand-select-trigger {
    min-height: 52px;
    padding: 10px 12px;
  }

  .brand-select-trigger strong {
    font-size: 17px;
  }

  .range-row {
    gap: 8px;
  }

  input[type="range"] {
    min-height: 28px;
  }

  .mode-segment {
    gap: 4px;
  }

  .mode-segment button {
    min-height: 44px;
    padding: 7px 5px;
    font-size: 11px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric {
    min-height: 82px;
    padding: 11px;
  }

  .metric span {
    font-size: 12px;
  }

  .metric strong {
    font-size: 20px;
  }

  .material-summary {
    min-height: 54px;
  }

  .board-size-panel {
    padding: 12px;
  }

  .size-slider-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
  }

  .size-slider-row > span {
    grid-column: 1;
  }

  .size-slider-row > strong {
    grid-column: 2;
  }

  .size-slider-row > input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .size-readonly-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
  }

  .size-readonly-row em {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
  }

  .editable-size-value input,
  .login-field input {
    font-size: 16px;
  }

  .check-row {
    min-height: 44px;
    padding: 8px 2px;
  }

  .check-row input {
    width: 20px;
    height: 20px;
  }

  #webView button,
  .auth-pill {
    min-height: 44px;
  }

  .primary-btn,
  .secondary-btn {
    min-height: 52px;
  }

  .history-page {
    min-height: 0;
    padding: 4px 0 12px;
  }

  .history-empty {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    min-height: 0;
    padding: 24px 16px;
    border-radius: 24px;
  }

  .history-empty-art {
    min-height: 170px;
  }

  .history-paper {
    width: 180px;
  }

  .history-bead {
    width: 34px;
    height: 34px;
  }

  .history-empty-copy {
    text-align: center;
  }

  .history-empty-copy h2 {
    font-size: 30px;
  }

  .history-empty-copy p {
    margin-inline: auto;
    font-size: 14px;
  }

  .history-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border-radius: 20px;
  }

  .history-card-preview {
    min-height: 210px;
  }

  .history-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .history-card-actions .danger-btn {
    grid-column: 1 / -1;
  }

  .crop-modal {
    place-items: stretch;
    padding: 0;
  }

  .crop-dialog {
    width: 100%;
    height: calc(100dvh - env(safe-area-inset-top));
    max-height: none;
    gap: 12px;
    padding: 16px 12px calc(12px + env(safe-area-inset-bottom));
    border-radius: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .crop-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-right: 40px;
  }

  .crop-head h2 {
    font-size: 23px;
  }

  .crop-head p {
    font-size: 13px;
  }

  .crop-ratio-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .crop-ratio-tabs button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 4px;
  }

  .crop-stage {
    min-height: 0;
    padding: 8px;
    overflow: hidden;
  }

  .crop-stage canvas {
    max-width: none;
    max-height: none;
    flex: none;
  }

  .crop-handle {
    width: 18px;
    height: 18px;
  }

  .crop-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .crop-actions button {
    min-height: 48px;
  }

  .login-modal,
  .export-modal,
  .size-modal {
    place-items: end center;
    padding: 0;
  }

  .login-dialog,
  .export-dialog,
  .size-dialog {
    width: 100%;
    max-height: calc(92dvh - env(safe-area-inset-top));
    overflow: auto;
    padding: 24px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  .login-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-code-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .wechat-login-box {
    min-height: 190px;
  }

  .export-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 390px) {
  .shell {
    padding-inline: 6px;
  }

  .topbar {
    padding-inline: 8px;
  }

  .brand-sub {
    display: none;
  }

  .flow-tabs button {
    font-size: 12px;
  }

  .flow-title h1 {
    font-size: 29px;
  }

  .upload-steps {
    gap: 10px;
    font-size: 12px;
  }

  .style-preview-card,
  #webView [data-flow-page="pattern"] .style-preview-card {
    min-height: 400px;
  }

  .metric strong {
    font-size: 18px;
  }
}

@media (hover: none) and (pointer: coarse) {
  button:hover,
  .history-card:hover,
  .large-upload-card:hover {
    transform: none;
  }
}
