:root{
  --calc-screen-padding: 12px;
  --fx-card-max-width: 520px;
  --fx-card-min-height: 420px;
  --fx-gap: 30px;
  --fg: #ecf1f0;
  --bg-dark: rgba(10,10,12,0.98);
  --card-border: rgba(255,255,255,0.06);
}

* { box-sizing: border-box; }

.calculator-section {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 24px 0 24px;
}
.calculator-inner {
  width: 100%;
  max-width: 1400px;
  padding: 0 20px;
  display: flex;
  gap: var(--fx-gap);
  align-items: flex-start;
  box-sizing: border-box;
  min-width: 0;
}

.calculator-left {
  padding-right:50px;
  flex: 1 1;
  min-width: 260px;
  z-index: 2;
  display: block;
  text-align: left;
}
.calculator-main-title { margin-bottom: 24px; font-weight:700; font-size: 32px; line-height:1.08; }
.calculator-sub { margin-bottom: 18px; color: rgba(236,241,240,0.85); }

.daily-info { display:flex; align-items:center; gap:24px; margin-bottom: 14px; }
.daily-actions { display:flex; gap:24px; align-items:center; }
.daily-actions .tg-btn { width:56px; height:56px; padding:0; border-radius:50%; }
.daily-actions .tg-btn img { width:28px; height:28px; display:block; }
.daily-actions .tg-btn img[src*="whatsapp"] { width:36px; height:36px; }

.calculator-right {
  flex: 0 0 var(--fx-card-max-width);
  max-width: var(--fx-card-max-width);
  width: 100%;
  margin-left: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}

.fx-card {
  width: 100%;
  max-width: var(--fx-card-max-width);
  min-height: var(--fx-card-min-height);
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(17,1,30,0.9));
  border: 1px solid var(--card-border);
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  box-sizing: border-box;
  position: relative;
  z-index: 0;
  overflow: visible;
  max-height: calc(100vh - 120px);
}

.fx-grid { display: grid; grid-template-rows: 1fr auto 1fr; gap: 12px; align-items: start; width: 100%; }
.fx-row-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; width: 100%; }
.fx-label { font-weight:700; font-size: 28px; text-align: center; margin-bottom: 6px; color: var(--fg); }
.currency-label { font-size: 14px; color: rgba(236,241,240,0.75); margin-bottom: 6px; }

.currency-select { display: inline-flex; align-items: center; gap: 10px; background: transparent; border: none; color: var(--fg); font-weight: 300; font-size: 36px; padding: 4px 6px; cursor: pointer; position: relative; line-height: 1; }
.currency-select .currency-arrow { width: 24px; height: 24px; transition: transform 0.25s ease; display:inline-block; }
.currency-select.open .currency-arrow { transform: rotate(180deg); }

.fx-divider { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; width: 100%; }
.fx-line { height: 1px; background: rgba(255,255,255,0.06); width:100%; }
.fx-swap-btn { width: 70px; height: 70px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fx-swap-icon { width: 26px; height: 26px; display:block; }

.field-label { font-size: 14px; color: rgba(236,241,240,0.75); margin-bottom:6px; display:block; }
.fx-input { width: 100%; min-width: 0; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); color: var(--fg); padding: 12px; border-radius: 8px; font-size: 18px; outline: none; }

input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.fx-rate { color: rgba(236,241,240,0.7); font-size: 14px; margin-top: 6px; }

.currency-dropdown {
  position: absolute;
  z-index: 9999;
  background: rgba(17,1,30,0.98);
  border: 1px solid rgba(255,255,255,0.08); 
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  min-width: 140px;
  max-width: calc(100vw - 24px);
  overflow: hidden; 
  padding: 0; 
  max-height: 0;       
  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height .36s cubic-bezier(.2,.9,.2,1),
    opacity .18s ease,
    transform .18s ease,
    padding .18s ease;
  pointer-events: none;
}

.currency-dropdown.show,
.currency-dropdown.open,
.currency-dropdown[aria-hidden="false"],
.currency-select.open + .currency-dropdown,
.currency-select[aria-expanded="true"] + .currency-dropdown,
.currency-select[data-open="true"] + .currency-dropdown
{
  padding: 6px;
  max-height: 420px; 
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  overflow: auto;
}

.currency-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;

  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .22s ease, transform .22s ease;
}

.currency-dropdown.show .currency-dropdown-item,
.currency-dropdown.open .currency-dropdown-item,
.currency-dropdown[aria-hidden="false"] .currency-dropdown-item {
  opacity: 1;
  transform: translateY(0);
}

.currency-dropdown.show .currency-dropdown-item:nth-child(1)  { transition-delay: .03s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(2)  { transition-delay: .06s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(3)  { transition-delay: .09s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(4)  { transition-delay: .12s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(5)  { transition-delay: .15s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(6)  { transition-delay: .18s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(7)  { transition-delay: .21s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(8)  { transition-delay: .24s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(9)  { transition-delay: .27s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(10) { transition-delay: .30s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(11) { transition-delay: .33s; }
.currency-dropdown.show .currency-dropdown-item:nth-child(12) { transition-delay: .36s; }

.currency-dropdown-item:hover,
.currency-dropdown-item:focus {
  background: rgba(236,241,240,0.06);
  outline: none;
}

.currency-dropdown::-webkit-scrollbar { width: 12px; }
.currency-dropdown::-webkit-scrollbar-thumb { background: rgba(236,241,240,0.12); border-radius: 8px; }

.currency-dropdown { position: absolute; }


@media (max-width: 860px) {
  .calculator-inner {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding-left: var(--calc-screen-padding);
    padding-right: var(--calc-screen-padding);
  }

  .calculator-left {
    display: contents;
  }


  .calculator-main-title,
  .daily-info {
    order: 1;
    width: 100%;
    max-width: 900px;
    align-self: center;
    text-align: center;
  }

  .calculator-right {
    order: 2;
    width: 100%;
    max-width: var(--fx-card-max-width);
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .calculator-sub {
    order: 3;
    width: 100%;
    max-width: 900px;
    align-self: center;
    text-align: center;
    margin: 0;
    padding: 0 6px;
  }

  .fx-card {
    width: 100%;
    max-width: calc(100% - (var(--calc-screen-padding) * 2));
    margin: 0 auto;
    padding: 14px;
    border-radius: 14px;
    min-height: auto;
    height: auto;
    z-index: 2;
  }

  .fx-grid { align-items: start; }
  .fx-row-pair { grid-template-columns: 1fr; gap: 10px; }
  .currency-select { font-size: 28px; }
  .fx-input { font-size: 16px; padding: 10px; }
  .fx-label { font-size: 20px; }
  .currency-dropdown { min-width: 0; }
}

@media (max-width: 600px) {
  .calculator-inner { padding-left: var(--calc-screen-padding); padding-right: var(--calc-screen-padding); gap: 14px; }
  .calculator-right { order: 2; width: 100%; max-width: none; }
  .fx-card {
    width: 100%;
    max-width: calc(100% - (var(--calc-screen-padding) * 2));
    min-height: calc(var(--fx-card-min-height) * 0.9);
    padding: 12px;
    border-radius: 12px;
    grid-template-rows: auto auto auto;
  }

  .fx-row-pair { grid-template-columns: 1fr; gap: 10px; }
  .currency-select { font-size: 26px; }
  .fx-input { font-size: 15px; padding: 10px; }
  .fx-label { font-size: 18px; }
}

@media (max-width: 380px) {
  .currency-select { font-size: 22px; }
  .fx-label { font-size: 16px; }
  .fx-card { min-height: calc(var(--fx-card-min-height) * 0.8); padding: 10px; border-radius: 10px; }
}

.calculator-left p, .calculator-left h3 { word-break: break-word; }
.fx-card img { max-width: 100%; height: auto; display: inline-block; }