/* 복리 계산기와 같은 색·카드 모양을 쓰되, 이 앱 안에서만 적용합니다. */
:root { color-scheme: light; font: 16px/1.5 system-ui, sans-serif; color: #163d31; background: #f7f6ee;
  --line: #d6dccd; --muted: #4f6659; --pad: clamp(16px, 2.4vw, 24px); --picker-height: 66px; }
* { box-sizing: border-box; }
body { max-width: 960px; margin: auto; padding: 0 clamp(16px, 4vw, 48px) 56px; }
header, header label, .masthead { display: flex; align-items: center; gap: 10px; }
header { justify-content: space-between; flex-wrap: wrap; padding-block: 18px; border-bottom: 1px solid var(--line); }
header a { color: inherit; font-weight: 650; text-decoration: none; white-space: nowrap; }
.masthead { position: relative; flex-wrap: wrap; }
h1 { margin: 0; font-size: clamp(1.1rem, 2.6vw, 1.5rem); letter-spacing: -.02em; line-height: 1.2; }
.masthead h1 { padding-inline-start: 14px; border-inline-start: 1px solid var(--line); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hint { flex: none; width: 19px; height: 19px; padding: 0; border: 1px solid #abb9ab; border-radius: 50%;
  background: #eef2e6; color: var(--muted); font: 600 12px/1 system-ui, sans-serif; cursor: pointer; }
.hint[aria-expanded=true] { background: #163d31; color: #f7f6ee; border-color: #163d31; }
.tip { position: absolute; z-index: 5; inset-inline-start: 0; top: calc(100% + 6px); width: min(320px, 86vw); margin: 0;
  padding: 10px 12px; border-radius: 10px; background: #163d31; color: #f5f7e5; font-weight: 500; font-size: .82rem;
  box-shadow: 0 6px 18px #163d3133; }
.tip p { margin: 0; }
.tip p + p { margin-top: 6px; opacity: .9; }

.workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
form, .result { border-radius: 18px; border: 1px solid var(--line); }
form { display: flex; flex-direction: column; gap: 22px; padding: var(--pad); background: #fffefa; }
form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-weight: 600; font-size: .92rem; }
/* 입력칸 글자는 어디서나 16px 이상입니다. 모바일 Safari가 초점을 줄 때 화면을 확대하지 않습니다. */
input, select { min-width: 0; max-width: 100%; padding: 10px; border: 1px solid #abb9ab; border-radius: 8px;
  color: #163d31; background: white; font: inherit; font-size: max(16px, 1rem); }
.amount-entry { display: flex; align-items: center; gap: 8px; padding-inline: 14px; background: #f3f6ed;
  border: 1px solid #bdceba; border-radius: 12px; }
.amount-entry:focus-within, .currency-picker:focus-within { outline: 2px solid #467257; outline-offset: 2px; }
.amount-entry:has(input[aria-invalid=true]) { border-color: #a83824; }
.amount input { width: 100%; padding: 9px 0; background: transparent; border: 0; outline: 0; color: #183f31;
  font-size: clamp(1.65rem, 3vw, 2.1rem); font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.amount-entry bdi { flex: none; color: #42604c; font-size: .87rem; letter-spacing: .06em; }
.field-error { margin: -8px 0 0; color: #a83824; font-size: .85rem; }
:focus-visible { outline: 3px solid #ab782a; outline-offset: 2px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 8px; margin-block-start: auto; }
.currency-picker { display: grid; align-items: center; min-height: var(--picker-height); position: relative; padding: 9px 12px;
  border: 1px solid #bdcab9; border-radius: 12px; background: #fff; }
.currency-picker:hover { border-color: #63836b; background: #fafcf6; }
.currency-caption { display: grid; gap: 1px; padding-inline-end: 12px; }
.currency-caption bdi { font-size: 1.08rem; font-weight: 750; letter-spacing: .035em; }
.currency-caption > span { font-size: .8rem; font-weight: 500; line-height: 1.25; color: var(--muted); overflow-wrap: anywhere; }
.currency-picker::after { content: ''; position: absolute; inset-inline-end: 12px; top: calc(50% - 4px); width: 6px; height: 6px;
  border: solid #58715d; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
.currency-picker select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.currency-picker option:disabled { color: GrayText; }
#exchange-swap { width: 46px; height: 46px; padding: 0; border: 1px solid #abb9ab; border-radius: 50%; background: #eef2e6;
  color: #163d31; font: 600 1.25rem/1 system-ui, sans-serif; cursor: pointer; }
#exchange-swap { margin-block-end: 10px; }
#exchange-swap:hover { background: #dfe8d3; }

.result { display: flex; flex-direction: column; min-width: 0; padding: var(--pad) clamp(20px, 3vw, 32px); background: #193d33; color: #f5f7e5; }
h2 { margin: 0; font-size: 1rem; font-weight: 550; line-height: 24px; }
.source-amount { min-height: 1.5em; margin: 0; color: #d1dfd1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
output { display: block; margin: 2px 0 16px; font-size: clamp(1.85rem, 4vw, 2.9rem); font-weight: 720; letter-spacing: -.025em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.result[data-state=loading] output { opacity: .55; }
.unit { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 2fr); align-items: baseline; gap: 8px;
  margin: 0; font-size: .94rem; color: #b5cab9; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.unit-rates { display: grid; align-content: space-evenly; min-block-size: var(--picker-height);
  padding-block: 3px; border-block-start: 1px solid #547064; }
.unit-rates:has(#exchange-unit:empty) { display: none; }
.unit bdi:first-child { color: #e0eada; }
.unit bdi:last-child { color: #e2f4c4; font-weight: 620; text-align: right; }
.unit:empty { display: none; }
/* 환율 식(1 USD = … KRW)은 RTL 언어에서도 왼쪽에서 오른쪽으로 읽히게 하고, 줄 정렬만 페이지 방향을 따릅니다. */
.unit { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] .unit { text-align: right; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 0; }
.status-line:has(#exchange-status:empty):has(#exchange-retry[hidden]) { display: none; }
#exchange-status { color: #ffe2aa; }
.result[data-state=same] #exchange-status { color: #c9d8c3; }
#exchange-retry { padding: 4px 14px; border: 1px solid #c9d8c3; border-radius: 999px; background: transparent; color: #f5f7e5;
  font: 600 .88rem/22px system-ui, sans-serif; cursor: pointer; }
#exchange-retry:disabled { opacity: .5; cursor: default; }
.observed { margin: auto 0 5px; color: #c9d8c3; font-size: .85rem; text-align: start; }
.observed:empty { display: none; }

.notice { margin: 14px 4px 0; color: var(--muted); font-size: .85rem; }
.notice a { color: #0b6a43; font-weight: 600; }
.sources { white-space: nowrap; }

@media (min-width: 721px) {
  .amount > span:first-child, .source-amount { line-height: 24px; }
  .amount-entry, #exchange-output { min-block-size: clamp(62px, 6vw, 72px); }
  #exchange-output { align-content: center; margin-block: 5px 12px; }
}

@media (max-width: 720px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  output { font-size: clamp(1.6rem, 8vw, 2.2rem); }
}
@media (max-width: 520px) {
  body { padding-inline: 14px; }
  header { gap: 8px; padding-block: 14px; }
  header label span { display: none; }
  .masthead h1 { padding-inline-start: 0; border: 0; }
  form { padding: 16px; gap: 16px; }
  .pair { gap: 6px; }
  #exchange-swap { width: 44px; height: 44px; }
  .tip { inset-inline: 0; width: auto; }
  .sources { white-space: normal; }
}
