/* The illustrated workshop is a mobile calculator surface only. */
.workshop-art,
.workshop-curtain,
.workshop-foreground {
  display: none;
}

@media (max-width: 950px) {
  body[data-exchange-view="calculator"] {
    --workshop-width: min(100vw, 600px);
    --workshop-art-height: calc(var(--workshop-width) * .7755581669);
    --workshop-edge: calc(var(--workshop-width) * .0329024677);
    --workshop-foot: calc(var(--workshop-width) * .223266745);
    --workshop-header-height: clamp(54px, calc(var(--workshop-width) * .1527614571), 92px);
    --workshop-control-size: clamp(44px, calc(var(--workshop-width) * .085), 52px);
    --workshop-control-face: clamp(34px, calc(var(--workshop-width) * .075), 46px);
    --workshop-control-inset: calc((var(--workshop-control-size) - var(--workshop-control-face)) / 2);
  }

  body[data-exchange-view="calculator"] .exchange-hero {
    display: block;
    width: 100%;
    max-width: 600px;
    min-height: 0;
    padding: 0;
    margin: 0 auto;
    gap: 0;
  }

  /* Nine-slice artwork keeps the scene and garden proportional while the
     blank paper and wooden sides grow with errors, quotes and larger text. */
  body[data-exchange-view="calculator"] #mobile-workshop {
    --ink: #352050;
    --muted: #75627f;
    --surface: #fff6e8;
    --surface-soft: #fffaf3;
    --surface-tint: #ede1ff;
    --line: #debed2;
    --field-border: #a891b3;
    --accent: #6434d9;
    --accent-hover: #5022bb;
    --on-accent: #fff;
    --focus: #6434d9;
    --token-light: #70f5cf;
    --token-mid: #13c6a3;
    --token-dark: #078e80;
    --token-edge: #19584e;
    --token-symbol: #f3fff8;
    display: block;
    position: relative;
    isolation: isolate;
    width: 100%;
    min-width: 0;
    padding: var(--workshop-art-height) var(--workshop-edge) var(--workshop-foot);
    margin: 0;
    color: var(--ink);
  }

  body[data-exchange-view="calculator"] #mobile-workshop::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-style: solid;
    border-color: transparent;
    border-width: var(--workshop-art-height) var(--workshop-edge) var(--workshop-foot);
    border-image-source: url('./workshop-plate.webp?v=db7b5f5d3459');
    border-image-slice: 660 28 190 28 fill;
    border-image-width: 1;
    border-image-repeat: stretch;
    pointer-events: none;
  }

  body[data-exchange-view="calculator"] #mobile-workshop[data-asset="BTC"] {
    --token-light: #ffeaa0;
    --token-mid: #ffc147;
    --token-dark: #d99116;
    --token-edge: #74501e;
    --token-symbol: #774119;
  }

  body[data-exchange-view="calculator"] #mobile-workshop[data-asset="LTC"] {
    --token-light: #f1ebff;
    --token-mid: #beb1f9;
    --token-dark: #8c74cc;
    --token-edge: #534477;
    --token-symbol: #553497;
  }

  body[data-exchange-view="calculator"] .workshop-art {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--workshop-art-height);
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
  }

  body[data-exchange-view="calculator"] .workshop-art svg {
    display: block;
    position: absolute;
    max-width: none;
    height: auto;
    fill: none;
    stroke: none;
    overflow: visible;
  }

  body[data-exchange-view="calculator"] .workshop-token {
    left: 39.952996475%;
    top: calc(var(--workshop-width) * .4700352526);
    width: 16.4512338425%;
    color: var(--token-symbol);
    filter: drop-shadow(0 2px 1px #38203924);
  }

  body[data-exchange-view="calculator"] .workshop-tray-front {
    inset: 0;
    width: 100%;
    height: var(--workshop-art-height);
  }

  body[data-exchange-view="calculator"] [data-workshop-symbol] {
    fill: var(--token-symbol);
    stroke: none;
    font-family: Nunito, Arial, sans-serif;
    font-weight: 900;
  }

  body[data-exchange-view="calculator"] .workshop-pile {
    left: 71.680376028%;
    top: calc(var(--workshop-width) * .5287896592);
    width: 17.0387779083%;
  }

  body[data-exchange-view="calculator"] [data-workshop-pile-coin] {
    opacity: 0;
    transform: translateY(-7px);
    transition: opacity 160ms ease, transform 240ms cubic-bezier(.2,.7,.3,1);
  }

  body[data-exchange-view="calculator"] [data-workshop-pile-coin].is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* The cloth and its painted wordmark move together. Native buttons stay
     still, and the foreground leaves and lantern sit above the fabric. */
  body[data-exchange-view="calculator"] .site-header {
    display: block;
    position: absolute;
    z-index: 30;
    isolation: isolate;
    top: 0;
    left: 50%;
    width: var(--workshop-width);
    max-width: 600px;
    height: var(--workshop-header-height);
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    transform: translateX(-50%);
    pointer-events: none;
  }

  body[data-exchange-view="calculator"] .site-header .workshop-curtain,
  body[data-exchange-view="calculator"] .site-header .workshop-foreground {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    fill: none;
    stroke: none;
    pointer-events: none;
    user-select: none;
  }

  body[data-exchange-view="calculator"] .site-header .workshop-curtain {
    z-index: 0;
    height: var(--workshop-header-height);
    overflow: visible;
  }

  body[data-exchange-view="calculator"] .site-header .workshop-foreground {
    z-index: 4;
    height: calc(var(--workshop-width) * .3525264395);
    overflow: hidden;
  }

  body[data-exchange-view="calculator"] .site-header .header-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: absolute;
    z-index: 2;
    top: 0;
    left: 9.5%;
    width: 39.5%;
    height: 90%;
    min-width: 0;
    gap: 0;
    pointer-events: auto;
  }

  body[data-exchange-view="calculator"] .site-header .wordmark {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    height: 100%;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    color: #fff8ff;
    font-size: clamp(20px, calc(var(--workshop-width) * .065), 36px);
  }

  body[data-exchange-view="calculator"] .site-header .wordmark .brand-accent {
    color: #e5d1ff;
  }

  body[data-exchange-view="calculator"] .site-header .wordmark > span {
    opacity: 1;
  }

  body[data-exchange-view="calculator"][data-workshop-curtain-ready="true"] .site-header .wordmark > span {
    opacity: 0;
  }

  body[data-exchange-view="calculator"] .site-header .brand-copyright,
  body[data-exchange-view="calculator"] .site-header .desktop-nav,
  body[data-exchange-view="calculator"] .site-header .header-cta svg {
    display: none;
  }

  body[data-exchange-view="calculator"] .site-header .header-cta,
  body[data-exchange-view="calculator"] .site-header .menu-toggle {
    position: absolute;
    z-index: 2;
    top: max(0px, calc((var(--workshop-header-height) * .8 - var(--workshop-control-size)) / 2));
    height: var(--workshop-control-size);
    min-height: 44px;
    margin: 0;
    padding: 8px;
    isolation: isolate;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: #fff8ff;
    pointer-events: auto;
  }

  body[data-exchange-view="calculator"] .site-header .header-cta {
    display: inline-flex;
    right: calc(5.3% + var(--workshop-control-size) + 8px);
    width: 24%;
    gap: 0;
    font-size: clamp(11px, calc(var(--workshop-width) * .03077), 16px);
    font-weight: 900;
    line-height: 1.25;
    white-space: nowrap;
  }

  /* Compact painted faces keep a 44px-or-larger touch target. */
  body[data-exchange-view="calculator"] .site-header .header-cta::before,
  body[data-exchange-view="calculator"] .site-header .menu-toggle::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: var(--workshop-control-inset) 0;
    border: 1px solid #ba8eff;
    border-radius: 10px;
    background: linear-gradient(145deg, #9656f3, #6d2ce2 70%, #7132d2);
    box-shadow: inset 0 1px 0 #dabaff75, 0 2px 3px #240e3724;
  }

  body[data-exchange-view="calculator"] .site-header .header-cta:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  body[data-exchange-view="calculator"] .site-header .header-cta:hover::before {
    background: linear-gradient(145deg, #a164f5, #7937e6);
  }

  body[data-exchange-view="calculator"] .site-header .menu-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    right: 5.3%;
    width: var(--workshop-control-size);
    gap: 6px;
  }

  body[data-exchange-view="calculator"] .site-header .menu-toggle::before {
    inset: var(--workshop-control-inset);
    border-color: #d5aff4;
    background: #49245e75;
    box-shadow: inset 0 1px 0 #ffffff24;
  }

  body[data-exchange-view="calculator"] .site-header .menu-toggle span {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 2px;
    background: #fff5ff;
    transition: transform 160ms ease;
  }

  body[data-exchange-view="calculator"] .site-header .menu-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(4px) rotate(45deg);
  }

  body[data-exchange-view="calculator"] .site-header .menu-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-4px) rotate(-45deg);
  }

  body[data-exchange-view="calculator"] .site-header :is(a, button):focus-visible {
    outline-color: #ffe58a;
    outline-offset: 3px;
  }

  body[data-exchange-view="calculator"] .site-header .mobile-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    z-index: 6;
    top: calc(100% + 10px);
    left: 12px;
    right: 12px;
    gap: 2px;
    padding: 10px;
    border: 1px solid #9874bb;
    border-radius: 18px;
    color: #fff6e7;
    background: #42275e;
    box-shadow: 0 15px 36px #28133845;
    pointer-events: auto;
  }

  body[data-exchange-view="calculator"] .site-header .mobile-menu[hidden] {
    display: none;
  }

  body[data-exchange-view="calculator"] .site-header .mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px;
    gap: 12px;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.4;
    white-space: normal;
  }

  body[data-exchange-view="calculator"] .site-header .mobile-menu a:hover {
    color: #fff;
    background: #674487;
  }

  body[data-exchange-view="calculator"] .site-header .mobile-menu svg {
    width: 20px;
    height: 20px;
    color: #dcc2ff;
  }

  /* Real calculator controls stay in the document and retain all validation.
     Only its introductory copy becomes screen-reader-only on this layout. */
  body[data-exchange-view="calculator"] #mobile-workshop #exchange-app {
    position: relative;
    z-index: 2;
    width: 100%;
    min-width: 0;
    color: var(--ink);
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-calculator {
    width: 100%;
    padding: 4px 20px 20px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-calculator .ex-card-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-field {
    margin-bottom: 15px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-label {
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.4;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-amount-input {
    min-height: 57px;
    padding: 10px 14px;
    gap: 10px;
    border-radius: 14px;
    background: #fffbf5d9;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-amount-input input {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.25;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-amount-input > span {
    font-size: 14px;
    font-weight: 900;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-help {
    font-size: 11px;
    line-height: 1.65;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-assets {
    gap: 8px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-asset {
    min-height: 46px;
    padding: 10px 5px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.55;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-asset[aria-pressed="true"],
  body[data-exchange-view="calculator"] #mobile-workshop .ex-primary {
    color: #fff;
    background: linear-gradient(145deg, #7747e6, #5a28c9);
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-asset[aria-pressed="true"]:hover:not(:disabled),
  body[data-exchange-view="calculator"] #mobile-workshop .ex-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, #8453eb, #6230cf);
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-receive {
    margin: 12px 0 16px;
    gap: 6px 12px;
    font-size: 12px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-receive strong {
    max-width: 100%;
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-input {
    min-height: 49px;
    padding: 12px 14px;
    border-radius: 13px;
    background: #fffbf5d9;
    font-size: 16px;
    line-height: 1.4;
  }

  /* The two adjacent elements form one warm summary, including live messages. */
  body[data-exchange-view="calculator"] #mobile-workshop .ex-total {
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin-top: 17px;
    padding: 13px 14px 7px;
    border: 0;
    border-radius: 16px 16px 0 0;
    background: #fff0b8;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-total > span {
    flex: 1 1 116px;
    font-size: 14px;
    font-weight: 900;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-total > strong {
    max-width: 100%;
    margin-left: auto;
    font-size: 26px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-total small {
    font-size: 11px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-estimate-state {
    min-height: 0;
    margin: 0 0 18px;
    padding: 0 14px 14px;
    border-radius: 0 0 16px 16px;
    background: #fff0b8;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-primary {
    min-height: 51px;
    padding: 13px 15px;
    border: 1px solid #5823bc;
    border-radius: 15px;
    box-shadow: inset 0 1px 0 #bd8dff8c;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.45;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-availability {
    margin-bottom: 15px;
    border: 1px solid #e5bc6d;
    color: #6f4916;
    background: #fff1c8;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .exchange-loading,
  body[data-exchange-view="calculator"] #mobile-workshop .exchange-noscript {
    padding: 8px 20px 22px;
    font-size: 14px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .exchange-loading-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (max-width: 360px) {
  body[data-exchange-view="calculator"] #mobile-workshop .ex-calculator {
    padding-inline: 16px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-label {
    font-size: 13px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-assets {
    gap: 6px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-asset {
    gap: 4px;
    font-size: 13px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-asset > span {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }

  body[data-exchange-view="calculator"] #mobile-workshop .ex-total > strong {
    font-size: 24px;
  }

  body[data-exchange-view="calculator"] .site-header .header-cta {
    padding-inline: 4px;
  }
}

@media (max-width: 950px) and (prefers-reduced-motion: reduce) {
  body[data-exchange-view="calculator"] [data-workshop-pile-coin],
  body[data-exchange-view="calculator"] .site-header .menu-toggle span {
    transition: none;
  }

  body[data-exchange-view="calculator"] [data-workshop-pile-coin] {
    transform: none;
  }
}
