body {
  font-family: "Kanit", sans-serif;
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  align-items: center; /* แก้ไขแล้ว */
  padding-top: 10px; /* แก้ไขแล้ว */
  min-height: 100vh;
}

/* 🆕 สไตล์ปุ่มกลับบ้าน */
.home-link {
  text-decoration: none;
  color: #555;
  margin-bottom: 15px;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.home-link:hover {
  color: #007bff;
}

.converter-container {
  background: #ffffff;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 80, 150, 0.1); /* แก้ไขแล้ว */
  max-width: 900px; /* แก้ไขแล้ว */
  width: 100%;
  border: 1px solid #e9ecef;
}

h1 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 2rem;
  color: #333; /* แก้ไขแล้ว */
}

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.input-row select,
.input-row input {
  flex: 1;
  padding: 12px 15px;
  font-size: 1rem; /* แก้ไขแล้ว */
  border-radius: 8px;
  border: 1px solid #ced4da;
  background: #fdfdfd; /* แก้ไขแล้ว */
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-row select:focus,
.input-row input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.2);
}

/* 🆕 สไตล์ปุ่มล้างข้อมูล */
#clearButton {
  flex: 0 0 auto;
  padding: 10px 15px; /* แก้ไขแล้ว */
  font-size: 1.1rem;
  font-weight: 500px;
  font-family: "Kanit", sans-serif;
  border-radius: 8px;
  border: 1px solid #4d4d4d;
  background: #dadada;
  color: #000000;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}
#clearButton:hover {
  background: #e03131;
  color: #fff; /* แก้ไขแล้ว */
  border-color: #e03131;
}
#clearButton:hover svg {
  fill: #fff;
}


/*
 * 🌟 พระเอกของงาน: Grid Layout สำหรับผลลัพธ์ 🌟
 */
#resultContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* แก้ไขแล้ว */
  gap: 15px;
  margin-top: 20px; /* แก้ไขแล้ว */
}

/* 🆕 สไตล์ "การ์ด" ผลลัพธ์ (แทนที่ p) */
.result-card {
  background: #f9fafb;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e9ecef;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 50, 100, 0.08); /* แก้ไขแล้ว */
}

/* 🆕 สไตล์ตัวเลขผลลัพธ์ (ตัวใหญ่ๆ) */
.result-card .value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: #007bff;
  line-height: 1.2; /* แก้ไขแล้ว */
  word-break: break-all; /* แก้ไขแล้ว */
}

/* 🆕 สไตล์ชื่อหน่วย (ตัวเล็กๆ) */
.result-card .unit {
  font-size: 1.0 rem;
  color: #444444;
  margin-top: 5px;
}


@media (max-width: 600px) {
  body {
    padding-top: 20px;
  }
  .converter-container {
    padding: 20px;
  }
  .input-row {
    flex-direction: column;
  }
  #resultContainer {
    grid-template-columns: 1fr 1fr; /* แก้ไขแล้ว */
  }
  .result-card .value {
    font-size: 1.25rem;
  }
}

@media (max-width: 400px) {
  #resultContainer {
    grid-template-columns: 1fr; /* แก้ไขแล้ว */
  }
}

.back-home-btn {
  display: inline-block;
  background: #1e88e5;
  color: #fff;
  padding: 10px 16px;
  margin-bottom: 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: normal;
  transition: 0.2s;
}
.back-home-btn:hover {
  background: #1565c0;
}