@font-face {
  font-family: 'NRT';
  src: url('NRT-Reg.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  /* Adjust these sizes to change the rate number/symbol ratio. */
  --rate-number-font-size: 1em;
  --rate-symbol-font-size: 0.8em;
  --bg-gradient: radial-gradient(circle at 50% 20%, #2a241b 0%, #141414 60%, #0d0d0d 100%);
  --gold-primary: #f5a623;
  --title-color: #f5a623;
  --rate-color: #f5a623;
  --gold-glow: rgba(245, 166, 35, 0.45);
  --card-bg: #1c1c1c;
  --card-border: #2e2e2e;
  --card-active-border: rgba(245, 166, 35, 0.35);
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  --btn-bg: #35353a;
  --btn-active: #484850;
  --btn-border: rgba(255, 255, 255, 0.09);
  --btn-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  --btn-text: #f5a623;
  --text-white: #ffffff;
  --text-muted: #9e9e9e;
  --swap-bg: linear-gradient(145deg, #ffc107, #f59e0b);
  --swap-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
  --swap-icon: #121212;
  --menu-bg: rgba(26, 26, 26, 0.96);
  --menu-border: rgba(245, 166, 35, 0.2);
  --menu-item-bg: rgba(255, 255, 255, 0.04);
  --hamburger-bg: rgba(255, 255, 255, 0.06);
  --hamburger-color: #f5a623;
}

body.light-mode {
  --bg-gradient: radial-gradient(circle at 50% 25%, #fdfbf6 0%, #f5e4c3 55%, #f2dec0 100%);
  --gold-primary: #b8731a;
  --title-color: #a66112;
  --rate-color: #c97f22;
  --gold-glow: rgba(184, 115, 26, 0.08);
  --card-bg: #ffffff;
  --card-border: #efe6d5;
  --card-active-border: rgba(201, 127, 34, 0.4);
  --card-shadow: 0 10px 24px rgba(166, 97, 18, 0.12);
  --btn-bg: #faf6ef;
  --btn-active: #efe6d5;
  --btn-border: rgba(166, 97, 18, 0.1);
  --btn-shadow: 0 5px 12px rgba(140, 95, 30, 0.07);
  --btn-text: #c77d1e;
  --text-white: #1f1f1f;
  --text-muted: #4f463d;
  --swap-bg: linear-gradient(145deg, #ff9800, #f57c00);
  --swap-shadow: 0 5px 16px rgba(245, 124, 0, 0.4);
  --swap-icon: #ffffff;
  --menu-bg: rgba(252, 247, 238, 0.97);
  --menu-border: rgba(184, 115, 26, 0.22);
  --menu-item-bg: rgba(184, 115, 26, 0.07);
  --hamburger-bg: rgba(184, 115, 26, 0.1);
  --hamburger-color: #a66112;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html, body { width: 100%; height: 100%; overflow: hidden; position: fixed; inset: 0; touch-action: none; background: var(--bg-gradient); color: var(--text-white); font-family: 'NRT', 'Inter', sans-serif; display: flex; justify-content: center; align-items: center; transition: background 0.5s ease, color 0.4s ease; padding-bottom: env(safe-area-inset-bottom); }
.intro-overlay { position: fixed; inset: 0; background: #111615; z-index: 9999; display: flex; justify-content: center; align-items: center; transition: opacity 0.65s ease, visibility 0.65s ease; }
.intro-overlay.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-img { width: 100%; height: 100%; object-fit: cover; animation: introSmooth 2.4s ease-out forwards; }
@keyframes introSmooth { 0% { transform: scale(1.04); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.app-container { width: 100%; max-width: 410px; height: 100%; max-height: 860px; padding: 18px 22px calc(22px + env(safe-area-inset-bottom)) 22px; display: flex; flex-direction: column; justify-content: space-between; }
.top-bar { display: flex; justify-content: space-between; align-items: flex-start; direction: ltr; min-height: 64px; }
.signature-link { position: relative; width: 85px; height: 100px; margin-top: 6px; background: transparent; display: flex; align-items: center; justify-content: flex-start; overflow: hidden; text-decoration: none; cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease; }
.signature-link:active { transform: scale(0.92); opacity: 0.8; }
.signature-img { width: 100%; height: 100%; object-fit: contain; object-position: center; mix-blend-mode: screen; transform: scale(1.15); filter: grayscale(1) contrast(2.6) brightness(0.88); transition: filter 0.45s ease; }
body.light-mode .signature-img { mix-blend-mode: multiply; filter: grayscale(1) invert(1) contrast(3.2) brightness(1.28); }
.signature-img.clean-alpha { mix-blend-mode: normal; filter: none; }
body.light-mode .signature-img.clean-alpha { mix-blend-mode: normal; filter: invert(1); }
.signature-fallback { height: 30px; width: auto; }
.signature-fallback path { stroke: var(--text-white); transition: stroke 0.4s ease; }

.top-right-group { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.top-actions-row { display: flex; align-items: center; gap: 8px; }
.refresh-btn { width: 34px; height: 34px; border-radius: 10px; background: var(--hamburger-bg); border: 1px solid var(--card-border); display: flex; justify-content: center; align-items: center; cursor: pointer; color: var(--hamburger-color); transition: transform 0.15s ease, background 0.3s ease; }
.refresh-btn:active { transform: scale(0.9); }
.refresh-btn svg { width: 17px; height: 17px; transition: transform 0.6s ease; }
.refresh-btn.spinning svg { transform: rotate(360deg); }
.hamburger-btn { width: 38px; height: 34px; border-radius: 10px; background: var(--hamburger-bg); border: 1px solid var(--card-border); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4.5px; cursor: pointer; transition: transform 0.15s ease, background 0.3s ease; }
.hamburger-btn:active { transform: scale(0.9); }
.hamburger-btn span { display: block; width: 18px; height: 2px; background: var(--hamburger-color); border-radius: 2px; }
.datetime-box { text-align: right; color: var(--text-muted); font-size: 0.9rem; line-height: 1.4; }
#dateDisplay { cursor: pointer; font-family: 'NRT', 'Inter', sans-serif; font-weight: 600; padding: 2px 6px; margin-right: -6px; border-radius: 6px; direction: ltr; }
#dateDisplay:active { transform: scale(0.94); background: var(--hamburger-bg); }
.time-text { font-family: 'NRT', 'Inter', sans-serif; font-size: 0.84rem; letter-spacing: 0.5px; }

.menu-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 900; opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0.35s ease; display: flex; justify-content: center; align-items: flex-start; padding: 40px 20px 20px; overflow-y: auto; }
.menu-backdrop.open { opacity: 1; visibility: visible; }
.menu-sheet { width: 100%; max-width: 370px; background: var(--menu-bg); border: 1.5px solid var(--menu-border); border-radius: 24px; padding: 20px 18px 16px; box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45); transform: translateY(-25px) scale(0.95); transition: transform 0.38s ease; direction: rtl; display: flex; flex-direction: column; gap: 12px; }
.menu-backdrop.open .menu-sheet { transform: translateY(0) scale(1); }
.menu-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--card-border); }
.menu-title { font-size: 1.05rem; font-weight: 800; color: var(--title-color); }
.menu-close-btn { width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--menu-item-bg); color: var(--text-white); font-size: 1rem; display: flex; justify-content: center; align-items: center; cursor: pointer; }
.menu-item { background: var(--menu-item-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.menu-item-text { font-size: 0.9rem; font-weight: 700; color: var(--text-white); line-height: 1.4; flex: 1; }

.currency-selector-box { background: var(--menu-item-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.currency-selector-label { font-size: 0.9rem; font-weight: 800; color: var(--gold-primary); text-align: right; }
.language-selector-box { background: var(--menu-item-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.language-row { display: flex; gap: 8px; width: 100%; }
.language-select-btn { flex: 1; background: var(--btn-bg); border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 6px; font-family: 'NRT', 'Inter', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--text-white); cursor: pointer; text-align: center; transition: all 0.25s ease; }
.language-select-btn:active { transform: scale(0.95); }
.language-select-btn.active { background: linear-gradient(135deg, #ffc107, #f59e0b); color: #121212; border-color: transparent; box-shadow: 0 4px 12px rgba(245, 166, 35, 0.35); font-weight: 800; }
.currency-row { display: flex; gap: 8px; width: 100%; }
.currency-row button { flex: 1; }
.curr-select-btn { background: var(--btn-bg); border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 6px; font-family: 'NRT', 'Inter', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--text-white); cursor: pointer; text-align: center; transition: all 0.25s ease; }
.curr-select-btn:active { transform: scale(0.95); }
.curr-select-btn.active { background: linear-gradient(135deg, #ffc107, #f59e0b); color: #121212; border-color: transparent; box-shadow: 0 4px 12px rgba(245, 166, 35, 0.35); font-weight: 800; }

.toggle-switch { position: relative; width: 50px; height: 28px; flex-shrink: 0; cursor: pointer; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background-color: #555558; border-radius: 34px; transition: background-color 0.32s ease; }
body.light-mode .toggle-slider { background-color: #cbbba2; }
.toggle-slider::before { content: ""; position: absolute; height: 22px; width: 22px; right: 3px; top: 3px; background-color: #ffffff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform 0.32s ease; }
.toggle-switch input:checked + .toggle-slider { background: linear-gradient(135deg, #ffc107, #f59e0b); box-shadow: 0 0 12px rgba(245, 166, 35, 0.4); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(-22px); }
html[dir="ltr"] .toggle-slider::before { right: auto; left: 3px; }
html[dir="ltr"] .toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }
.menu-footer { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--card-border); text-align: center; font-family: 'NRT', 'Inter', sans-serif; font-size: 0.76rem; font-weight: 600; color: var(--text-muted); direction: ltr; }

.rate-header { text-align: center; margin: 0 0 6px; flex-shrink: 0; }
.rate-title { font-size: 1.8rem; font-weight: 800; color: var(--title-color); text-shadow: 0 0 18px var(--gold-glow); margin-bottom: 4px; }
.rate-banner { direction: ltr; font-family: 'NRT', 'Inter', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--rate-color); filter: drop-shadow(0 0 10px rgba(255, 183, 17, 0.45)); letter-spacing: 0.5px; }
.exchange-rate-line {
  letter-spacing: 0 !important;
  font-kerning: normal;
  font-feature-settings: "liga" 1, "calt" 1;
}
.rate-number { font-size: var(--rate-number-font-size); }
.rate-currency-symbol { font-size: var(--rate-symbol-font-size); }

.converter-section { position: relative; display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; flex-shrink: 0; }
.currency-card { width: 100%; height: clamp(74px, 10vh, 90px); min-width: 0; flex: 0 0 clamp(74px, 10vh, 90px); background: var(--card-bg); border: 1.5px solid var(--card-border); border-radius: 18px; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; direction: ltr; box-shadow: var(--card-shadow); }
.currency-card.active-input { border-color: var(--card-active-border); }
.amount-display { flex: 1 1 0; min-width: 0; max-width: none; font-family: 'NRT', 'Inter', sans-serif; font-size: clamp(1.6rem, 5.8vw, 2.1rem); font-weight: 600; line-height: 1.35; padding: 2px 2px; color: var(--text-white); overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; direction: ltr; text-align: left; }
.amount-display::-webkit-scrollbar { display: none; }

/* ─── Per-digit slot-machine animations ────────────────────── */
.amt-digit {
  display: inline-block;
  vertical-align: baseline;
  line-height: inherit;
}

/* New digit slides in from BELOW (typing) */
.amt-digit[data-anim="in-up"] {
  animation: amtInUp 170ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* New digit slides in from ABOVE (backspace) */
.amt-digit[data-anim="in-down"] {
  animation: amtInDown 170ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Result digit rolls up (value increasing) */
.amt-digit[data-anim="roll-up"] {
  animation: amtRollUp 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Result digit rolls down (value decreasing) */
.amt-digit[data-anim="roll-down"] {
  animation: amtRollDown 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Input digit: stamp in with a little bounce */
@keyframes amtInUp {
  0%   { transform: translateY(65%) scaleY(0.6); opacity: 0; }
  65%  { transform: translateY(-6%) scaleY(1.05); opacity: 1; }
  100% { transform: translateY(0)  scaleY(1);    opacity: 1; }
}
@keyframes amtInDown {
  0%   { transform: translateY(-65%) scaleY(0.6); opacity: 0; }
  65%  { transform: translateY(6%)   scaleY(1.05); opacity: 1; }
  100% { transform: translateY(0)    scaleY(1);    opacity: 1; }
}

/* Result digit: slot-machine roll with blur */
@keyframes amtRollUp {
  0%   { transform: translateY(55%) scale(0.82); opacity: 0; filter: blur(4px); }
  55%  { opacity: 1; filter: blur(0px); }
  100% { transform: translateY(0)   scale(1);    opacity: 1; filter: blur(0px); }
}
@keyframes amtRollDown {
  0%   { transform: translateY(-55%) scale(0.82); opacity: 0; filter: blur(4px); }
  55%  { opacity: 1; filter: blur(0px); }
  100% { transform: translateY(0)    scale(1);    opacity: 1; filter: blur(0px); }
}

@media (prefers-reduced-motion: reduce) {
  .amt-digit[data-anim] { animation-duration: 0.01ms !important; animation-delay: 0ms !important; }
}
.currency-info { text-align: right; display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.currency-label-button { appearance: none; border: 0; padding: 6px 8px; margin: -6px -8px; background: transparent; color: inherit; font: inherit; cursor: default; border-radius: 10px; text-align: right; }
.secondary-currency-toggle { cursor: pointer; touch-action: manipulation; }
.secondary-currency-toggle:active:not(:disabled) { background: var(--hamburger-bg); transform: scale(0.96); }
.secondary-currency-toggle:focus-visible { outline: 2px solid var(--gold-primary); outline-offset: 2px; }
.secondary-currency-toggle:disabled { cursor: default; }
.currency-name { font-size: 1.25rem; font-weight: 700; color: var(--gold-primary); text-shadow: 0 0 10px var(--gold-glow); }
.currency-symbol { font-family: 'NRT', 'Inter', sans-serif; font-size: 1.3rem; font-weight: 600; color: var(--gold-primary); margin-top: 2px; }

.swap-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; background: var(--swap-bg); border: none; box-shadow: var(--swap-shadow); display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 5; transition: transform 0.2s ease; }
.swap-btn.pressed { transform: translate(-50%, -50%) scale(0.9) rotate(180deg); }
.swap-btn svg { width: 24px; height: 24px; stroke: var(--swap-icon); stroke-width: 2.2; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(6px, 1.4vh, 12px) clamp(10px, 3.8vw, 22px); direction: ltr; padding: 2px 6px; flex-shrink: 0; }
.key-btn { background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: 14px; height: clamp(44px, 6.2vh, 54px); display: flex; justify-content: center; align-items: center; font-family: 'NRT', 'Inter', sans-serif; font-size: clamp(1.4rem, 5vw, 1.65rem); font-weight: 500; color: var(--btn-text); box-shadow: var(--btn-shadow); cursor: pointer; transition: transform 0.06s ease; }
.key-btn.pressed { background: var(--btn-active); transform: scale(0.94); }
.key-btn.transparent { background: transparent; border: none; box-shadow: none; font-size: 2rem; }
.key-btn.transparent.pressed { background: rgba(128, 128, 128, 0.12); }
.key-btn svg path { stroke: var(--btn-text); }

.menu-backdrop {
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

html[dir="ltr"] .menu-sheet { direction: ltr; }
html[dir="ltr"] .currency-selector-label { text-align: left; }

@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

body { padding-bottom: 0; }
.app-container {
  max-height: none;
  padding-top: calc(18px + env(safe-area-inset-top));
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

@media (max-width: 360px) {
  .app-container { padding-right: 16px; padding-left: 16px; }
  .keypad { column-gap: 14px; padding-right: 6px; padding-left: 6px; }
  .rate-title { font-size: 1.6rem; }
  .rate-banner { font-size: 1.3rem; }
  .currency-card { padding-right: 16px; padding-left: 16px; }
}

@media (max-height: 740px) {
  .app-container {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
  .signature-link { height: 64px; }
  .rate-title { font-size: 1.55rem; margin-bottom: 2px; }
  .rate-banner { font-size: 1.3rem; }
  .converter-section { gap: 10px; margin-bottom: 4px; }
  .currency-card { padding-top: 12px; padding-bottom: 12px; }
  .amount-display { font-size: 1.8rem; }
  .currency-name { font-size: 1.1rem; }
  .currency-symbol { font-size: 1.1rem; }
  .keypad { gap: 9px 18px; }
  .key-btn { height: clamp(42px, 7.5dvh, 54px); }
}

@media (orientation: landscape) and (max-height: 500px) {
  .app-container {
    max-width: 760px;
    padding: calc(8px + env(safe-area-inset-top)) 24px calc(8px + env(safe-area-inset-bottom));
  }
  .top-bar { min-height: 44px; }
  .signature-link { height: 44px; margin-top: 0; }
  .rate-header { margin-bottom: 2px; }
  .rate-title { font-size: 1.25rem; }
  .rate-banner { font-size: 1.1rem; }
  .converter-section { flex-direction: row; align-items: center; gap: 12px; margin-bottom: 4px; }
  .currency-card { width: auto; height: 70px; flex: 1 1 0; padding: 8px 14px; }
  .swap-btn { width: 40px; height: 40px; }
  .swap-btn svg { width: 20px; height: 20px; }
  .keypad { grid-template-columns: repeat(6, 1fr); gap: 6px 10px; padding: 2px 0; }
  .key-btn { height: 38px; border-radius: 12px; font-size: 1.2rem; }
}

.rate-banner {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: clamp(0.9rem, 5.3vw, 1.5rem);
}

html[lang="en"] .rate-banner {
  font-size: clamp(0.7rem, 3.8vw, 1.15rem);
  letter-spacing: 0;
}

body.metals-open {
  overflow: hidden;
}

body.metals-open .app-container {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  flex: 1 1 auto;
  justify-content: flex-start;
  overflow: hidden;
}

body.metals-open .top-bar {
  flex: 0 0 auto;
}

body.metals-open #discountSettingRow,
body.metals-open .currency-selector-box {
  display: none;
}

.metals-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  padding: 2px 0 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.metal-investment-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  width: 100%;
  padding: 2px 0 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.metal-investment-heading {
  text-align: center;
}

.metal-investment-heading .rate-title {
  margin: 0 0 5px;
  font-size: 1.45rem;
}

.metal-investment-item-name {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
}

.metal-investment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metal-investment-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 15px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  color: var(--text-white);
  font-size: 0.92rem;
  font-weight: 700;
}

.metal-investment-field input {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--card-border);
  border-radius: 11px;
  outline: none;
  background: var(--btn-bg);
  color: var(--text-white);
  font: 700 1.1rem 'NRT', 'Inter', sans-serif;
  text-align: left;
  direction: ltr;
}

.metal-investment-field input:focus-visible {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.metal-investment-field-unit {
  min-height: 1.1em;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

.metal-investment-currency {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--menu-item-bg);
}

.metal-investment-currency-option {
  flex: 1;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-white);
  font: 700 0.95rem 'NRT', 'Inter', sans-serif;
  cursor: pointer;
}

.metal-investment-currency-option.active {
  border-color: var(--gold-primary);
  background: var(--card-bg);
  color: var(--gold-primary);
  box-shadow: var(--card-shadow);
}

.metal-investment-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 15px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
}

.metal-investment-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.metal-investment-result-row + .metal-investment-result-row {
  border-top: 1px solid var(--card-border);
}

.metal-investment-result-row strong {
  color: var(--text-white);
  direction: ltr;
  font-size: 1rem;
  text-align: end;
}

.metal-investment-result-row strong.is-positive { color: #16804a; }
.metal-investment-result-row strong.is-negative { color: #d44747; }

.metals-view[hidden],
.metal-investment-view[hidden],
.currency-rates-view[hidden],
.calculator-view[hidden],
.metal-price-card[hidden] {
  display: none;
}

/* ─── Hero Morph Overlay — Liquid Glass ─────────────────────── */
#heroMorphOverlay {
  position: fixed;
  z-index: 800;
  pointer-events: none;

  /* Liquid glass: semi-transparent + strong blur */
  background: rgba(28, 28, 28, 0.35);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);

  /* Soft glass edge */
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;

  /* Inner highlight shimmer — top-left bright, bottom-right dark */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 0 0.5px rgba(255, 255, 255, 0.04);

  opacity: 0;
  will-change: transform, border-radius, opacity;
}

/* Light-mode glass */
body.light-mode #heroMorphOverlay {
  background: rgba(252, 247, 238, 0.45);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(184, 115, 26, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(166, 97, 18, 0.12),
    0 12px 40px rgba(140, 95, 30, 0.18),
    0 0 0 0.5px rgba(255, 255, 255, 0.3);
}

#heroMorphOverlay.expanding {
  pointer-events: none;
  animation: heroExpand 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#heroMorphOverlay.collapsing {
  pointer-events: none;
  animation: heroCollapse 380ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes heroExpand {
  0%   { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes heroCollapse {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* Gold shimmer sweep across the glass surface during expansion */
#heroMorphOverlay::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    125deg,
    rgba(245, 166, 35, 0.07) 40%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(245, 166, 35, 0.07) 60%,
    rgba(255, 255, 255, 0.00) 80%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#heroMorphOverlay[style*="opacity: 1"]::after,
#heroMorphOverlay[style*="width"]::after {
  opacity: 1;
}

/* Fade-out for the currency list items during hero morph */
#currencyRateList.hero-fading-out .currency-rate-card {
  transition: opacity 220ms ease, transform 220ms ease;
  opacity: 0;
  transform: scale(0.96);
}

/* Keep the clicked card visible during fade-out */
#currencyRateList.hero-fading-out .currency-rate-card.hero-source {
  opacity: 0 !important;
}

/* Calculator content fade states for hero transition */
.calculator-view.hero-content-hidden {
  opacity: 0;
}

.calculator-view.hero-content-visible {
  opacity: 1;
  transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Override existing enter/exit when hero morph is active */
.calculator-view.hero-active {
  transition: none !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #heroMorphOverlay.expanding,
  #heroMorphOverlay.collapsing {
    animation-duration: 0.01ms;
  }
  #currencyRateList.hero-fading-out .currency-rate-card {
    transition-duration: 0.01ms;
  }
  .calculator-view.hero-content-visible {
    transition-duration: 0.01ms;
  }
}

.currency-rates-view,
.calculator-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.currency-rates-view {
  gap: 12px;
  padding: 2px 0 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.currency-rates-heading {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.currency-rates-title {
  color: var(--gold-primary);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 0 12px var(--gold-glow);
}

.currency-base-toggle {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-height: 58px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 15px;
  background: var(--menu-item-bg);
  isolation: isolate;
}

.currency-base-indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: calc((100% - 8px) / 2);
  border: 1.5px solid #f5a623;
  border-radius: 11px;
  overflow: hidden;
  background: #1d1d1d;
  box-shadow: 0 0 12px rgba(255, 209, 0, 0.35);
  pointer-events: none;
  transition: all 0.3s ease;
}

.currency-base-indicator::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 221, 130, 0.02) 38%, rgba(255, 221, 130, 0.34) 50%, rgba(255, 221, 130, 0.02) 62%, transparent 80%);
  content: "";
  opacity: 0;
  transform: translateX(-100%);
  pointer-events: none;
}

.currency-base-toggle.shimmer .currency-base-indicator::after {
  animation: tabGliderShimmer 650ms ease-out;
}

body.light-mode .currency-base-indicator {
  border-color: var(--gold-primary);
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(166, 97, 18, 0.14);
}

.currency-base-toggle.is-usd .currency-base-indicator {
  transform: translateX(-100%);
}

html[dir="ltr"] .currency-base-indicator {
  right: auto;
  left: 4px;
}

html[dir="ltr"] .currency-base-toggle.is-usd .currency-base-indicator {
  transform: translateX(100%);
}

.currency-base-option {
  position: relative;
  z-index: 1;
  flex: 1 1 50%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-white);
  font-family: 'NRT', 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.currency-base-option.active {
  color: var(--gold-primary);
  text-shadow: 0 0 12px var(--gold-glow);
  transform: scale(1.05);
}

.currency-rate-value-changing {
  animation: currencyRateValueChange 250ms ease-in-out;
}

@keyframes currencyRateValueChange {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.currency-rate-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.currency-rate-identity .metal-price-name {
  text-align: start;
}

.currency-rate-identity .metal-price-unit {
  text-align: start;
}

.currency-base-option:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}


.currency-rate-list {
  flex: 1 0 auto;
  width: 100%;
}

.currency-rate-card {
  width: 100%;
  color: inherit;
  font-family: 'NRT', 'Inter', sans-serif;
  text-align: start;
  cursor: pointer;
  transition: transform 150ms ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.currency-rate-card:active {
  transform: scale(0.97);
}

.currency-rate-card:focus-visible,
.back-to-rates-btn:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

.calculator-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  width: 100%;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: center;
  transition: opacity 400ms cubic-bezier(0.22, 1, 0.36, 1), transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.calculator-view.is-entering {
  opacity: 0;
  transform: translateY(24px) scale(0.96);
}

.calculator-view.is-exiting {
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  pointer-events: none;
}

.back-to-rates-btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  align-self: center;
  justify-content: center;
  direction: rtl;
  flex-shrink: 0;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 209, 0, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-white);
  font-family: 'NRT', 'Inter', sans-serif;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.back-to-rates-btn:hover,
.back-to-rates-btn:active {
  background: rgba(255, 209, 0, 0.12);
  border-color: rgba(255, 209, 0, 0.75);
  box-shadow: 0 0 14px rgba(255, 209, 0, 0.18);
}

.back-to-rates-btn:active {
  transform: scale(0.98);
}

.back-to-rates-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #f5a623;
}

.metals-heading {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  direction: rtl;
  min-height: 58px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 15px;
  background: var(--menu-item-bg);
  isolation: isolate;
}

.tab-glider {
  position: absolute;
  z-index: 0;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: calc((100% - 8px) / 2);
  border: 1px solid var(--card-active-border);
  border-radius: 11px;
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 0 15px rgba(255, 183, 17, 0.35);
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.metals-heading.silver-active .tab-glider {
  transform: translateX(-100%);
}

body.light-mode .tab-glider {
  box-shadow: 0 3px 10px rgba(166, 97, 18, 0.14);
}

.tab-glider::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 221, 130, 0.02) 38%, rgba(255, 221, 130, 0.34) 50%, rgba(255, 221, 130, 0.02) 62%, transparent 80%);
  content: "";
  opacity: 0;
  transform: translateX(-100%);
}

.metals-heading.shimmer .tab-glider::after {
  animation: tabGliderShimmer 650ms ease-out 450ms;
}

@keyframes tabGliderShimmer {
  0% { opacity: 0; transform: translateX(-100%); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

.metal-tab {
  position: relative;
  z-index: 1;
  flex: 1 1 50%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-white);
  font-family: 'NRT', 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: color 0.28s ease, text-shadow 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.metal-tab.active {
  color: var(--gold-primary);
  text-shadow: 0 0 12px var(--gold-glow);
  transform: scale(1.05);
}

.metal-tab:active {
  transform: scale(0.96);
}

.metal-price-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 1px 10px;
}

.metal-price-list.list-exit-to-left {
  animation: metalListExitLeft 180ms ease-in forwards;
}

.metal-price-list.list-exit-to-right {
  animation: metalListExitRight 180ms ease-in forwards;
}

.metal-price-list.list-enter .metal-price-card:not([hidden]) {
  animation: metalCardEnter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--row-index, 0) * 40ms);
}

.metal-price-list.enter-from-left {
  --enter-x: -12px;
}

.metal-price-list.enter-from-right {
  --enter-x: 12px;
}

@keyframes metalListExitLeft {
  to { opacity: 0; transform: translateX(-14px) scale(0.99); filter: blur(3px); }
}

@keyframes metalListExitRight {
  to { opacity: 0; transform: translateX(14px) scale(0.99); filter: blur(3px); }
}

@keyframes metalCardEnter {
  from { opacity: 0; transform: translate(var(--enter-x, 0), 12px) scale(0.98); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.metal-price-card {
  display: flex;
  min-height: 65px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.metal-price-card[data-metal] {
  cursor: pointer;
}

.metal-price-card[data-metal]:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

.metal-price-name {
  min-width: 0;
  color: var(--text-white);
  font-size: 0.98rem;
  font-weight: 700;
}

.metal-price-amount {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  color: var(--gold-primary);
  direction: ltr;
  font-family: 'NRT', 'Inter', sans-serif;
  font-size: clamp(0.9rem, 4.5vw, 1.1rem);
  font-weight: 700;
  white-space: nowrap;
}

.metal-price-number {
  display: inline-flex;
  align-items: center;
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

/* ─── Price Change Flash (بۆ چرکەیەک سەوز یان سوور دەبێت پاشان دەگەڕێتەوە بۆ ڕەنگەکەی خۆی) ─── */
@keyframes priceFlashUpText {
  0% {
    color: #22c55e;
    text-shadow: 0 0 14px rgba(34, 197, 94, 0.6);
  }
  30% {
    color: #34d399;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
  }
  100% {
    color: var(--gold-primary);
    text-shadow: none;
  }
}

@keyframes priceFlashDownText {
  0% {
    color: #ef4444;
    text-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
  }
  30% {
    color: #f87171;
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.4);
  }
  100% {
    color: var(--gold-primary);
    text-shadow: none;
  }
}

@keyframes priceFlashUpCard {
  0% {
    background-color: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.25);
  }
  35% {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.35);
  }
  100% {
    background-color: var(--card-bg);
    border-color: var(--card-border);
    box-shadow: var(--card-shadow);
  }
}

@keyframes priceFlashDownCard {
  0% {
    background-color: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
  }
  35% {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.35);
  }
  100% {
    background-color: var(--card-bg);
    border-color: var(--card-border);
    box-shadow: var(--card-shadow);
  }
}

/* Light Mode Overrides for text */
@keyframes priceFlashUpTextLight {
  0% { color: #16a34a; }
  30% { color: #16a34a; }
  100% { color: var(--gold-primary); }
}

@keyframes priceFlashDownTextLight {
  0% { color: #dc2626; }
  30% { color: #dc2626; }
  100% { color: var(--gold-primary); }
}

.metal-price-card.price-flash-up {
  animation: priceFlashUpCard 1s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.metal-price-card.price-flash-up .metal-price-number {
  animation: priceFlashUpText 1s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.metal-price-card.price-flash-down {
  animation: priceFlashDownCard 1s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.metal-price-card.price-flash-down .metal-price-number {
  animation: priceFlashDownText 1s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

body.light-mode .metal-price-card.price-flash-up .metal-price-number {
  animation-name: priceFlashUpTextLight;
}

body.light-mode .metal-price-card.price-flash-down .metal-price-number {
  animation-name: priceFlashDownTextLight;
}

.metal-price-unit {
  color: var(--text-muted);
  font-family: 'NRT', 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
}

.metal-price-unit:empty {
  display: none;
}

.amount-display,
.amount-display * {
  white-space: nowrap;
}

.metals-status {
  min-height: 1.2em;
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 360px) {
  .metal-price-card { min-height: 60px; padding: 10px 11px; }
  .metal-price-name { font-size: 0.88rem; }
  .metal-price-amount { font-size: 0.86rem; }
  .metal-tab { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tab-glider,
  .metal-tab,
  .currency-rate-card,
  .currency-base-indicator,
  .currency-base-option,
  .calculator-view {
    transition-duration: 0.01ms;
  }

  .currency-rate-value-changing,
  .metal-price-card.price-flash-up,
  .metal-price-card.price-flash-down,
  .metal-price-card.price-flash-up .metal-price-number,
  .metal-price-card.price-flash-down .metal-price-number {
    animation-duration: 0.01ms;
  }

  .metals-heading.shimmer .tab-glider::after,
  .metal-price-list.list-exit-to-left,
  .metal-price-list.list-exit-to-right,
  .metal-price-list.list-enter .metal-price-card:not([hidden]) {
    animation-duration: 0.01ms;
    animation-delay: 0ms;
  }
}

html {
  position: static;
  inset: auto;
  display: block;
  height: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
}

body {
  position: relative;
  inset: auto;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
  align-items: flex-start;
  touch-action: pan-y;
}

.app-container {
  flex: 0 0 auto;
  height: 100vh;
  height: 100dvh;
}

/* Fixed four-item navigation and wallet screens; all colors come from the existing theme. */
.app-container { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; z-index: 850; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 410px); min-height: calc(70px + env(safe-area-inset-bottom)); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 5px; border: 1px solid var(--card-border); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--menu-bg); box-shadow: 0 -8px 28px rgba(0,0,0,.2); backdrop-filter: blur(16px); }
.bottom-nav-item { flex: 1 1 0; min-width: 0; height: 48px; padding: 0; overflow: hidden; border: 0; border-radius: 24px; background: transparent; color: var(--text-muted); display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0; font: 700 .68rem 'NRT','Inter',sans-serif; cursor: pointer; white-space: nowrap; transition: flex .28s ease, padding .28s ease, color .2s ease, background-color .25s ease, transform .2s ease; }
.bottom-nav-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav-item.active { flex-grow: 1.9; padding: 0 12px; gap: 8px; color: var(--gold-primary); background: color-mix(in srgb, var(--gold-primary) 12%, transparent); }
.bottom-nav-item > span:not(.wallet-nav-orb) { max-width: 0; overflow: hidden; opacity: 0; transition: max-width .28s ease, opacity .2s ease; white-space: nowrap; }
.bottom-nav-item.active > span:not(.wallet-nav-orb) { max-width: 11em; opacity: 1; }
.bottom-nav-item:active { transform: scale(.94); }
.bottom-nav-item:not(.active) { flex-grow: 1; }
.bottom-nav-item:not(.active) svg { flex: 0 0 22px; }
.wallet-nav-item { position: relative; padding-top: 0; }
.wallet-view { position: fixed; z-index: 840; inset: env(safe-area-inset-top) 0 calc(68px + env(safe-area-inset-bottom)); width: min(100%, 410px); margin: 0 auto; padding: 20px 18px 28px; direction: rtl; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; background: var(--bg-gradient); }
.wallet-view[hidden] { display: none; }
body.wallet-open .app-container { visibility: hidden; }
.wallet-page-heading { text-align: center; margin-bottom: 16px; }
.wallet-summary, .wallet-asset-card { border: 1px solid var(--card-border); border-radius: 20px; background: var(--card-bg); box-shadow: var(--card-shadow); }
.wallet-summary { padding: 18px; margin-bottom: 16px; }
.wallet-summary-top, .wallet-summary-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-muted); font-size: .88rem; font-weight: 700; }
.wallet-currency-toggle { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--btn-bg); }
.wallet-currency-toggle button { min-width: 48px; padding: 6px 9px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font-weight: 800; cursor: pointer; }
.wallet-currency-toggle button.active { color: var(--swap-icon); background: var(--gold-primary); }
.wallet-total { display: block; margin: 13px 0; color: var(--text-white); font-size: clamp(1.6rem, 7vw, 2.2rem); direction: ltr; text-align: right; }
.wallet-summary-bottom { justify-content: flex-start; direction: ltr; }
.wallet-summary-profit { font-family: 'NRT', 'Inter', sans-serif; font-size: 1rem; font-weight: 700; direction: ltr; unicode-bidi: isolate; background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
.wallet-profit-text { font-family: 'NRT', 'Inter', sans-serif; font-size: .85rem; font-weight: 700; direction: ltr; unicode-bidi: isolate; background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
.wallet-summary-profit.is-profit, .wallet-profit-text.is-profit { color: #22c55e !important; background: transparent !important; border: none !important; }
.wallet-summary-profit.is-loss, .wallet-profit-text.is-loss { color: #ef4444 !important; background: transparent !important; border: none !important; }
.wallet-summary-profit.is-neutral, .wallet-profit-text.is-neutral { color: var(--text-muted) !important; background: transparent !important; border: none !important; }
.wallet-profit-badge { margin-inline-start: auto; padding: 4px 10px; border-radius: 999px; font-family: 'NRT', 'Inter', sans-serif; font-size: .8rem; font-weight: 700; direction: ltr; unicode-bidi: isolate; display: inline-flex; align-items: center; gap: 3px; }
.wallet-profit-badge.is-profit { color: #22c55e !important; background: rgba(34, 197, 94, 0.14) !important; border: 1px solid rgba(34, 197, 94, 0.28) !important; }
.wallet-profit-badge.is-loss { color: #ef4444 !important; background: rgba(239, 68, 68, 0.14) !important; border: 1px solid rgba(239, 68, 68, 0.28) !important; }
.wallet-profit-badge.is-neutral { color: var(--text-muted) !important; background: var(--menu-item-bg) !important; border: 1px solid var(--card-border) !important; }
.wallet-asset-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.wallet-asset-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 13px 12px; }
.wallet-asset-info { display: flex; align-items: center; min-width: 0; gap: 9px; }
.wallet-asset-icon { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--menu-item-bg); color: var(--gold-primary); font-weight: 900; }
.wallet-asset-details { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wallet-asset-details strong { color: var(--text-white); font-size: .93rem; }
.wallet-asset-details small, .wallet-asset-stats small { color: var(--text-muted); font-size: .7rem; }
.wallet-asset-stats { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px; direction: ltr; text-align: left; }
.wallet-asset-stats > strong { font-size: .85rem; }
.wallet-card-actions { display: flex; gap: 7px; margin-top: 2px; }
.wallet-card-actions button { padding: 2px 5px; border: 0; background: transparent; color: var(--gold-primary); font: 600 .7rem 'NRT','Inter',sans-serif; cursor: pointer; }
.wallet-empty { min-height: 48vh; padding: 18px 8px 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.wallet-empty[hidden] { display: none; }
.wallet-empty-icon { width: 94px; height: 94px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 28px; background: var(--card-bg); border: 1px solid var(--card-border); box-shadow: var(--card-shadow); color: var(--gold-primary); font-size: 3.5rem; }
.wallet-empty-icon svg { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.wallet-empty h2 { color: var(--text-white); font-size: 1.15rem; margin-bottom: 8px; }
.wallet-empty p { max-width: 300px; color: var(--text-muted); line-height: 1.7; font-size: .9rem; }
.wallet-primary-button { min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--gold-primary); color: var(--swap-icon); box-shadow: 0 6px 18px var(--gold-glow); font: 800 .95rem 'NRT','Inter',sans-serif; cursor: pointer; }
.wallet-empty .wallet-primary-button { margin-top: 23px; }
.wallet-form-view { display: flex; flex-direction: column; gap: 13px; }
.wallet-form-view[hidden] { display: none; }
.wallet-form-view > .back-to-rates-btn { flex: 0 0 auto; margin-bottom: 5px; }

/* Live Market Price Card in Form */
.wallet-live-price-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--card-border); border-radius: 18px; background: var(--card-bg); box-shadow: var(--card-shadow); }
.wallet-live-price-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wallet-live-price-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .82rem; font-weight: 700; }
.live-pulse-dot { width: 8px; height: 8px; border-radius: 50%; background-color: #22c55e; box-shadow: 0 0 8px #22c55e; animation: pulseGreen 1.8s infinite; }
@keyframes pulseGreen { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); } 70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.wallet-live-price-body { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wallet-live-price-digits { font-family: 'NRT', 'Inter', sans-serif; font-size: 1.45rem; font-weight: 800; color: var(--gold-primary); text-shadow: 0 0 14px var(--gold-glow); direction: ltr; }
.wallet-live-price-unit { font-size: .82rem; font-weight: 600; color: var(--text-muted); }

.wallet-field { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 13px; border: 1px solid var(--card-border); border-radius: 16px; background: var(--card-bg); box-shadow: var(--card-shadow); color: var(--text-white); font-size: .84rem; font-weight: 700; }
.wallet-field input, .wallet-field textarea, .wallet-picker-button { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--card-border); border-radius: 11px; outline: none; background: var(--btn-bg); color: var(--text-white); font: 700 .95rem 'NRT','Inter',sans-serif; }
.wallet-field input { direction: ltr; text-align: left; color-scheme: dark; }
body.light-mode .wallet-field input { color-scheme: light; }
.wallet-field textarea { resize: vertical; user-select: text; -webkit-user-select: text; }
.wallet-field input:focus, .wallet-field textarea:focus, .wallet-picker-button:focus-visible { border-color: var(--gold-primary); box-shadow: 0 0 0 3px var(--gold-glow); }
.wallet-picker-button { display: flex; align-items: center; justify-content: space-between; text-align: right; cursor: pointer; }
.wallet-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Input with Currency Affix */
.wallet-input-affix { position: relative; display: flex; align-items: center; width: 100%; }
.wallet-input-affix input { padding-left: 48px !important; }
.wallet-currency-affix { position: absolute; left: 11px; font-family: 'NRT', 'Inter', sans-serif; font-size: .78rem; font-weight: 800; color: var(--gold-primary); pointer-events: none; direction: ltr; text-transform: uppercase; }

.wallet-save-button { width: 100%; margin-top: auto; }
.wallet-form-delete-btn { width: 100%; margin-top: 10px; min-height: 46px; border-radius: 14px; border: 1px solid rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); color: #ef4444; font: 700 .92rem 'NRT', 'Inter', sans-serif; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .15s ease; }
.wallet-form-delete-btn:active { transform: scale(.98); background: rgba(239, 68, 68, 0.16); }
.wallet-form-delete-btn[hidden] { display: none !important; }

.wallet-confirm-backdrop { position: fixed; z-index: 1100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.wallet-confirm-backdrop[hidden] { display: none !important; }
.wallet-confirm-sheet { width: min(92%, 350px); padding: 24px 20px 20px; border-radius: 24px; background: var(--menu-bg); border: 1px solid var(--menu-border); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; align-items: center; text-align: center; animation: confirm-pop .22s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes confirm-pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
.wallet-confirm-icon-wrap { width: 54px; height: 54px; border-radius: 50%; background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.28); display: grid; place-items: center; margin-bottom: 14px; }
.wallet-confirm-title { margin: 0 0 6px; color: var(--text-white); font-size: 1.15rem; font-weight: 800; }
.wallet-confirm-desc { margin: 0 0 12px; color: var(--text-muted); font-size: .84rem; line-height: 1.5; }
.wallet-confirm-preview { width: 100%; padding: 9px 12px; margin-bottom: 18px; border-radius: 12px; background: var(--menu-item-bg); border: 1px solid var(--card-border); color: var(--gold-primary); font-weight: 700; font-size: .88rem; direction: rtl; }
.wallet-confirm-actions { display: flex; width: 100%; gap: 10px; }
.wallet-confirm-cancel, .wallet-confirm-delete { flex: 1; min-height: 44px; padding: 10px 14px; border-radius: 14px; font: 700 .88rem 'NRT', 'Inter', sans-serif; cursor: pointer; transition: transform .18s ease, filter .18s ease; }
.wallet-confirm-cancel { border: 1px solid var(--card-border); background: var(--btn-bg); color: var(--text-white); }
.wallet-confirm-delete { border: 0; background: #ef4444; color: #ffffff; box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35); }
.wallet-confirm-cancel:active, .wallet-confirm-delete:active { transform: scale(.96); }
.wallet-picker-backdrop { position: fixed; z-index: 1000; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(0,0,0,.55); backdrop-filter: blur(5px); }
.wallet-picker-backdrop[hidden] { display: none; }
.wallet-picker-sheet { width: min(100%, 410px); max-height: min(72vh, 560px); padding: 17px; border: 1px solid var(--menu-border); border-radius: 24px; background: var(--menu-bg); box-shadow: 0 18px 48px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 13px; }
.wallet-picker-heading { display: flex; justify-content: space-between; align-items: center; color: var(--text-white); }
.wallet-picker-heading h2 { font-size: 1.1rem; }
.wallet-picker-heading button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--menu-item-bg); color: var(--text-white); font-size: 1.3rem; cursor: pointer; }
.wallet-picker-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.wallet-picker-tabs button { min-height: 42px; border: 1px solid var(--card-border); border-radius: 12px; background: var(--btn-bg); color: var(--text-muted); font: 700 .9rem 'NRT','Inter',sans-serif; }
.wallet-picker-tabs button.active { color: var(--swap-icon); border-color: var(--gold-primary); background: var(--gold-primary); }
.wallet-picker-options { overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wallet-option { min-height: 48px; padding: 8px; border: 1px solid var(--card-border); border-radius: 13px; background: var(--card-bg); color: var(--text-white); font: 700 .85rem 'NRT','Inter',sans-serif; cursor: pointer; }
.wallet-option:active { border-color: var(--gold-primary); }
.wallet-fab { position: fixed; z-index: 860; left: max(18px, calc((100vw - 410px) / 2 + 18px)); bottom: calc(82px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border: 0; border-radius: 50%; background: var(--gold-primary); color: var(--swap-icon); box-shadow: 0 7px 20px var(--gold-glow); font-size: 2rem; line-height: 1; cursor: pointer; }
.wallet-fab[hidden] { display: none !important; }
@media (max-width: 360px) { .bottom-nav { padding-right: 8px; padding-left: 8px; } .bottom-nav-item { font-size: .6rem; } .wallet-view { padding-right: 13px; padding-left: 13px; } .wallet-asset-card { grid-template-columns: minmax(0,1fr) auto; padding: 11px 9px; } .wallet-asset-details small { font-size: .64rem; } }
@keyframes wallet-screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.wallet-view:not([hidden]) { animation: wallet-screen-in .24s ease-out both; }
@media (prefers-reduced-motion: reduce) { .wallet-view:not([hidden]) { animation: none; } }
html.wallet-open, body.wallet-open { touch-action: pan-y; }
