html,
body {
  min-height: 100%;
}

:root {
  --surface-0: #07111f;
  --surface-1: #0d1727;
  --surface-2: #142033;
  --surface-3: #1d2b40;
  --surface-border: rgba(158, 174, 194, 0.18);
  --surface-border-soft: rgba(158, 174, 194, 0.1);
  --text-main: #f4f8ff;
  --text-muted: #93a6bf;
  --accent: #41c2ff;
  --accent-2: #7dd3fc;
  --success: #22c55e;
  --danger: #fb7185;
  --canvas-bg: #0a1322;
  --panel-bg: rgba(12, 20, 34, 0.8);
  --toolbar-bg: rgba(12, 20, 34, 0.78);
  --transition-ui: 180ms ease;
  --shadow-soft: 0 18px 40px rgba(2, 6, 23, 0.28);
  --shadow-strong: 0 30px 80px rgba(2, 6, 23, 0.42);
  --radius-shell: 1.9rem;
  --radius-card: 1.35rem;
  --radius-control: 1rem;
  --font-ui: "Manrope", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

html.light-mode {
  --surface-0: #f7fbff;
  --surface-1: #edf4fb;
  --surface-2: #ffffff;
  --surface-3: #dceaf8;
  --surface-border: rgba(148, 163, 184, 0.18);
  --surface-border-soft: rgba(148, 163, 184, 0.1);
  --text-main: #132033;
  --text-muted: #63758c;
  --accent: #119ae0;
  --accent-2: #0f6fcf;
  --canvas-bg: #f7fbff;
  --panel-bg: rgba(255, 255, 255, 0.82);
  --toolbar-bg: rgba(255, 255, 255, 0.84);
  --shadow-soft: 0 14px 38px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 24px 68px rgba(15, 23, 42, 0.12);
}

html.premium-mode {
  --surface-0: #160914;
  --surface-1: #201027;
  --surface-2: #31163a;
  --surface-3: #49225a;
  --surface-border: rgba(255, 184, 230, 0.22);
  --surface-border-soft: rgba(255, 184, 230, 0.1);
  --text-main: #fff4fb;
  --text-muted: #d0b2c9;
  --accent: #ff77c8;
  --accent-2: #ffb86b;
  --canvas-bg: #170a17;
  --panel-bg: rgba(31, 13, 34, 0.84);
  --toolbar-bg: rgba(25, 10, 30, 0.88);
  --shadow-soft: 0 24px 56px rgba(18, 5, 20, 0.44);
  --shadow-strong: 0 36px 96px rgba(18, 5, 20, 0.62);
}

.icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon use {
  fill: currentColor;
}

button .icon {
  color: currentColor;
}

button svg.icon {
  transform: translateZ(0);
}

#pageList .page-item {
  cursor: grab;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(22, 33, 54, 0.92), rgba(12, 20, 36, 0.86));
  border-radius: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(148, 163, 184, 0.08);
}

html.light-mode #pageList .page-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 255, 0.72));
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(191, 219, 254, 0.42);
}

#pageList .page-item:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.28);
  box-shadow: 0 0 0 3px rgba(65, 194, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(148, 163, 184, 0.08);
}

#pageList .page-item:active {
  cursor: grabbing;
}

#pageList .page-item.active {
  outline: 1px solid rgba(14, 165, 233, 0.55);
  box-shadow: 0 0 0 3px rgba(65, 194, 255, 0.14), 0 0 0 1px rgba(14, 165, 233, 0.2) inset, inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

html,
body {
  font-family: var(--font-ui);
  color: var(--text-main);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(65, 194, 255, 0.18), transparent 24%),
    radial-gradient(circle at 88% 10%, rgba(125, 211, 252, 0.08), transparent 26%),
    radial-gradient(circle at 52% 100%, rgba(34, 197, 94, 0.06), transparent 24%),
    linear-gradient(160deg, var(--surface-0) 0%, var(--surface-1) 52%, #0b1423 100%);
}

html.light-mode body {
  background:
    radial-gradient(circle at 12% 14%, rgba(17, 154, 224, 0.12), transparent 34%),
    radial-gradient(circle at 92% 0%, rgba(15, 111, 207, 0.08), transparent 30%),
    linear-gradient(160deg, #f8fbff 0%, #edf4fb 45%, #ffffff 100%);
}

html.premium-mode body {
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 119, 200, 0.16), transparent 26%),
    radial-gradient(circle at 88% 0%, rgba(255, 184, 107, 0.14), transparent 24%),
    radial-gradient(circle at 52% 100%, rgba(192, 132, 252, 0.1), transparent 28%),
    linear-gradient(160deg, #140814 0%, #1c0d22 42%, #27132d 100%);
}

body {
  position: relative;
  isolation: isolate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    radial-gradient(circle at 12% 12%, rgba(14, 165, 233, 0.18), transparent 26%),
    radial-gradient(circle at 88% 0%, rgba(124, 58, 237, 0.08), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(34, 197, 94, 0.08), transparent 28%);
  filter: blur(18px);
  opacity: 0.9;
}

body::after {
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 72%);
}

html.light-mode body::after {
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.1) 1px, transparent 1px);
}

html.premium-mode body::after {
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 184, 230, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 184, 107, 0.07) 1px, transparent 1px);
}

html.premium-mode .workspace-shell {
  background:
    linear-gradient(180deg, rgba(28, 11, 31, 0.88), rgba(36, 14, 39, 0.78)),
    linear-gradient(135deg, rgba(255, 119, 200, 0.05), transparent 45%);
  border-color: rgba(255, 184, 230, 0.18);
  box-shadow: 0 34px 110px rgba(18, 5, 20, 0.64), inset 0 1px 0 rgba(255, 214, 240, 0.12);
}

html.premium-mode .panel {
  background:
    linear-gradient(180deg, rgba(35, 14, 39, 0.92), rgba(24, 10, 28, 0.8)),
    linear-gradient(135deg, rgba(255, 184, 107, 0.06), transparent 42%);
  border-color: rgba(255, 184, 230, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 214, 240, 0.08), 0 18px 44px rgba(18, 5, 20, 0.36);
}

html.premium-mode .panel::before {
  background: linear-gradient(135deg, rgba(255, 184, 107, 0.08), transparent 42%);
}

html.premium-mode .glass,
html.premium-mode .floating-toolbar {
  background:
    linear-gradient(180deg, rgba(31, 12, 35, 0.9), rgba(23, 10, 28, 0.78)),
    linear-gradient(135deg, rgba(255, 119, 200, 0.06), transparent 44%);
  border-color: rgba(255, 184, 230, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 214, 240, 0.08), 0 18px 44px rgba(18, 5, 20, 0.36);
}

html.premium-mode .tool-btn {
  background:
    linear-gradient(180deg, rgba(53, 20, 57, 0.96), rgba(31, 11, 35, 0.92)),
    linear-gradient(135deg, rgba(255, 184, 107, 0.08), transparent 55%);
  border-color: rgba(255, 184, 230, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 214, 240, 0.08), 0 10px 24px rgba(18, 5, 20, 0.3);
}

html.premium-mode .tool-btn:hover {
  background:
    linear-gradient(180deg, rgba(70, 26, 73, 0.98), rgba(37, 13, 41, 0.94)),
    linear-gradient(135deg, rgba(255, 119, 200, 0.12), transparent 55%);
  border-color: rgba(255, 184, 107, 0.34);
}

html.premium-mode .tool-btn.tool-active {
  background:
    linear-gradient(180deg, rgba(122, 36, 106, 0.98), rgba(72, 22, 71, 0.94)),
    linear-gradient(135deg, rgba(255, 184, 107, 0.18), transparent 58%);
  border-color: rgba(255, 184, 107, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 184, 107, 0.28) inset, 0 0 0 3px rgba(255, 119, 200, 0.14), 0 20px 40px rgba(18, 5, 20, 0.34);
}

html.premium-mode .btn-primary,
html.premium-mode .upload-primary-btn,
html.premium-mode .workspace-empty-cta {
  background: linear-gradient(180deg, #ff8dd8, #f472b6);
  border-color: rgba(255, 184, 107, 0.54);
  box-shadow: 0 18px 34px rgba(122, 36, 106, 0.3);
}

html.premium-mode #viewerWrap {
  background:
    linear-gradient(rgba(255, 184, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 184, 107, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(255, 214, 240, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(25, 10, 30, 0.94), rgba(19, 8, 22, 0.8));
  background-size: 28px 28px, 28px 28px, auto, auto;
  border-color: rgba(255, 184, 230, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 214, 240, 0.12), inset 0 0 0 1px rgba(255, 119, 200, 0.08);
}

html.premium-mode .workspace-empty-state {
  background:
    radial-gradient(circle at top, rgba(255, 119, 200, 0.18), transparent 36%),
    linear-gradient(180deg, rgba(29, 11, 33, 0.9), rgba(21, 8, 24, 0.78));
  border-color: rgba(255, 184, 230, 0.28);
}

html.premium-mode .shop-card,
html.premium-mode .shop-code-card {
  background:
    linear-gradient(180deg, rgba(33, 12, 37, 0.92), rgba(22, 9, 25, 0.82)),
    linear-gradient(135deg, rgba(255, 184, 107, 0.06), transparent 48%);
  border-color: rgba(255, 184, 230, 0.18);
}

html.premium-mode .shop-price,
html.premium-mode .shop-status-pill {
  background: linear-gradient(180deg, rgba(68, 23, 70, 0.92), rgba(35, 12, 39, 0.84));
  border-color: rgba(255, 184, 107, 0.24);
  color: #fff4fb;
}

.workspace-shell {
  background: linear-gradient(180deg, rgba(11, 19, 33, 0.82), rgba(12, 20, 34, 0.68));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: var(--shadow-strong), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  max-width: 100%;
  border-radius: var(--radius-shell);
  backdrop-filter: blur(28px) saturate(1.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.15);
}

html.light-mode .workspace-shell {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 248, 255, 0.72));
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: var(--shadow-strong), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 24, 40, 0.84), rgba(11, 18, 32, 0.76));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 38%);
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

html.light-mode .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 250, 254, 0.72));
}

.glass,
.floating-toolbar {
  backdrop-filter: blur(20px) saturate(1.08);
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(17, 26, 43, 0.84), rgba(12, 20, 34, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-soft);
}

html.light-mode .glass,
html.light-mode .floating-toolbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 249, 255, 0.68));
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), var(--shadow-soft);
}

.transition-ui,
button,
summary,
input,
.page-item,
.activity-item {
  transition: all var(--transition-ui);
}

.tool-btn {
  min-height: 44px;
  border: 1px solid rgba(158, 174, 194, 0.16);
  background: linear-gradient(180deg, rgba(23, 35, 57, 0.92), rgba(14, 22, 38, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 24px rgba(2, 6, 23, 0.22);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  border-radius: var(--radius-control);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}

html.light-mode .tool-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 248, 255, 0.86));
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84), 0 10px 24px rgba(15, 23, 42, 0.08);
}

.tool-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.35);
  background: linear-gradient(180deg, rgba(24, 38, 63, 0.96), rgba(15, 23, 42, 0.9));
}

html.light-mode .tool-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(232, 244, 255, 0.72));
}

.tool-btn:active {
  transform: translateY(0) scale(0.986);
}

.tool-btn:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.72), var(--shadow-soft);
}

.tool-btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tool-btn[data-premium-action] {
  justify-content: flex-start;
}

.premium-tool-btn {
  position: relative;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.12rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.premium-tool-label {
  line-height: 1.1;
}

.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.48rem;
  line-height: 1;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
  border-radius: 999px;
  padding: 0.18rem 0.36rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(59, 130, 246, 0.12));
  color: #0ea5e9;
  border: 1px solid rgba(125, 211, 252, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
  white-space: nowrap;
}

html:not(.light-mode) .premium-badge {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(37, 99, 235, 0.1));
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.premium-badge::before {
  content: "";
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.premium-badge.unlocked {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(74, 222, 128, 0.1));
  color: #16a34a;
  border-color: rgba(134, 239, 172, 0.28);
}

.tool-btn.tool-active {
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(14, 165, 233, 0.24) inset, var(--shadow-soft);
  background: linear-gradient(180deg, rgba(20, 59, 89, 0.92), rgba(14, 39, 63, 0.9));
}

html.light-mode .tool-btn.tool-active {
  background: linear-gradient(180deg, rgba(214, 238, 255, 0.96), rgba(191, 230, 255, 0.82));
}

.btn-primary {
  border: 1px solid rgba(14, 116, 144, 0.65);
  background: linear-gradient(180deg, #18a6e7, #0f8ed2);
  box-shadow: 0 12px 24px rgba(14, 116, 144, 0.22);
  color: #ffffff;
}

.btn-primary:hover {
  border-color: rgba(14, 116, 144, 0.85);
  background: linear-gradient(180deg, #22b0ef, #0f8ed2);
  color: #ffffff;
  transform: translateY(-1px);
}

.upload-primary-btn {
  min-height: 3.5rem;
  background: linear-gradient(180deg, rgba(26, 163, 233, 0.98), rgba(14, 142, 210, 0.92));
  border-color: rgba(14, 116, 144, 0.58);
  color: #ffffff;
  box-shadow: 0 16px 30px rgba(14, 116, 144, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.upload-primary-btn:hover {
  background: linear-gradient(180deg, rgba(36, 176, 239, 1), rgba(14, 142, 210, 0.96));
  color: #ffffff;
}

html.light-mode .upload-primary-btn {
  background: linear-gradient(180deg, rgba(24, 166, 231, 0.98), rgba(15, 142, 210, 0.92));
  color: #ffffff;
}

html.light-mode .upload-primary-btn:hover {
  background: linear-gradient(180deg, rgba(20, 154, 220, 1), rgba(12, 130, 194, 0.96));
  color: #ffffff;
  border-color: rgba(11, 110, 168, 0.72);
  box-shadow: 0 18px 32px rgba(14, 116, 144, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

#viewerWrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.72), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(237, 244, 251, 0.68));
  border: 1px solid rgba(148, 163, 184, 0.16);
  min-height: min(70vh, 840px);
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.design-layer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.design-layer-grid .tool-btn {
  min-height: 3.25rem;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  justify-content: flex-start;
}

.design-layer-grid .tool-btn .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.design-layer-grid .premium-tool-btn {
  align-items: flex-start;
  justify-content: center;
  gap: 0.28rem;
}

.design-layer-grid .premium-tool-label {
  display: block;
  max-width: 100%;
}

.design-layer-grid .premium-badge {
  position: static;
  align-self: flex-start;
}

html:not(.light-mode) #viewerWrap {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(8, 15, 28, 0.88), rgba(10, 18, 34, 0.7));
}

.workspace-empty-state {
  position: absolute;
  inset: 1.25rem;
  z-index: 2;
  border-radius: 1.4rem;
  border: 1px dashed rgba(125, 211, 252, 0.38);
  background:
    radial-gradient(circle at top, rgba(65, 194, 255, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(12, 20, 34, 0.82), rgba(10, 18, 34, 0.7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: opacity var(--transition-ui), transform var(--transition-ui), border-color var(--transition-ui);
}

html.light-mode .workspace-empty-state {
  background:
    radial-gradient(circle at top, rgba(17, 154, 224, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 249, 255, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.workspace-empty-state:hover {
  transform: translateY(-2px);
  border-color: rgba(65, 194, 255, 0.56);
}

.workspace-empty-state.is-drag-active,
#viewerWrap.is-drag-active .workspace-empty-state {
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(65, 194, 255, 0.88);
  background:
    radial-gradient(circle at top, rgba(65, 194, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(16, 31, 52, 0.9), rgba(10, 18, 34, 0.76));
  box-shadow: 0 0 0 3px rgba(65, 194, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

html.light-mode .workspace-empty-state.is-drag-active,
html.light-mode #viewerWrap.is-drag-active .workspace-empty-state {
  background:
    radial-gradient(circle at top, rgba(17, 154, 224, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(240, 248, 255, 0.82));
}

.workspace-empty-state.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.workspace-empty-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(65, 194, 255, 0.14);
  color: var(--accent);
  border: 1px solid rgba(125, 211, 252, 0.24);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.workspace-empty-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(24, 166, 231, 0.2), rgba(15, 142, 210, 0.14));
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(14, 116, 144, 0.22);
}

.workspace-empty-icon .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.workspace-empty-state h3 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.workspace-empty-state p {
  margin: 0;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

.workspace-empty-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(24, 166, 231, 0.98), rgba(15, 142, 210, 0.92));
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(14, 116, 144, 0.2);
}

#pdfCanvas {
  width: 100%;
  max-width: 100%;
  border-radius: 0.75rem;
  display: block;
  position: relative;
  z-index: 1;
  -webkit-user-drag: none;
  user-select: none;
}

#overlayLayer {
  z-index: 20;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}

#overlayLayer.overlay-root {
  position: absolute;
  left: 0;
  top: 0;
}

.overlay-draw {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay-item {
  position: absolute;
  border: 1px solid transparent;
  cursor: move;
  pointer-events: auto;
  box-sizing: border-box;
}

.overlay-item.is-active {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2) inset;
}

.overlay-text {
  width: 100%;
  height: 100%;
  font-size: 42px;
  line-height: 1.1;
  color: #111827;
  padding: 2px 4px;
  outline: none;
  background: transparent;
  cursor: text;
  user-select: text;
}

.overlay-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.overlay-resize {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 11px;
  height: 11px;
  background: #38bdf8;
  border: 1px solid #ffffff;
  border-radius: 2px;
  cursor: nwse-resize;
  pointer-events: auto;
}

.pdf-text-layer {
  z-index: 5;
  pointer-events: none;
  user-select: none;
  color: transparent;
  transform-origin: 0 0;
  display: none;
}

.pdf-text-layer > span {
  position: absolute;
  white-space: pre;
  transform-origin: 0 0;
  color: transparent;
  line-height: 1;
}

.pdf-edit-box {
  position: absolute;
  border: 1px solid transparent;
  background: transparent;
  color: transparent;
  font-size: 12px;
  line-height: 1.1;
  padding: 0;
  overflow: hidden;
  cursor: text;
  user-select: none;
}

.pdf-edit-box:hover,
.pdf-edit-box.is-selected {
  border-color: rgba(56, 189, 248, 0.38);
}

.pdf-edit-box.pdf-edit-box-edited {
  border-color: transparent;
  color: #111827;
  padding: 1px 2px;
  border-radius: 0;
  cursor: move;
  touch-action: none;
  box-shadow: none;
}

.pdf-edit-box.pdf-edit-box-debug {
  outline: 1px dashed rgba(239, 68, 68, 0.85);
  outline-offset: 0;
  overflow: visible;
}

.pdf-edit-debug-chip {
  position: absolute;
  left: -1px;
  top: -16px;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(239, 68, 68, 0.6);
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 9px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
}

.pdf-edit-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #38bdf8;
  border: 1px solid #ffffff;
  border-radius: 2px;
  display: none;
  z-index: 2;
}

.pdf-edit-box.pdf-edit-box-edited.is-selected .pdf-edit-handle {
  display: block;
}

.pdf-edit-handle.h-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.pdf-edit-handle.h-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.pdf-edit-handle.h-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.pdf-edit-handle.h-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.pdf-edit-handle.h-n { left: calc(50% - 4px); top: -5px; cursor: ns-resize; }
.pdf-edit-handle.h-s { left: calc(50% - 4px); bottom: -5px; cursor: ns-resize; }
.pdf-edit-handle.h-w { left: -5px; top: calc(50% - 4px); cursor: ew-resize; }
.pdf-edit-handle.h-e { right: -5px; top: calc(50% - 4px); cursor: ew-resize; }

.pdf-edit-input {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: inherit;
  line-height: 1.15;
  padding: 1px 2px;
  overflow: hidden;
  font: inherit;
  box-sizing: border-box;
}

.accordion-panel {
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, rgba(17, 27, 46, 0.82), rgba(10, 18, 34, 0.74));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius-card) - 0.25rem);
  overflow: visible;
}

html.light-mode .accordion-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(245, 249, 255, 0.38));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.accordion-panel[open] > summary {
  border-bottom: 1px solid var(--surface-border-soft);
}

#appLayout > * {
  min-width: 0;
}

#propertyToolbar {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

#pageList {
  padding: 0.25rem 0.4rem 0.5rem 0.25rem;
  overflow-x: visible;
}

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

.floating-toolbar {
  position: absolute;
  z-index: 40;
  padding: 0.35rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.floating-toolbar.hidden {
  display: none;
}

.toast-host {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  border: 1px solid var(--surface-border);
  background: var(--toolbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  transform: translateY(-8px);
  opacity: 0;
  animation: toastIn 200ms ease-in-out forwards;
}

.toast-item.is-out {
  animation: toastOut 200ms ease-in-out forwards;
}

@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.modal-enter {
  animation: modalIn 200ms ease-in-out forwards;
}

.modal-leave {
  animation: modalOut 200ms ease-in-out forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

#modalRoot {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  overflow: auto;
  align-items: center;
  justify-content: center;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

html.light-mode #modalRoot {
  background: rgba(241, 245, 249, 0.42);
}

#modalRoot > div {
  position: relative;
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  margin: auto;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  left: auto;
  inset-inline-start: auto;
  inset-inline-end: 1rem;
  z-index: 5;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.64);
  color: #223047;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

html:not(.light-mode) .modal-close {
  background: rgba(14, 23, 42, 0.78);
  color: #f4f8ff;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.modal-close:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.28);
}

.checkout-modal,
.shop-modal {
  position: relative;
  overflow: hidden;
}

.checkout-shell,
.shop-shell {
  position: relative;
  z-index: 1;
}

.shop-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.shop-hero-copy {
  padding-top: 0.15rem;
  max-width: 48rem;
}

.checkout-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #0ea5e9;
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.14), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(14, 165, 233, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 24px rgba(15, 23, 42, 0.08);
}

.checkout-icon .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.checkout-icon--signature {
  color: #7c3aed;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.15), rgba(168, 85, 247, 0.08));
  border-color: rgba(124, 58, 237, 0.18);
}

.checkout-icon--ocr {
  color: #0f766e;
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.14), rgba(45, 212, 191, 0.08));
  border-color: rgba(13, 148, 136, 0.18);
}

.checkout-icon--theme {
  color: #7c3aed;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.14), rgba(199, 210, 254, 0.1));
  border-color: rgba(124, 58, 237, 0.18);
}

.checkout-icon--base {
  color: #16a34a;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.14), rgba(134, 239, 172, 0.08));
  border-color: rgba(34, 197, 94, 0.18);
}

.checkout-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(18, 29, 48, 0.94), rgba(10, 18, 34, 0.86));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.checkout-price {
  font-size: 1.75rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f8fbff;
}

html.light-mode .checkout-price-row {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(242, 247, 255, 0.62));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

html.light-mode .checkout-price {
  color: #0f172a;
}

.shop-code-card {
  min-width: 100%;
  max-width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1.25rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(19, 30, 50, 0.9), rgba(11, 19, 35, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 28px rgba(2, 6, 23, 0.26);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.shop-code-wrap {
  margin-top: 1.25rem;
  display: block;
}

.shop-modal {
  padding-top: 1.25rem;
}

.shop-grid {
  align-items: stretch;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shop-card {
  min-height: 220px;
}

.shop-card h4 {
  font-size: 1.05rem;
  line-height: 1.35;
}

.shop-card p {
  font-size: 0.95rem;
}

.shop-code-wrap .shop-code-card {
  max-width: none;
}

.shop-code-wrap .tool-btn {
  flex: 0 0 auto;
}

html.light-mode .shop-code-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(242, 247, 255, 0.54));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76), 0 14px 28px rgba(15, 23, 42, 0.08);
}

.shop-code-card:focus-within {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.76), 0 14px 28px rgba(15, 23, 42, 0.08);
}

.shop-code-input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border-radius: 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(6, 13, 26, 0.72);
  color: var(--text-main);
  padding: 0.78rem 0.9rem;
  box-shadow: inset 0 1px 2px rgba(2, 6, 23, 0.28);
}

html.light-mode .shop-code-input {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.shop-code-input::placeholder {
  color: rgba(100, 116, 139, 0.7);
}

.shop-code-input:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12), inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.shop-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1.35rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(18, 29, 48, 0.94), rgba(10, 18, 34, 0.84));
  min-height: 250px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 34px rgba(2, 6, 23, 0.26);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

html.light-mode .shop-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(244, 249, 255, 0.58));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 16px 34px rgba(15, 23, 42, 0.08);
}

.shop-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, var(--shop-accent, rgba(14, 165, 233, 0.16)), transparent 55%);
  pointer-events: none;
}

.shop-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 40%);
  pointer-events: none;
}

html.light-mode .shop-card::after {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 40%);
}

.shop-card > * {
  position: relative;
  z-index: 1;
}

.shop-card:hover {
  transform: translateY(-3px);
  border-color: rgba(14, 165, 233, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 22px 40px rgba(2, 6, 23, 0.34);
}

html.light-mode .shop-card:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 22px 40px rgba(15, 23, 42, 0.1);
}

.shop-card-free {
  --shop-accent: rgba(34, 197, 94, 0.18);
}

.shop-card-featured {
  --shop-accent: rgba(14, 165, 233, 0.22);
  border-color: rgba(14, 165, 233, 0.32);
}

.shop-card-icon {
  width: 2.35rem;
  height: 2.35rem;
  margin-bottom: 0.8rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(25, 39, 63, 0.9), rgba(13, 21, 37, 0.82));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 22px rgba(2, 6, 23, 0.2);
}

html.light-mode .shop-card-icon {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 249, 255, 0.56));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 10px 22px rgba(15, 23, 42, 0.06);
}

.shop-card-icon .icon {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
}

.shop-price {
  white-space: nowrap;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  color: #f8fbff;
  align-self: flex-start;
  padding: 0.42rem 0.62rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(24, 38, 63, 0.92), rgba(12, 20, 36, 0.84));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html.light-mode .shop-price {
  color: #0f172a;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(242, 247, 255, 0.74));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.shop-status-pill {
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.76rem;
  line-height: 1;
  color: var(--accent);
  align-self: flex-start;
  padding: 0.48rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(24, 38, 63, 0.72), rgba(12, 20, 36, 0.62));
  border: 1px solid rgba(125, 211, 252, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html.light-mode .shop-status-pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(242, 247, 255, 0.78));
  border-color: rgba(125, 211, 252, 0.28);
}

.shop-card .btn-primary,
.shop-card .tool-btn {
  min-height: 42px;
}

#shopBtn {
  position: relative;
  overflow: hidden;
  border-color: rgba(14, 165, 233, 0.22);
  background: linear-gradient(180deg, rgba(24, 38, 63, 0.94), rgba(14, 23, 42, 0.86));
}

html.light-mode #shopBtn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(237, 245, 255, 0.68));
}

#shopBtn .icon {
  color: var(--accent);
}

#shopBtn:hover {
  border-color: rgba(14, 165, 233, 0.35);
}

#themeToggle {
  min-width: 0;
}

header.panel img {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 24px rgba(2, 6, 23, 0.26);
  background: linear-gradient(180deg, rgba(25, 39, 63, 0.92), rgba(13, 21, 37, 0.84));
}

html.light-mode header.panel img {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 24px rgba(15, 23, 42, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.7));
}

header.panel {
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

header.panel h1 {
  font-size: clamp(2rem, 2.4vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -0.055em;
}

header.panel p {
  font-weight: 500;
}

details > summary {
  font-weight: 700;
  letter-spacing: -0.02em;
}

#buildVersion {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.toast-item {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 28px rgba(2, 6, 23, 0.28);
}

button[data-premium-action] {
  position: relative;
}

@media (max-width: 1279px) {
  #appLayout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 767px) {
  #modalRoot {
    padding: 0.5rem;
  }

  #modalRoot > div {
    max-height: calc(100dvh - 1rem);
  }

  .shop-hero {
    grid-template-columns: 1fr;
  }

  .checkout-shell,
  .shop-shell {
    padding-right: 0 !important;
  }

  .shop-code-card {
    width: 100%;
  }

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

  .modal-close {
    top: 0.55rem;
    right: 0.55rem;
    left: auto;
    inset-inline-end: 0.55rem;
    width: 2.3rem;
    height: 2.3rem;
  }

  .shop-code-wrap .mt-2 {
    display: grid;
    grid-template-columns: 1fr;
  }
}
