/* ===================== */
/* 기본 설정 */
/* ===================== */
* {
  box-sizing: border-box;
  font-family: 'Pretendard', sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #1e293b, #0f172a);
  color: #f8fafc;

  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 100vh;
}

/* ===================== */
/* 전체 앱 */
/* ===================== */
.app {
  display: flex;
  gap: 20px;
  align-items: stretch;

  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================== */
/* 메인 카드 */
/* ===================== */
.container {
  width: 380px;

  background: rgba(31, 41, 55, 0.8);
  backdrop-filter: blur(10px);

  padding: 32px;

  border-radius: 24px;

  border: 1px solid rgba(255, 255, 255, 0.1);

  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

h1 {
  margin: 0 0 28px 0;

  font-size: 24px;
  text-align: center;

  background: linear-gradient(to right, #10b981, #3b82f6);

  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===================== */
/* 입력 영역 */
/* ===================== */
.row {
  display: flex;
  gap: 8px;

  margin-bottom: 16px;
  width: 100%;
}

select,
input {
  flex: 1;
  min-width: 0;

  padding: 12px 8px;

  border: 1px solid #374151;
  border-radius: 12px;

  background: #111827;
  color: white;

  font-size: 14px;

  transition: border-color 0.2s;
}

#countInput {
  flex: 0.6;
}

select:focus,
input:focus {
  outline: none;
  border-color: #10b981;
}

/* ===================== */
/* 몸무게 입력 */
/* ===================== */
.weight-box {
  position: relative;
  margin-bottom: 20px;
}

.weight-box input {
  width: 100%;
  padding-right: 40px;
}

.unit-inside {
  position: absolute;

  right: 16px;
  top: 50%;

  transform: translateY(-50%);

  color: #6b7280;
  font-size: 13px;

  pointer-events: none;
}

/* ===================== */
/* 결과 박스 */
/* ===================== */
.result {
  padding: 20px;

  background: #111827;

  border-radius: 16px;
  border-left: 4px solid #10b981;
}

#caffeineText {
  font-weight: bold;
  font-size: 18px;

  margin-bottom: 5px;
}

#limitText {
  font-size: 14px;
  color: #9ca3af;
}

/* ===================== */
/* 사이드 프로그레스 */
/* ===================== */
.side {
  width: 100px;

  background: rgba(31, 41, 55, 0.8);

  border-radius: 24px;

  padding: 20px 10px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
  width: 20px;
  height: 250px;

  background: #111827;

  border-radius: 10px;

  display: flex;
  align-items: flex-end;

  overflow: hidden;
}

.progress-fill {
  width: 100%;
  height: 0%;

  background: linear-gradient(to top, #10b981, #34d399);

  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  margin-top: 15px;

  font-size: 11px;
  color: #9ca3af;

  text-align: center;
  word-break: keep-all;
}

/* ===================== */
/* GitHub 버튼 + 툴팁 */
/* ===================== */
.github-btn {
  position: fixed;

  top: 15px;
  right: 15px;

  width: 40px;
  height: 40px;

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 999;

  text-decoration: none;
}

/* 아이콘 */
.github-btn img {
  width: 100%;
  height: 100%;

  border-radius: 50%;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.github-btn:hover img {
  transform: scale(1.1);

  box-shadow: 0 0 15px rgba(255,255,255,0.25);
}

/* 툴팁 */
.tooltip {
  position: absolute;

  right: 55px;
  top: 50%;

  transform: translateY(-50%);

  background: rgba(0,0,0,0.8);
  color: white;

  padding: 8px 12px;

  border-radius: 10px;

  font-size: 12px;
  white-space: nowrap;

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* hover 시 표시 */
.github-btn:hover .tooltip {
  opacity: 1;
  visibility: visible;

  transform: translateY(-50%) translateX(-3px);
}

/* ===================== */
/* 모바일 대응 */
/* ===================== */
@media (max-width: 600px) {
  .app {
    flex-direction: column;
    align-items: center;
  }

  .side {
    width: 380px;
    flex-direction: row;

    gap: 15px;
  }

  .progress-bar {
    width: 100%;
    height: 20px;
  }

  .progress-fill {
    height: 100%;
    width: 0%;
  }

  .tooltip {
    display: none;
  }
}
