:root {
  color-scheme: light;
  --ink: #21180f;
  --muted: #6a4c2d;
  --sky: #67c8ff;
  --sky-deep: #2097e8;
  --red: #f23d2f;
  --red-dark: #b82018;
  --gold: #ffd54a;
  --gold-deep: #ef9f19;
  --green: #18a957;
  --green-dark: #08783c;
  --brick: #c8662d;
  --brick-dark: #7a351d;
  --cream: #fff8d6;
  --panel: rgba(255, 248, 214, 0.96);
  --panel-strong: #fffdf0;
  --shadow: 0 28px 80px rgba(59, 39, 20, 0.28);
  --button-shadow: 0 8px 0 rgba(86, 48, 24, 0.28), 0 16px 24px rgba(59, 39, 20, 0.18);
  font-family: "Trebuchet MS", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 2px, transparent 2px),
    linear-gradient(180deg, var(--sky) 0%, #9be5ff 54%, #5eca65 54%, #35ab49 100%);
  background-size: 42px 42px, 42px 42px, auto;
}

button,
select {
  font: inherit;
}

.app {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  isolation: isolate;
}

.sky-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  width: 118px;
  height: 42px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 28px -16px 0 6px #ffffff, 58px 0 0 2px #ffffff, 0 9px 0 rgba(42, 118, 180, 0.12);
}

.cloud-one {
  top: 8%;
  left: 8%;
}

.cloud-two {
  top: 17%;
  right: 12%;
  transform: scale(0.82);
}

.coin {
  position: absolute;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 4px solid #fff1a8;
  border-radius: 50%;
  color: #8d4d00;
  background: radial-gradient(circle at 35% 30%, #fff6a6, var(--gold) 52%, var(--gold-deep) 100%);
  font-size: 1.35rem;
  font-weight: 950;
  box-shadow: inset -5px -6px 0 rgba(141, 77, 0, 0.18), 0 8px 0 rgba(98, 58, 18, 0.2);
}

.coin-one {
  top: 21%;
  left: 19%;
}

.coin-two {
  top: 10%;
  right: 30%;
}

.coin-three {
  bottom: 24%;
  right: 18%;
}

.hill {
  position: absolute;
  bottom: -90px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #8ee56b, #28a847);
  box-shadow: inset 0 20px 0 rgba(255, 255, 255, 0.16);
}

.hill-one {
  left: 3%;
  width: 310px;
  height: 190px;
}

.hill-two {
  right: 3%;
  width: 390px;
  height: 230px;
}

.pipe {
  position: absolute;
  bottom: 0;
  width: 92px;
  height: 132px;
  border: 5px solid var(--green-dark);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, #43de72 0%, var(--green) 45%, var(--green-dark) 100%);
  box-shadow: inset 15px 0 0 rgba(255, 255, 255, 0.24);
}

.pipe::before {
  content: "";
  position: absolute;
  left: -15px;
  top: -32px;
  width: 112px;
  height: 42px;
  border: 5px solid var(--green-dark);
  border-radius: 16px;
  background: linear-gradient(90deg, #52ef80 0%, var(--green) 58%, var(--green-dark) 100%);
}

.pipe-left {
  left: 6%;
}

.pipe-right {
  right: 7%;
  transform: scale(0.82);
}

.calculator {
  position: relative;
  width: min(442px, 100%);
  padding: 18px;
  border: 5px solid #ffffff;
  border-radius: 26px;
  background:
    linear-gradient(var(--panel), var(--panel)),
    repeating-linear-gradient(0deg, var(--brick) 0 20px, var(--brick-dark) 20px 24px);
  box-shadow: var(--shadow), 0 10px 0 var(--brick-dark);
}

.calculator::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border-radius: 22px;
  background: repeating-linear-gradient(90deg, rgba(200, 102, 45, 0.34) 0 44px, rgba(122, 53, 29, 0.34) 44px 48px);
}

.brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 6vw, 2.05rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.status-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.status-pill {
  max-width: 112px;
  padding: 8px 10px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 7px 0 rgba(8, 120, 60, 0.32);
}

.display-panel {
  position: relative;
  min-height: 120px;
  padding: 18px 18px 16px;
  border: 4px solid #ffffff;
  border-radius: 18px;
  color: #ffffff;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 45%),
    #155faa;
  box-shadow: inset 0 -9px 0 rgba(0, 0, 0, 0.18), 0 8px 0 rgba(86, 48, 24, 0.22);
}

.display-icons {
  position: absolute;
  top: 9px;
  left: 12px;
  display: flex;
  gap: 6px;
}

.display-icons span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 7px;
  color: #7a351d;
  background: var(--gold);
  font-size: 0.8rem;
  font-weight: 950;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.expression {
  min-height: 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.display {
  display: block;
  width: 100%;
  margin-top: 8px;
  color: #ffffff;
  font-size: clamp(2.25rem, 11vw, 4.1rem);
  font-weight: 950;
  line-height: 1.05;
  text-align: right;
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
  text-overflow: ellipsis;
}

.exchange-panel {
  margin: 12px 0;
  padding: 12px;
  border: 4px solid #ffffff;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 248, 214, 0.98), rgba(255, 233, 154, 0.94)),
    repeating-linear-gradient(90deg, rgba(200, 102, 45, 0.15) 0 16px, transparent 16px 32px);
  box-shadow: 0 8px 0 rgba(86, 48, 24, 0.18);
}

.currency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 42px;
  border: 3px solid #ffffff;
  border-radius: 12px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--panel-strong);
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(86, 48, 24, 0.16);
}

.swap-button {
  width: 44px;
  height: 42px;
  border: 3px solid #ffffff;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  font-size: 1.35rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(178, 32, 24, 0.32);
}

.conversion {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.conversion span {
  color: #2b7b23;
  font-size: 1.32rem;
  font-weight: 950;
}

.conversion small {
  color: var(--muted);
  font-weight: 850;
}

.rate-credit {
  font-size: 0.7rem;
  opacity: 0.78;
}

.rate-credit a {
  color: #125f2f;
  font-weight: 950;
}

.voice-button {
  width: 76px;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto auto;
  place-content: center;
  gap: 5px;
  border: 4px solid #ffffff;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff5a4e, var(--red-dark));
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 7px 0 rgba(178, 32, 24, 0.32);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.voice-button span:first-child {
  font-size: 1.1rem;
  line-height: 1;
}

.voice-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.1);
}

.voice-button:active,
.voice-button.is-listening {
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 3px 0 rgba(178, 32, 24, 0.3);
}

.voice-button.is-listening {
  background: linear-gradient(180deg, #27d96b, var(--green-dark));
  animation: listenPulse 900ms ease-in-out infinite;
}

.voice-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 3px solid #ffffff;
  border-radius: 14px;
  background: linear-gradient(135deg, #eaffff, #c9f5ff);
  box-shadow: 0 5px 0 rgba(86, 48, 24, 0.12);
}

.voice-copy strong {
  color: #155faa;
  font-size: 0.82rem;
  font-weight: 950;
}

.voice-copy small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes listenPulse {
  0%,
  100% {
    filter: saturate(1);
  }

  50% {
    filter: saturate(1.35) brightness(1.05);
  }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.key {
  min-width: 0;
  aspect-ratio: 1 / 0.82;
  border: 4px solid #ffffff;
  border-radius: 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fffef5, #ffe9a5);
  font-size: 1.45rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: var(--button-shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.key:hover,
.swap-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.1);
}

.key:active,
.swap-button:active,
.key.is-pressed {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 3px 0 rgba(86, 48, 24, 0.25), 0 10px 18px rgba(59, 39, 20, 0.14);
}

.utility {
  color: #ffffff;
  background: linear-gradient(180deg, #55c9ff, #1676d2);
}

.operator {
  color: #7a351d;
  background: linear-gradient(180deg, #fff07a, var(--gold-deep));
}

.equals {
  color: #ffffff;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
}

@media (max-width: 560px) {
  .pipe,
  .hill,
  .coin-three {
    opacity: 0.55;
  }
}

@media (max-width: 430px) {
  .app {
    padding: 14px;
    align-items: start;
  }

  .calculator {
    padding: 13px;
    border-radius: 22px;
  }

  .brand-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .status-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  h1 {
    font-size: 1.36rem;
  }

  .display-panel {
    min-height: 108px;
  }

  .currency-row {
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    gap: 8px;
  }

  .swap-button {
    width: 40px;
  }

  .voice-button {
    width: 62px;
    min-height: 44px;
    font-size: 0.82rem;
  }

  .voice-copy small {
    white-space: normal;
  }

  .keypad {
    gap: 8px;
  }

  .key {
    border-radius: 14px;
    font-size: 1.23rem;
  }
}
