:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #1d2e24;
  --muted: #748177;
  --green: #2e684a;
  --border: #e4eae2;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #f2f5f1; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: radial-gradient(circle at 50% 0%, #e5f0e1 0, transparent 31rem), #f2f5f1; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(46,104,74,.35); outline-offset: 3px; }

.app-shell { width: min(100%, 560px); min-height: 100vh; min-height: 100svh; margin: 0 auto; display: flex; flex-direction: column; padding: max(18px,env(safe-area-inset-top)) 18px max(20px,env(safe-area-inset-bottom)); }
.site-header { min-height: 48px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 720; letter-spacing: -.055em; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 13px; background: #e3f0df; color: var(--green); }
.brand-mark svg { width: 22px; height: 22px; }
.refresh-button { display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: rgba(255,255,255,.82); color: #526357; cursor: pointer; }
.refresh-button svg { width: 20px; height: 20px; }
.refresh-button.is-loading svg { animation: rotate .85s linear infinite; }

.main-content { flex: 1; padding: 32px 0 28px; }
.intro { margin: 0 3px 22px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; color: var(--green); font-size: 14px; font-weight: 650; }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #75b575; box-shadow: 0 0 0 3px rgba(117,181,117,.13); }
h1 { margin: 0; color: var(--ink); font-size: clamp(29px,8vw,36px); font-weight: 690; letter-spacing: -.055em; line-height: 1.08; }
.intro-copy { margin: 9px 0 0; color: var(--muted); font-size: 16px; line-height: 1.45; }

.currency-board { padding: 14px; border: 1px solid rgba(220,228,218,.9); border-radius: 25px; background: rgba(255,255,255,.78); box-shadow: 0 16px 42px rgba(45,67,48,.065), 0 2px 7px rgba(45,67,48,.03); }
.rate-status { min-height: 27px; display: flex; align-items: center; gap: 9px; margin: 1px 3px 13px; color: #647267; font-size: 14px; line-height: 1.4; }
.rate-status .status-dot { width: 7px; height: 7px; flex-basis: 7px; box-shadow: none; }
.rate-status.is-error { color: #815347; }
.rate-status.is-error .status-dot { background: #cf7f68; }
.rate-status.is-offline .status-dot { background: #d3a65f; }
.currency-list { display: flex; flex-direction: column; gap: 8px; }
.currency-row { display: grid; grid-template-columns: 32px minmax(58px,.75fr) minmax(94px,1.5fr) 30px 30px; align-items: center; gap: 6px; min-height: 74px; padding: 9px 8px; border: 1px solid #e7ede7; border-radius: 17px; background: #edf2ee; transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.currency-row.is-active { border-color: #263b2d; background: #263b2d; color: #f6fbf4; }
.currency-row.is-dragging { position: relative; z-index: 2; opacity: .94; transform: scale(1.015); box-shadow: 0 10px 24px rgba(25,47,32,.2); }
.flag { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: rgba(255,255,255,.8); font-size: 22px; line-height: 1; }
.currency-copy { min-width: 0; }
.currency-code { display: block; color: #293a2e; font-size: 16px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.currency-name { display: block; max-width: 100%; margin-top: 3px; overflow: hidden; color: #778479; font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.is-active .currency-code { color: #f6fbf4; }
.is-active .currency-name { color: #c2d1c3; }
.currency-input { width: 100%; min-width: 0; height: 48px; padding: 0 11px; border: 1px solid #e5e9e3; border-radius: 11px; background: rgba(255,255,255,.94); color: #202d24; text-align: right; font-size: clamp(18px,5vw,22px); font-weight: 590; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.currency-input::placeholder { color: #9aa49b; }
.is-active .currency-input { border-color: #c7e0c4; background: #dcebd8; color: #18251c; }
.drag-handle { display: grid; width: 30px; height: 44px; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #87948a; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 21px; height: 25px; }
.is-active .drag-handle { color: #d5e4d5; }
.drag-handle:focus-visible { outline-color: #8fc897; }
.remove-currency { display: grid; width: 30px; height: 40px; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #9a756e; cursor: pointer; }
.remove-currency:hover { background: rgba(163,93,80,.09); color: #a25347; }
.remove-currency svg { width: 18px; height: 18px; }
.is-active .remove-currency { color: #dcbab4; }
.currency-empty { margin: 0; padding: 18px 10px; color: var(--muted); text-align: center; font-size: 14px; }
.add-currency-button { display: flex; width: 100%; min-height: 50px; align-items: center; justify-content: center; gap: 9px; margin-top: 9px; padding: 8px 12px; border: 1px dashed #cbd8ca; border-radius: 15px; background: #f4f7f2; color: #536d57; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 150ms ease, border-color 150ms ease; }
.add-currency-button:hover { border-color: #91b294; background: #edf4e9; }
.add-currency-icon { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 9px; background: #e1ecde; color: var(--green); font-size: 22px; font-weight: 400; line-height: 1; }
.currency-dialog { width: min(440px,calc(100vw - 32px)); max-width: none; max-height: min(82svh,720px); margin: auto; padding: 18px; overflow: hidden; border: 1px solid #e0e8de; border-radius: 22px; background: #fbfcfa; color: var(--ink); box-shadow: 0 24px 70px rgba(26,48,31,.22); }
.currency-dialog::backdrop { background: rgba(22,36,27,.42); backdrop-filter: blur(3px); }
.currency-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.currency-dialog-header h2 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.currency-dialog-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.dialog-close { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; padding: 0 0 3px; border: 0; border-radius: 50%; background: #edf2eb; color: #667369; font-size: 25px; line-height: 1; cursor: pointer; }
.currency-search-label { display: block; margin-bottom: 6px; color: #667369; font-size: 12px; font-weight: 600; }
.currency-search { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #dce5da; border-radius: 12px; background: #fff; color: var(--ink); font-size: 15px; }
.currency-options { display: flex; max-height: min(50svh,430px); flex-direction: column; gap: 5px; margin-top: 11px; overflow-y: auto; overscroll-behavior: contain; }
.currency-option { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border: 1px solid transparent; border-radius: 12px; background: #f0f4ef; color: var(--ink); text-align: left; cursor: pointer; }
.currency-option:hover, .currency-option:focus-visible { border-color: #bad0b8; background: #e8f1e5; }
.currency-option .flag { flex: 0 0 30px; }
.currency-option-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.currency-option-copy strong { font-size: 14px; }
.currency-option-copy span { overflow: hidden; color: #748177; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.currency-option-plus { color: var(--green); font-size: 22px; }
.currency-options-empty { margin: 0; padding: 18px 8px; color: var(--muted); font-size: 14px; text-align: center; }
.order-hint { display: flex; align-items: center; gap: 8px; margin: 14px 5px 0; color: #707d72; font-size: 14px; line-height: 1.45; }
.grip-example { color: #58745c; font-size: 22px; line-height: 1; }
.source-note { margin: 13px 5px 0; color: #78857b; font-size: 13px; line-height: 1.5; }
.source-note a { color: #426e4d; text-decoration: underline; text-decoration-color: #b8d0b6; text-underline-offset: 3px; }
.install-hint { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 1px solid #e4e9e2; border-radius: 16px; background: rgba(255,255,255,.66); color: #707d72; font-size: 13px; line-height: 1.45; }
.install-hint strong { color: #506052; font-size: 14px; font-weight: 620; }
.install-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 11px; background: #ebf3e8; color: var(--green); }
.install-icon svg { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes rotate { to { transform: rotate(360deg); } }
@media (min-width: 700px) { .app-shell { padding-top: 26px; padding-bottom: 28px; } .main-content { padding-top: 40px; padding-bottom: 34px; } }
@media (max-width: 365px) { .app-shell { padding-left: 13px; padding-right: 13px; } .currency-board { padding: 10px; } .currency-row { grid-template-columns: 28px minmax(54px,.72fr) minmax(88px,1.5fr) 30px 28px; gap: 4px; padding: 8px 6px; } .flag { width: 27px; height: 27px; font-size: 20px; } .drag-handle { width: 30px; } .remove-currency { width: 28px; } .currency-input { padding: 0 8px; } }
@media (max-width: 699px) and (max-height: 900px) {
  .app-shell { padding-top: max(10px,env(safe-area-inset-top)); padding-bottom: max(12px,env(safe-area-inset-bottom)); }
  .site-header { min-height: 40px; }
  .brand-mark { width: 32px; height: 32px; }
  .refresh-button { width: 38px; height: 38px; }
  .main-content { padding: 16px 0 12px; }
  .intro { margin-bottom: 12px; }
  .eyebrow { margin-bottom: 7px; font-size: 13px; }
  h1 { font-size: clamp(27px,7.5vw,32px); }
  .intro-copy { margin-top: 6px; font-size: 14px; line-height: 1.3; }
  .currency-board { padding: 10px; border-radius: 20px; }
  .rate-status { min-height: 20px; margin-bottom: 8px; font-size: 12px; }
  .currency-list { gap: 6px; }
  .currency-row { min-height: 60px; padding: 6px 7px; border-radius: 14px; }
  .currency-input { height: 42px; font-size: 20px; }
  .flag { width: 27px; height: 27px; font-size: 20px; }
  .currency-name { font-size: 11px; }
  .order-hint { margin-top: 9px; font-size: 12px; line-height: 1.3; }
  .source-note { margin-top: 8px; font-size: 12px; line-height: 1.4; }
  .install-hint { padding: 10px 12px; font-size: 12px; }
  .install-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .install-hint strong { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
