    /******************************* Theme Colors and Variables ********************************/

:root{
  --bg: #0b0f0c;
  --panel: rgba(15, 22, 17, 0.78);
  --panel-2: rgba(10, 16, 12, 0.72);
  --border: rgba(255, 255, 255, 0.10);
  --text: #e9eef7;
  --muted: rgba(233, 238, 247, 0.75);

  /* money colors */
  --green: #24c16a;
  --green-2: #0ea95d;
  --gold: #f5d76e;
}

    /****************************** Global Reset and Base Layout ******************************/

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

    /****************** Global Visual Effects for Background and Overlay **********************/

/* Position and fade filter for the background gif */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("images/money-background.gif") center/cover no-repeat;
  opacity: 0.12;
  filter: blur(0.5px) saturate(1.1);
  pointer-events: none;
  z-index: -2;
}

/* Dark overlay so text stays readable */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 20% 10%,
      rgba(36, 193, 106, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.78));
  pointer-events: none;
  z-index: -1;
}

    /********************************** Application Layout ***********************************/

/* Container for the app */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

header {
  text-align: center;
  margin: 10px 0 16px;
}

/* Scaling the h1 text to screen size */
h1 {
  margin: 10px 0 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: 0.4px;
}

/* Input containers layout */
.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}

    /************************************ Form Components ************************************/

.input-field {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 600;
}

input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  font-size: 17px;
  outline: none;
}

input::placeholder {
  color: rgba(233, 238, 247, 0.45);
}

/* Style for when an input box is clicked */
input:focus {
  border-color: rgba(36, 193, 106, 0.65);
  box-shadow: 0 0 0 4px rgba(36, 193, 106, 0.18);
}

/* Button row */
.button-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 4px;
}

    /******************************** Interactive Controls ********************************/

#calculate-change {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.212);
  background: linear-gradient(135deg, var(--green), var(--green-2));
  color: #08130c;
  font-weight: 800;
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(0,0,0,0.35),
    0 0 0 1px rgba(36, 193, 106, 0.25) inset;
  transform: translateY(0);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

#calculate-change:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

#calculate-change:active {
  transform: translateY(1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

#message {
  color: rgba(245, 215, 110, 0.92);
  font-weight: 700;
  margin: 0;
}

    /*************************** Results Section Layout and Components **************************/

#results {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 400ms ease, transform 400ms ease;

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

/* Allows hidden results to show when their class is toggled */
#results.enter {
  opacity: 1;
  transform: translateY(0);
}

.center-section {
  grid-column: 1 / -1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

#output-label {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.output-box {
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}

    /********************************* Media and Image Styling *********************************/

.money {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

.money h2 {
  margin: 8px 0 6px;
  font-size: 1.1rem;
  color: rgba(233,238,247,0.9);
}

.money p {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(245, 215, 110, 0.12);
}

/* Images */
.money img {
  width: min(140px, 100%);
  height: auto;
  display: block;
  margin: 0 auto 6px;
  transition: transform 220ms ease;
}

.money img:hover {
  transform: scale(1.04);
}

    /*********************************** Utility Classes *************************************/

/* Hides elements with the "hidden" class */
.hidden { display: none !important; }

/* Screen-reader-only for the function that was necessary to pass the tests, but that I did not want visible */
.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;
}

    /******************************** Responsive Design Overrides ********************************/
@media (max-width: 900px) {
  #results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .top-grid { grid-template-columns: 1fr; }
  .button-row { flex-direction: column; align-items: stretch; }
  #calculate-change { width: 100%; }
}

@media (max-width: 560px) {
  #results { grid-template-columns: 1fr; }
  .money p { font-size: 1.6rem; }
}
