.exchange {
  --wood: #bb8761;
  --wood-dark: #885c43;
  --card-border: #d8d4c4;
  width: min(1010px, 94%);
  margin: auto;
  padding: clamp(10px, 2.6vh, 28px) 0;
  color: var(--ink, #173c49);
  font-family: var(--ui, sans-serif);
}
.exchange * {box-sizing: border-box}
.exchange button, .exchange input {font: inherit}
.exchange button {touch-action: manipulation}
.exchange [hidden] {display: none !important}
.exchange-heading {display: block; height: auto; padding: 0; background: transparent; text-align: inherit; border: 0}
.exchange-heading h2 {margin: 0; font: 600 clamp(25px, 4vw, 44px)/1.08 Georgia, 'Yu Mincho', serif; letter-spacing: -.045em; color: inherit; overflow-wrap: anywhere}
.exchange-heading p {margin: 5px 0 0; font-weight: 600; color: #516867}
.exchange-btn, .exchange-back, .exchange-quantity, .exchange-sound {
  min-height: 36px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 9px;
  font-weight: 700 !important;
}
.exchange-btn {padding: 9px 19px; color: #fff; background: var(--ocean); box-shadow: 0 2px 0 #08485c; border: 1px solid #0b5064}
.exchange-btn:hover {background: #08495f}
.exchange-back, .exchange-sound {padding: 8px 13px; border: 1px solid #bbc8be; background: #fffdf7}
.exchange-back:hover, .exchange-back[aria-pressed=true], .exchange-sound:hover {background: #e3f1e9; border-color: #77a498}
.exchange-line {display: flex; align-items: center; justify-content: flex-start; gap: 10px; color: #135b70; min-width: 0}
.exchange-line > span {font: 500 clamp(20px, min(3.25vw, 5.1vh), 39px)/1.18 NH, 'Trebuchet MS', sans-serif}
.exchange-sound {min-height: 33px; width: 37px; height: 33px; padding: 6px; display: grid; place-items: center; flex: none; color: #34665c}
.exchange-sound svg {width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round}
.exchange-status {font-size: .9rem; line-height: 1.42; color: #475d5c; margin: 4px 0; min-height: 0}
.exchange-status:empty {display: none}
.exchange-status.exchange-success {color: #236346; font-weight: 750}
.exchange-shop {display: flex; flex-direction: column; align-items: stretch; max-width: 920px}
.exchange-sign {
  position: relative;
  margin: 0 4%;
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: .8em;
  border: 2px solid #4b827b; border-bottom: 0;
  background: #e3f0e6;
  padding: clamp(9px, 1.7vh, 21px);
  border-radius: 25px 25px 0 0;
  color: #214e49;
}
.exchange-sign .exchange-heading h2 {font-size: clamp(25px, min(4.4vw, 6.5vh), 49px)}
.exchange-tag {font-weight: 700; font-size: clamp(11px, 1.2vw, 15px); border: 1px solid #c9a978; border-radius: 6px; background: #fcf3d6; color: #725328; padding: 5px 9px; white-space: nowrap}
.exchange-counter {
  position: relative; isolation: isolate;
  padding: clamp(24px, 4.5vh, 42px) clamp(12px, 3.5vw, 44px) clamp(11px, 2.4vh, 25px); 
  border: 1px solid #c5bfad; border-bottom: 8px solid var(--wood);
  background: linear-gradient(#faf2df, #fffaf0 65%, #faf5e9);
  border-radius: 13px 13px 16px 16px;
  box-shadow: 0 3px 0 var(--wood-dark), 0 8px 25px #85673411;
}
.exchange-counter:before {
  content: ''; pointer-events: none; position: absolute; top: -1px; left: -1px; right: -1px;
  height: clamp(12px, 2.7vh, 23px); border-radius: 12px 12px 5px 5px;
  background: repeating-linear-gradient(90deg, #bf584b 0 32px, #fff8e3 32px 64px);
  box-shadow: inset 0 -3px 0 #704b351e, 0 2px 0 #ad8c6429;
}
.exchange-stage {display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: clamp(8px, 1.7vh, 18px)}
.exchange-grid {display: grid; gap: clamp(6px, 1.1vw, 13px)}
.exchange-shapes {grid-template-columns: repeat(4, minmax(0,1fr))}
.exchange-colors, .exchange-amounts {grid-template-columns: repeat(5, minmax(0,1fr))}
.exchange-tray {padding: clamp(5px, .8vw, 11px); display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 5px; border-radius: 12px; background: #fffdf5; border: 2px solid #e4d0af; border-bottom-color: #c6a47e; box-shadow: 0 2px 0 #b78e6c51; color: #224b51; min-width: 0; cursor: pointer}
.exchange-tray:hover, .exchange-quantity:hover {background: white; border-color: #6ea69d; transform: translateY(-1px)}
.exchange-tray:active, .exchange-quantity:active {transform: translateY(1px)}
.exchange-cutout {display: inline-grid; place-items: center; flex: none; width: clamp(34px, min(8.8vw, 10.7vh), 94px); aspect-ratio: 1; filter: drop-shadow(0 2px 1px #57442a1f)}
.exchange-cutout svg {display: block; width: 100%; height: 100%}
.exchange-label {max-width: 100%; overflow-wrap: anywhere; font: 500 clamp(14px, min(2.4vw, 3.3vh), 25px)/1.12 NH,'Trebuchet MS',sans-serif; text-align: center}
.exchange-ink .exchange-cutout {width: clamp(29px, min(7.1vw,8.4vh),70px)}
.exchange-item {display: flex; align-items: center; gap: 9px; font: 600 clamp(15px, 2vw, 22px)/1.2 var(--ui); margin-bottom: 10px}
.exchange-item .exchange-cutout {width: clamp(28px, 4vh, 41px)}
.exchange-amounts {width: min(100%, 595px)}
.exchange-quantity {background: #fffdf7; border: 1px solid #c7b795; border-bottom-width: 3px; padding: 4px; min-height: clamp(38px, 6vh, 62px); color: #285b63; font: 600 clamp(22px,4.5vh,35px)/1 NH,sans-serif !important}
.exchange-model {margin-top: clamp(10px, 2.3vh, 23px); border-top: 1px dashed #d1c7b1; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px}
.exchange-model .exchange-line > span {font-size: clamp(15px, min(2.35vw, 3.8vh), 28px)}
.exchange-sizes {display: flex; gap: 4px}
.exchange-sizes .exchange-back {font-size: .85rem; padding: 5px 8px; min-height: 30px}
.exchange-ticket {display: grid; grid-template-columns: minmax(140px, 1fr) minmax(150px, .85fr); width: min(100%, 690px); gap: clamp(12px, 3vw, 40px); align-items: center; margin: 7px auto 0}
.exchange-qr {display: grid; place-items: center; width: min(100%, 37vh); aspect-ratio: 1; margin: auto; border: 1px solid #cad5cb; border-radius: 8px; overflow: hidden; background: white; color: var(--ink); text-align: center}
.exchange-qr img {width: 100%; display: block; image-rendering: pixelated}
.exchange-finished img {opacity: .18; filter: blur(1px)}
.exchange-details {display: flex; flex-direction: column; gap: clamp(3px, 1.1vh, 10px); align-items: flex-start}
.exchange-details small {color: #566565; font-weight: 700}
.exchange-details .exchange-item {margin: 0}
.exchange-total {font-size: clamp(16px, 2.7vh, 25px)}
.exchange-code {font: 700 clamp(24px, min(5vw, 5vh), 40px)/1.05 ui-monospace, monospace; white-space: nowrap; letter-spacing: .035em; color: #0d5c76}
.exchange-wallet {max-width: 890px}
.exchange-wallet-head {display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 12px}
.exchange-balance {background: #fcf0ce; border: 1px solid #ddc48d; border-radius: 23px; color: #734d21; padding: 8px 16px; font-size: clamp(15px,2.6vw,24px); white-space: nowrap}
.exchange-reader, .exchange-confirm {border: 1px solid var(--card-border); border-radius: 17px; box-shadow: 0 3px 0 #e0dbcc; background: #fffdf7; padding: clamp(12px,2.4vw,28px)}
.exchange-reader {display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(12px, 2.4vw, 30px)}
.exchange-scanner {border-radius: 11px; background: #1e3e42; height: clamp(145px, 40vh, 345px); overflow: hidden; position: relative}
.exchange-scanner video {display: block; width: 100%; height: 100%; object-fit: cover}
.exchange-finder {position: absolute; height: 64%; aspect-ratio: 1; max-width: 90%; left: 50%; top: 50%; transform: translate(-50%,-50%); box-sizing: border-box; --edge: #fffdf2; background: linear-gradient(var(--edge),var(--edge)) 0 0/18% 3px, linear-gradient(var(--edge),var(--edge)) 0 0/3px 18%,linear-gradient(var(--edge),var(--edge)) 100% 0/18% 3px,linear-gradient(var(--edge),var(--edge)) 100% 0/3px 18%, linear-gradient(var(--edge),var(--edge)) 0 100%/18% 3px, linear-gradient(var(--edge),var(--edge)) 0 100%/3px 18%, linear-gradient(var(--edge),var(--edge)) 100% 100%/18% 3px, linear-gradient(var(--edge),var(--edge)) 100% 100%/3px 18%;background-repeat: no-repeat}
.exchange-entry {display: flex; flex-direction: column; align-items: flex-start; gap: 8px}
.exchange-entry .exchange-heading h2 {font-size: clamp(20px, 3vw, 32px)}
.exchange-manual {border-top: 1px dashed #d3cebf; margin-top: 3px; padding-top: 10px; width: 100%; display: grid; gap: 9px}
.exchange-manual label {display: grid; gap: 6px; font-size: 13px; font-weight: 700}
.exchange-manual input {width: 100%; border: 1px solid #b4c4bb; background: #fff; border-radius: 8px; padding: 8px 12px; font: 650 23px/1.3 ui-monospace,monospace; letter-spacing: .15em; color: var(--ink)}
.exchange-manual input::placeholder {font-weight: 400; color: #889594}
.exchange-confirm {max-width: 500px; margin: auto}
.exchange-summary {display: flex; align-items: center; gap: 15px; padding: 17px 0 8px; font: 500 clamp(17px, 3vw, 29px)/1.2 NH,sans-serif}
.exchange-summary .exchange-cutout {width: clamp(38px, 7.5vh, 62px)}
.exchange-totals {display: grid; grid-template-columns: auto auto; margin: 6px 0 12px; padding: 10px 0; gap: 7px; border-block: 1px dashed #cfcbbd}
.exchange-totals dd {margin: 0; text-align: right; font-weight: 750}
.exchange-confirm .exchange-line > span {font-size: clamp(19px, 3.2vw, 28px)}
.exchange-actions {display: flex; justify-content: flex-end; gap: 8px; padding: 9px 0}
@media (max-width: 560px) and (orientation:portrait) {
  .exchange {width: 94%; padding: 9px 0}
  .exchange-shapes {grid-template-columns: repeat(3,minmax(0,1fr))}
  .exchange-colors {grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px}
  .exchange-label {font-size: clamp(13px,4.1vw,19px)}
  .exchange-ink .exchange-label {font-size: clamp(11px,2.8vw,15px)}
  .exchange-cutout {width: min(12vw,7vh)}
  .exchange-model {flex-wrap: wrap}
  .exchange-reader {grid-template-columns: 1fr; gap: 10px}
  .exchange-scanner {height: clamp(88px, 18vh, 170px)}
  .exchange-entry {gap: 3px}
  .exchange-qr {width: 100%}
  .exchange-ticket {grid-template-columns: minmax(120px,1fr) minmax(124px, .85fr); gap: 8px}
  .exchange-total,.exchange-details .exchange-item {font-size: 14px}
  .exchange-ticket .exchange-item {gap: 4px}
  .exchange-ticket .exchange-item .exchange-cutout {width: 24px}
  .exchange-sizes .exchange-back {padding: 4px 7px}
}
@media (max-height: 490px) and (orientation:landscape) {
  .exchange {width: min(850px, 96%); padding: 4px 0}
  .exchange-sign {padding: 3px 8px}
  .exchange-sign .exchange-heading h2,.exchange-heading h2 {font-size: 23px}
  .exchange-counter {padding: 16px 12px 6px; border-bottom-width: 4px}
  .exchange-counter:before {height: 11px}
  .exchange-cutout, .exchange-ink .exchange-cutout {width: min(6vw, 8vh)}
  .exchange-stage {margin-bottom: 3px}
  .exchange-grid {gap: 4px}
  .exchange-shapes {grid-template-columns: repeat(7,minmax(0,1fr))}
  .exchange-tray {padding: 3px; gap: 3px}
  .exchange-model {margin-top: 4px; padding-top: 4px}
  .exchange-line > span {font-size: 20px}
  .exchange-back, .exchange-btn, .exchange-sound {padding: 4px 8px; min-height: 28px}
  .exchange-model .exchange-line > span {font-size: 17px}
  .exchange-item {margin-bottom: 4px; font-size: 14px}
  .exchange-item .exchange-cutout {width: 23px}
  .exchange-amounts {grid-template-columns: repeat(10,minmax(0,1fr)); width: 100%}
  .exchange-quantity {min-height: 31px; font-size: 20px !important}
  .exchange-ticket {margin-top: 2px}
  .exchange-details {gap: 2px}
  .exchange-reader, .exchange-confirm {padding: 9px}
  .exchange-wallet-head {padding-bottom: 3px}
  .exchange-entry {gap: 3px}
  .exchange-status {font-size: 12px}
  .exchange-manual {padding-top: 4px; gap: 4px}
  .exchange-manual input {font-size: 17px; padding: 4px 8px}
  .exchange-balance {padding: 4px 10px}
  .exchange-summary {padding: 3px 0}
  .exchange-totals {padding: 4px 0; margin: 3px 0; gap: 2px}
  .exchange-summary .exchange-cutout {width: 30px}
  .exchange-scanner {height: 43vh}
}
.exchange-wallet-tools {display:flex; align-items:center; gap:clamp(5px,1vw,12px)}
.exchange-find {font-size:clamp(12px,1.4vw,15px)!important}
.exchange-directory {color:var(--ink); background:var(--paper); border:1px solid #b9c8bb; border-radius:15px; padding:clamp(12px,2.8vw,24px); width:min(570px,94vw); max-height:90dvh; overflow:auto; box-shadow:0 18px 60px #25474a40; font-family:var(--ui)}
.exchange-directory::backdrop {background:#123a4959}
.exchange-directory-head {display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 10px}
.exchange-directory-head h2 {font:600 clamp(21px,3.3vw,30px)/1.12 Georgia,'Yu Mincho',serif;letter-spacing:-.04em;margin:0}
.exchange-directory-table {border-collapse:collapse;width:100%;font:500 14px/1.35 var(--ui);text-align:left}
.exchange-directory-table th,.exchange-directory-table td {padding:5px 8px;border-bottom:1px solid #dce1d7;text-align:left;overflow-wrap:anywhere}
.exchange-directory-table thead th {font-size:12px;color:#4a655c;background:#eaf1e7}
.exchange-directory-table tbody th {width:32%}
.exchange-directory-shape {display:flex;align-items:center;gap:7px;font:500 17px/1.2 NH,sans-serif}
.exchange-directory-shape .exchange-cutout {width:23px}
.exchange-directory-note {font:600 13px/1.45 var(--ui);color:#376154;margin:12px 0 0}
@media(max-width:560px) {.exchange-wallet-tools .exchange-find {padding:5px 8px;min-height:31px}.exchange-wallet-tools .exchange-balance {padding:5px 8px}.exchange-directory-table th,.exchange-directory-table td {padding:4px 5px}}
