.exchange-calc-wrapper,
.exchange-calc-wrapper *,
.exchange-calc-wrapper *::before,
.exchange-calc-wrapper *::after {
  box-sizing: border-box;
}

.exchange-calc-wrapper {
  --exchange-paper: #faf2e8;
  --exchange-paper-soft: #fff7e8;
  --exchange-panel: #fffdf7;
  --exchange-panel-muted: #f4e5d4;
  --exchange-ink: #2b2119;
  --exchange-muted: #6b5745;
  --exchange-line: #6b5745;
  --exchange-line-soft: rgba(107, 87, 69, 0.28);
  --exchange-cta: #f2e3d3;
  --exchange-cta-hover: #ead6bf;
  --exchange-tone-idle: #486f83;
  --exchange-tone-profit: #5f7f4b;
  --exchange-tone-loss: #a94d3e;
  --exchange-result-idle: #dfeef8;
  --exchange-result-profit: #e3efd2;
  --exchange-result-loss: #f0ddd5;
  width: min(980px, calc(100% - 24px));
  margin: 14px auto 24px;
  color: var(--exchange-ink);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.exchange-calc-container {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  color: var(--exchange-ink);
  border: 2px solid var(--exchange-line);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(107, 87, 69, 0.18);
  background:
    linear-gradient(90deg, rgba(107, 87, 69, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(107, 87, 69, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, var(--exchange-paper-soft), var(--exchange-paper));
  background-size: 22px 22px, 22px 22px, auto;
}

.exchange-calc-header {
  display: grid;
  gap: 8px;
  padding: 18px 20px 16px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(250, 242, 232, 0.94)),
    var(--exchange-paper-soft);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.exchange-calc-kicker {
  width: fit-content;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid var(--exchange-line);
  border-radius: 0;
  background: rgba(242, 227, 211, 0.82);
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.1;
  font-weight: 950;
  letter-spacing: 0;
}

.exchange-calc-header h2 {
  margin: 0;
  color: var(--exchange-ink);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 950;
  letter-spacing: 0;
  word-break: keep-all;
}

.exchange-calc-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--exchange-muted);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 700;
  word-break: keep-all;
}

.exchange-calc-body-shell {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 2px solid var(--exchange-line);
}

.exchange-calc-main {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.exchange-calc-panel,
.exchange-calc-note {
  min-width: 0;
  border: 2px solid var(--exchange-line);
  border-radius: 0;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: none;
}

.exchange-calc-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.exchange-calc-input-panel,
.exchange-calc-result-panel {
  align-self: stretch;
}

.exchange-calc-panel-header,
.exchange-calc-result-header {
  display: grid;
  gap: 5px;
}

.exchange-calc-result-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.exchange-calc-section-title {
  margin: 0;
  color: var(--exchange-ink);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: 0;
}

.exchange-calc-panel-header p,
.exchange-calc-result-header p,
.exchange-calc-note p {
  margin: 0;
  color: var(--exchange-muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
  word-break: keep-all;
}

.exchange-calc-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

.exchange-calc-form {
  display: grid;
  gap: 9px;
}

.exchange-calc-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.exchange-calc-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--exchange-line-soft);
  border-radius: 0;
  background: var(--exchange-paper-soft);
}

.exchange-calc-field label {
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 950;
}

.exchange-calc-input-wrap {
  position: relative;
  display: grid;
  align-items: center;
}

.exchange-calc-wrapper .exchange-calc-input,
.exchange-calc-wrapper .exchange-calc-share-input {
  width: 100% !important;
  min-width: 0;
  height: 40px !important;
  min-height: 40px !important;
  padding: 8px 54px 8px 10px !important;
  border: 1.5px solid var(--exchange-line) !important;
  border-radius: 0 !important;
  background: #fffef8 !important;
  color: var(--exchange-ink) !important;
  -webkit-text-fill-color: var(--exchange-ink) !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 850 !important;
  box-shadow: none !important;
}

.exchange-calc-wrapper .exchange-calc-input::placeholder {
  color: rgba(107, 87, 69, 0.58);
  -webkit-text-fill-color: rgba(107, 87, 69, 0.58);
  font-weight: 700;
}

.exchange-calc-wrapper .exchange-calc-input:focus-visible,
.exchange-calc-wrapper .exchange-calc-share-input:focus-visible {
  outline: 3px solid rgba(210, 170, 85, 0.5);
  outline-offset: 2px;
}

.exchange-calc-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  max-width: 44px;
  transform: translateY(-50%);
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 950;
  text-align: right;
  white-space: nowrap;
}

.exchange-calc-convert {
  min-height: 17px;
  color: var(--exchange-tone-idle);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 850;
}

.exchange-calc-wrapper button.exchange-calc-example,
.exchange-calc-wrapper button.exchange-calc-reset,
.exchange-calc-wrapper button.exchange-calc-secondary,
.exchange-calc-wrapper button.exchange-calc-social,
.exchange-calc-wrapper button.exchange-calc-modal-close {
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100%;
  min-width: 0;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 8px !important;
  border: 1.5px solid var(--exchange-line) !important;
  border-radius: 0 !important;
  background: var(--exchange-cta) !important;
  color: var(--exchange-ink) !important;
  font-size: 12px !important;
  line-height: 1.1 !important;
  font-weight: 950 !important;
  letter-spacing: 0 !important;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none !important;
}

.exchange-calc-wrapper button.exchange-calc-reset {
  background: #ead8cc !important;
  color: var(--exchange-tone-loss) !important;
}

.exchange-calc-wrapper button.exchange-calc-secondary {
  background: var(--exchange-panel-muted) !important;
}

.exchange-calc-wrapper button:hover {
  background: var(--exchange-cta-hover) !important;
}

.exchange-calc-wrapper button:focus-visible {
  outline: 3px solid rgba(210, 170, 85, 0.5) !important;
  outline-offset: 2px;
}

.exchange-calc-result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 5px 9px;
  border: 1.5px solid var(--exchange-line);
  border-radius: 0;
  background: var(--exchange-panel-muted);
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 950;
  white-space: nowrap;
}

.exchange-calc-result-badge.is-profit {
  background: var(--exchange-result-profit);
  color: var(--exchange-tone-profit);
}

.exchange-calc-result-badge.is-loss {
  background: var(--exchange-result-loss);
  color: var(--exchange-tone-loss);
}

.exchange-calc-hero-result {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 14px 12px;
  border: 2px solid var(--exchange-line);
  border-radius: 0;
  background: var(--exchange-result-idle);
  text-align: center;
}

.exchange-calc-wrapper.is-profit .exchange-calc-hero-result {
  background: var(--exchange-result-profit);
}

.exchange-calc-wrapper.is-loss .exchange-calc-hero-result {
  background: var(--exchange-result-loss);
}

.exchange-calc-hero-label {
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 950;
}

.exchange-calc-hero-result strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  color: var(--exchange-ink);
  font-size: 30px;
  line-height: 1.08;
  font-weight: 950;
  word-break: break-word;
}

.exchange-calc-hero-unit {
  font-size: 15px;
  font-weight: 950;
}

.exchange-calc-hero-result small {
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
}

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

.exchange-calc-metric {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--exchange-line-soft);
  border-radius: 0;
  background: var(--exchange-paper-soft);
  text-align: center;
}

.exchange-calc-metric-label {
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 900;
}

.exchange-calc-metric strong {
  min-width: 0;
  color: var(--exchange-ink);
  font-size: 17px;
  line-height: 1.15;
  font-weight: 950;
  word-break: break-word;
}

.exchange-calc-spread {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--exchange-line-soft);
  border-radius: 0;
  background: rgba(244, 229, 212, 0.72);
}

.exchange-calc-spread-track {
  position: relative;
  height: 14px;
  overflow: hidden;
  border: 1.5px solid var(--exchange-line);
  border-radius: 0;
  background: var(--exchange-paper-soft);
}

.exchange-calc-spread-zero {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--exchange-muted);
  font-size: 10px;
  line-height: 1;
  font-weight: 950;
}

.exchange-calc-spread-bar {
  display: block;
  width: 50%;
  height: 100%;
  min-width: 4px;
  background: var(--exchange-tone-idle);
  transition: width 160ms ease, background-color 160ms ease;
}

.exchange-calc-spread p {
  margin: 0;
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 750;
}

.exchange-calc-summary {
  border: 1px solid var(--exchange-line-soft);
  border-radius: 0;
  background: var(--exchange-paper-soft);
  overflow: hidden;
}

.exchange-calc-summary summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--exchange-ink);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}

.exchange-calc-summary summary::-webkit-details-marker {
  display: none;
}

.exchange-calc-summary summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--exchange-line);
  border-radius: 0;
  background: var(--exchange-panel-muted);
  font-size: 14px;
  line-height: 1;
}

.exchange-calc-summary[open] summary::after {
  content: "-";
}

.exchange-calc-summary-content {
  padding: 0 10px 10px;
  color: var(--exchange-muted);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 700;
}

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

.exchange-calc-note {
  padding: 10px 12px;
  background: rgba(244, 229, 212, 0.78);
}

.exchange-calc-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--exchange-ink);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
}

.exchange-calc-note b {
  color: var(--exchange-ink);
  font-weight: 950;
}

.exchange-calc-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(43, 33, 25, 0.46);
}

.exchange-calc-modal.is-open,
.exchange-calc-modal.active {
  display: grid;
}

.exchange-calc-modal-card {
  width: min(100%, 440px);
  padding: 14px;
  border: 2px solid var(--exchange-line);
  border-radius: 0;
  background: var(--exchange-paper-soft);
  box-shadow: 4px 4px 0 rgba(107, 87, 69, 0.22);
  color: var(--exchange-ink);
}

.exchange-calc-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--exchange-line);
}

.exchange-calc-modal-header h3,
.exchange-calc-modal-card p {
  margin: 0;
}

.exchange-calc-modal-header h3 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 950;
}

.exchange-calc-modal-card p {
  padding: 10px 0;
  color: var(--exchange-muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}

.exchange-calc-wrapper button.exchange-calc-modal-close {
  width: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  background: #ead8cc !important;
  color: var(--exchange-tone-loss) !important;
  font-size: 20px !important;
  line-height: 1 !important;
}

.exchange-calc-share-row,
.exchange-calc-share-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.exchange-calc-share-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

body[data-scheme="dark"] .exchange-calc-wrapper,
.exchange-calc-wrapper:where(.dark) {
  --exchange-paper: #201d18;
  --exchange-paper-soft: #2b261f;
  --exchange-panel: #302a22;
  --exchange-panel-muted: #3a3024;
  --exchange-ink: #fff5df;
  --exchange-muted: #d7c3a5;
  --exchange-line: #d9b46f;
  --exchange-line-soft: rgba(217, 180, 111, 0.28);
  --exchange-cta: #3a3024;
  --exchange-cta-hover: #4a3a29;
  --exchange-tone-idle: #8bc2d7;
  --exchange-tone-profit: #a6c48c;
  --exchange-tone-loss: #e5a190;
  --exchange-result-idle: rgba(69, 101, 115, 0.36);
  --exchange-result-profit: rgba(104, 132, 86, 0.34);
  --exchange-result-loss: rgba(169, 77, 62, 0.28);
}

body[data-scheme="dark"] .exchange-calc-container,
.exchange-calc-wrapper.dark .exchange-calc-container {
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.32);
}

body[data-scheme="dark"] .exchange-calc-header,
.exchange-calc-wrapper.dark .exchange-calc-header {
  background:
    linear-gradient(135deg, rgba(48, 42, 34, 0.96), rgba(32, 29, 24, 0.94)),
    var(--exchange-paper-soft);
}

body[data-scheme="dark"] .exchange-calc-panel,
body[data-scheme="dark"] .exchange-calc-note,
body[data-scheme="dark"] .exchange-calc-field,
body[data-scheme="dark"] .exchange-calc-metric,
body[data-scheme="dark"] .exchange-calc-summary,
.exchange-calc-wrapper.dark .exchange-calc-panel,
.exchange-calc-wrapper.dark .exchange-calc-note,
.exchange-calc-wrapper.dark .exchange-calc-field,
.exchange-calc-wrapper.dark .exchange-calc-metric,
.exchange-calc-wrapper.dark .exchange-calc-summary {
  background: rgba(43, 38, 31, 0.94);
}

body[data-scheme="dark"] .exchange-calc-wrapper .exchange-calc-input,
body[data-scheme="dark"] .exchange-calc-wrapper .exchange-calc-share-input,
.exchange-calc-wrapper.dark .exchange-calc-input,
.exchange-calc-wrapper.dark .exchange-calc-share-input {
  background: #171410 !important;
  color: #fff5df !important;
  -webkit-text-fill-color: #fff5df !important;
}

body[data-scheme="dark"] .exchange-calc-wrapper .exchange-calc-input::placeholder,
.exchange-calc-wrapper.dark .exchange-calc-input::placeholder {
  color: rgba(215, 195, 165, 0.58);
  -webkit-text-fill-color: rgba(215, 195, 165, 0.58);
}

body[data-scheme="dark"] .exchange-calc-modal-card {
  background: #2b261f;
  color: #fff5df;
}

@media (max-width: 860px) {
  .exchange-calc-wrapper {
    width: min(390px, calc(100% - 20px));
  }

  .exchange-calc-header {
    padding: 15px 14px 14px;
  }

  .exchange-calc-header h2 {
    font-size: 24px;
  }

  .exchange-calc-body-shell {
    padding: 12px;
  }

  .exchange-calc-main {
    grid-template-columns: 1fr;
  }

  .exchange-calc-quick-actions,
  .exchange-calc-form-row,
  .exchange-calc-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exchange-calc-panel {
    padding: 12px;
  }
}

@media (max-width: 370px) {
  .exchange-calc-wrapper {
    width: min(344px, calc(100% - 16px));
  }

  .exchange-calc-header h2 {
    font-size: 22px;
  }

  .exchange-calc-body-shell {
    padding: 10px;
  }

  .exchange-calc-quick-actions,
  .exchange-calc-form-row,
  .exchange-calc-actions,
  .exchange-calc-metrics,
  .exchange-calc-share-row {
    grid-template-columns: 1fr;
  }

  .exchange-calc-hero-result strong {
    font-size: 25px;
  }
}
