:root {
  --bg-1: #f6fbff;
  --bg-2: #eaf2f9;
  --card: rgba(255, 255, 255, 0.82);
  --card-border: rgba(30, 68, 96, 0.2);
  --accent: #1e7f98;
  --accent-2: #15596d;
  --text: #0f2436;
  --muted: #4f697f;
  --danger: #9b3c44;
  --success: #1f7a66;
  --shadow: 0 14px 30px rgba(16, 48, 72, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(71, 172, 197, 0.12), transparent 34%),
    linear-gradient(220deg, rgba(38, 146, 121, 0.1), transparent 38%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  padding: 22px;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(30, 68, 96, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 68, 96, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 95%);
  animation: drift 14s linear infinite;
}

@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-28px); }
}

.site-header {
  max-width: 1080px;
  margin: 0 auto 22px;
  text-align: left;
}

.brand {
  font-family: "Sora", "Trebuchet MS", sans-serif;
  font-size: clamp(1.7rem, 2.9vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a6f83;
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
}

.layout {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 18px;
}

.tool-banner-ad {
  max-width: 1080px;
  margin: 16px auto 0;
  background: rgba(247, 251, 255, 0.82);
  border: 1px solid rgba(30, 68, 96, 0.2);
  border-radius: 14px;
  padding: 10px;
}

.tool-banner-ad .ad-label {
  margin: 0 0 8px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.tool-banner-ad .ad-box {
  min-height: 110px;
  border: 1px solid rgba(30, 68, 96, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  padding: 8px;
}

.converter-card,
.history-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  padding: 22px;
  animation: rise-in 0.55s ease both;
}

.history-card {
  animation-delay: 0.1s;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

h1,
h2 {
  margin-top: 0;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: -2px;
  color: var(--muted);
}

.row {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

label {
  font-size: 0.92rem;
  color: #38546a;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(30, 68, 96, 0.24);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 127, 152, 0.18);
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.swap-btn {
  border: 1px solid rgba(30, 68, 96, 0.25);
  background: rgba(244, 251, 255, 0.92);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.swap-btn:hover {
  transform: translateY(-1px);
  background: rgba(222, 243, 252, 0.95);
}

.convert-btn {
  margin-top: 4px;
  width: 100%;
  border: 1px solid rgba(16, 99, 122, 0.45);
  background: linear-gradient(135deg, #10637a, #1a8398);
  color: #ffffff;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.convert-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.result-panel {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid rgba(29, 114, 95, 0.26);
  background: rgba(113, 226, 190, 0.2);
  padding: 12px;
}

.result-label {
  display: block;
  color: var(--success);
  font-size: 0.86rem;
  margin-bottom: 3px;
}

#resultText {
  margin: 0;
  font-size: 1.02rem;
}

#historyList {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

#historyList li {
  color: #2d4a5e;
  font-size: 0.95rem;
}

.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 36, 54, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 16px;
}

.ad-modal {
  width: min(440px, 100%);
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(30, 68, 96, 0.24);
  background:
    linear-gradient(120deg, rgba(171, 220, 244, 0.5), rgba(238, 247, 255, 0.94) 45%),
    rgba(255, 255, 255, 0.9);
  padding: 22px;
  box-shadow: var(--shadow);
}

.close-ad {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: #1a6f83;
  font-size: 1.2rem;
  cursor: pointer;
}

.ad-badge {
  margin: 0 0 5px;
  color: #15596d;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ad-cta {
  border: 1px solid rgba(16, 99, 122, 0.5);
  margin-top: 8px;
  background: linear-gradient(135deg, #10637a, #1a8398);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.floating-ad {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 900;
  width: min(350px, calc(100vw - 28px));
  background: rgba(244, 251, 255, 0.98);
  border: 1px solid rgba(30, 68, 96, 0.25);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.floating-ad p {
  margin: 0;
  color: #2f4c62;
  font-size: 0.9rem;
}

.floating-ad button {
  border: 1px solid rgba(30, 68, 96, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .history-card {
    margin-bottom: 70px;
  }
}

@media (max-width: 720px) {
  .grid-two,
  .grid-input {
    grid-template-columns: 1fr;
  }

  .swap-btn {
    width: 100%;
  }
}

@media (max-width: 600px) {
  body {
    padding: 14px;
  }

  .converter-card,
  .history-card {
    padding: 16px;
  }

  .grid-two,
  .grid-input {
    grid-template-columns: 1fr;
  }

  .site-header {
    margin-bottom: 16px;
  }

  .brand {
    font-size: 1.45rem;
  }
}
